MCPcopy Create free account
hub / github.com/baldurk/renderdoc / printMeshData

Function printMeshData

docs/python_api/examples/renderdoc/decode_mesh.py:196–221  ·  view source on GitHub ↗
(controller, meshData)

Source from the content-addressed store, hash-verified

194 return tuple(range(mesh.numIndices))
195
196def printMeshData(controller, meshData):
197 indices = getIndices(controller, meshData[0])
198
199 print("Mesh configuration:")
200 for attr in meshData:
201 print("\t%s:" % attr.name)
202 print("\t\t- vertex: %s / %d stride" % (attr.vertexResourceId, attr.vertexByteStride))
203 print("\t\t- format: %s x %s @ %d" % (attr.format.compType, attr.format.compCount, attr.vertexByteOffset))
204
205 # We'll decode the first three indices making up a triangle
206 for i in range(0, 3):
207 idx = indices[i]
208
209 print("Vertex %d is index %d:" % (i, idx))
210
211 for attr in meshData:
212 # This is the data we're reading from. This would be good to cache instead of
213 # re-fetching for every attribute for every index
214 offset = attr.vertexByteOffset + attr.vertexByteStride * idx
215 data = controller.GetBufferData(attr.vertexResourceId, offset, 0)
216
217 # Get the value from the data
218 value = unpackData(attr.format, data)
219
220 # We don't go into the details of semantic matching here, just print both
221 print("\tAttribute '%s': %s" % (attr.name, value))
222
223def sampleCode(controller):
224 # Find the biggest drawcall in the whole capture

Callers 1

sampleCodeFunction · 0.85

Calls 5

getIndicesFunction · 0.85
printFunction · 0.85
unpackDataFunction · 0.85
rangeFunction · 0.50
GetBufferDataMethod · 0.45

Tested by

no test coverage detected