Files
renderdoc/util/test/tests/Vulkan/VK_Int8_IBuffer.py
T
Shahbaz Youssefi ed4c3756d0 Enable primitive restart for list topologies
This is supported by OpenGL, and on Vulkan with
VK_EXT_primitive_topology_list_restart.  On Vulkan, all drivers are
known to support this even without
VK_EXT_primitive_topology_list_restart.  On D3D, primitive restart is
only supported for strip topologies.

Previously, RenderDoc specifically disabled primitive restart for
non-strip topologies.  In this change, that is no longer done.  If the
app enables primitive restart, so will RenderDoc behave accordingly.  It
would be the responsibility of the app to avoid primitive restart if the
API doesn't allow it.
2022-08-29 14:59:14 +01:00

66 lines
2.3 KiB
Python

import rdtest
import renderdoc as rd
class VK_Int8_IBuffer(rdtest.TestCase):
demos_test_name = 'VK_Int8_IBuffer'
def check_capture(self):
action = self.find_action("Draw")
self.check(action is not None)
self.controller.SetFrameEvent(action.eventId, False)
pipe: rd.PipeState = self.controller.GetPipelineState()
postvs_data = self.get_postvs(action, rd.MeshDataStage.VSOut, 0, action.numIndices)
ib = pipe.GetIBuffer()
# Calculate the strip restart index for this index width
striprestart_index = pipe.GetRestartIndex() & ((1 << (ib.byteStride*8)) - 1)
# We don't check all of the output, we check a few key vertices to ensure they match up
postvs_ref = {
0: {
'vtx': 0,
'idx': 0,
'gl_PerVertex_var.gl_Position': [-0.8, -0.2, 0.0, 1.0],
'vertOut.col': [0.0, 1.0, 0.0, 1.0],
'vertOut.uv': [0.0, 0.0, 0.0, 1.0],
},
4: {
'vtx': 4,
'idx': 4,
'gl_PerVertex_var.gl_Position': [0.0, -0.2, 0.0, 1.0],
'vertOut.col': [0.0, 1.0, 0.0, 1.0],
'vertOut.uv': [0.0, 0.0, 0.0, 1.0],
},
8: {
'idx': striprestart_index
},
9: {
'vtx': 9,
'idx': 8,
'gl_PerVertex_var.gl_Position': [-0.8, 0.7, 0.0, 1.0],
'vertOut.col': [0.0, 0.0, 1.0, 1.0],
'vertOut.uv': [0.0, 0.0, 0.0, 1.0],
},
}
self.check_mesh_data(postvs_ref, postvs_data)
# Check that the rendered mesh is as expected
out = pipe.GetOutputTargets()[0].resourceId
for x in [x*0.01 for x in range(1, 100)]:
self.check_pixel_value(out, x, 0.1, [0.2, 0.2, 0.2, 1.0])
self.check_pixel_value(out, x, 0.5, [0.2, 0.2, 0.2, 1.0])
self.check_pixel_value(out, 0.3, 0.25, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(out, 0.5, 0.25, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(out, 0.7, 0.25, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(out, 0.3, 0.75, [0.0, 0.0, 1.0, 1.0])
self.check_pixel_value(out, 0.5, 0.75, [0.0, 0.0, 1.0, 1.0])
self.check_pixel_value(out, 0.7, 0.75, [0.0, 0.0, 1.0, 1.0])