Repository navigation
Expand file tree
/
Copy pathmem_binds.py
More file actions
57 lines (42 loc) · 1.57 KB
/
Copy pathmem_binds.py
File metadata and controls
57 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# these imports are not strictly necessary, but are convenient
import renderdoc
import qrenderdoc
# this is here to give autocomplete when editing the example
# in VS Code where it doesn't know about this global
from typing import TYPE_CHECKING
if TYPE_CHECKING:
pyrenderdoc = qrenderdoc.CaptureContext()
if not pyrenderdoc.IsCaptureLoaded():
filename = pyrenderdoc.Extensions().OpenFileName("Choose a capture", "", "*.rdc")
pyrenderdoc.LoadCapture(filename, renderdoc.ReplayOptions(), filename, False, True)
mems = {}
for t in pyrenderdoc.GetTextures():
if t.memory == renderdoc.ResourceId():
continue
entry = (
t.memoryOffset,
t.memoryOffset + t.byteSize,
f"[Texture] {pyrenderdoc.GetResourceName(t.resourceId)}",
)
if t.memory not in mems:
mems[t.memory] = []
mems[t.memory].append(entry)
for b in pyrenderdoc.GetBuffers():
if b.memory == renderdoc.ResourceId():
continue
entry = (
b.memoryOffset,
b.memoryOffset + b.length,
f"[Buffer] {pyrenderdoc.GetResourceName(b.resourceId)}",
)
if b.memory not in mems:
mems[b.memory] = []
mems[b.memory].append(entry)
for m in mems:
binds = mems[m]
for idx, bind1 in enumerate(binds):
for bind2 in binds[idx + 1 :]:
if bind1[0] < bind2[0] and bind1[1] > bind2[0]:
print(f"In memory {pyrenderdoc.GetResourceName(m)} overlap:")
print(f" {bind1[0]:08x} - {bind1[1]:08x}: {bind1[2]} ")
print(f" {bind2[0]:08x} - {bind2[1]:08x}: {bind2[2]}")