Ignore bound index buffer for non-indexed draws, apply vertexOffset

This commit is contained in:
baldurk
2020-05-11 18:04:22 +01:00
parent 3bd09bd4a9
commit 79c47ff91e
2 changed files with 9 additions and 4 deletions
+3 -3
View File
@@ -74,7 +74,7 @@ def fetch_indices(controller: rd.ReplayController, mesh: rd.MeshFormat, index_of
mesh.indexByteStride*num_indices)
# Unpack all the indices
indices = struct.unpack(index_fmt, ibdata)
indices = struct.unpack_from(index_fmt, ibdata)
# Apply the baseVertex offset
return [i + mesh.baseVertex for i in indices]
@@ -88,7 +88,7 @@ class MeshAttribute:
name: str
def get_vsin_attrs(controller: rd.ReplayController, index_mesh: rd.MeshFormat):
def get_vsin_attrs(controller: rd.ReplayController, vertexOffset: int, index_mesh: rd.MeshFormat):
pipe: rd.PipeState = controller.GetPipelineState()
inputs: List[rd.VertexInputAttribute] = pipe.GetVertexInputs()
@@ -107,7 +107,7 @@ def get_vsin_attrs(controller: rd.ReplayController, index_mesh: rd.MeshFormat):
attr.mesh.instStepRate = a.instanceRate
attr.mesh.instanced = a.perInstance
attr.mesh.vertexResourceId = vbs[a.vertexBuffer].resourceId
attr.mesh.vertexByteOffset = vbs[a.vertexBuffer].byteOffset + a.byteOffset
attr.mesh.vertexByteOffset = vbs[a.vertexBuffer].byteOffset + a.byteOffset + vertexOffset * attr.mesh.vertexByteStride
attr.mesh.format = a.format
+6 -1
View File
@@ -266,7 +266,12 @@ class TestCase:
mesh.indexResourceId = ib.resourceId
mesh.baseVertex = draw.baseVertex
attrs = analyse.get_vsin_attrs(self.controller, mesh)
if not (draw.flags & rd.DrawFlags.Indexed):
mesh.indexByteOffset = 0
mesh.indexByteStride = 0
mesh.indexResourceId = rd.ResourceId.Null()
attrs = analyse.get_vsin_attrs(self.controller, draw.vertexOffset, mesh)
first_index = min(first_index, draw.numIndices-1)