From 47f2fa8b93d1d447e7c829cb92fe3a859c88d4f0 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 20 May 2020 11:20:13 +0100 Subject: [PATCH] Don't apply restart index if primitive restart is disabled --- util/test/rdtest/analyse.py | 5 +++-- util/test/rdtest/testcase.py | 6 +++--- util/test/tests/Iter_Test.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/util/test/rdtest/analyse.py b/util/test/rdtest/analyse.py index 4f24106ff..1dada4667 100644 --- a/util/test/rdtest/analyse.py +++ b/util/test/rdtest/analyse.py @@ -55,7 +55,7 @@ def open_capture(filename="", cap: rd.CaptureFile=None, opts: rd.ReplayOptions=N return controller -def fetch_indices(controller: rd.ReplayController, mesh: rd.MeshFormat, index_offset: int, first_index: int, num_indices: int): +def fetch_indices(controller: rd.ReplayController, draw: rd.DrawcallDescription, mesh: rd.MeshFormat, index_offset: int, first_index: int, num_indices: int): # Get the character for the width of index index_fmt = 'B' if mesh.indexByteStride == 2: @@ -65,6 +65,7 @@ def fetch_indices(controller: rd.ReplayController, mesh: rd.MeshFormat, index_of pipe = controller.GetPipelineState() restart_idx = pipe.GetStripRestartIndex() & ((1 << (mesh.indexByteStride*8)) - 1) + restart_enabled = pipe.IsStripRestartEnabled() and rd.IsStrip(draw.topology) # Duplicate the format by the number of indices index_fmt = '=' + str(num_indices) + index_fmt @@ -80,7 +81,7 @@ def fetch_indices(controller: rd.ReplayController, mesh: rd.MeshFormat, index_of indices = struct.unpack_from(index_fmt, ibdata) # Apply the baseVertex offset - return [i if i == restart_idx else i + mesh.baseVertex for i in indices] + return [i if restart_enabled and i == restart_idx else i + mesh.baseVertex for i in indices] else: # With no index buffer, just generate a range return tuple(range(first_index, first_index + num_indices)) diff --git a/util/test/rdtest/testcase.py b/util/test/rdtest/testcase.py index 6ac5b7fdc..ddb8754f8 100644 --- a/util/test/rdtest/testcase.py +++ b/util/test/rdtest/testcase.py @@ -275,7 +275,7 @@ class TestCase: first_index = min(first_index, draw.numIndices-1) - indices = analyse.fetch_indices(self.controller, mesh, 0, first_index, num_indices) + indices = analyse.fetch_indices(self.controller, draw, mesh, 0, first_index, num_indices) return analyse.decode_mesh_data(self.controller, indices, indices, attrs, 0, 0) @@ -307,8 +307,8 @@ class TestCase: in_mesh.indexByteStride = 0 in_mesh.indexResourceId = rd.ResourceId.Null() - indices = analyse.fetch_indices(self.controller, mesh, 0, first_index, num_indices) - in_indices = analyse.fetch_indices(self.controller, in_mesh, 0, first_index, num_indices) + indices = analyse.fetch_indices(self.controller, draw, mesh, 0, first_index, num_indices) + in_indices = analyse.fetch_indices(self.controller, draw, in_mesh, 0, first_index, num_indices) attrs = analyse.get_postvs_attrs(self.controller, mesh, data_stage) diff --git a/util/test/tests/Iter_Test.py b/util/test/tests/Iter_Test.py index 8debc38b0..a97dc6c29 100644 --- a/util/test/tests/Iter_Test.py +++ b/util/test/tests/Iter_Test.py @@ -86,7 +86,7 @@ class Iter_Test(rdtest.TestCase): mesh.indexByteOffset = ib.byteOffset + draw.indexOffset * draw.indexByteWidth mesh.baseVertex = draw.baseVertex - indices = rdtest.fetch_indices(self.controller, mesh, 0, vtx, 1) + indices = rdtest.fetch_indices(self.controller, draw, mesh, 0, vtx, 1) if len(indices) < 1: rdtest.log.print("No index buffer, skipping")