From 9de4a7985910e9d2f3662275eb3880e9d5d46724 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 18 Mar 2024 10:24:15 +0000 Subject: [PATCH] Update tests to new descriptor interface --- .../test/demos/d3d12/d3d12_reflection_zoo.cpp | 6 +- util/test/rdtest/shared/Buffer_Truncation.py | 4 +- util/test/rdtest/shared/Draw_Zoo.py | 2 +- util/test/rdtest/shared/Overlay_Test.py | 12 +- util/test/rdtest/shared/Texture_Zoo.py | 19 +- util/test/rdtest/testcase.py | 2 +- util/test/tests/D3D11/D3D11_CBuffer_Zoo.py | 6 +- util/test/tests/D3D11/D3D11_Deferred_Map.py | 4 +- util/test/tests/D3D11/D3D11_Parameter_Zoo.py | 2 +- .../tests/D3D11/D3D11_Pixel_History_Zoo.py | 8 +- .../tests/D3D11/D3D11_Primitive_Restart.py | 2 +- util/test/tests/D3D11/D3D11_Refcount_Check.py | 2 +- .../tests/D3D11/D3D11_Shader_Debug_Zoo.py | 8 +- util/test/tests/D3D11/D3D11_Shader_Editing.py | 2 +- .../tests/D3D11/D3D11_Shader_Linkage_Zoo.py | 2 +- .../D3D11_Untyped_Backbuffer_Descriptor.py | 4 +- .../test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py | 2 +- .../D3D12/D3D12_AMD_Shader_Extensions.py | 2 +- util/test/tests/D3D12/D3D12_CBuffer_Zoo.py | 26 +- .../tests/D3D12/D3D12_Descriptor_Indexing.py | 317 ++++++++---------- .../tests/D3D12/D3D12_Execute_Indirect.py | 16 +- .../tests/D3D12/D3D12_List_Alloc_Tests.py | 2 +- .../D3D12/D3D12_Multi_Wait_Before_Signal.py | 2 +- util/test/tests/D3D12/D3D12_Overlay_Test.py | 2 +- util/test/tests/D3D12/D3D12_Parameter_Zoo.py | 4 +- util/test/tests/D3D12/D3D12_Pixel_History.py | 112 +++---- util/test/tests/D3D12/D3D12_Reflection_Zoo.py | 256 +++++++++----- .../tests/D3D12/D3D12_RenderTarget_Binds.py | 32 +- .../tests/D3D12/D3D12_Resource_Mapping_Zoo.py | 2 +- .../tests/D3D12/D3D12_Shader_Debug_Zoo.py | 8 +- util/test/tests/D3D12/D3D12_Shader_Editing.py | 2 +- .../tests/D3D12/D3D12_Shader_Linkage_Zoo.py | 2 +- .../D3D12_Untyped_Backbuffer_Descriptor.py | 4 +- util/test/tests/D3D12/D3D12_VRS.py | 2 +- .../test/tests/D3D12/D3D12_Vertex_Attr_Zoo.py | 2 +- util/test/tests/D3D12/D3D12_Vertex_UAV.py | 2 +- .../tests/D3D12/D3D12_Write_Subresource.py | 4 +- util/test/tests/GL/GL_Buffer_Spam.py | 2 +- util/test/tests/GL/GL_Buffer_Updates.py | 2 +- util/test/tests/GL/GL_CBuffer_Zoo.py | 22 +- util/test/tests/GL/GL_Depth_Bounds.py | 2 +- .../test/tests/GL/GL_Multithread_Rendering.py | 14 +- util/test/tests/GL/GL_Parameter_Zoo.py | 2 +- util/test/tests/GL/GL_Per_Type_Tex_Units.py | 43 ++- util/test/tests/GL/GL_Pixel_History.py | 12 +- util/test/tests/GL/GL_Renderbuffer_Zoo.py | 10 +- util/test/tests/GL/GL_Resource_Lifetimes.py | 25 +- .../tests/GL/GL_Separable_Geometry_Shaders.py | 2 +- util/test/tests/GL/GL_Shader_Editing.py | 2 +- util/test/tests/GL/GL_Unshared_Context.py | 4 +- util/test/tests/GL/GL_Vertex_Attr_Zoo.py | 2 +- util/test/tests/Iter_Test.py | 20 +- util/test/tests/Vulkan/VK_Adv_CBuffer_Zoo.py | 6 +- .../tests/Vulkan/VK_Blend_Pixel_History.py | 6 +- util/test/tests/Vulkan/VK_CBuffer_Zoo.py | 24 +- .../tests/Vulkan/VK_Dedicated_Allocation.py | 16 +- .../tests/Vulkan/VK_Descriptor_Indexing.py | 143 ++++---- util/test/tests/Vulkan/VK_Discard_Zoo.py | 2 +- .../test/tests/Vulkan/VK_Dynamic_Rendering.py | 45 +-- .../tests/Vulkan/VK_Extended_Dynamic_State.py | 16 +- .../test/tests/Vulkan/VK_Graphics_Pipeline.py | 44 ++- util/test/tests/Vulkan/VK_Image_Layouts.py | 2 +- .../tests/Vulkan/VK_Imageless_Framebuffer.py | 2 +- util/test/tests/Vulkan/VK_Indirect.py | 6 +- util/test/tests/Vulkan/VK_Int8_IBuffer.py | 2 +- .../tests/Vulkan/VK_KHR_Buffer_Address.py | 2 +- util/test/tests/Vulkan/VK_Line_Raster.py | 2 +- util/test/tests/Vulkan/VK_Misaligned_Dirty.py | 2 +- util/test/tests/Vulkan/VK_Multi_Entry.py | 40 +-- util/test/tests/Vulkan/VK_Multi_View.py | 2 +- util/test/tests/Vulkan/VK_Overlay_Test.py | 4 +- util/test/tests/Vulkan/VK_Parameter_Zoo.py | 136 +++++--- util/test/tests/Vulkan/VK_Pixel_History.py | 92 ++--- util/test/tests/Vulkan/VK_Postponed.py | 2 +- util/test/tests/Vulkan/VK_Robustness2.py | 7 +- util/test/tests/Vulkan/VK_SPIRV_13_Shaders.py | 2 +- util/test/tests/Vulkan/VK_Sample_Locations.py | 2 +- util/test/tests/Vulkan/VK_Shader_Debug_Zoo.py | 2 +- util/test/tests/Vulkan/VK_Shader_Editing.py | 2 +- util/test/tests/Vulkan/VK_Spec_Constants.py | 10 +- .../test/tests/Vulkan/VK_Synchronization_2.py | 2 +- util/test/tests/Vulkan/VK_Vertex_Attr_Zoo.py | 4 +- 82 files changed, 881 insertions(+), 796 deletions(-) diff --git a/util/test/demos/d3d12/d3d12_reflection_zoo.cpp b/util/test/demos/d3d12/d3d12_reflection_zoo.cpp index 52ccc09a61..e5a4e6ad79 100644 --- a/util/test/demos/d3d12/d3d12_reflection_zoo.cpp +++ b/util/test/demos/d3d12/d3d12_reflection_zoo.cpp @@ -310,15 +310,13 @@ float4 main(float4 pos : SV_Position) : SV_Target0 setMarker(cmd, "DXBC"); cmd->SetPipelineState(dxbc); - // don't have to actually draw anything, saves us from needing to bind any descriptors. We - // can still check the reflection - cmd->DrawInstanced(0, 0, 0, 0); + cmd->DrawInstanced(3, 1, 0, 0); if(m_DXILSupport) { setMarker(cmd, "DXIL"); cmd->SetPipelineState(dxil); - cmd->DrawInstanced(0, 0, 0, 0); + cmd->DrawInstanced(3, 1, 0, 0); } FinishUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET); diff --git a/util/test/rdtest/shared/Buffer_Truncation.py b/util/test/rdtest/shared/Buffer_Truncation.py index ff211a065a..e5698ecf22 100644 --- a/util/test/rdtest/shared/Buffer_Truncation.py +++ b/util/test/rdtest/shared/Buffer_Truncation.py @@ -101,7 +101,7 @@ def check_capture(self): stage = rd.ShaderStage.Pixel - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor if self.find_action('NoCBufferRange') == None: self.check(cbuf.byteSize == 256) @@ -109,7 +109,7 @@ def check_capture(self): variables = self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize) outcol: rd.ShaderVariable = variables[1] diff --git a/util/test/rdtest/shared/Draw_Zoo.py b/util/test/rdtest/shared/Draw_Zoo.py index a2c4dd519b..bdd47905e7 100644 --- a/util/test/rdtest/shared/Draw_Zoo.py +++ b/util/test/rdtest/shared/Draw_Zoo.py @@ -55,7 +55,7 @@ def check_action(self, action: rd.ActionDescription, ref_data): vsout_pos_name = sig.semanticName break - out_tex = self.pipe.GetOutputTargets()[0].resourceId + out_tex = self.pipe.GetOutputTargets()[0].resource vsin_ref = {} restarts = [] diff --git a/util/test/rdtest/shared/Overlay_Test.py b/util/test/rdtest/shared/Overlay_Test.py index 547b48a8ac..12959cbade 100644 --- a/util/test/rdtest/shared/Overlay_Test.py +++ b/util/test/rdtest/shared/Overlay_Test.py @@ -41,7 +41,7 @@ def check_capture(self, base_event=0): pipe: rd.PipeState = self.controller.GetPipelineState() - col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource tex = rd.TextureDisplay() tex.resourceId = col_tex @@ -438,7 +438,7 @@ def check_capture(self, base_event=0): pipe: rd.PipeState = self.controller.GetPipelineState() - col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource for overlay in rd.DebugOverlay: if overlay == rd.DebugOverlay.NoOverlay: @@ -555,7 +555,7 @@ def check_capture(self, base_event=0): self.controller.SetFrameEvent(mask_marker.next.eventId, True) - col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource # Check just highlight drawcall to make sure it renders on sample 0 tex.resourceId = col_tex @@ -585,9 +585,9 @@ def check_capture(self, base_event=0): # Now check clear-before-X by hand, for colour and for depth self.controller.SetFrameEvent(test_marker.next.eventId, True) - col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource - depth_tex: rd.ResourceId = pipe.GetDepthTarget().resourceId + depth_tex = pipe.GetDepthTarget().resource eps = 1.0/256.0 @@ -726,7 +726,7 @@ def check_capture(self, base_event=0): pipe: rd.PipeState = self.controller.GetPipelineState() - col_tex = pipe.GetOutputTargets()[0].resourceId + col_tex = pipe.GetOutputTargets()[0].resource sub = rd.Subresource(pipe.GetOutputTargets()[0].firstMip, pipe.GetOutputTargets()[0].firstSlice, 0) for overlay in rd.DebugOverlay: diff --git a/util/test/rdtest/shared/Texture_Zoo.py b/util/test/rdtest/shared/Texture_Zoo.py index a666d5c932..d5b113adbf 100644 --- a/util/test/rdtest/shared/Texture_Zoo.py +++ b/util/test/rdtest/shared/Texture_Zoo.py @@ -57,20 +57,21 @@ def check_test(self, fmt_name: str, name: str, test_mode: int): image_view = (test_mode != Texture_Zoo.TEST_CAPTURE) if image_view: - bound_res: rd.BoundResource = pipe.GetOutputTargets()[0] + desc = pipe.GetOutputTargets()[0] else: - bound_res: rd.BoundResource = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel)[0].resources[0] + desc = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel)[0].descriptor + + tex_id = desc.resource texs = self.controller.GetTextures() for t in texs: self.textures[t.resourceId] = t - tex_id: rd.ResourceId = bound_res.resourceId tex: rd.TextureDescription = self.textures[tex_id] - testCompType: rd.CompType = tex.format.compType - if bound_res.typeCast != rd.CompType.Typeless: - testCompType = bound_res.typeCast + testCompType = desc.format.compType + if testCompType == rd.CompType.Typeless: + testCompType = tex.format.compType pickCompType = testCompType @@ -366,13 +367,13 @@ def check_test(self, fmt_name: str, name: str, test_mode: int): x, y, sl, mp, sm, name, fmt_name, picked, expected)) if not image_view: - output_tex = pipe.GetOutputTargets()[0].resourceId + output_tex = pipe.GetOutputTargets()[0].resource # in the test captures pick the output texture, it should be identical to the # (0,0) pixel in slice 0, mip 0, sample 0 view: rd.Viewport = pipe.GetViewport(0) - val: rd.PixelValue = self.pick(pipe.GetOutputTargets()[0].resourceId, int(view.x + view.width / 2), + val: rd.PixelValue = self.pick(pipe.GetOutputTargets()[0].resource, int(view.x + view.width / 2), int(view.y + view.height / 2), rd.Subresource(), rd.CompType.Typeless) picked = list(val.floatValue) @@ -555,7 +556,7 @@ def check_capture_with_controller(self, proxy_api: str): pipe = self.controller.GetPipelineState() - tex_id = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel)[0].resources[0].resourceId + tex_id = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel)[0].descriptor.resource for mip in [0, 1]: for sl in [16, 17, 18]: diff --git a/util/test/rdtest/testcase.py b/util/test/rdtest/testcase.py index 94727cd2bb..707fbc77af 100644 --- a/util/test/rdtest/testcase.py +++ b/util/test/rdtest/testcase.py @@ -454,7 +454,7 @@ def check_triangle(self, out = None, back = None, fore = None, vp = None): # if no output is specified, check the current colour output at this action if out is None: - out = pipe.GetOutputTargets()[0].resourceId + out = pipe.GetOutputTargets()[0].resource tex_details = self.get_texture(out) diff --git a/util/test/tests/D3D11/D3D11_CBuffer_Zoo.py b/util/test/tests/D3D11/D3D11_CBuffer_Zoo.py index f76463fa8e..4f1b8862be 100644 --- a/util/test/tests/D3D11/D3D11_CBuffer_Zoo.py +++ b/util/test/tests/D3D11/D3D11_CBuffer_Zoo.py @@ -15,13 +15,13 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() stage = rd.ShaderStage.Pixel - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_cbuffer(var_check) @@ -76,7 +76,7 @@ def check_capture(self): self.controller.FreeTrace(trace) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) rdtest.log.success("Picked value is as expected") diff --git a/util/test/tests/D3D11/D3D11_Deferred_Map.py b/util/test/tests/D3D11/D3D11_Deferred_Map.py index 586e60c14d..7f85e47cec 100644 --- a/util/test/tests/D3D11/D3D11_Deferred_Map.py +++ b/util/test/tests/D3D11/D3D11_Deferred_Map.py @@ -14,7 +14,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() # Top half should be red, bottom half should be green - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.25, [1.0, 0.0, 0.0, 1.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.75, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.25, [1.0, 0.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.75, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Screen output is as expected") diff --git a/util/test/tests/D3D11/D3D11_Parameter_Zoo.py b/util/test/tests/D3D11/D3D11_Parameter_Zoo.py index 8fec211941..874d6251ee 100644 --- a/util/test/tests/D3D11/D3D11_Parameter_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Parameter_Zoo.py @@ -18,7 +18,7 @@ def check_capture(self): tex = rd.TextureDisplay() tex.overlay = rd.DebugOverlay.Drawcall - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) diff --git a/util/test/tests/D3D11/D3D11_Pixel_History_Zoo.py b/util/test/tests/D3D11/D3D11_Pixel_History_Zoo.py index b879772914..8f2d04430e 100644 --- a/util/test/tests/D3D11/D3D11_Pixel_History_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Pixel_History_Zoo.py @@ -30,11 +30,11 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] vp: rd.Viewport = pipe.GetViewport(0) - tex = rt.resourceId + tex = rt.resource x, y = (int(vp.width / 2), int(vp.height / 2)) tex_details = self.get_texture(tex) @@ -45,7 +45,7 @@ def check_capture(self): if tex_details.mips > 1: sub.mip = rt.firstMip - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) # Should be at least two modifications in every test - clear and action self.check(len(modifs) >= 2) @@ -76,7 +76,7 @@ def check_capture(self): rdtest.log.success("shader output and premod/postmod is consistent") # The current pixel value should match the last postMod - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) # Also the red channel should be zero, as it indicates errors self.check(float(value_selector(modifs[-1].postMod.col)[0]) == 0.0) diff --git a/util/test/tests/D3D11/D3D11_Primitive_Restart.py b/util/test/tests/D3D11/D3D11_Primitive_Restart.py index b8eaf839b4..5244d103cb 100644 --- a/util/test/tests/D3D11/D3D11_Primitive_Restart.py +++ b/util/test/tests/D3D11/D3D11_Primitive_Restart.py @@ -65,7 +65,7 @@ def check_capture(self): self.check_mesh_data(postvs_ref, postvs_data) # Check that the rendered mesh is as expected - out = pipe.GetOutputTargets()[0].resourceId + out = pipe.GetOutputTargets()[0].resource 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]) diff --git a/util/test/tests/D3D11/D3D11_Refcount_Check.py b/util/test/tests/D3D11/D3D11_Refcount_Check.py index 2eb0ac87db..365d18ed11 100644 --- a/util/test/tests/D3D11/D3D11_Refcount_Check.py +++ b/util/test/tests/D3D11/D3D11_Refcount_Check.py @@ -28,6 +28,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Captured loaded with color as expected") \ No newline at end of file diff --git a/util/test/tests/D3D11/D3D11_Shader_Debug_Zoo.py b/util/test/tests/D3D11/D3D11_Shader_Debug_Zoo.py index 52e5318d33..cd57ba3b29 100644 --- a/util/test/tests/D3D11/D3D11_Shader_Debug_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Shader_Debug_Zoo.py @@ -31,7 +31,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4 * test, 0, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 4 * test, 0, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: if test in undefined_tests: rdtest.log.comment("Undefined test {} did not match. {}".format(test, str(ex))) @@ -60,8 +60,8 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0, 4, debugged.value.f32v[0:4]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0, 4, [9.0, 66.0, 4.0, 18.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0, 4, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0, 4, [9.0, 66.0, 4.0, 18.0]) except rdtest.TestFailureException as ex: raise rdtest.TestFailureException("Flow test did not match. {}".format(str(ex))) finally: @@ -95,7 +95,7 @@ def check_capture(self): # Validate the debug output result try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4, 4, debugged.value.f32v[0:4], sub=rd.Subresource(0, 0, test)) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 4, 4, debugged.value.f32v[0:4], sub=rd.Subresource(0, 0, test)) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Test {} did not match. {}".format(test, str(ex))) diff --git a/util/test/tests/D3D11/D3D11_Shader_Editing.py b/util/test/tests/D3D11/D3D11_Shader_Editing.py index c63980360c..5b44ef450f 100644 --- a/util/test/tests/D3D11/D3D11_Shader_Editing.py +++ b/util/test/tests/D3D11/D3D11_Shader_Editing.py @@ -23,7 +23,7 @@ def check_capture(self): psrefl2: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Pixel) vsrefl: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Vertex) - tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource # Both triangles should be green self.check_pixel_value(tex, 0.25, 0.5, [0.0, 1.0, 0.0, 1.0]) diff --git a/util/test/tests/D3D11/D3D11_Shader_Linkage_Zoo.py b/util/test/tests/D3D11/D3D11_Shader_Linkage_Zoo.py index 2312612cb8..11a150d167 100644 --- a/util/test/tests/D3D11/D3D11_Shader_Linkage_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Shader_Linkage_Zoo.py @@ -32,7 +32,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 200, 150, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 200, 150, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Test {} did not match. {}".format(event_name, str(ex))) diff --git a/util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py b/util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py index 3aaf061a0c..dca7fe373a 100644 --- a/util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py +++ b/util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py @@ -13,7 +13,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.25, 0.5, [1.0, 1.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.25, 0.5, [1.0, 1.0, 1.0, 1.0]) rdtest.log.success("Picked value for first action is as expected") @@ -24,6 +24,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.75, 0.5, [1.0, 1.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.75, 0.5, [1.0, 1.0, 1.0, 1.0]) rdtest.log.success("Picked value for second action is as expected") diff --git a/util/test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py b/util/test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py index e7758cf46e..46fc6c0a90 100644 --- a/util/test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py +++ b/util/test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py @@ -72,6 +72,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Triangle picked value is as expected") diff --git a/util/test/tests/D3D12/D3D12_AMD_Shader_Extensions.py b/util/test/tests/D3D12/D3D12_AMD_Shader_Extensions.py index 3816842dd9..3187a68196 100644 --- a/util/test/tests/D3D12/D3D12_AMD_Shader_Extensions.py +++ b/util/test/tests/D3D12/D3D12_AMD_Shader_Extensions.py @@ -14,7 +14,7 @@ def check_capture(self): self.controller.SetFrameEvent(action.next.eventId, False) pipe = self.controller.GetPipelineState() - tex = pipe.GetOutputTargets()[0].resourceId + tex = pipe.GetOutputTargets()[0].resource vp = pipe.GetViewport(0) # Should have barycentrics showing the closest vertex for each pixel in the triangle diff --git a/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py b/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py index 73540356bc..ec769c8a48 100644 --- a/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py +++ b/util/test/tests/D3D12/D3D12_CBuffer_Zoo.py @@ -51,7 +51,6 @@ def check_event(self): stage = rd.ShaderStage.Pixel refl: rd.ShaderReflection = pipe.GetShaderReflection(stage) - mapping: rd.ShaderBindpointMapping = pipe.GetBindpointMapping(stage) # Make sure we have three constant buffers - b7 normal, b1 root constants, and space9999999:b0 binds = [ @@ -60,40 +59,39 @@ def check_event(self): (999999999, 0), ] - if len(refl.constantBlocks) != len(mapping.constantBlocks) or len(refl.constantBlocks) != len(binds): + if len(refl.constantBlocks) != len(binds): raise rdtest.TestFailureException( - "Expected {}} constant buffers, only got {} {}".format(len(binds), len(refl.constantBlocks), - len(refl.constantBlocks))) + "Expected {} constant buffers, only got {}".format(len(binds), len(refl.constantBlocks))) for b in range(0, len(binds)): - if binds[b][0] != mapping.constantBlocks[b].bindset or binds[b][1] != mapping.constantBlocks[b].bind: + if binds[b][0] != refl.constantBlocks[b].fixedBindSetOrSpace or binds[b][1] != refl.constantBlocks[b].fixedBindNumber: raise rdtest.TestFailureException( - "Unexpected cb[{}] mapping: set {} bind {}".format(b, mapping.constantBlocks[b].bindset, - mapping.constantBlocks[b].bind)) + "Unexpected cb[{}] mapping: space {} bind {}".format(b, refl.constantBlocks[b].fixedBindSetOrSpace, + refl.constantBlocks[b].fixedBindNumber)) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 1, 0) + cbuf = pipe.GetConstantBlock(stage, 1, 0).descriptor root_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 1, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 2, 0) + cbuf = pipe.GetConstantBlock(stage, 2, 0).descriptor huge_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 2, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_cbuffers(var_check, root_check, huge_check) @@ -152,7 +150,7 @@ def check_event(self): self.controller.FreeTrace(trace) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) rdtest.log.success("Picked value is as expected") diff --git a/util/test/tests/D3D12/D3D12_Descriptor_Indexing.py b/util/test/tests/D3D12/D3D12_Descriptor_Indexing.py index 3c85ae4638..f74536a464 100644 --- a/util/test/tests/D3D12/D3D12_Descriptor_Indexing.py +++ b/util/test/tests/D3D12/D3D12_Descriptor_Indexing.py @@ -6,57 +6,33 @@ class D3D12_Descriptor_Indexing(rdtest.TestCase): demos_test_name = 'D3D12_Descriptor_Indexing' def check_compute(self, eventId): - action = self.find_action("Dispatch", eventId) - self.check(action is not None) - self.controller.SetFrameEvent(action.eventId, False) - - pipe = self.controller.GetD3D12PipelineState() + action = self.find_action("Dispatch", eventId) + self.check(action is not None) + self.controller.SetFrameEvent(action.eventId, False) - if len(pipe.rootElements) != 2: - raise rdtest.TestFailureException("Wrong number of root elements is bound: {}, not 2" - .format(len(pipe.rootElements))) + pipe = self.controller.GetPipelineState() + d3d12pipe = self.controller.GetD3D12PipelineState() - root = pipe.rootElements[0] - # second root element is the cbuffer const, we don't care + rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute) - if root.dynamicallyUsedCount != 1: - raise rdtest.TestFailureException("Compute root range 0 has {} dynamically used, not 1" - .format(root.dynamicallyUsedCount)) + self.check_eq(len(rw), 1) + self.check_eq(rw[0].access.index, 0) + self.check_eq(rw[0].access.stage, rd.ShaderStage.Compute) + self.check_eq(rw[0].access.type, rd.DescriptorType.ReadWriteBuffer) + self.check_eq(rw[0].access.staticallyUnused, False) + self.check_eq(rw[0].access.arrayElement, 15) + # we don't check currently which one is the sampler heap + self.check(rw[0].access.descriptorStore in d3d12pipe.descriptorHeaps) - if not root.views[15].dynamicallyUsed: - raise rdtest.TestFailureException("Compute root range 0[15] isn't dynamically used") + self.check_eq(len(pipe.GetReadOnlyResources(rd.ShaderStage.Compute)), 0) - for i in range(len(root.views)): - if i == 15: - continue - - if root.views[i].dynamicallyUsed: - raise rdtest.TestFailureException("Compute root range 0[{}] i dynamically used".format(i)) + rw_used = pipe.GetReadWriteResources(rd.ShaderStage.Compute, True) - # these lists are only expected to be empty because the descriptors aren't written to, and so with mutable - # consideration these aren't considered read-only with unknown contents - pipe = self.controller.GetPipelineState() - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Compute, False) - self.check_eq(ro, []) - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Compute, True) - self.check_eq(ro, []) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute, False) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 0) - self.check_eq(len(rw[0].resources), 32) - self.check(rw[0].resources[15].dynamicallyUsed) - self.check_eq(rw[0].resources[15].resourceId, root.views[15].resourceId) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute, True) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 15) - self.check_eq(len(rw[0].resources), 1) - self.check_eq(rw[0].resources[0].resourceId, root.views[15].resourceId) - self.check(rw[0].resources[0].dynamicallyUsed) + # should get the same results for dynamic array indexing, the 'only used' is only for + # statically unused or used bindings + self.check(rw == rw_used) def check_capture(self): - for sm in ["sm_5_1", "sm_6_0", "sm_6_6"]: base = self.find_action("Tests " + sm) if base == None: @@ -68,7 +44,8 @@ def check_capture(self): self.check(action is not None) self.controller.SetFrameEvent(action.eventId, False) - pipe = self.controller.GetD3D12PipelineState() + pipe = self.controller.GetPipelineState() + d3d12pipe = self.controller.GetD3D12PipelineState() # Check bindings: # - buffer 8 in root range 0 should be statically used (single fixed declaration) for the parameters @@ -77,38 +54,84 @@ def check_capture(self): # images 49 & 59 in root range 1 should be used for a second array in the same range # image 60 in root range 1 should be used for a fixed index in an array # image 99 and 103 in root range 1 should be used + # + # Currently D3D12 only reports descriptor category bind_info = { - 0: [8, 12], - 1: [19, 20, 21, 49, 59, 60, 99, 103], + (rd.DescriptorCategory.ReadOnlyResource, 0): { + 'loc': (0, 8), + 'elems': [0] + }, + (rd.DescriptorCategory.ReadOnlyResource, 1): { + 'loc': (0, 12), + 'elems': [0] + }, + (rd.DescriptorCategory.ReadOnlyResource, 2): { + 'loc': (1, 0), + 'elems': [19, 20, 21] + }, + (rd.DescriptorCategory.ReadOnlyResource, 3): { + 'loc': (1, 40), + 'elems': [9, 19, 20] + }, + (rd.DescriptorCategory.ReadOnlyResource, 4): { + 'loc': (1, 80), + 'elems': [19, 23] + }, } - if len(pipe.rootElements) != 3: - raise rdtest.TestFailureException("Wrong number of root signature ranges: {}, not 3" - .format(len(pipe.rootElements))) + ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel) + samp = pipe.GetSamplers(rd.ShaderStage.Pixel) + rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel) - for rangeIdx, root in enumerate(pipe.rootElements): - if rangeIdx == 2: # static sampler - continue + self.check_eq(len(ro), 2 + 8) + self.check_eq(len(samp), 1) + self.check_eq(len(rw), 0) - if root.dynamicallyUsedCount != len(bind_info[rangeIdx]): - raise rdtest.TestFailureException( - "Root range {} doesn't have the right used count. {} is not the expected count of {}" - .format(rangeIdx, root.dynamicallyUsedCount, len(bind_info[rangeIdx]))) + refl = pipe.GetShaderReflection(rd.ShaderStage.Pixel) + + for a in samp + ro: + idx = (rd.CategoryForDescriptorType(a.access.type), a.access.index) + if a.access.type == rd.DescriptorType.Sampler: # static sampler + # descriptor store should not be a heap, but we don't verify exactly where it comes from + self.check(a.access.descriptorStore not in d3d12pipe.descriptorHeaps) + self.check_eq(a.access.index, 0) + continue - for idx, el in enumerate(root.views): - expected_used = idx in bind_info[rangeIdx] - actually_used = el.dynamicallyUsed + if rd.IsReadOnlyDescriptor(a.access.type): + res = refl.readOnlyResources[a.access.index] + else: + res = refl.readWriteResources[a.access.index] - if expected_used and not actually_used: - raise rdtest.TestFailureException( - "Range {} element {} expected to be used, but isn't.".format(rangeIdx, idx)) + if idx not in bind_info.keys(): + raise rdtest.TestFailureException( + "Accessed bind {} of type {} doesn't exist in expected list".format( + a.access.index, str(a.access.type))) - if not expected_used and actually_used: - raise rdtest.TestFailureException( - "Range {} element {} expected to be unused, but is.".format(rangeIdx, idx)) + if a.access.arrayElement not in bind_info[idx]['elems']: + raise rdtest.TestFailureException( + "Bind {} reports array element {} as used, which shouldn't be".format( + res.name, a.access.arrayElement)) + + if (res.fixedBindSetOrSpace, res.fixedBindNumber) != bind_info[idx]['loc']: + raise rdtest.TestFailureException("Bind {} expected to be {} but is {}, {}".format( + res.name, bind_info[idx]['loc'], res.fixedBindSetOrSpace, res.fixedBindNumber)) + + # On D3D12 the logical location is just an index into the heap. This test sets up all + # descriptor tables at 0 so register = heap + loc = self.controller.GetDescriptorLocations(a.access.descriptorStore, + [rd.DescriptorRange(a.access)])[0] + if loc.fixedBindNumber != bind_info[idx]['loc'][1] + a.access.arrayElement: + raise rdtest.TestFailureException("Location {} not expected for space,reg {} array element {}".format( + loc.fixedBindNumber, bind_info[idx]['loc'], a.access.arrayElement)) + if loc.logicalBindName != "ResourceDescriptorHeap[{}]".format(bind_info[idx]['loc'][1] + + a.access.arrayElement): + raise rdtest.TestFailureException("Location {} not expected for space,reg {} array element {}".format( + loc.logicalBindName, bind_info[idx]['loc'], a.access.arrayElement)) + + bind_info[idx]['elems'].remove(a.access.arrayElement) rdtest.log.success("Dynamic usage is as expected for {}".format(sm)) - + for sm in ["sm_6_6_heap"]: base = self.find_action("Tests " + sm) if base == None: @@ -120,121 +143,67 @@ def check_capture(self): self.check(action is not None) self.controller.SetFrameEvent(action.eventId, False) - pipe = self.controller.GetD3D12PipelineState() + pipe = self.controller.GetPipelineState() # Check bindings: - # - CBV - # - Samplers + # - CBV + # - Samplers # - SRV resources - # - UAV resources + # - UAV resources bind_info = { - 0: [9], - 1: [0, 1, 2, 4, 5, 6, 7], - 2: [8, 12, 19, 20, 21, 49, 59, 6, 99, 103], - 3: [10], + rd.DescriptorCategory.ConstantBlock: [9], + rd.DescriptorCategory.Sampler: [0, 1, 2, 4, 5, 6, 7], + rd.DescriptorCategory.ReadOnlyResource: [8, 12, 19, 20, 21, 49, 59, 6, 99, 103], + rd.DescriptorCategory.ReadWriteResource: [10], } - if len(pipe.rootElements) != 4: - raise rdtest.TestFailureException("Wrong number of root signature ranges: {}, not 4" - .format(len(pipe.rootElements))) - cbvRangeIdx = 0 - samplerRangeIdx = 1 - srvRangeIdx = 2 - uavRangeIdx = 3 - for rangeIdx, root in enumerate(pipe.rootElements): - if root.dynamicallyUsedCount != len(bind_info[rangeIdx]): - raise rdtest.TestFailureException( - "{} : Root range {} doesn't have the right used count. {} is not the expected count of {}" - .format(sm, rangeIdx, root.dynamicallyUsedCount, len(bind_info[rangeIdx]))) - - for el in root.views: - expected_used = ( el.tableIndex in bind_info[srvRangeIdx] ) or ( ( el.tableIndex in bind_info[uavRangeIdx] ) ) - if not expected_used: - raise rdtest.TestFailureException( - "Descriptor {} expected to be unused, but is.".format(el.tableIndex)) - for el in root.constantBuffers: - expected_used = el.tableIndex in bind_info[cbvRangeIdx] - if not expected_used: - raise rdtest.TestFailureException( - "CBV {} expected to be unused, but is.".format(el.tableIndex)) - for el in root.samplers: - expected_used = el.tableIndex in bind_info[samplerRangeIdx] - if not expected_used: - raise rdtest.TestFailureException( - "Sampler {} expected to be unused, but is.".format(el.tableIndex)) - - for elemId in bind_info[srvRangeIdx]: - actually_used = any( srv.tableIndex == elemId for srv in pipe.rootElements[srvRangeIdx].views) - if not actually_used: - raise rdtest.TestFailureException( - "SRV {} expected to be used, but isn't.".format(elemId)) - for elemId in bind_info[uavRangeIdx]: - actually_used = any( uav.tableIndex == elemId for uav in pipe.rootElements[uavRangeIdx].views) - if not actually_used: + ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel) + samp = pipe.GetSamplers(rd.ShaderStage.Pixel) + rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel) + + # All accesses should come direct without a shader binding + self.check(all([d.access.index == rd.DescriptorAccess.NoShaderBinding for d in ro])) + self.check(all([d.access.index == rd.DescriptorAccess.NoShaderBinding for d in samp])) + self.check(all([d.access.index == rd.DescriptorAccess.NoShaderBinding for d in rw])) + # Check accesses are in the right lists + self.check( + all([rd.CategoryForDescriptorType(d.access.type) == rd.DescriptorCategory.ReadOnlyResource for d in ro + ])) + self.check(all([rd.CategoryForDescriptorType(d.access.type) == rd.DescriptorCategory.Sampler for d in samp + ])) + self.check( + all([ + rd.CategoryForDescriptorType(d.access.type) == rd.DescriptorCategory.ReadWriteResource for d in rw + ])) + # the "byte offsets" are descriptor indices and should match the expectation above + self.check([d.access.byteOffset for d in rw] == sorted(bind_info[rd.DescriptorCategory.ReadWriteResource])) + self.check([d.access.byteOffset for d in ro] == sorted(bind_info[rd.DescriptorCategory.ReadOnlyResource])) + self.check([d.access.byteOffset for d in samp] == sorted(bind_info[rd.DescriptorCategory.Sampler])) + + for a in ro + rw: + loc = self.controller.GetDescriptorLocations(a.access.descriptorStore, + [rd.DescriptorRange(a.access)])[0] + + if loc.fixedBindNumber != a.access.byteOffset: + raise rdtest.TestFailureException("Bind {} not expected for space,reg {} array element {}".format( + loc.fixedBindNumber, a.access.byteOffset)) + + if loc.logicalBindName != "ResourceDescriptorHeap[{}]".format(a.access.byteOffset): raise rdtest.TestFailureException( - "UAV {} expected to be used, but isn't.".format(elemId)) - for elemId in bind_info[cbvRangeIdx]: - actually_used = any( cbv.tableIndex == elemId for cbv in pipe.rootElements[cbvRangeIdx].constantBuffers) - if not actually_used: - raise rdtest.TestFailureException( - "CBV {} expected to be used, but isn't.".format(elemId)) - for elemId in bind_info[samplerRangeIdx]: - actually_used = any( samp.tableIndex == elemId for samp in pipe.rootElements[samplerRangeIdx].samplers) - if not actually_used: - raise rdtest.TestFailureException( - "Sampler {} expected to be used, but isn't.".format(elemId)) + "Bind {} not expected for descriptor access ResourceDescriptorHeap[{}]".format( + loc.logicalBindName, a.access.byteOffset)) - pipe = self.controller.GetPipelineState() - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel, False) - self.check_eq(len(ro), 5) - self.check_eq(ro[0].dynamicallyUsedCount, 1) - self.check_eq(ro[0].firstIndex, 0) - self.check_eq(len(ro[0].resources), 1) - self.check_eq(ro[1].dynamicallyUsedCount, 1) - self.check_eq(ro[1].firstIndex, 0) - self.check_eq(len(ro[1].resources), 1) - self.check_eq(ro[2].dynamicallyUsedCount, 3) - self.check_eq(ro[2].firstIndex, 0) - self.check_eq(len(ro[2].resources), 32) - self.check_eq(ro[3].dynamicallyUsedCount, 3) - self.check_eq(ro[3].firstIndex, 0) - self.check_eq(len(ro[3].resources), 32) - self.check_eq(ro[4].dynamicallyUsedCount, 2) - self.check_eq(ro[4].firstIndex, 0) - self.check_eq(len(ro[4].resources), 32) - self.check(not ro[2].resources[18].dynamicallyUsed) - self.check(ro[2].resources[19].dynamicallyUsed) - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel, True) - self.check_eq(len(ro), 5) - self.check_eq(ro[0].dynamicallyUsedCount, 1) - self.check_eq(ro[0].firstIndex, 0) - self.check_eq(len(ro[0].resources), 1) - self.check_eq(ro[1].dynamicallyUsedCount, 1) - self.check_eq(ro[1].firstIndex, 0) - self.check_eq(len(ro[1].resources), 1) - self.check_eq(ro[2].dynamicallyUsedCount, 3) - self.check_eq(ro[2].firstIndex, 19) - # this contains more resources after the dynamically used ones because of the mismatch between - # root signature elements and bindings - self.check_eq(len(ro[2].resources), 32-8) - self.check_eq(ro[3].dynamicallyUsedCount, 3) - self.check_eq(ro[3].firstIndex, 0) - # similar to above - self.check_eq(len(ro[3].resources), 32) - self.check_eq(ro[4].dynamicallyUsedCount, 2) - self.check_eq(ro[4].firstIndex, 0) - self.check_eq(len(ro[4].resources), 103-80+1) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel, False) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 0) - self.check_eq(len(rw[0].resources), 32) - self.check(rw[0].resources[15].dynamicallyUsed) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel, True) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 15) - self.check_eq(len(rw[0].resources), 1) - self.check(rw[0].resources[0].dynamicallyUsed) + for a in samp: + loc = self.controller.GetDescriptorLocations(a.access.descriptorStore, + [rd.DescriptorRange(a.access)])[0] + + if loc.fixedBindNumber != a.access.byteOffset: + raise rdtest.TestFailureException("Bind {} not expected for space,reg {} array element {}".format( + loc.fixedBindNumber, a.access.byteOffset)) + + if loc.logicalBindName != "SamplerDescriptorHeap[{}]".format(a.access.byteOffset): + raise rdtest.TestFailureException( + "Bind {} not expected for descriptor access SamplerDescriptorHeap[{}]".format( + loc.logicalBindName, a.access.byteOffset)) rdtest.log.success("Dynamic usage is as expected for {}".format(sm)) diff --git a/util/test/tests/D3D12/D3D12_Execute_Indirect.py b/util/test/tests/D3D12/D3D12_Execute_Indirect.py index af941c71bb..8be33df9a9 100644 --- a/util/test/tests/D3D12/D3D12_Execute_Indirect.py +++ b/util/test/tests/D3D12/D3D12_Execute_Indirect.py @@ -68,9 +68,9 @@ def check_capture(self): ro = pipe.GetReadOnlyResources(rd.ShaderStage.Vertex) rw = pipe.GetReadWriteResources(rd.ShaderStage.Vertex) self.check(vbs[0].resourceId != rd.ResourceId()) - self.check(ro[0].resources[0].resourceId != rd.ResourceId()) - self.check(rw[0].resources[0].resourceId != rd.ResourceId()) - self.check(pipe.GetConstantBuffer(rd.ShaderStage.Vertex, 0, 0).resourceId != rd.ResourceId()) + self.check(ro[0].descriptor.resource != rd.ResourceId()) + self.check(rw[0].descriptor.resource != rd.ResourceId()) + self.check(pipe.GetConstantBlock(rd.ShaderStage.Vertex, 0, 0).descriptor.resource != rd.ResourceId()) action = self.find_action("Post draw") self.controller.SetFrameEvent(action.eventId, False) @@ -85,9 +85,9 @@ def check_capture(self): ro = pipe.GetReadOnlyResources(rd.ShaderStage.Vertex) rw = pipe.GetReadWriteResources(rd.ShaderStage.Vertex) self.check(len(vbs) == 0 or vbs[0].resourceId == rd.ResourceId()) - self.check(len(ro) == 0 or ro[0].resources[0].resourceId == rd.ResourceId()) - self.check(len(rw) == 0 or rw[0].resources[0].resourceId == rd.ResourceId()) - self.check(pipe.GetConstantBuffer(rd.ShaderStage.Vertex, 0, 0).resourceId == rd.ResourceId()) + self.check(len(ro) == 0 or ro[0].descriptor.resource == rd.ResourceId()) + self.check(len(rw) == 0 or rw[0].descriptor.resource == rd.ResourceId()) + self.check(pipe.GetConstantBlock(rd.ShaderStage.Vertex, 0, 0).descriptor.resource == rd.ResourceId()) rdtest.log.success("State is reset after execute") @@ -101,7 +101,7 @@ def check_capture(self): for y in range(30): for x in range(12): idx = z*30*12+y*12+x - value = struct.unpack_from('4f', self.controller.GetBufferData(rw[0].resources[0].resourceId, 16*idx, 16)) + value = struct.unpack_from('4f', self.controller.GetBufferData(rw[0].descriptor.resource, 16*idx, 16)) expect = [float(x), float(y), float(z), float(idx)] if not rdtest.value_compare(expect, value): @@ -141,7 +141,7 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId + drawNum, False) pipe = self.controller.GetPipelineState() - out = pipe.GetOutputTargets()[0].resourceId + out = pipe.GetOutputTargets()[0].resource count = 0 draws = [] diff --git a/util/test/tests/D3D12/D3D12_List_Alloc_Tests.py b/util/test/tests/D3D12/D3D12_List_Alloc_Tests.py index dea84dba81..122f137fb5 100644 --- a/util/test/tests/D3D12/D3D12_List_Alloc_Tests.py +++ b/util/test/tests/D3D12/D3D12_List_Alloc_Tests.py @@ -19,6 +19,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Captured loaded with color as expected") \ No newline at end of file diff --git a/util/test/tests/D3D12/D3D12_Multi_Wait_Before_Signal.py b/util/test/tests/D3D12/D3D12_Multi_Wait_Before_Signal.py index 9cc7e29df5..61c833b947 100644 --- a/util/test/tests/D3D12/D3D12_Multi_Wait_Before_Signal.py +++ b/util/test/tests/D3D12/D3D12_Multi_Wait_Before_Signal.py @@ -16,7 +16,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - tex = pipe.GetOutputTargets()[0].resourceId + tex = pipe.GetOutputTargets()[0].resource self.check_pixel_value(tex, 270, 194, [0.20117, 0.20117, 0.20117, 0.0]) self.check_pixel_value(tex, 180, 170, [0.5031, 0.25, 1.0, 1.0]) self.check_pixel_value(tex, 180, 194, [0.25, 0.75391, 1.0, 1.0]) diff --git a/util/test/tests/D3D12/D3D12_Overlay_Test.py b/util/test/tests/D3D12/D3D12_Overlay_Test.py index 130f4dc979..05a2b78d49 100644 --- a/util/test/tests/D3D12/D3D12_Overlay_Test.py +++ b/util/test/tests/D3D12/D3D12_Overlay_Test.py @@ -30,7 +30,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource for overlay in rd.DebugOverlay: if overlay == rd.DebugOverlay.NoOverlay: diff --git a/util/test/tests/D3D12/D3D12_Parameter_Zoo.py b/util/test/tests/D3D12/D3D12_Parameter_Zoo.py index 5a560fc9e2..e09229627c 100644 --- a/util/test/tests/D3D12/D3D12_Parameter_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Parameter_Zoo.py @@ -18,7 +18,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Captured loaded with color as expected") @@ -54,7 +54,7 @@ def check_capture(self): tex = rd.TextureDisplay() tex.overlay = rd.DebugOverlay.Drawcall - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) diff --git a/util/test/tests/D3D12/D3D12_Pixel_History.py b/util/test/tests/D3D12/D3D12_Pixel_History.py index a096578a77..acf179c60e 100644 --- a/util/test/tests/D3D12/D3D12_Pixel_History.py +++ b/util/test/tests/D3D12/D3D12_Pixel_History.py @@ -71,9 +71,9 @@ def primary_test(self, begin_name: str): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -101,19 +101,19 @@ def primary_test(self, begin_name: str): # For pixel 110, 100, inside the red triangle with stencil value 0x55 x, y = 110, 100 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, unbound_fs_eid], [passed, True], [unboundPS, True], [primitive_id, 0], [get_post_mod_stencil, 0x33]], [[event_id, stencil_write_eid], [passed, True], [primitive_id, 0], [get_post_mod_stencil, 0x55]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) # For pixel 190, 149 inside the red triangle x, y = 190, 149 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, unbound_fs_eid], [passed, True], [unboundPS, True], [primitive_id, 0]], @@ -123,11 +123,11 @@ def primary_test(self, begin_name: str): ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 190, 150 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_write_eid], [passed, True]], @@ -136,88 +136,88 @@ def primary_test(self, begin_name: str): [[event_id, test_eid], [depth_test_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 200, 50 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], [[event_id, test_eid], [passed, True], [primitive_id, 7]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 150, 250 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [shader_discarded, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 330, 145 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, test_eid], [passed, True], [primitive_id, 3], [get_shader_out_color, (0.0, 0.0, 0.0, 2.75)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 340, 145 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, test_eid], [passed, False], [depth_clipped, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 330, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [get_shader_out_color, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, True], [primitive_id, 0], [get_shader_out_color, (0.0, 1.0, 0.0, 2.75)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 320, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [get_shader_out_color, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, False], [depth_bounds_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) x, y = 345, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [get_shader_out_color, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, False], [depth_bounds_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) rdtest.log.print("Testing dynamic state pipelines") self.controller.SetFrameEvent(dynamic_stencil_mask_eid, True) x, y = 100, 250 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], @@ -230,14 +230,14 @@ def primary_test(self, begin_name: str): [get_post_mod_color, (0.0, 1.0, 1.0, 1.0)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) rdtest.log.print("Testing depth test for per fragment reporting") self.controller.SetFrameEvent(depth_test_eid, True) x, y = 275, 260 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], @@ -258,14 +258,14 @@ def primary_test(self, begin_name: str): [get_post_mod_depth, 0.10]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) # For pixel 70, 100 inside the yellow triangle rendered with 16-bit depth rdtest.log.print("Testing 16-bit depth format") self.controller.SetFrameEvent(depth_16bit_test_eid, True) x, y = 70, 100 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_16bit_test_eid], [primitive_id, 0], [depth_test_failed, False], @@ -273,15 +273,15 @@ def primary_test(self, begin_name: str): [get_post_mod_depth, 0.33]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) # For pixel 60, 130 inside the light green triangle which is 1000 draws of 1 instance of 1 triangle rdtest.log.print("Testing Lots of Drawcalls") self.controller.SetFrameEvent(one_thousand_instances_action.eventId, True) x, y = 60, 130 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) countEvents = 1 + 1000 self.check(len(modifs) == countEvents, "Expected {} events, got {}".format(countEvents, len(modifs))) self.check_modifs_consistent(modifs) @@ -291,8 +291,8 @@ def primary_test(self, begin_name: str): self.controller.SetFrameEvent(one_thousand_instances_action.next.eventId, True) x, y = 60, 50 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) countEvents = 1 + 255 self.check(len(modifs) == countEvents, "Expected {} events, got {}".format(countEvents, len(modifs))) self.check_modifs_consistent(modifs) @@ -310,13 +310,13 @@ def multisampled_image_test(self, pass_name: str): self.controller.SetFrameEvent(action_eid, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] if self.is_depth: - rt: rd.BoundResource = pipe.GetDepthTarget() + rt = pipe.GetDepthTarget() sub = rd.Subresource() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) if tex_details.arraysize > 1: sub.slice = rt.firstSlice @@ -326,7 +326,7 @@ def multisampled_image_test(self, pass_name: str): x, y = 140, 130 sub.sample = 1 rdtest.log.print("Testing pixel {}, {} at sample {}".format(x, y, sub.sample)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, beg_renderpass_eid], [passed, True]], @@ -343,13 +343,13 @@ def multisampled_image_test(self, pass_name: str): self.check_events(events, modifs, True) if self.is_depth: - self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil)/255.0, 0.0, 1.0], sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil)/255.0, 0.0, 1.0], sub=sub, cast=rt.format.compType) else: - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) sub.sample = 2 rdtest.log.print("Testing pixel {}, {} at sample {}".format(x, y, sub.sample)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, beg_renderpass_eid], [passed, True]], [[event_id, action_eid], [passed, True], [primitive_id, 0], [get_pre_mod_depth, 0.0], [get_shader_out_depth, 0.9], @@ -367,9 +367,9 @@ def multisampled_image_test(self, pass_name: str): if self.is_depth: self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil) / 255.0, 0.0, 1.0], - sub=sub, cast=rt.typeCast) + sub=sub, cast=rt.format.compType) else: - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) def secondary_cmd_test(self, pass_name: str): begin_pass_action = self.find_action(pass_name) @@ -383,9 +383,9 @@ def secondary_cmd_test(self, pass_name: str): self.controller.SetFrameEvent(secondary_marker.next.eventId, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] sub = rd.Subresource() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) if tex_details.arraysize > 1: sub.slice = rt.firstSlice @@ -400,19 +400,19 @@ def secondary_cmd_test(self, pass_name: str): # Test culling x, y = 70, 40 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid], [passed, True], [get_post_mod_color, (0.0, 1.0, 0.0, 1.0)]], [[event_id, background_eid], [passed, True], [get_pre_mod_color, (0.0, 1.0, 0.0, 1.0)]], [[event_id, culled_eid], [passed, False], [culled, True]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) # Blue triangle x, y = 40, 40 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid], [passed, True], [get_post_mod_color, (0.0, 1.0, 0.0, 1.0)]], # This is the first event in the command buffer, should have pre-mod @@ -421,18 +421,18 @@ def secondary_cmd_test(self, pass_name: str): [[event_id, sec_red_and_blue], [passed, True], [get_post_mod_color, (0.0, 0.0, 1.0, 1.0)]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) # Didn't get post mod for background_eid self.controller.SetFrameEvent(background_eid, True) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid]], # The only event, should have both pre and post mod. [[event_id, background_eid], [passed, True], [get_pre_mod_color, (0.0, 1.0, 0.0, 1.0)], [get_post_mod_color, (1.0, 0.0, 1.0, 1.0)]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, get_post_mod_color(modifs[-1]), sub=sub, cast=rt.format.compType) def depth_target_test(self, begin_name: str): begin_pass_action = self.find_action(begin_name) @@ -449,9 +449,9 @@ def depth_target_test(self, begin_name: str): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetDepthTarget() + rt = pipe.GetDepthTarget() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -469,7 +469,7 @@ def depth_target_test(self, begin_name: str): x, y = 200, 190 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True], [get_post_mod_depth, 1.0]], [[event_id, background_eid], [passed, True], [primitive_id, 0], [get_pre_mod_depth, 1.0], [get_post_mod_depth, 0.95]], @@ -481,7 +481,7 @@ def depth_target_test(self, begin_name: str): # For pixel 110, 100, inside the red triangle with stencil value 0x55 x, y = 110, 100 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, unbound_fs_eid], [passed, True], [unboundPS, True], [primitive_id, 0], [get_post_mod_stencil, 0x33]], @@ -494,9 +494,9 @@ def depth_target_test(self, begin_name: str): self.controller.SetFrameEvent(depth_16bit_test_eid, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetDepthTarget() + rt = pipe.GetDepthTarget() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -507,7 +507,7 @@ def depth_target_test(self, begin_name: str): x, y = 70, 100 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, clear_depth_16bit_eid], [passed, True]], [[event_id, depth_16bit_test_eid], [passed, True], [primitive_id, 0], [depth_test_failed, False], diff --git a/util/test/tests/D3D12/D3D12_Reflection_Zoo.py b/util/test/tests/D3D12/D3D12_Reflection_Zoo.py index 0d7050a57f..fbf1733661 100644 --- a/util/test/tests/D3D12/D3D12_Reflection_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Reflection_Zoo.py @@ -52,7 +52,6 @@ def check_event(self): stage = rd.ShaderStage.Pixel refl: rd.ShaderReflection = pipe.GetShaderReflection(stage) - mapping: rd.ShaderBindpointMapping = pipe.GetBindpointMapping(stage) # Check we have the source and it is unmangled debugInfo: rd.ShaderDebugInfo = refl.debugInfo @@ -61,10 +60,17 @@ def check_event(self): self.check('Iñtërnâtiônàližætiøn' in debugInfo.files[0].contents) - def checker(resType: rd.TextureType, varType: rd.VarType, col: int, register: int, typeName: str, *, - isTexture: bool = True, regCount: int = 1, structVarCheck=None): + def checker(textureType: rd.TextureType, + varType: rd.VarType, + col: int, + register: int, + typeName: str, + *, + isTexture: bool = True, + regCount: int = 1, + structVarCheck=None): return { - 'resType': resType, + 'textureType': textureType, 'isTexture': isTexture, 'register': register, 'regCount': regCount, @@ -102,115 +108,181 @@ def buf_struct_check(type: rd.ShaderConstantType): return ro_db = { - 'tex1d': checker(rd.TextureType.Texture1D, rd.VarType.Float, 4, 0, 'float4'), - 'tex2d': checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 1, 'float4'), - 'tex3d': checker(rd.TextureType.Texture3D, rd.VarType.Float, 4, 2, 'float4'), - 'tex1darray': checker(rd.TextureType.Texture1DArray, rd.VarType.Float, 4, 3, 'float4'), - 'tex2darray': checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 4, 4, 'float4'), - 'texcube': checker(rd.TextureType.TextureCube, rd.VarType.Float, 4, 5, 'float4'), - 'texcubearray': checker(rd.TextureType.TextureCubeArray, rd.VarType.Float, 4, 6, 'float4'), - 'tex2dms': checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 4, 7, 'float4'), - 'tex2dmsarray': checker(rd.TextureType.Texture2DMSArray, rd.VarType.Float, 4, 8, 'float4'), - - 'tex2d_f1': checker(rd.TextureType.Texture2D, rd.VarType.Float, 1, 10, 'float'), - 'tex2d_f2': checker(rd.TextureType.Texture2D, rd.VarType.Float, 2, 11, 'float2'), - 'tex2d_f3': checker(rd.TextureType.Texture2D, rd.VarType.Float, 3, 12, 'float3'), - 'tex2d_u2': checker(rd.TextureType.Texture2D, rd.VarType.UInt, 2, 13, 'uint2'), - 'tex2d_u3': checker(rd.TextureType.Texture2D, rd.VarType.UInt, 3, 14, 'uint3'), - 'tex2d_i2': checker(rd.TextureType.Texture2D, rd.VarType.SInt, 2, 15, 'int2'), - 'tex2d_i3': checker(rd.TextureType.Texture2D, rd.VarType.SInt, 3, 16, 'int3'), - - 'msaa_flt2_4x': checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 2, 17, 'float2'), - 'msaa_flt3_2x': checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 3, 18, 'float3'), - 'msaa_flt4_8x': checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 4, 19, 'float4'), - - 'buf_f1': checker(rd.TextureType.Buffer, rd.VarType.Float, 1, 20, 'float', isTexture=False), - 'buf_f2': checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 21, 'float2', isTexture=False), - 'buf_f3': checker(rd.TextureType.Buffer, rd.VarType.Float, 3, 22, 'float3', isTexture=False), - 'buf_f4': checker(rd.TextureType.Buffer, rd.VarType.Float, 4, 23, 'float4', isTexture=False), - 'buf_u2': checker(rd.TextureType.Buffer, rd.VarType.UInt, 2, 24, 'uint2', isTexture=False), - 'buf_i3': checker(rd.TextureType.Buffer, rd.VarType.SInt, 3, 25, 'int3', isTexture=False), - - 'bytebuf': checker(rd.TextureType.Buffer, rd.VarType.UByte, 1, 30, 'byte', isTexture=False), - - 'strbuf': checker(rd.TextureType.Buffer, rd.VarType.Unknown, 0, 40, 'buf_struct', isTexture=False, structVarCheck=buf_struct_check), - 'strbuf_f2': checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 41, 'float2', isTexture=False), - - 'tex2dArray': checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 1, 50, 'float', regCount=4), + 'tex1d': + checker(rd.TextureType.Texture1D, rd.VarType.Float, 4, 0, 'float4'), + 'tex2d': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 1, 'float4'), + 'tex3d': + checker(rd.TextureType.Texture3D, rd.VarType.Float, 4, 2, 'float4'), + 'tex1darray': + checker(rd.TextureType.Texture1DArray, rd.VarType.Float, 4, 3, 'float4'), + 'tex2darray': + checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 4, 4, 'float4'), + 'texcube': + checker(rd.TextureType.TextureCube, rd.VarType.Float, 4, 5, 'float4'), + 'texcubearray': + checker(rd.TextureType.TextureCubeArray, rd.VarType.Float, 4, 6, 'float4'), + 'tex2dms': + checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 4, 7, 'float4'), + 'tex2dmsarray': + checker(rd.TextureType.Texture2DMSArray, rd.VarType.Float, 4, 8, 'float4'), + 'tex2d_f1': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 1, 10, 'float'), + 'tex2d_f2': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 2, 11, 'float2'), + 'tex2d_f3': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 3, 12, 'float3'), + 'tex2d_u2': + checker(rd.TextureType.Texture2D, rd.VarType.UInt, 2, 13, 'uint2'), + 'tex2d_u3': + checker(rd.TextureType.Texture2D, rd.VarType.UInt, 3, 14, 'uint3'), + 'tex2d_i2': + checker(rd.TextureType.Texture2D, rd.VarType.SInt, 2, 15, 'int2'), + 'tex2d_i3': + checker(rd.TextureType.Texture2D, rd.VarType.SInt, 3, 16, 'int3'), + 'msaa_flt2_4x': + checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 2, 17, 'float2'), + 'msaa_flt3_2x': + checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 3, 18, 'float3'), + 'msaa_flt4_8x': + checker(rd.TextureType.Texture2DMS, rd.VarType.Float, 4, 19, 'float4'), + 'buf_f1': + checker(rd.TextureType.Buffer, rd.VarType.Float, 1, 20, 'float', isTexture=False), + 'buf_f2': + checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 21, 'float2', isTexture=False), + 'buf_f3': + checker(rd.TextureType.Buffer, rd.VarType.Float, 3, 22, 'float3', isTexture=False), + 'buf_f4': + checker(rd.TextureType.Buffer, rd.VarType.Float, 4, 23, 'float4', isTexture=False), + 'buf_u2': + checker(rd.TextureType.Buffer, rd.VarType.UInt, 2, 24, 'uint2', isTexture=False), + 'buf_i3': + checker(rd.TextureType.Buffer, rd.VarType.SInt, 3, 25, 'int3', isTexture=False), + 'bytebuf': + checker(rd.TextureType.Buffer, rd.VarType.UByte, 1, 30, 'byte', isTexture=False), + 'strbuf': + checker(rd.TextureType.Buffer, + rd.VarType.Unknown, + 0, + 40, + 'buf_struct', + isTexture=False, + structVarCheck=buf_struct_check), + 'strbuf_f2': + checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 41, 'float2', isTexture=False), + 'tex2dArray': + checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 1, 50, 'float', regCount=4), } rw_db = { - 'rwtex1d': checker(rd.TextureType.Texture1D, rd.VarType.Float, 4, 0, 'float4'), - 'rwtex2d': checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 1, 'float4'), - 'rwtex3d': checker(rd.TextureType.Texture3D, rd.VarType.Float, 4, 2, 'float4'), - 'rwtex1darray': checker(rd.TextureType.Texture1DArray, rd.VarType.Float, 4, 3, 'float4'), - 'rwtex2darray': checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 4, 4, 'float4'), - - 'rwtex2d_f1': checker(rd.TextureType.Texture2D, rd.VarType.Float, 1, 10, 'float'), - 'rwtex2d_f2': checker(rd.TextureType.Texture2D, rd.VarType.Float, 2, 11, 'float2'), - 'rwtex2d_f3': checker(rd.TextureType.Texture2D, rd.VarType.Float, 3, 12, 'float3'), - 'rwtex2d_u2': checker(rd.TextureType.Texture2D, rd.VarType.UInt, 2, 13, 'uint2'), - 'rwtex2d_u3': checker(rd.TextureType.Texture2D, rd.VarType.UInt, 3, 14, 'uint3'), - 'rwtex2d_i2': checker(rd.TextureType.Texture2D, rd.VarType.SInt, 2, 15, 'int2'), - 'rwtex2d_i3': checker(rd.TextureType.Texture2D, rd.VarType.SInt, 3, 16, 'int3'), - - 'rwbuf_f1': checker(rd.TextureType.Buffer, rd.VarType.Float, 1, 20, 'float', isTexture=False), - 'rwbuf_f2': checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 21, 'float2', isTexture=False), - 'rwbuf_f3': checker(rd.TextureType.Buffer, rd.VarType.Float, 3, 22, 'float3', isTexture=False), - 'rwbuf_f4': checker(rd.TextureType.Buffer, rd.VarType.Float, 4, 23, 'float4', isTexture=False), - 'rwbuf_u2': checker(rd.TextureType.Buffer, rd.VarType.UInt, 2, 24, 'uint2', isTexture=False), - 'rwbuf_i3': checker(rd.TextureType.Buffer, rd.VarType.SInt, 3, 25, 'int3', isTexture=False), - - 'rov': checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 30, 'float4'), - - 'rwbytebuf': checker(rd.TextureType.Buffer, rd.VarType.UByte, 1, 40, 'byte', isTexture=False), - - 'rwstrbuf': checker(rd.TextureType.Buffer, rd.VarType.Unknown, 0, 50, 'buf_struct', isTexture=False, structVarCheck=buf_struct_check), - 'rwcounter': checker(rd.TextureType.Buffer, rd.VarType.Unknown, 0, 51, 'buf_struct', isTexture=False, structVarCheck=buf_struct_check), - 'rwappend': checker(rd.TextureType.Buffer, rd.VarType.Unknown, 0, 52, 'buf_struct', isTexture=False, structVarCheck=buf_struct_check), - 'rwconsume': checker(rd.TextureType.Buffer, rd.VarType.Unknown, 0, 53, 'buf_struct', isTexture=False, structVarCheck=buf_struct_check), - 'rwstrbuf_f2': checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 54, 'float2', isTexture=False), + 'rwtex1d': + checker(rd.TextureType.Texture1D, rd.VarType.Float, 4, 0, 'float4'), + 'rwtex2d': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 1, 'float4'), + 'rwtex3d': + checker(rd.TextureType.Texture3D, rd.VarType.Float, 4, 2, 'float4'), + 'rwtex1darray': + checker(rd.TextureType.Texture1DArray, rd.VarType.Float, 4, 3, 'float4'), + 'rwtex2darray': + checker(rd.TextureType.Texture2DArray, rd.VarType.Float, 4, 4, 'float4'), + 'rwtex2d_f1': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 1, 10, 'float'), + 'rwtex2d_f2': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 2, 11, 'float2'), + 'rwtex2d_f3': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 3, 12, 'float3'), + 'rwtex2d_u2': + checker(rd.TextureType.Texture2D, rd.VarType.UInt, 2, 13, 'uint2'), + 'rwtex2d_u3': + checker(rd.TextureType.Texture2D, rd.VarType.UInt, 3, 14, 'uint3'), + 'rwtex2d_i2': + checker(rd.TextureType.Texture2D, rd.VarType.SInt, 2, 15, 'int2'), + 'rwtex2d_i3': + checker(rd.TextureType.Texture2D, rd.VarType.SInt, 3, 16, 'int3'), + 'rwbuf_f1': + checker(rd.TextureType.Buffer, rd.VarType.Float, 1, 20, 'float', isTexture=False), + 'rwbuf_f2': + checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 21, 'float2', isTexture=False), + 'rwbuf_f3': + checker(rd.TextureType.Buffer, rd.VarType.Float, 3, 22, 'float3', isTexture=False), + 'rwbuf_f4': + checker(rd.TextureType.Buffer, rd.VarType.Float, 4, 23, 'float4', isTexture=False), + 'rwbuf_u2': + checker(rd.TextureType.Buffer, rd.VarType.UInt, 2, 24, 'uint2', isTexture=False), + 'rwbuf_i3': + checker(rd.TextureType.Buffer, rd.VarType.SInt, 3, 25, 'int3', isTexture=False), + 'rov': + checker(rd.TextureType.Texture2D, rd.VarType.Float, 4, 30, 'float4'), + 'rwbytebuf': + checker(rd.TextureType.Buffer, rd.VarType.UByte, 1, 40, 'byte', isTexture=False), + 'rwstrbuf': + checker(rd.TextureType.Buffer, + rd.VarType.Unknown, + 0, + 50, + 'buf_struct', + isTexture=False, + structVarCheck=buf_struct_check), + 'rwcounter': + checker(rd.TextureType.Buffer, + rd.VarType.Unknown, + 0, + 51, + 'buf_struct', + isTexture=False, + structVarCheck=buf_struct_check), + 'rwappend': + checker(rd.TextureType.Buffer, + rd.VarType.Unknown, + 0, + 52, + 'buf_struct', + isTexture=False, + structVarCheck=buf_struct_check), + 'rwconsume': + checker(rd.TextureType.Buffer, + rd.VarType.Unknown, + 0, + 53, + 'buf_struct', + isTexture=False, + structVarCheck=buf_struct_check), + 'rwstrbuf_f2': + checker(rd.TextureType.Buffer, rd.VarType.Float, 2, 54, 'float2', isTexture=False), } # ROVs are optional, if it wasn't found then ignore that if '#define ROV 0' in debugInfo.files[0].contents: del rw_db['rov'] - for s in refl.samplers: - s: rd.ShaderSampler + access = [(a.type, a.index) for a in self.controller.GetDescriptorAccess()] - self.check(0 <= s.bindPoint < len(mapping.samplers)) - - bind: rd.Bindpoint = mapping.samplers[s.bindPoint] - - self.check(bind.bindset == 0) - self.check(bind.used) - self.check(bind.arraySize == 1) + for idx, s in enumerate(refl.samplers): + self.check(s.fixedBindSetOrSpace == 0) + self.check((rd.DescriptorType.Sampler, idx) in access) + self.check(s.bindArraySize == 1) if s.name == 's1': - self.check(bind.bind == 5) + self.check(s.fixedBindNumber == 5) elif s.name == 's2': - self.check(bind.bind == 8) + self.check(s.fixedBindNumber == 8) else: raise rdtest.TestFailureException('Unrecognised sampler {}'.format(s.name)) - for res_list, map_list, res_db, res_readonly in [ - (refl.readOnlyResources, mapping.readOnlyResources, ro_db, True), - (refl.readWriteResources, mapping.readWriteResources, rw_db, False)]: - for res in res_list: + for res_list, res_db, res_readonly in [(refl.readOnlyResources, ro_db, True), + (refl.readWriteResources, rw_db, False)]: + for idx, res in enumerate(res_list): res: rd.ShaderResource - self.check(0 <= res.bindPoint < len(map_list)) - - bind: rd.Bindpoint = map_list[res.bindPoint] self.check(res.isReadOnly == res_readonly) - self.check(bind.bindset == 0) - self.check(bind.used) + self.check(res.fixedBindSetOrSpace == 0) + + self.check((res.descriptorType, idx) in access, f"{res.name} - ({str(res.descriptorType)}, {idx})") if res.name in res_db: check = res_db[res.name] - self.check(res.resType == check['resType']) + self.check(res.textureType == check['textureType']) self.check(res.isTexture == check['isTexture']) if check['structVarCheck']: @@ -220,8 +292,8 @@ def buf_struct_check(type: rd.ShaderConstantType): self.check(res.variableType.name == check['typeName']) self.check(res.variableType.columns == check['columns']) - self.check(bind.bind == check['register']) - self.check(bind.arraySize == check['regCount']) + self.check(res.fixedBindNumber == check['register']) + self.check(res.bindArraySize == check['regCount']) else: raise rdtest.TestFailureException('Unrecognised read-only resource {}'.format(res.name)) diff --git a/util/test/tests/D3D12/D3D12_RenderTarget_Binds.py b/util/test/tests/D3D12/D3D12_RenderTarget_Binds.py index 4ab8fb4304..a67f57d8a1 100644 --- a/util/test/tests/D3D12/D3D12_RenderTarget_Binds.py +++ b/util/test/tests/D3D12/D3D12_RenderTarget_Binds.py @@ -28,10 +28,10 @@ def check_capture(self): rtvs = pipe.GetOutputTargets() self.check(len(rtvs) == 2) - self.check_triangle(out=rtvs[0].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 0.0, 0.0, 1.0]) - self.check_triangle(out=rtvs[1].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 0.0, 1.0, 1.0]) - self.check(self.get_resource(rtvs[0].resourceId).name == 'TextureA') - self.check(self.get_resource(rtvs[1].resourceId).name == 'TextureB') + self.check_triangle(out=rtvs[0].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 0.0, 0.0, 1.0]) + self.check_triangle(out=rtvs[1].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 0.0, 1.0, 1.0]) + self.check(self.get_resource(rtvs[0].resource).name == 'TextureA') + self.check(self.get_resource(rtvs[1].resource).name == 'TextureB') rdtest.log.success("RTVs at first action are as expected") @@ -44,10 +44,10 @@ def check_capture(self): rtvs = pipe.GetOutputTargets() self.check(len(rtvs) == 2) - self.check_triangle(out=rtvs[0].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 1.0, 0.0, 1.0]) - self.check_triangle(out=rtvs[1].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 1.0, 1.0, 1.0]) - self.check(self.get_resource(rtvs[0].resourceId).name == 'TextureC') - self.check(self.get_resource(rtvs[1].resourceId).name == 'TextureD') + self.check_triangle(out=rtvs[0].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 1.0, 0.0, 1.0]) + self.check_triangle(out=rtvs[1].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 1.0, 1.0, 1.0]) + self.check(self.get_resource(rtvs[0].resource).name == 'TextureC') + self.check(self.get_resource(rtvs[1].resource).name == 'TextureD') rdtest.log.success("RTVs at second action are as expected") @@ -60,10 +60,10 @@ def check_capture(self): rtvs = pipe.GetOutputTargets() self.check(len(rtvs) == 2) - self.check_triangle(out=rtvs[0].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 0.0, 0.0, 1.0]) - self.check_triangle(out=rtvs[1].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 0.0, 1.0, 1.0]) - self.check(self.get_resource(rtvs[0].resourceId).name == 'TextureE') - self.check(self.get_resource(rtvs[1].resourceId).name == 'TextureF') + self.check_triangle(out=rtvs[0].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 0.0, 0.0, 1.0]) + self.check_triangle(out=rtvs[1].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 0.0, 1.0, 1.0]) + self.check(self.get_resource(rtvs[0].resource).name == 'TextureE') + self.check(self.get_resource(rtvs[1].resource).name == 'TextureF') rdtest.log.success("RTVs at third action are as expected") @@ -76,9 +76,9 @@ def check_capture(self): rtvs = pipe.GetOutputTargets() self.check(len(rtvs) == 2) - self.check_triangle(out=rtvs[0].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 1.0, 0.0, 1.0]) - self.check_triangle(out=rtvs[1].resourceId, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 1.0, 1.0, 1.0]) - self.check(self.get_resource(rtvs[0].resourceId).name == 'TextureG') - self.check(self.get_resource(rtvs[1].resourceId).name == 'TextureH') + self.check_triangle(out=rtvs[0].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[1.0, 1.0, 0.0, 1.0]) + self.check_triangle(out=rtvs[1].resource, back=[0.0, 1.0, 0.0, 1.0], fore=[0.0, 1.0, 1.0, 1.0]) + self.check(self.get_resource(rtvs[0].resource).name == 'TextureG') + self.check(self.get_resource(rtvs[1].resource).name == 'TextureH') rdtest.log.success("RTVs at fourth action are as expected") diff --git a/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py b/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py index 4027c7625c..947852eb6c 100644 --- a/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py @@ -23,7 +23,7 @@ def test_debug_pixel(self, x, y, test_name): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, x, y, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: rdtest.log.error("Test {} did not match. {}".format(test_name, str(ex))) return False diff --git a/util/test/tests/D3D12/D3D12_Shader_Debug_Zoo.py b/util/test/tests/D3D12/D3D12_Shader_Debug_Zoo.py index 670613b9ed..960c357a9a 100644 --- a/util/test/tests/D3D12/D3D12_Shader_Debug_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Shader_Debug_Zoo.py @@ -42,7 +42,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4 * test, 0, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 4 * test, 0, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: if test in undefined_tests: rdtest.log.comment("Undefined test {} did not match. {}".format(test, str(ex))) @@ -82,7 +82,7 @@ def check_capture(self): # Validate the debug output result try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 4, 4, debugged.value.f32v[0:4], sub=rd.Subresource(0, 0, test)) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 4, 4, debugged.value.f32v[0:4], sub=rd.Subresource(0, 0, test)) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Test {} did not match. {}".format(test, str(ex))) @@ -125,7 +125,7 @@ def check_capture(self): # Validate the debug output result try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 51, 51, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 51, 51, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Vertex sample pixel shader output did not match. {}".format(str(ex))) @@ -171,7 +171,7 @@ def check_capture(self): # Validate the debug output result try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 64, 64, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 64, 64, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Vertex sample pixel shader output did not match. {}".format(str(ex))) diff --git a/util/test/tests/D3D12/D3D12_Shader_Editing.py b/util/test/tests/D3D12/D3D12_Shader_Editing.py index 6b2c43de4e..ddb3adc665 100644 --- a/util/test/tests/D3D12/D3D12_Shader_Editing.py +++ b/util/test/tests/D3D12/D3D12_Shader_Editing.py @@ -23,7 +23,7 @@ def check_capture(self): psrefl2: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Pixel) vsrefl: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Vertex) - tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource # Both triangles should be green self.check_pixel_value(tex, 0.25, 0.5, [0.0, 1.0, 0.0, 1.0]) diff --git a/util/test/tests/D3D12/D3D12_Shader_Linkage_Zoo.py b/util/test/tests/D3D12/D3D12_Shader_Linkage_Zoo.py index 3251c66096..090133939e 100644 --- a/util/test/tests/D3D12/D3D12_Shader_Linkage_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Shader_Linkage_Zoo.py @@ -40,7 +40,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 200, 150, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 200, 150, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Test {} did not match. {}".format(event_name, str(ex))) diff --git a/util/test/tests/D3D12/D3D12_Untyped_Backbuffer_Descriptor.py b/util/test/tests/D3D12/D3D12_Untyped_Backbuffer_Descriptor.py index 23e81d43d8..3a498abb8e 100644 --- a/util/test/tests/D3D12/D3D12_Untyped_Backbuffer_Descriptor.py +++ b/util/test/tests/D3D12/D3D12_Untyped_Backbuffer_Descriptor.py @@ -13,7 +13,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.25, 0.5, [1.0, 1.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.25, 0.5, [1.0, 1.0, 1.0, 1.0]) rdtest.log.success("Picked value for first action is as expected") @@ -24,6 +24,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.75, 0.5, [1.0, 1.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.75, 0.5, [1.0, 1.0, 1.0, 1.0]) rdtest.log.success("Picked value for second action is as expected") diff --git a/util/test/tests/D3D12/D3D12_VRS.py b/util/test/tests/D3D12/D3D12_VRS.py index d0a6c022b6..97739aab58 100644 --- a/util/test/tests/D3D12/D3D12_VRS.py +++ b/util/test/tests/D3D12/D3D12_VRS.py @@ -9,7 +9,7 @@ def get_shading_rates(self): pipe: rd.PipeState = self.controller.GetPipelineState() v = pipe.GetViewport(0) - tex = pipe.GetOutputTargets()[0].resourceId + tex = pipe.GetOutputTargets()[0].resource # Ensure we check even-based quads x = int(v.x) - int(v.x % 2) diff --git a/util/test/tests/D3D12/D3D12_Vertex_Attr_Zoo.py b/util/test/tests/D3D12/D3D12_Vertex_Attr_Zoo.py index e9d60f86d9..e85f45aece 100644 --- a/util/test/tests/D3D12/D3D12_Vertex_Attr_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Vertex_Attr_Zoo.py @@ -72,6 +72,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Triangle picked value is as expected") diff --git a/util/test/tests/D3D12/D3D12_Vertex_UAV.py b/util/test/tests/D3D12/D3D12_Vertex_UAV.py index f108c4d713..a56b616e0b 100644 --- a/util/test/tests/D3D12/D3D12_Vertex_UAV.py +++ b/util/test/tests/D3D12/D3D12_Vertex_UAV.py @@ -25,7 +25,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource tex.overlay = rd.DebugOverlay.QuadOverdrawPass out.SetTextureDisplay(tex) diff --git a/util/test/tests/D3D12/D3D12_Write_Subresource.py b/util/test/tests/D3D12/D3D12_Write_Subresource.py index 0611959601..188a424261 100644 --- a/util/test/tests/D3D12/D3D12_Write_Subresource.py +++ b/util/test/tests/D3D12/D3D12_Write_Subresource.py @@ -13,7 +13,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() # Should be black around the sides, white in the centre - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.05, 0.05, [0.0, 0.0, 0.0, 0.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [1.0, 1.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.05, 0.05, [0.0, 0.0, 0.0, 0.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [1.0, 1.0, 1.0, 1.0]) rdtest.log.success("Picked values are as expected") \ No newline at end of file diff --git a/util/test/tests/GL/GL_Buffer_Spam.py b/util/test/tests/GL/GL_Buffer_Spam.py index 14e5cd2f5c..d295aaec4a 100644 --- a/util/test/tests/GL/GL_Buffer_Spam.py +++ b/util/test/tests/GL/GL_Buffer_Spam.py @@ -18,4 +18,4 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) diff --git a/util/test/tests/GL/GL_Buffer_Updates.py b/util/test/tests/GL/GL_Buffer_Updates.py index b7c77f0880..c6e2641ad3 100644 --- a/util/test/tests/GL/GL_Buffer_Updates.py +++ b/util/test/tests/GL/GL_Buffer_Updates.py @@ -15,7 +15,7 @@ def check_capture(self): if action.flags & rd.ActionFlags.Drawcall: pipe = self.controller.GetPipelineState() - tex = self.controller.GetPipelineState().GetOutputTargets()[0].resourceId + tex = self.controller.GetPipelineState().GetOutputTargets()[0].resource view: rd.Viewport = self.controller.GetPipelineState().GetViewport(0) diff --git a/util/test/tests/GL/GL_CBuffer_Zoo.py b/util/test/tests/GL/GL_CBuffer_Zoo.py index 74bdb9b9b3..34807171e8 100644 --- a/util/test/tests/GL/GL_CBuffer_Zoo.py +++ b/util/test/tests/GL/GL_CBuffer_Zoo.py @@ -14,14 +14,19 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() + refl = pipe.GetShaderReflection(rd.ShaderStage.Fragment) + + # identify the constant buffer + cbufIdx = [index for index, c in enumerate(refl.constantBlocks) if c.bufferBacked][0] + stage = rd.ShaderStage.Pixel - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, cbufIdx, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, - pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + pipe.GetShaderEntryPoint(stage), cbufIdx, + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) # For more detailed reference for the below checks, see the commented definition of the cbuffer # in the shader source code in the demo itself @@ -428,17 +433,20 @@ def check_capture(self): rdtest.log.success("CBuffer variables are as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [537.1, 538.0, 539.0, 540.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [537.1, 538.0, 539.0, 540.0]) rdtest.log.success("Picked value is as expected") - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 1, 0) + # identify the bare uniforms cbuffer + cbufIdx = [index for index, c in enumerate(refl.constantBlocks) if not c.bufferBacked][0] + + cbuf = pipe.GetConstantBlock(stage, 1, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, - pipe.GetShaderEntryPoint(stage), 1, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + pipe.GetShaderEntryPoint(stage), cbufIdx, + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) # For bare uniforms we have partial data - only values used in the shader need to get assigned locations and # some drivers are aggressive about stripping any others. Only uniforms with locations get upload values. diff --git a/util/test/tests/GL/GL_Depth_Bounds.py b/util/test/tests/GL/GL_Depth_Bounds.py index 7c6b251ff1..f04ade449b 100644 --- a/util/test/tests/GL/GL_Depth_Bounds.py +++ b/util/test/tests/GL/GL_Depth_Bounds.py @@ -22,7 +22,7 @@ def check_capture(self): pipe = self.controller.GetPipelineState() - tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource self.check_pixel_value(tex, 200, 200, [0.0, 1.0, 0.0, 1.0]) self.check_pixel_value(tex, 200, 100, [0.0, 1.0, 0.0, 1.0]) diff --git a/util/test/tests/GL/GL_Multithread_Rendering.py b/util/test/tests/GL/GL_Multithread_Rendering.py index 8b552ef5e8..974da8df87 100644 --- a/util/test/tests/GL/GL_Multithread_Rendering.py +++ b/util/test/tests/GL/GL_Multithread_Rendering.py @@ -12,10 +12,10 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.25, 0.0, [0.0, 0.0, 0.0, 0.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.75, 0.0, [0.0, 0.0, 0.0, 0.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.25, 0.0, [0.0, 0.0, 0.0, 0.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.75, 0.0, [0.0, 0.0, 0.0, 0.0]) - tex_details: rd.TextureDescription = self.get_texture(pipe.GetOutputTargets()[0].resourceId) + tex_details: rd.TextureDescription = self.get_texture(pipe.GetOutputTargets()[0].resource) w = int(tex_details.width / 40) h = int(tex_details.height / 40) @@ -23,11 +23,11 @@ def check_capture(self): # Left side of the screen should be 20x40 red V shaped triangles on red background for y in range(40): for x in range(20): - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(x*w), int(tex_details.height - 1 - y*h), [0.3, 0.2, 0.2, 1.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [1.0, 0.0, 0.25, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, int(x*w), int(tex_details.height - 1 - y*h), [0.3, 0.2, 0.2, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [1.0, 0.0, 0.25, 1.0]) # Right side of the screen should be delta shaped blue triangles for y in range(40): for x in range(20): - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(tex_details.width/2) + int(x*w), int(tex_details.height - 1 - y*h - (h-1)), [0.2, 0.3, 0.2, 1.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(tex_details.width/2) + int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [0.0, 1.0, 0.75, 1.0]) \ No newline at end of file + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, int(tex_details.width/2) + int(x*w), int(tex_details.height - 1 - y*h - (h-1)), [0.2, 0.3, 0.2, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, int(tex_details.width/2) + int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [0.0, 1.0, 0.75, 1.0]) \ No newline at end of file diff --git a/util/test/tests/GL/GL_Parameter_Zoo.py b/util/test/tests/GL/GL_Parameter_Zoo.py index 5cad376d32..e10bbb5b7a 100644 --- a/util/test/tests/GL/GL_Parameter_Zoo.py +++ b/util/test/tests/GL/GL_Parameter_Zoo.py @@ -117,7 +117,7 @@ def check_capture(self): tex = rd.TextureDisplay() tex.overlay = rd.DebugOverlay.Drawcall - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) diff --git a/util/test/tests/GL/GL_Per_Type_Tex_Units.py b/util/test/tests/GL/GL_Per_Type_Tex_Units.py index 5e0c67fa38..4b323b21db 100644 --- a/util/test/tests/GL/GL_Per_Type_Tex_Units.py +++ b/util/test/tests/GL/GL_Per_Type_Tex_Units.py @@ -14,18 +14,29 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - bind: rd.ShaderBindpointMapping = pipe.GetBindpointMapping(rd.ShaderStage.Fragment) - texs: List[rd.BoundResourceArray] = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) + refl = pipe.GetShaderReflection(rd.ShaderStage.Fragment) - if len(bind.readOnlyResources) != 2: + texs = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) + + if len(texs) != 2: raise rdtest.TestFailureException( - "Expected 2 textures bound, not {}".format(len(bind.readOnlyResources))) + "Expected 2 textures bound, not {}".format(len(texs))) + + # find tex2 in the reflection + idx = [index for index, res in enumerate(refl.readOnlyResources) if res.name == "tex2"][0] + + # find the descriptor access for tex2 + tex2 = [t for t in texs if t.access.index == idx][0] + + # look up the location of the descriptor it accessed + location = self.controller.GetDescriptorLocations(tex2.access.descriptorStore, [rd.DescriptorRange(tex2.access)])[0] - if bind.readOnlyResources[0].bind != 2: + # it should be bind 2 + if location.fixedBindNumber != 2: raise rdtest.TestFailureException( - "First texture should be on slot 2, not {}".format(bind.readOnlyResources[0].bind)) + "First texture should be on slot 2, not {}".format(location.fixedBindNumber)) - id = texs[2].resources[0].resourceId + id = tex2.descriptor.resource tex_details = self.get_texture(id) res_details = self.get_resource(id) @@ -49,11 +60,21 @@ def check_capture(self): rdtest.log.success("First texture is as expected") - if bind.readOnlyResources[1].bind != 3: + # find tex2 in the reflection + idx = [index for index, res in enumerate(refl.readOnlyResources) if res.name == "tex3"][0] + + # find the descriptor access for tex2 + tex3 = [t for t in texs if t.access.index == idx][0] + + # look up the location of the descriptor it accessed + location = self.controller.GetDescriptorLocations(tex3.access.descriptorStore, [rd.DescriptorRange(tex3.access)])[0] + + # it should be bind 2 + if location.fixedBindNumber != 3: raise rdtest.TestFailureException( - "First texture should be on slot 3, not {}".format(texs[0].bindPoint.bind)) + "Second texture should be on slot 3, not {}".format(location.fixedBindNumber)) - id = texs[3].resources[0].resourceId + id = tex3.descriptor.resource tex_details = self.get_texture(id) res_details = self.get_resource(id) @@ -79,6 +100,6 @@ def check_capture(self): rdtest.log.success("Second texture is as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [1.0, 1.0, 0.0, 0.2]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [1.0, 1.0, 0.0, 0.2]) rdtest.log.success("Picked value is as expected") diff --git a/util/test/tests/GL/GL_Pixel_History.py b/util/test/tests/GL/GL_Pixel_History.py index 6abe7cfb12..674d91096a 100644 --- a/util/test/tests/GL/GL_Pixel_History.py +++ b/util/test/tests/GL/GL_Pixel_History.py @@ -21,8 +21,8 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] - tex: rd.ResourceId = rt.resourceId + rt = pipe.GetOutputTargets()[0] + tex: rd.ResourceId = rt.resource sub = rd.Subresource() texDescription : rd.TextureDescription = self.get_texture(tex) @@ -42,17 +42,17 @@ def check_capture(self): x, y = 190, 149 rdtest.log.print("Testing pixel {}, {}".format(x, y)) events = [glclear.eventId, action.eventId] - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, modifs[-1].postMod.col.floatValue, sub=sub, cast=rt.typeCast, eps=eps) + self.check_pixel_value(tex, x, y, modifs[-1].postMod.col.floatValue, sub=sub, cast=rt.format.compType, eps=eps) self.check_shader_out_with_postmod(modifs[-1].shaderOut.col.floatValue, modifs[-1].postMod.col.floatValue, texDescription.format.compCount, eps) x, y = 328, 199 rdtest.log.print("Testing pixel {}, {}".format(x, y)) events = [glclear.eventId] - modifs: List[rd.pixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.pixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, modifs[-1].postMod.col.floatValue, sub=sub, cast=rt.typeCast, eps=eps) + self.check_pixel_value(tex, x, y, modifs[-1].postMod.col.floatValue, sub=sub, cast=rt.format.compType, eps=eps) rdtest.log.success('Testing Event {} completed.'.format(action.eventId)) diff --git a/util/test/tests/GL/GL_Renderbuffer_Zoo.py b/util/test/tests/GL/GL_Renderbuffer_Zoo.py index 5155372781..578abf5f27 100644 --- a/util/test/tests/GL/GL_Renderbuffer_Zoo.py +++ b/util/test/tests/GL/GL_Renderbuffer_Zoo.py @@ -17,7 +17,7 @@ def check_capture(self): depth = pipe.GetDepthTarget() vp = pipe.GetViewport(0) - id = pipe.GetOutputTargets()[0].resourceId + id = pipe.GetOutputTargets()[0].resource mn, mx = self.controller.GetMinMax(id, rd.Subresource(), rd.CompType.Typeless) @@ -38,16 +38,16 @@ def check_capture(self): rdtest.log.success('Color Renderbuffer at action {} is working as expected'.format(action.eventId)) - if depth.resourceId != rd.ResourceId(): - val = self.controller.PickPixel(depth.resourceId, int(0.5 * vp.width), int(0.5 * vp.height), + if depth.resource != rd.ResourceId(): + val = self.controller.PickPixel(depth.resource, int(0.5 * vp.width), int(0.5 * vp.height), rd.Subresource(), rd.CompType.Typeless) if not rdtest.value_compare(val.floatValue[0], 0.75): raise rdtest.TestFailureException( "Picked value {} in triangle for depth doesn't match expectation".format(val)) - mn, mx = self.controller.GetMinMax(depth.resourceId, rd.Subresource(), rd.CompType.Typeless) - hist = self.controller.GetHistogram(depth.resourceId, rd.Subresource(), + mn, mx = self.controller.GetMinMax(depth.resource, rd.Subresource(), rd.CompType.Typeless) + hist = self.controller.GetHistogram(depth.resource, rd.Subresource(), rd.CompType.Typeless, 0.75, 0.9, (True, False, False, False)) if not rdtest.value_compare(mn.floatValue[0], 0.75): diff --git a/util/test/tests/GL/GL_Resource_Lifetimes.py b/util/test/tests/GL/GL_Resource_Lifetimes.py index 8849475ba8..f50db250c3 100644 --- a/util/test/tests/GL/GL_Resource_Lifetimes.py +++ b/util/test/tests/GL/GL_Resource_Lifetimes.py @@ -11,21 +11,30 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, True) - mapping: rd.ShaderBindpointMapping = self.controller.GetPipelineState().GetBindpointMapping(rd.ShaderStage.Vertex) - self.check(mapping.readWriteResources[0].bind == 3) + pipe = self.controller.GetPipelineState() - mapping: rd.ShaderBindpointMapping = self.controller.GetPipelineState().GetBindpointMapping(rd.ShaderStage.Pixel) - self.check(mapping.readWriteResources[0].bind == 3) + rw = pipe.GetReadWriteResources(rd.ShaderStage.Vertex) + location = self.controller.GetDescriptorLocations(rw[0].access.descriptorStore, [rd.DescriptorRange(rw[0].access)])[0] + self.check_eq(location.fixedBindNumber, 3) + + rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel) + location = self.controller.GetDescriptorLocations(rw[0].access.descriptorStore, [rd.DescriptorRange(rw[0].access)])[0] + self.check_eq(location.fixedBindNumber, 3) action: rd.ActionDescription = self.find_action("glDraw", action.eventId+1) self.controller.SetFrameEvent(action.eventId, True) - mapping: rd.ShaderBindpointMapping = self.controller.GetPipelineState().GetBindpointMapping(rd.ShaderStage.Vertex) - self.check(mapping.readWriteResources[0].bind == 3) + pipe = self.controller.GetPipelineState() + + rw = pipe.GetReadWriteResources(rd.ShaderStage.Vertex) + location = self.controller.GetDescriptorLocations(rw[0].access.descriptorStore, [rd.DescriptorRange(rw[0].access)])[0] + self.check_eq(location.fixedBindNumber, 3) + + rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel) + location = self.controller.GetDescriptorLocations(rw[0].access.descriptorStore, [rd.DescriptorRange(rw[0].access)])[0] + self.check_eq(location.fixedBindNumber, 3) - mapping: rd.ShaderBindpointMapping = self.controller.GetPipelineState().GetBindpointMapping(rd.ShaderStage.Pixel) - self.check(mapping.readWriteResources[0].bind == 3) last_action: rd.ActionDescription = self.get_last_action() diff --git a/util/test/tests/GL/GL_Separable_Geometry_Shaders.py b/util/test/tests/GL/GL_Separable_Geometry_Shaders.py index 8f81845d38..5040a4a485 100644 --- a/util/test/tests/GL/GL_Separable_Geometry_Shaders.py +++ b/util/test/tests/GL/GL_Separable_Geometry_Shaders.py @@ -82,7 +82,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - rt = pipe.GetOutputTargets()[0].resourceId + rt = pipe.GetOutputTargets()[0].resource self.check_pixel_value(rt, 0.5, 0.1, [1.0, 0.0, 0.0, 1.0]) self.check_pixel_value(rt, 0.75, 0.5, [0.0, 1.0, 0.0, 1.0]) self.check_pixel_value(rt, 0.25, 0.5, [1.0, 0.0, 1.0, 0.0]) diff --git a/util/test/tests/GL/GL_Shader_Editing.py b/util/test/tests/GL/GL_Shader_Editing.py index 1b2d905e61..0e4d007049 100644 --- a/util/test/tests/GL/GL_Shader_Editing.py +++ b/util/test/tests/GL/GL_Shader_Editing.py @@ -32,7 +32,7 @@ def check_capture(self): # Work at the last action, where the uniforms have been trashed self.controller.SetFrameEvent(self.get_last_action().eventId, False) - tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource # On upper row: Left triangle is fully green, right triangle is half-green # On lower row: Left triangle is fully green diff --git a/util/test/tests/GL/GL_Unshared_Context.py b/util/test/tests/GL/GL_Unshared_Context.py index ac37037009..97084557c4 100644 --- a/util/test/tests/GL/GL_Unshared_Context.py +++ b/util/test/tests/GL/GL_Unshared_Context.py @@ -13,9 +13,9 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - texs: List[rd.BoundResourceArray] = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) + texs = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) - id = texs[0].resources[0].resourceId + id = texs[0].descriptor.resource #sample 4 corners and middle magic_value: rd.PixelValue = [1.0, 0.5, 0.25, 1.0] diff --git a/util/test/tests/GL/GL_Vertex_Attr_Zoo.py b/util/test/tests/GL/GL_Vertex_Attr_Zoo.py index cfef07e61a..a4c0006bb0 100644 --- a/util/test/tests/GL/GL_Vertex_Attr_Zoo.py +++ b/util/test/tests/GL/GL_Vertex_Attr_Zoo.py @@ -88,6 +88,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Triangle picked value is as expected") diff --git a/util/test/tests/Iter_Test.py b/util/test/tests/Iter_Test.py index 2d4c12e648..a6a9586df4 100644 --- a/util/test/tests/Iter_Test.py +++ b/util/test/tests/Iter_Test.py @@ -39,12 +39,12 @@ def image_save(self, action: rd.ActionDescription): texsave = rd.TextureSave() for res in pipe.GetOutputTargets(): - texsave.resourceId = res.resourceId + texsave.resourceId = res.resource texsave.mip = res.firstMip self.save_texture(texsave) depth = pipe.GetDepthTarget() - texsave.resourceId = depth.resourceId + texsave.resourceId = depth.resource texsave.mip = depth.firstMip self.save_texture(texsave) @@ -169,7 +169,7 @@ def pixel_debug(self, action: rd.ActionDescription): rdtest.log.print("No pixel shader bound at {}".format(action.eventId)) return - if len(pipe.GetOutputTargets()) == 0 and pipe.GetDepthTarget().resourceId == rd.ResourceId.Null(): + if len(pipe.GetOutputTargets()) == 0 and pipe.GetDepthTarget().resource == rd.ResourceId.Null(): rdtest.log.print("No render targets bound at {}".format(action.eventId)) return @@ -188,13 +188,13 @@ def pixel_debug(self, action: rd.ActionDescription): target = rd.ResourceId.Null() if len(pipe.GetOutputTargets()) > 0: - valid_targets = [o.resourceId for o in pipe.GetOutputTargets() if o.resourceId != rd.ResourceId.Null()] + valid_targets = [o.resource for o in pipe.GetOutputTargets() if o.resource != rd.ResourceId.Null()] rdtest.log.print("Valid targets at {} are {}".format(action.eventId, valid_targets)) if len(valid_targets) > 0: target = valid_targets[int(random.random()*len(valid_targets))] if target == rd.ResourceId.Null(): - target = pipe.GetDepthTarget().resourceId + target = pipe.GetDepthTarget().resource if target == rd.ResourceId.Null(): rdtest.log.print("No targets bound! Can't fetch history at {}".format(action.eventId)) @@ -233,7 +233,7 @@ def pixel_debug(self, action: rd.ActionDescription): break - if target == pipe.GetDepthTarget().resourceId: + if target == pipe.GetDepthTarget().resource: rdtest.log.print("Not doing pixel debug for depth output") return @@ -256,7 +256,7 @@ def pixel_debug(self, action: rd.ActionDescription): cycles, variables = self.process_trace(trace) - output_index = [o.resourceId for o in pipe.GetOutputTargets()].index(target) + output_index = [o.resource for o in pipe.GetOutputTargets()].index(target) if action.outputs[0] == rd.ResourceId.Null(): rdtest.log.success('Successfully debugged pixel in {} cycles, skipping result check due to no output'.format(cycles)) @@ -310,7 +310,7 @@ def mesh_output(self, action: rd.ActionDescription): def drawcall_overlay(self, action: rd.ActionDescription): pipe = self.controller.GetPipelineState() - if len(pipe.GetOutputTargets()) == 0 and pipe.GetDepthTarget().resourceId == rd.ResourceId.Null(): + if len(pipe.GetOutputTargets()) == 0 and pipe.GetDepthTarget().resource == rd.ResourceId.Null(): rdtest.log.print("No render targets bound at {}".format(action.eventId)) return @@ -326,8 +326,8 @@ def drawcall_overlay(self, action: rd.ActionDescription): depth = pipe.GetDepthTarget() if len(col) > 1 and col[0].resourceId != rd.ResourceId(): tex.resourceId = col[0].resourceId - elif depth.resourceId != rd.ResourceId(): - tex.resourceId = depth.resourceId + elif depth.resource != rd.ResourceId(): + tex.resourceId = depth.resource if tex.resourceId != rd.ResourceId(): self.texout.SetTextureDisplay(tex) diff --git a/util/test/tests/Vulkan/VK_Adv_CBuffer_Zoo.py b/util/test/tests/Vulkan/VK_Adv_CBuffer_Zoo.py index 606164dec8..4fd1f55bdb 100644 --- a/util/test/tests/Vulkan/VK_Adv_CBuffer_Zoo.py +++ b/util/test/tests/Vulkan/VK_Adv_CBuffer_Zoo.py @@ -16,13 +16,13 @@ def check_capture(self): stage = rd.ShaderStage.Vertex - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) # For more detailed reference for the below checks, see the commented definition of the cbuffer # in the shader source code in the demo itself @@ -222,6 +222,6 @@ def check_capture(self): rdtest.log.success("CBuffer variables are as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 0.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 0.0]) rdtest.log.success("Picked value is as expected") diff --git a/util/test/tests/Vulkan/VK_Blend_Pixel_History.py b/util/test/tests/Vulkan/VK_Blend_Pixel_History.py index 253556ff6b..07b25c3c10 100644 --- a/util/test/tests/Vulkan/VK_Blend_Pixel_History.py +++ b/util/test/tests/Vulkan/VK_Blend_Pixel_History.py @@ -45,9 +45,9 @@ def primary_test(self): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -65,7 +65,7 @@ def primary_test(self): # Pixel inside of all of the triangles x, y = 200, 150 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) self.check_modifs_consistent(modifs) red_modifs = [m for m in modifs if m.eventId >= red_eid and m.eventId < red_last_eid] green_modifs = [m for m in modifs if m.eventId == green_eid] diff --git a/util/test/tests/Vulkan/VK_CBuffer_Zoo.py b/util/test/tests/Vulkan/VK_CBuffer_Zoo.py index 53ce748623..80ca9033cb 100644 --- a/util/test/tests/Vulkan/VK_CBuffer_Zoo.py +++ b/util/test/tests/Vulkan/VK_CBuffer_Zoo.py @@ -24,42 +24,42 @@ def check_capture(self): self.check('GLSL' in disasm) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_glsl_cbuffer(var_check) rdtest.log.success("GLSL CBuffer variables are as expected") - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 1, 0) + cbuf = pipe.GetConstantBlock(stage, 1, 0).descriptor inline_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 1, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_inline_cbuffer(inline_check) rdtest.log.success("GLSL Inline uniform variables are as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) rdtest.log.success("GLSL picked value is as expected") # Check the specialization constants - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 2, 0) + cbuf = pipe.GetConstantBlock(stage, 2, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 2, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) # int A; # Default value 10, untouched @@ -92,31 +92,31 @@ def check_capture(self): self.check('HLSL' in disasm) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0) + cbuf = pipe.GetConstantBlock(stage, 0, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_hlsl_cbuffer(var_check) rdtest.log.success("HLSL CBuffer variables are as expected") - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 1, 0) + cbuf = pipe.GetConstantBlock(stage, 1, 0).descriptor inline_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(stage), stage, pipe.GetShaderEntryPoint(stage), 1, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) self.check_inline_cbuffer(inline_check) rdtest.log.success("HLSL Inline uniform variables are as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [536.1, 537.0, 538.0, 539.0]) rdtest.log.success("HLSL picked value is as expected") diff --git a/util/test/tests/Vulkan/VK_Dedicated_Allocation.py b/util/test/tests/Vulkan/VK_Dedicated_Allocation.py index 8f79fc012a..b9262bcea1 100644 --- a/util/test/tests/Vulkan/VK_Dedicated_Allocation.py +++ b/util/test/tests/Vulkan/VK_Dedicated_Allocation.py @@ -45,11 +45,11 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 155, 195, [1.0, 0.0, 0.09, 1.0], eps=1.0/255.0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 190, 195, [0.0, 1.0, 0.09, 1.0], eps=1.0/255.0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 255, 195, [1.0, 0.0, 0.09, 1.0], eps=1.0/255.0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 230, 150, [0.723, 1.0, 1.0, 1.0], eps=1.0/255.0) - - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 190, 80, [0.2, 0.2, 0.2, 1.0], eps=1.0/255.0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 200, 80, [0.723, 1.0, 1.0, 1.0], eps=1.0/255.0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 210, 80, [0.2, 0.2, 0.2, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 155, 195, [1.0, 0.0, 0.09, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 190, 195, [0.0, 1.0, 0.09, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 255, 195, [1.0, 0.0, 0.09, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 230, 150, [0.723, 1.0, 1.0, 1.0], eps=1.0/255.0) + + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 190, 80, [0.2, 0.2, 0.2, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 200, 80, [0.723, 1.0, 1.0, 1.0], eps=1.0/255.0) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 210, 80, [0.2, 0.2, 0.2, 1.0], eps=1.0/255.0) diff --git a/util/test/tests/Vulkan/VK_Descriptor_Indexing.py b/util/test/tests/Vulkan/VK_Descriptor_Indexing.py index aa161919b4..2ac39038cd 100644 --- a/util/test/tests/Vulkan/VK_Descriptor_Indexing.py +++ b/util/test/tests/Vulkan/VK_Descriptor_Indexing.py @@ -11,118 +11,101 @@ def check_capture(self): self.check(action is not None) self.controller.SetFrameEvent(action.eventId, False) + pipe = self.controller.GetPipelineState() vkpipe: rd.VKState = self.controller.GetVulkanPipelineState() if len(vkpipe.compute.descriptorSets) != 1: raise rdtest.TestFailureException("Wrong number of compute sets is bound: {}, not 1" .format(len(vkpipe.compute.descriptorSets))) - binding = vkpipe.compute.descriptorSets[0].bindings[0] + rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute) - if binding.dynamicallyUsedCount != 1: - raise rdtest.TestFailureException("Compute bind 0 doesn't have the right used count {}" - .format(binding.dynamicallyUsedCount)) + self.check_eq(len(rw), 1) + self.check_eq(rw[0].access.index, 0) + self.check_eq(rw[0].access.stage, rd.ShaderStage.Compute) + self.check_eq(rw[0].access.type, rd.DescriptorType.ReadWriteBuffer) + self.check_eq(rw[0].access.staticallyUnused, False) + self.check_eq(rw[0].access.arrayElement, 15) + self.check_eq(rw[0].access.descriptorStore, + vkpipe.compute.descriptorSets[0].descriptorSetResourceId) - if not binding.binds[15].dynamicallyUsed: - raise rdtest.TestFailureException("Compute bind 0[15] isn't dynamically used") + self.check_eq( + len(pipe.GetReadOnlyResources(rd.ShaderStage.Compute)), 0) - # these lists are only expected to be empty because the descriptors aren't written to, and so with mutable - # consideration these aren't considered read-only with unknown contents - pipe = self.controller.GetPipelineState() - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Compute, False) - self.check_eq(ro, []) - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Compute, True) - self.check_eq(ro, []) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute, False) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 0) - self.check_eq(len(rw[0].resources), 128) - self.check(rw[0].resources[15].dynamicallyUsed) - self.check_eq(rw[0].resources[15].resourceId, binding.binds[15].resourceResourceId) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Compute, True) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 15) - self.check_eq(len(rw[0].resources), 1) - self.check_eq(rw[0].resources[0].resourceId, binding.binds[15].resourceResourceId) - self.check(rw[0].resources[0].dynamicallyUsed) + rw_used = pipe.GetReadWriteResources(rd.ShaderStage.Compute, True) + + # should get the same results for dynamic array indexing, the 'only used' is only for + # statically unused or used bindings + self.check(rw == rw_used) action = self.find_action("Draw") self.check(action is not None) self.controller.SetFrameEvent(action.eventId, False) - vkpipe: rd.VKState = self.controller.GetVulkanPipelineState() + pipe = self.controller.GetPipelineState() + vkpipe = self.controller.GetVulkanPipelineState() # Check bindings: - # - buffer 15 in bind 0 should be used + # - buffer 15 in bind 0 (the SSBO) should be used # - images 19, 20, 21 in bind 1 should be used for the non-uniform index # images 49 & 59 in bind 1 should be used for the first fixed index # image 4 in bind 1 should be used for the global access from a function with no dynamic/patched parameters # - images 381 & 386 in bind 2 should be used for the second fixed index # - image 1 in bind 3 should be used bind_info = { - 0: { 'dynamicallyUsedCount': 1, 'used': [15] }, - 1: { 'dynamicallyUsedCount': 6, 'used': [4, 19, 20, 21, 49, 59] }, - 2: { 'dynamicallyUsedCount': 2, 'used': [381, 386] }, - 3: { 'dynamicallyUsedCount': 1, 'used': [1] }, + (rd.DescriptorType.ReadWriteBuffer, 0): {'loc': (0, 0), 'elems': [15]}, + (rd.DescriptorType.ImageSampler, 0): {'loc': (0, 1), 'elems': [4, 19, 20, 21, 49, 59]}, + (rd.DescriptorType.ImageSampler, 1): {'loc': (0, 2), 'elems': [381, 386]}, + (rd.DescriptorType.ImageSampler, 2): {'loc': (0, 3), 'elems': [1]}, } if len(vkpipe.graphics.descriptorSets) != 1: raise rdtest.TestFailureException("Wrong number of sets is bound: {}, not 1" .format(len(vkpipe.graphics.descriptorSets))) - desc_set: rd.VKDescriptorSet = vkpipe.graphics.descriptorSets[0] + desc_set = vkpipe.graphics.descriptorSets[0] - binding: rd.VKDescriptorBinding - for bind, binding in enumerate(desc_set.bindings): - if binding.dynamicallyUsedCount != bind_info[bind]['dynamicallyUsedCount']: - raise rdtest.TestFailureException("Bind {} doesn't have the right used count. {} is not the expected count of {}" - .format(bind, binding.dynamicallyUsedCount, bind_info[bind]['dynamicallyUsedCount'])) + rw = pipe.GetReadWriteResources(rd.ShaderStage.Fragment) + ro = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) - el: rd.VKBindingElement - for idx, el in enumerate(binding.binds): - expected_used = idx in bind_info[bind]['used'] - actually_used = el.dynamicallyUsed + self.check_eq(len(ro), 1+6+2) + self.check_eq(len(rw), 1) - if expected_used and not actually_used: - raise rdtest.TestFailureException("Bind {} element {} expected to be used, but isn't.".format(bind, idx)) + refl = pipe.GetShaderReflection(rd.ShaderStage.Fragment) - if not expected_used and actually_used: - raise rdtest.TestFailureException("Bind {} element {} expected to be unused, but is.".format(bind, idx)) + for a in ro + rw: + idx = (a.access.type, a.access.index) + if idx not in bind_info.keys(): + raise rdtest.TestFailureException( + "Accessed bind {} of type {} doesn't exist in expected list".format(a.access.index, str(a.access.type))) - pipe = self.controller.GetPipelineState() - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel, False) - self.check_eq(len(ro), 3) - self.check_eq(ro[0].dynamicallyUsedCount, 6) - self.check_eq(ro[0].firstIndex, 0) - self.check_eq(len(ro[0].resources), 128) - self.check_eq(ro[1].dynamicallyUsedCount, 2) - self.check_eq(ro[1].firstIndex, 0) - self.check_eq(len(ro[1].resources), 512) - self.check(not ro[0].resources[18].dynamicallyUsed) - self.check(ro[0].resources[19].dynamicallyUsed) - ro = pipe.GetReadOnlyResources(rd.ShaderStage.Pixel, True) - self.check_eq(len(ro), 3) - self.check_eq(ro[0].dynamicallyUsedCount, 6) - self.check_eq(ro[0].firstIndex, 4) - self.check_eq(len(ro[0].resources), 56) - self.check_eq(ro[1].dynamicallyUsedCount, 2) - self.check_eq(ro[1].firstIndex, 381) - self.check_eq(len(ro[1].resources), 6) - self.check(not ro[0].resources[14].dynamicallyUsed) - self.check(ro[0].resources[15].dynamicallyUsed) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel, False) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 0) - self.check_eq(len(rw[0].resources), 128) - self.check(rw[0].resources[15].dynamicallyUsed) - - rw = pipe.GetReadWriteResources(rd.ShaderStage.Pixel, True) - self.check_eq(rw[0].dynamicallyUsedCount, 1) - self.check_eq(rw[0].firstIndex, 15) - self.check_eq(len(rw[0].resources), 1) - self.check(rw[0].resources[0].dynamicallyUsed) + if rd.IsReadOnlyDescriptor(a.access.type): + res = refl.readOnlyResources[a.access.index] + else: + res = refl.readWriteResources[a.access.index] + + if a.access.arrayElement not in bind_info[idx]['elems']: + raise rdtest.TestFailureException("Bind {} reports array element {} as used, which shouldn't be" + .format(res.name, a.access.arrayElement)) + + if a.access.descriptorStore != desc_set.descriptorSetResourceId: + raise rdtest.TestFailureException("Access is in descriptor store {} but expected set 0 {}" + .format(a.access.descriptorStore, desc_set)) + + if (res.fixedBindSetOrSpace, res.fixedBindNumber) != bind_info[idx]['loc']: + raise rdtest.TestFailureException("Bind {} expected to be {} but is {}, {}" + .format(res.name, bind_info[idx]['loc']), res.fixedBindSetOrSpace, res.fixedBindNumber) + + # On vulkan the logical bind name is set-relative bind[idx]. The fixed bind number is the bind only + loc = self.controller.GetDescriptorLocations( + a.access.descriptorStore, [rd.DescriptorRange(a.access)])[0] + if loc.fixedBindNumber != bind_info[idx]['loc'][1]: + raise rdtest.TestFailureException("Bind {} not expected for set,bind {}" + .format(loc.fixedBindNumber, bind_info[idx]['loc'])) + if loc.logicalBindName != "{}[{}]".format(bind_info[idx]['loc'][1], a.access.arrayElement): + raise rdtest.TestFailureException("Bind {} not expected for set,bind {} array element {}" + .format(loc.logicalBindName, bind_info[idx]['loc'], a.access.arrayElement)) + + bind_info[idx]['elems'].remove(a.access.arrayElement) rdtest.log.success("Dynamic usage is as expected") diff --git a/util/test/tests/Vulkan/VK_Discard_Zoo.py b/util/test/tests/Vulkan/VK_Discard_Zoo.py index 9621cb114b..79085a037e 100644 --- a/util/test/tests/Vulkan/VK_Discard_Zoo.py +++ b/util/test/tests/Vulkan/VK_Discard_Zoo.py @@ -143,7 +143,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - tex_id = pipe.GetOutputTargets()[0].resourceId + tex_id = pipe.GetOutputTargets()[0].resource self.check_pixel_value(tex_id, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) self.controller.SetFrameEvent(action.next.eventId, True) diff --git a/util/test/tests/Vulkan/VK_Dynamic_Rendering.py b/util/test/tests/Vulkan/VK_Dynamic_Rendering.py index d462582358..70f32f4cb9 100644 --- a/util/test/tests/Vulkan/VK_Dynamic_Rendering.py +++ b/util/test/tests/Vulkan/VK_Dynamic_Rendering.py @@ -10,7 +10,7 @@ def check_capture(self): out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) - for cmdLevel in [0,1]: + for cmdLevel in [0, 1]: action = self.find_action("Draw {}".format(cmdLevel)).next self.check(action is not None) @@ -54,38 +54,29 @@ def check_capture(self): rdtest.log.success('Triangle is as expected') - pipe: rd.VKState = self.controller.GetVulkanPipelineState() + pipe = self.controller.GetPipelineState() + vkpipe = self.controller.GetVulkanPipelineState() - if len(pipe.graphics.descriptorSets) != 1: - raise rdtest.TestFailureException("Wrong number of sets is bound: {}, not 1" - .format(len(pipe.graphics.descriptorSets))) + access = pipe.GetDescriptorAccess() - desc_set: rd.VKDescriptorSet = pipe.graphics.descriptorSets[0] + # only expect two accesses, the buffer we actually use and the push constants + if len(access) != 2: + raise rdtest.TestFailureException("Only expected two descriptor accesses, but saw {}".format( + len(access))) - if len(desc_set.bindings) != 1: - raise rdtest.TestFailureException("Wrong number of bindings: {}, not 1" - .format(len(desc_set.bindings))) + if not (rd.DescriptorType.ReadWriteBuffer, 0, 17) in [(a.type, a.index, a.arrayElement) for a in access]: + raise rdtest.TestFailureException( + f"Graphics bind 0[17] isn't the accessed RW buffer descriptor {str(rd.DumpObject(access))}") - binding = desc_set.bindings[0] - if binding.dynamicallyUsedCount != 1: - raise rdtest.TestFailureException("Bind doesn't have the right used count. {} is not the expected count of {}" - .format(binding.dynamicallyUsedCount, 1)) - - for idx, el in enumerate(binding.binds): - expected_used = idx == 17 - actually_used = el.dynamicallyUsed - - if expected_used and not actually_used: - raise rdtest.TestFailureException("Bind {} element {} expected to be used, but isn't.".format(bind, idx)) - - if not expected_used and actually_used: - raise rdtest.TestFailureException("Bind {} element {} expected to be unused, but is.".format(bind, idx)) + if len(vkpipe.graphics.descriptorSets) != 1: + raise rdtest.TestFailureException("Wrong number of sets is bound: {}, not 1".format( + len(vkpipe.graphics.descriptorSets))) rdtest.log.success("Dynamic usage is as expected") tex = rd.TextureDisplay() tex.overlay = rd.DebugOverlay.Drawcall - tex.resourceId = pipe.currentPass.framebuffer.attachments[0].imageResourceId + tex.resourceId = vkpipe.currentPass.framebuffer.attachments[0].resource out.SetTextureDisplay(tex) @@ -93,10 +84,10 @@ def check_capture(self): overlay_id = out.GetDebugOverlayTexID() - x = int(pipe.viewportScissor.viewportScissors[0].vp.width/2) - y = int(pipe.viewportScissor.viewportScissors[0].vp.height/2) + x = int(vkpipe.viewportScissor.viewportScissors[0].vp.width / 2) + y = int(vkpipe.viewportScissor.viewportScissors[0].vp.height / 2) self.check_pixel_value(overlay_id, x, y, [0.8, 0.1, 0.8, 1.0], eps=1.0 / 256.0) - self.check_pixel_value(overlay_id, x//10, y//10, [0.0, 0.0, 0.0, 0.5], eps=1.0 / 256.0) + self.check_pixel_value(overlay_id, x // 10, y // 10, [0.0, 0.0, 0.0, 0.5], eps=1.0 / 256.0) out.Shutdown() diff --git a/util/test/tests/Vulkan/VK_Extended_Dynamic_State.py b/util/test/tests/Vulkan/VK_Extended_Dynamic_State.py index de1e83504c..0b9f1b0134 100644 --- a/util/test/tests/Vulkan/VK_Extended_Dynamic_State.py +++ b/util/test/tests/Vulkan/VK_Extended_Dynamic_State.py @@ -80,14 +80,14 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 100, 200, [0.0, 1.0, 0.0, 1.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 300, 200, [0.0, 0.0, 1.0, 1.0]) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 200, 100, [0.2, 0.2, 0.2, 1.0]) - - self.check_pixel_value(pipe.GetDepthTarget().resourceId, 100, 200, [0.4, 205.0/255.0, 0.0, 1.0]) - self.check_pixel_value(pipe.GetDepthTarget().resourceId, 300, 200, [0.6, 205.0/255.0, 0.0, 1.0]) - self.check_pixel_value(pipe.GetDepthTarget().resourceId, 200, 100, [0.9, 204.0/255.0, 0.0, 1.0]) - self.check_pixel_value(pipe.GetDepthTarget().resourceId, 200, 200, [0.4, 206.0/255.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 100, 200, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 300, 200, [0.0, 0.0, 1.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 200, 100, [0.2, 0.2, 0.2, 1.0]) + + self.check_pixel_value(pipe.GetDepthTarget().resource, 100, 200, [0.4, 205.0/255.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetDepthTarget().resource, 300, 200, [0.6, 205.0/255.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetDepthTarget().resource, 200, 100, [0.9, 204.0/255.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetDepthTarget().resource, 200, 200, [0.4, 206.0/255.0, 0.0, 1.0]) rdtest.log.success("Triangles are as expected") diff --git a/util/test/tests/Vulkan/VK_Graphics_Pipeline.py b/util/test/tests/Vulkan/VK_Graphics_Pipeline.py index a7080cd58f..29a8d88330 100644 --- a/util/test/tests/Vulkan/VK_Graphics_Pipeline.py +++ b/util/test/tests/Vulkan/VK_Graphics_Pipeline.py @@ -66,16 +66,15 @@ def check_capture(self): self.check(len(fsrefl.readOnlyResources) == 1) self.check(fsrefl.readOnlyResources[0].name == "smiley") - vkpipe = self.controller.GetVulkanPipelineState() + access = pipe.GetDescriptorAccess() - binding = vkpipe.graphics.descriptorSets[1].bindings[0] + # only expect 4 accesses, the texture we actually read, spec constant, push constants, and VS UBO + if len(access) != 4: + raise rdtest.TestFailureException("Only expected 4 descriptor accesses, but saw {}".format(len(access))) - if binding.dynamicallyUsedCount != 1: - raise rdtest.TestFailureException("Bind 0 doesn't have the right used count {}" - .format(binding.dynamicallyUsedCount)) - - if not binding.binds[13].dynamicallyUsed: - raise rdtest.TestFailureException("Graphics bind 0[13] isn't dynamically used") + if not (rd.DescriptorType.ImageSampler, 0, 13) in [(a.type, a.index, a.arrayElement) for a in access]: + raise rdtest.TestFailureException( + f"Graphics bind 0[15] isn't the accessed descriptor {str(rd.DumpObject(access))}") trace = self.controller.DebugVertex(0, 0, 0, 0) @@ -99,8 +98,8 @@ def check_capture(self): if len(expect) != value.columns: raise rdtest.TestFailureException( - "Vertex output {} has different size ({} values) to expectation ({} values)" - .format(name, action.eventId, value.columns, len(expect))) + "Vertex output {} has different size ({} values) to expectation ({} values)".format( + name, action.eventId, value.columns, len(expect))) compType = rd.VarTypeCompType(value.type) if compType == rd.CompType.UInt: @@ -113,17 +112,17 @@ def check_capture(self): is_eq, diff_amt = rdtest.value_compare_diff(expect, debugged, eps=5.0E-06) if not is_eq: rdtest.log.error( - "Debugged vertex output value {}: {} difference. {} doesn't exactly match postvs output {}".format( - name, action.eventId, diff_amt, debugged, expect)) + "Debugged vertex output value {}: {} difference. {} doesn't exactly match postvs output {}". + format(name, action.eventId, diff_amt, debugged, expect)) outputs = outputs + 1 - rdtest.log.success('Successfully debugged vertex in {} cycles, {}/{} outputs match' - .format(cycles, outputs, len(vsrefl.outputSignature))) + rdtest.log.success('Successfully debugged vertex in {} cycles, {}/{} outputs match'.format( + cycles, outputs, len(vsrefl.outputSignature))) self.controller.FreeTrace(trace) - history = self.controller.PixelHistory(pipe.GetOutputTargets()[0].resourceId, 200, 150, rd.Subresource(0, 0, 0), + history = self.controller.PixelHistory(pipe.GetOutputTargets()[0].resource, 200, 150, rd.Subresource(0, 0, 0), rd.CompType.Typeless) # should be a clear then a draw @@ -134,9 +133,9 @@ def check_capture(self): self.check(self.find_action('', history[1].eventId).eventId == action.eventId) self.check(history[1].Passed()) - if not rdtest.value_compare(history[1].shaderOut.col.floatValue, tri_col, eps=1.0/256.0): - raise rdtest.TestFailureException( - "History for drawcall output is wrong: {}".format(history[1].shaderOut.col.floatValue)) + if not rdtest.value_compare(history[1].shaderOut.col.floatValue, tri_col, eps=1.0 / 256.0): + raise rdtest.TestFailureException("History for drawcall output is wrong: {}".format( + history[1].shaderOut.col.floatValue)) inputs = rd.DebugPixelInputs() inputs.sample = 0 @@ -170,7 +169,7 @@ def check_capture(self): out = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource tex.overlay = rd.DebugOverlay.TriangleSizeDraw out.SetTextureDisplay(tex) @@ -187,11 +186,8 @@ def check_capture(self): source = vsrefl.debugInfo.files[0].contents.replace('#if 0', '#if 1') - newShader = self.controller.BuildTargetShader(vsrefl.entryPoint, - rd.ShaderEncoding.GLSL, - bytes(source, 'UTF-8'), - rd.ShaderCompileFlags(), - rd.ShaderStage.Vertex) + newShader = self.controller.BuildTargetShader(vsrefl.entryPoint, rd.ShaderEncoding.GLSL, bytes(source, 'UTF-8'), + rd.ShaderCompileFlags(), rd.ShaderStage.Vertex) if len(newShader[1]) != 0: raise rdtest.TestFailureException("Failed to compile edited shader: {}".format(newShader[1])) diff --git a/util/test/tests/Vulkan/VK_Image_Layouts.py b/util/test/tests/Vulkan/VK_Image_Layouts.py index 97e4e33563..b646687aab 100644 --- a/util/test/tests/Vulkan/VK_Image_Layouts.py +++ b/util/test/tests/Vulkan/VK_Image_Layouts.py @@ -72,6 +72,6 @@ def check_capture(self): elif res.name == "Image:Undefined": if img.layouts[0].name != "VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL": raise rdtest.TestFailureException("Undefined image is in {} layout".format(img.layouts[0].name)) - elif img.resourceId == pipe.currentPass.framebuffer.attachments[0].imageResourceId: + elif img.resourceId == pipe.currentPass.framebuffer.attachments[0].resource: if img.layouts[0].name != "VK_IMAGE_LAYOUT_GENERAL": raise rdtest.TestFailureException("Rendered swapchain image is in {} layout".format(img.layouts[0].name)) diff --git a/util/test/tests/Vulkan/VK_Imageless_Framebuffer.py b/util/test/tests/Vulkan/VK_Imageless_Framebuffer.py index 491af1f32e..fa9520388c 100644 --- a/util/test/tests/Vulkan/VK_Imageless_Framebuffer.py +++ b/util/test/tests/Vulkan/VK_Imageless_Framebuffer.py @@ -14,6 +14,6 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("picked value is as expected") diff --git a/util/test/tests/Vulkan/VK_Indirect.py b/util/test/tests/Vulkan/VK_Indirect.py index 4312894701..ea808e8fb1 100644 --- a/util/test/tests/Vulkan/VK_Indirect.py +++ b/util/test/tests/Vulkan/VK_Indirect.py @@ -15,7 +15,7 @@ def check_overlay(self, pass_samples, *, no_overlay = False): tex = rd.TextureDisplay() tex.overlay = rd.DebugOverlay.Drawcall - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource self.out.SetTextureDisplay(tex) @@ -160,8 +160,8 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - ssbo: rd.BoundResource = pipe.GetReadWriteResources(rd.ShaderStage.Compute)[0].resources[0] - data: bytes = self.controller.GetBufferData(ssbo.resourceId, 0, 0) + ssbo = pipe.GetReadWriteResources(rd.ShaderStage.Compute)[0].descriptor + data: bytes = self.controller.GetBufferData(ssbo.resource, 0, 0) rdtest.log.print("Got {} bytes of uints".format(len(data))) diff --git a/util/test/tests/Vulkan/VK_Int8_IBuffer.py b/util/test/tests/Vulkan/VK_Int8_IBuffer.py index 8b3503faa9..1162a23b3d 100644 --- a/util/test/tests/Vulkan/VK_Int8_IBuffer.py +++ b/util/test/tests/Vulkan/VK_Int8_IBuffer.py @@ -52,7 +52,7 @@ def check_capture(self): self.check_mesh_data(postvs_ref, postvs_data) # Check that the rendered mesh is as expected - out = pipe.GetOutputTargets()[0].resourceId + out = pipe.GetOutputTargets()[0].resource 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]) diff --git a/util/test/tests/Vulkan/VK_KHR_Buffer_Address.py b/util/test/tests/Vulkan/VK_KHR_Buffer_Address.py index 3312d0689c..50b7955b87 100644 --- a/util/test/tests/Vulkan/VK_KHR_Buffer_Address.py +++ b/util/test/tests/Vulkan/VK_KHR_Buffer_Address.py @@ -31,7 +31,7 @@ def check_capture(self): cycles, variables = self.process_trace(trace) output: rd.SourceVariableMapping = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0) debugged = self.evaluate_source_var(output, variables) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, x, y, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4]) self.controller.FreeTrace(trace) x = x + 100 diff --git a/util/test/tests/Vulkan/VK_Line_Raster.py b/util/test/tests/Vulkan/VK_Line_Raster.py index f1eafddf96..c18e8e40f0 100644 --- a/util/test/tests/Vulkan/VK_Line_Raster.py +++ b/util/test/tests/Vulkan/VK_Line_Raster.py @@ -36,7 +36,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.tex = pipe.GetOutputTargets()[0].resourceId + self.tex = pipe.GetOutputTargets()[0].resource texdetails = self.get_texture(self.tex) diff --git a/util/test/tests/Vulkan/VK_Misaligned_Dirty.py b/util/test/tests/Vulkan/VK_Misaligned_Dirty.py index 37be4feb49..fcd965d79a 100644 --- a/util/test/tests/Vulkan/VK_Misaligned_Dirty.py +++ b/util/test/tests/Vulkan/VK_Misaligned_Dirty.py @@ -61,7 +61,7 @@ def check_capture(self): rdtest.log.success("vertex output is as expected") - tex = pipe.GetOutputTargets()[0].resourceId + tex = pipe.GetOutputTargets()[0].resource texdetails = self.get_texture(tex) diff --git a/util/test/tests/Vulkan/VK_Multi_Entry.py b/util/test/tests/Vulkan/VK_Multi_Entry.py index 33e68d92bb..fb2aaaf802 100644 --- a/util/test/tests/Vulkan/VK_Multi_Entry.py +++ b/util/test/tests/Vulkan/VK_Multi_Entry.py @@ -18,17 +18,17 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, True) - pipe: rd.PipeState = self.controller.GetPipelineState() - vkpipe = self.controller.GetVulkanPipelineState() + pipe = self.controller.GetPipelineState() - binding = vkpipe.graphics.descriptorSets[0].bindings[0] + access = pipe.GetDescriptorAccess() - if binding.dynamicallyUsedCount != 1: - raise rdtest.TestFailureException("Bind 0 doesn't have the right used count {}" - .format(binding.dynamicallyUsedCount)) + # only expect two accesses, the texture we actually read and the push constants + if len(access) != 2: + raise rdtest.TestFailureException("Only expected two descriptor accesses, but saw {}".format(len(access))) - if not binding.binds[15].dynamicallyUsed: - raise rdtest.TestFailureException("Graphics bind 0[15] isn't dynamically used") + if not (rd.DescriptorType.ImageSampler, 0, 15) in [(a.type, a.index, a.arrayElement) for a in access]: + raise rdtest.TestFailureException( + f"Graphics bind 0[15] isn't the accessed descriptor {str(rd.DumpObject(access))}") refl: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Vertex) @@ -58,8 +58,8 @@ def check_capture(self): if len(expect) != value.columns: raise rdtest.TestFailureException( - "Vertex output {} has different size ({} values) to expectation ({} values)" - .format(name, action.eventId, value.columns, len(expect))) + "Vertex output {} has different size ({} values) to expectation ({} values)".format( + name, action.eventId, value.columns, len(expect))) compType = rd.VarTypeCompType(value.type) if compType == rd.CompType.UInt: @@ -72,17 +72,17 @@ def check_capture(self): is_eq, diff_amt = rdtest.value_compare_diff(expect, debugged, eps=5.0E-06) if not is_eq: rdtest.log.error( - "Debugged vertex output value {}: {} difference. {} doesn't exactly match postvs output {}".format( - name, action.eventId, diff_amt, debugged, expect)) + "Debugged vertex output value {}: {} difference. {} doesn't exactly match postvs output {}". + format(name, action.eventId, diff_amt, debugged, expect)) outputs = outputs + 1 - rdtest.log.success('Successfully debugged vertex in {} cycles, {}/{} outputs match' - .format(cycles, outputs, len(refl.outputSignature))) + rdtest.log.success('Successfully debugged vertex in {} cycles, {}/{} outputs match'.format( + cycles, outputs, len(refl.outputSignature))) self.controller.FreeTrace(trace) - history = self.controller.PixelHistory(pipe.GetOutputTargets()[0].resourceId, 200, 150, rd.Subresource(0, 0, 0), + history = self.controller.PixelHistory(pipe.GetOutputTargets()[0].resource, 200, 150, rd.Subresource(0, 0, 0), rd.CompType.Typeless) # should be a clear then a draw @@ -94,14 +94,14 @@ def check_capture(self): self.check(history[1].Passed()) if not rdtest.value_compare(history[1].shaderOut.col.floatValue, (0.0, 1.0, 0.0, 1.0)): - raise rdtest.TestFailureException( - "History for drawcall output is wrong: {}".format(history[1].shaderOut.col.floatValue)) + raise rdtest.TestFailureException("History for drawcall output is wrong: {}".format( + history[1].shaderOut.col.floatValue)) inputs = rd.DebugPixelInputs() inputs.sample = 0 inputs.primitive = 0 trace = self.controller.DebugPixel(200, 150, inputs) - + refl: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Pixel) self.check(len(refl.readOnlyResources) == 1) @@ -133,7 +133,7 @@ def check_capture(self): out = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture) tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource tex.overlay = rd.DebugOverlay.TriangleSizeDraw out.SetTextureDisplay(tex) @@ -146,4 +146,4 @@ def check_capture(self): rdtest.log.success("Triangle size overlay gave correct output") - out.Shutdown() \ No newline at end of file + out.Shutdown() diff --git a/util/test/tests/Vulkan/VK_Multi_View.py b/util/test/tests/Vulkan/VK_Multi_View.py index 5a943a3f34..eee0b22d2b 100644 --- a/util/test/tests/Vulkan/VK_Multi_View.py +++ b/util/test/tests/Vulkan/VK_Multi_View.py @@ -35,7 +35,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) slice = view + 1 sub = rd.Subresource(0, slice, 0) - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, x, y, debugged.value.f32v[0:4], sub=sub) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4], sub=sub) self.controller.FreeTrace(trace) inst = 0 diff --git a/util/test/tests/Vulkan/VK_Overlay_Test.py b/util/test/tests/Vulkan/VK_Overlay_Test.py index 3350651c0d..1f35f0a833 100644 --- a/util/test/tests/Vulkan/VK_Overlay_Test.py +++ b/util/test/tests/Vulkan/VK_Overlay_Test.py @@ -16,7 +16,7 @@ def check_capture(self): pipe = self.controller.GetPipelineState() tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource tex.overlay = rd.DebugOverlay.ClearBeforeDraw out.SetTextureDisplay(tex) @@ -49,7 +49,7 @@ def check_capture(self): pipe = self.controller.GetPipelineState() tex = rd.TextureDisplay() - tex.resourceId = pipe.GetOutputTargets()[0].resourceId + tex.resourceId = pipe.GetOutputTargets()[0].resource for overlay in rd.DebugOverlay: if overlay == rd.DebugOverlay.NoOverlay: diff --git a/util/test/tests/Vulkan/VK_Parameter_Zoo.py b/util/test/tests/Vulkan/VK_Parameter_Zoo.py index cf3dc38201..bf3c621f26 100644 --- a/util/test/tests/Vulkan/VK_Parameter_Zoo.py +++ b/util/test/tests/Vulkan/VK_Parameter_Zoo.py @@ -16,7 +16,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) # Readback reported extension support descriptor_update_template = self.find_action("KHR_descriptor_update_template") is not None @@ -36,16 +36,37 @@ def check_capture(self): res_names[res.resourceId] = res.name expected_binds = [ - {'sampname': 'refsamp'}, - {'resname': 'refcombinedimg', 'sampname': 'refcombinedsamp'}, - {'resname': 'refsampled'}, - {'resname': 'refstorage'}, - {'resname': 'refunitexel'}, - {'resname': 'refstoretexel'}, - {'resname': 'refunibuf'}, - {'resname': 'refstorebuf'}, - {'resname': 'refunibufdyn'}, - {'resname': 'refstorebufdyn'}, + { + 'sampname': 'refsamp' + }, + { + 'resname': 'refcombinedimg', + 'sampname': 'refcombinedsamp' + }, + { + 'resname': 'refsampled' + }, + { + 'resname': 'refstorage' + }, + { + 'resname': 'refunitexel' + }, + { + 'resname': 'refstoretexel' + }, + { + 'resname': 'refunibuf' + }, + { + 'resname': 'refstorebuf' + }, + { + 'resname': 'refunibufdyn' + }, + { + 'resname': 'refstorebufdyn' + }, ] setidx = 0 @@ -53,16 +74,26 @@ def check_capture(self): descset: rd.VKDescriptorSet if setidx == 2 and not descset.pushDescriptor: - raise rdtest.TestFailureException("Expected set {} to be a push set", - setidx) + raise rdtest.TestFailureException("Expected set {} to be a push set", setidx) if setidx != 2 and descset.pushDescriptor: - raise rdtest.TestFailureException("Expected set {} to be a non-push set", - setidx) + raise rdtest.TestFailureException("Expected set {} to be a non-push set", setidx) + + range: rd.DescriptorRange = rd.DescriptorRange() + range.offset = 0 + # push descriptors don't include dynamic descriptors so don't fetch those + range.count = len([ + e for e in expected_binds + if ('sampname' in e or not descset.pushDescriptor or 'dyn' not in e['resname']) + ]) + range.descriptorSize = 1 + + descs = self.controller.GetDescriptors(descset.descriptorSetResourceId, [range]) + samps = self.controller.GetSamplerDescriptors(descset.descriptorSetResourceId, [range]) - for bindidx in range(len(descset.bindings)): - sampname = res_names.get(descset.bindings[bindidx].binds[0].samplerResourceId, '!' + str(setidx)) - resname = res_names.get(descset.bindings[bindidx].binds[0].resourceResourceId, '!' + str(setidx)) + for bindidx, (desc, samp) in enumerate(zip(descs, samps)): + sampname = res_names.get(samp.object, '!' + str(setidx)) + resname = res_names.get(desc.resource, '!' + str(setidx)) expected_samp = expected_binds[bindidx].get('sampname', '!') + str(setidx) expected_res = expected_binds[bindidx].get('resname', '!') + str(setidx) @@ -95,9 +126,21 @@ def check_capture(self): if not descset.pushDescriptor: raise rdtest.TestFailureException("Expected set 2 to be a push set") - for bindidx in range(len(descset.bindings)): - sampname = res_names.get(descset.bindings[bindidx].binds[0].samplerResourceId, '!' + str(setidx)) - resname = res_names.get(descset.bindings[bindidx].binds[0].resourceResourceId, '!' + str(setidx)) + range: rd.DescriptorRange = rd.DescriptorRange() + range.offset = 0 + # push descriptors don't include dynamic descriptors so don't fetch those + range.count = len([ + e for e in expected_binds + if ('sampname' in e or not descset.pushDescriptor or 'dyn' not in e['resname']) + ]) + range.descriptorSize = 1 + + descs = self.controller.GetDescriptors(descset.descriptorSetResourceId, [range]) + samps = self.controller.GetSamplerDescriptors(descset.descriptorSetResourceId, [range]) + + for bindidx, (desc, samp) in enumerate(zip(descs, samps)): + sampname = res_names.get(samp.object, '!' + str(setidx)) + resname = res_names.get(desc.resource, '!' + str(setidx)) expected_samp = expected_binds[bindidx].get('sampname', '!') + str(setidx) expected_res = expected_binds[bindidx].get('resname', '!') + str(setidx) @@ -131,21 +174,18 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, False) - vkpipe: rd.VKState = self.controller.GetVulkanPipelineState() - - desc_set: rd.VKDescriptorSet = vkpipe.graphics.descriptorSets[0] + pipe = self.controller.GetPipelineState() - self.check(len(desc_set.bindings) == 11) + ro = pipe.GetReadOnlyResources(rd.ShaderStage.Vertex) + access = pipe.GetDescriptorAccess() - binding = desc_set.bindings[10] + self.check_eq(len(ro), 1) - self.check(binding.dynamicallyUsedCount == 1) - self.check(len(binding.binds) == 4) - self.check(not binding.binds[0].dynamicallyUsed) - self.check(binding.binds[1].dynamicallyUsed) - self.check(not binding.binds[2].dynamicallyUsed) - self.check(not binding.binds[3].dynamicallyUsed) + if not (rd.DescriptorType.Image, 0, 1) in [(a.type, a.index, a.arrayElement) for a in access]: + raise rdtest.TestFailureException( + f"Graphics bind 0[1] isn't the accessed descriptor {str(rd.DumpObject(access))}") + vkpipe: rd.VKState = self.controller.GetVulkanPipelineState() self.check(len(vkpipe.viewportScissor.viewportScissors) == 0) postvs_data = self.get_postvs(action, rd.MeshDataStage.VSOut, 0, action.numIndices) @@ -154,12 +194,12 @@ def check_capture(self): 0: { 'vtx': 0, 'idx': 0, - '_Position': [-1.0, 1.0, 0.0, 1.0], + '_Position': [-1.0, 1.0, 0.0, 1.0], }, 1: { 'vtx': 1, 'idx': 1, - '_Position': [ 1.0, 1.0, 0.0, 1.0], + '_Position': [1.0, 1.0, 0.0, 1.0], }, 2: { 'vtx': 2, @@ -169,7 +209,7 @@ def check_capture(self): 3: { 'vtx': 3, 'idx': 3, - '_Position': [ 1.0, -1.0, 0.0, 1.0], + '_Position': [1.0, -1.0, 0.0, 1.0], }, } @@ -185,17 +225,18 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, False) - vkpipe: rd.VKState = self.controller.GetVulkanPipelineState() + pipe = self.controller.GetPipelineState() - desc_set: rd.VKDescriptorSet = vkpipe.graphics.descriptorSets[0] + ro = pipe.GetReadOnlyResources(rd.ShaderStage.Fragment) - if desc_set.bindings[0].binds[0].filter.minify != rd.FilterMode.Linear: - raise rdtest.TestFailureException( - "Expected linear sampler at binding slot 0 in immutable action") + if len(ro) != 1: + raise rdtest.TestFailureException("Expected only one resource to be used") - if self.get_resource(desc_set.bindings[0].binds[0].samplerResourceId).name != "validSampler": - raise rdtest.TestFailureException( - "Expected validSampler to be at binding slot 0 in immutable action") + if ro[0].sampler.filter.minify != rd.FilterMode.Linear: + raise rdtest.TestFailureException("Expected linear sampler at binding slot 0 in immutable action") + + if self.get_resource(ro[0].descriptor.secondary).name != "validSampler": + raise rdtest.TestFailureException("Expected validSampler to be at binding slot 0 in immutable action") rdtest.log.success("Immutable Draw is as expected") @@ -203,19 +244,18 @@ def check_capture(self): # Check for resource leaks if len(sdfile.chunks) > 500: - raise rdtest.TestFailureException( - "Too many chunks found: {}".format(len(sdfile.chunks))) + raise rdtest.TestFailureException("Too many chunks found: {}".format(len(sdfile.chunks))) action = self.find_action("before_empty") - action = self.get_action(action.eventId+1) + action = self.get_action(action.eventId + 1) self.check("vkQueueSubmit" in action.GetName(sdfile)) a = action.GetName(sdfile) - action = self.get_action(action.eventId+1) + action = self.get_action(action.eventId + 1) self.check("vkQueueSubmit" in action.GetName(sdfile)) self.check("No Command Buffers" in action.GetName(sdfile)) self.check(a != action.GetName(sdfile)) - action = self.get_action(action.eventId+1) + action = self.get_action(action.eventId + 1) if "after_empty" not in action.GetName(sdfile): self.check("vkQueueSubmit2" in action.GetName(sdfile)) a = action.GetName(sdfile) diff --git a/util/test/tests/Vulkan/VK_Pixel_History.py b/util/test/tests/Vulkan/VK_Pixel_History.py index f0ac8757f4..6296727f99 100644 --- a/util/test/tests/Vulkan/VK_Pixel_History.py +++ b/util/test/tests/Vulkan/VK_Pixel_History.py @@ -50,9 +50,9 @@ def primary_test(self): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -79,19 +79,19 @@ def primary_test(self): # For pixel 110, 100, inside the red triangle with stencil value 0x55 x, y = 110, 100 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, unbound_fs_eid], [passed, True], [unboundPS, True], [primitive_id, 0], [post_mod_stencil, 0x33]], [[event_id, stencil_write_eid], [passed, True], [primitive_id, 0], [post_mod_stencil, 0x55]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) # For pixel 190, 149 inside the red triangle x, y = 190, 149 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, unbound_fs_eid], [passed, True], [unboundPS, True], [primitive_id, 0]], @@ -100,11 +100,11 @@ def primary_test(self): [[event_id, test_eid], [stencil_test_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 190, 150 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_write_eid], [passed, True]], @@ -113,88 +113,88 @@ def primary_test(self): [[event_id, test_eid], [depth_test_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 200, 50 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], [[event_id, test_eid], [passed, True], [primitive_id, 7]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 150, 250 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [shader_discarded, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 330, 145 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, test_eid], [passed, True], [primitive_id, 3], [shader_out_col, (0.0, 0.0, 0.0, 2.75)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 340, 145 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, test_eid], [passed, False], [depth_clipped, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 330, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [shader_out_col, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, True], [primitive_id, 0], [shader_out_col, (0.0, 1.0, 0.0, 2.75)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 320, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [shader_out_col, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, False], [depth_bounds_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) x, y = 345, 105 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, depth_bounds_prep_eid], [passed, True], [primitive_id, 0], [shader_out_col, (1.0, 0.0, 0.0, 2.75)]], [[event_id, depth_bounds_clip_eid], [passed, False], [depth_bounds_failed, True]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) rdtest.log.print("Testing dynamic state pipelines") self.controller.SetFrameEvent(dynamic_stencil_mask_eid, True) x, y = 100, 250 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], @@ -207,14 +207,14 @@ def primary_test(self): [post_mod_col, (0.0, 1.0, 1.0, 1.0)]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) rdtest.log.print("Testing depth test for per fragment reporting") self.controller.SetFrameEvent(depth_test_eid, True) x, y = 275, 260 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True]], [[event_id, background_eid], [passed, True]], @@ -235,7 +235,7 @@ def primary_test(self): [post_mod_depth, 0.10]], ] self.check_events(events, modifs, False) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) def multisampled_image_test(self): test_marker: rd.ActionDescription = self.find_action("Multisampled: test") @@ -243,13 +243,13 @@ def multisampled_image_test(self): self.controller.SetFrameEvent(action_eid, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] if self.is_depth: - rt: rd.BoundResource = pipe.GetDepthTarget() + rt = pipe.GetDepthTarget() sub = rd.Subresource() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) if tex_details.arraysize > 1: sub.slice = rt.firstSlice @@ -259,7 +259,7 @@ def multisampled_image_test(self): x, y = 140, 130 sub.sample = 1 rdtest.log.print("Testing pixel {}, {} at sample {}".format(x, y, sub.sample)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, beg_renderpass_eid], [passed, True], [post_mod_depth, 0.0]], @@ -276,13 +276,13 @@ def multisampled_image_test(self): self.check_events(events, modifs, True) if self.is_depth: - self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil)/255.0, 0.0, 1.0], sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil)/255.0, 0.0, 1.0], sub=sub, cast=rt.format.compType) else: - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) sub.sample = 2 rdtest.log.print("Testing pixel {}, {} at sample {}".format(x, y, sub.sample)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, beg_renderpass_eid], [passed, True], [post_mod_depth, 0.0]], [[event_id, action_eid], [passed, True], [primitive_id, 0], [pre_mod_depth, 0.0], [shader_out_depth, 0.9], @@ -300,18 +300,18 @@ def multisampled_image_test(self): if self.is_depth: self.check_pixel_value(tex, x, y, [modifs[-1].postMod.depth, float(modifs[-1].postMod.stencil) / 255.0, 0.0, 1.0], - sub=sub, cast=rt.typeCast) + sub=sub, cast=rt.format.compType) else: - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) def secondary_cmd_test(self): secondary_marker: rd.ActionDescription = self.find_action("Secondary: red and blue") self.controller.SetFrameEvent(secondary_marker.next.eventId, True) pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetOutputTargets()[0] + rt = pipe.GetOutputTargets()[0] sub = rd.Subresource() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) if tex_details.arraysize > 1: sub.slice = rt.firstSlice @@ -326,19 +326,19 @@ def secondary_cmd_test(self): # Test culling x, y = 70, 40 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid], [passed, True], [post_mod_col, (0.0, 1.0, 0.0, 1.0)]], [[event_id, background_eid], [passed, True], [pre_mod_col, (0.0, 1.0, 0.0, 1.0)]], [[event_id, culled_eid], [passed, False], [culled, True]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) # Blue triangle x, y = 40, 40 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid], [passed, True], [post_mod_col, (0.0, 1.0, 0.0, 1.0)]], # This is the first event in the command buffer, should have pre-mod @@ -347,18 +347,18 @@ def secondary_cmd_test(self): [[event_id, sec_red_and_blue], [passed, True], [post_mod_col, (0.0, 0.0, 1.0, 1.0)]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) # Didn't get post mod for background_eid self.controller.SetFrameEvent(background_eid, True) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, sec_beg_renderpass_eid]], # The only event, should have both pre and post mod. [[event_id, background_eid], [passed, True], [pre_mod_col, (0.0, 1.0, 0.0, 1.0)], [post_mod_col, (1.0, 0.0, 1.0, 1.0)]], ] self.check_events(events, modifs, True) - self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.typeCast) + self.check_pixel_value(tex, x, y, value_selector(modifs[-1].postMod.col), sub=sub, cast=rt.format.compType) def depth_target_test(self): test_marker: rd.ActionDescription = self.find_action("Test Begin") @@ -366,9 +366,9 @@ def depth_target_test(self): pipe: rd.PipeState = self.controller.GetPipelineState() - rt: rd.BoundResource = pipe.GetDepthTarget() + rt = pipe.GetDepthTarget() - tex = rt.resourceId + tex = rt.resource tex_details = self.get_texture(tex) sub = rd.Subresource() @@ -383,7 +383,7 @@ def depth_target_test(self): x, y = 200, 190 rdtest.log.print("Testing pixel {}, {}".format(x, y)) - modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.typeCast) + modifs: List[rd.PixelModification] = self.controller.PixelHistory(tex, x, y, sub, rt.format.compType) events = [ [[event_id, begin_renderpass_eid], [passed, True], [post_mod_depth, 1.0]], [[event_id, background_eid], [passed, True], [primitive_id, 0], [pre_mod_depth, 1.0], [post_mod_depth, 0.95]], diff --git a/util/test/tests/Vulkan/VK_Postponed.py b/util/test/tests/Vulkan/VK_Postponed.py index cbf5f52d3a..6ad5f01de0 100644 --- a/util/test/tests/Vulkan/VK_Postponed.py +++ b/util/test/tests/Vulkan/VK_Postponed.py @@ -39,7 +39,7 @@ def check_capture(self): self.controller.SetFrameEvent(action.eventId, True) pipe = self.controller.GetPipelineState() - tex_details = self.get_texture(pipe.GetOutputTargets()[0].resourceId) + tex_details = self.get_texture(pipe.GetOutputTargets()[0].resource) # Green triangles in each quadrant w = int(tex_details.width / 2) diff --git a/util/test/tests/Vulkan/VK_Robustness2.py b/util/test/tests/Vulkan/VK_Robustness2.py index a5e1fe06c8..1f9bc64e86 100644 --- a/util/test/tests/Vulkan/VK_Robustness2.py +++ b/util/test/tests/Vulkan/VK_Robustness2.py @@ -77,15 +77,14 @@ def check_capture(self): pipe = self.controller.GetPipelineState() refl = pipe.GetShaderReflection(rd.ShaderStage.Fragment) - mapping = pipe.GetBindpointMapping(rd.ShaderStage.Fragment) for i, cb in enumerate(refl.constantBlocks): - cbuf = pipe.GetConstantBuffer(rd.ShaderStage.Fragment, i, 0) + cbuf = pipe.GetConstantBlock(rd.ShaderStage.Fragment, i, 0).descriptor var_check = rdtest.ConstantBufferChecker( self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(rd.ShaderStage.Fragment), rd.ShaderStage.Fragment, refl.entryPoint, i, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize)) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize)) if cb.bufferBacked: var_check.check('data').type(rd.VarType.Float).rows(1).cols(4).value([0.0, 0.0, 0.0, 0.0]) @@ -98,4 +97,4 @@ def check_capture(self): var_check.check('coord').type(rd.VarType.SInt).rows(1).cols(4).value(val) rdtest.log.success('CBuffer {} at bindpoint {}.{}[0] contains the correct contents' - .format(cb.name, mapping.constantBlocks[i].bindset, mapping.constantBlocks[i].bind)) + .format(cb.name, cb.fixedBindSetOrSpace, cb.fixedBindNumber)) diff --git a/util/test/tests/Vulkan/VK_SPIRV_13_Shaders.py b/util/test/tests/Vulkan/VK_SPIRV_13_Shaders.py index ebfc759678..88f34bb482 100644 --- a/util/test/tests/Vulkan/VK_SPIRV_13_Shaders.py +++ b/util/test/tests/Vulkan/VK_SPIRV_13_Shaders.py @@ -75,6 +75,6 @@ def check_capture(self): rdtest.log.success("vertex output is as expected") - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("picked value is as expected") diff --git a/util/test/tests/Vulkan/VK_Sample_Locations.py b/util/test/tests/Vulkan/VK_Sample_Locations.py index 7c0583ee9e..2d72e077f4 100644 --- a/util/test/tests/Vulkan/VK_Sample_Locations.py +++ b/util/test/tests/Vulkan/VK_Sample_Locations.py @@ -65,7 +65,7 @@ def check_capture(self): # Grab the multisampled image's ID here save_data = rd.TextureSave() curpass: rd.VKCurrentPass = pipe.currentPass - save_data.resourceId = curpass.framebuffer.attachments[curpass.renderpass.colorAttachments[0]].imageResourceId + save_data.resourceId = curpass.framebuffer.attachments[curpass.renderpass.colorAttachments[0]].resource save_data.destType = rd.FileType.PNG save_data.sample.mapToArray = False diff --git a/util/test/tests/Vulkan/VK_Shader_Debug_Zoo.py b/util/test/tests/Vulkan/VK_Shader_Debug_Zoo.py index d3188fbba3..8d712c94e2 100644 --- a/util/test/tests/Vulkan/VK_Shader_Debug_Zoo.py +++ b/util/test/tests/Vulkan/VK_Shader_Debug_Zoo.py @@ -45,7 +45,7 @@ def check_capture(self): debugged = self.evaluate_source_var(output, variables) try: - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, x, y, debugged.value.f32v[0:4]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, x, y, debugged.value.f32v[0:4]) except rdtest.TestFailureException as ex: failed = True rdtest.log.error("Test {} in sub-section {} did not match. {}".format(test, child, str(ex))) diff --git a/util/test/tests/Vulkan/VK_Shader_Editing.py b/util/test/tests/Vulkan/VK_Shader_Editing.py index 7620fd8579..d9573a5dab 100644 --- a/util/test/tests/Vulkan/VK_Shader_Editing.py +++ b/util/test/tests/Vulkan/VK_Shader_Editing.py @@ -24,7 +24,7 @@ def check_capture(self): fsrefl2: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Fragment) vsrefl: rd.ShaderReflection = pipe.GetShaderReflection(rd.ShaderStage.Vertex) - tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId + tex: rd.ResourceId = pipe.GetOutputTargets()[0].resource # Both triangles should be green self.check_pixel_value(tex, 0.25, 0.5, [0.0, 1.0, 0.0, 1.0]) diff --git a/util/test/tests/Vulkan/VK_Spec_Constants.py b/util/test/tests/Vulkan/VK_Spec_Constants.py index b9db330868..d575933b4b 100644 --- a/util/test/tests/Vulkan/VK_Spec_Constants.py +++ b/util/test/tests/Vulkan/VK_Spec_Constants.py @@ -33,12 +33,12 @@ def check_capture(self): raise rdtest.TestFailureException("CBuffer variable is array of {}, not {}".format(array_len, num_colors+1)) if num_colors > 0: - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(rd.ShaderStage.Pixel, 0, 0) + cbuf = pipe.GetConstantBlock(rd.ShaderStage.Pixel, 0, 0).descriptor cb_vars = self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(rd.ShaderStage.Pixel), rd.ShaderStage.Pixel, pipe.GetShaderEntryPoint(rd.ShaderStage.Pixel), 0, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize) self.check(len(cb_vars) == 1) @@ -56,12 +56,12 @@ def check_capture(self): rdtest.log.success("Draw with {} colors uniform buffer is as expected".format(num_colors)) - cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(rd.ShaderStage.Pixel, 1, 0) + cbuf = pipe.GetConstantBlock(rd.ShaderStage.Pixel, 1, 0).descriptor cb_vars = self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(), pipe.GetShader(rd.ShaderStage.Pixel), rd.ShaderStage.Pixel, pipe.GetShaderEntryPoint(rd.ShaderStage.Pixel), 1, - cbuf.resourceId, cbuf.byteOffset, cbuf.byteSize) + cbuf.resource, cbuf.byteOffset, cbuf.byteSize) self.check(len(cb_vars) == 3) @@ -137,7 +137,7 @@ def check_capture(self): expected[col] += 1.0 # Sample the centre of the viewport - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(view.x) + int(view.width / 2), int(view.height / 2), expected) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, int(view.x) + int(view.width / 2), int(view.height / 2), expected) rdtest.log.success("Draw with {} colors picked value is as expected".format(num_colors)) diff --git a/util/test/tests/Vulkan/VK_Synchronization_2.py b/util/test/tests/Vulkan/VK_Synchronization_2.py index b4ce34cc6a..6205856cf3 100644 --- a/util/test/tests/Vulkan/VK_Synchronization_2.py +++ b/util/test/tests/Vulkan/VK_Synchronization_2.py @@ -88,6 +88,6 @@ def check_capture(self): elif res.name == "Image:Undefined": if img.layouts[0].name != "VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL": raise rdtest.TestFailureException("Undefined image is in {} layout".format(img.layouts[0].name)) - elif img.resourceId == pipe.currentPass.framebuffer.attachments[0].imageResourceId: + elif img.resourceId == pipe.currentPass.framebuffer.attachments[0].resource: if img.layouts[0].name != "VK_IMAGE_LAYOUT_GENERAL": raise rdtest.TestFailureException("Rendered swapchain image is in {} layout".format(img.layouts[0].name)) diff --git a/util/test/tests/Vulkan/VK_Vertex_Attr_Zoo.py b/util/test/tests/Vulkan/VK_Vertex_Attr_Zoo.py index c5c2c8e385..10926a9de9 100644 --- a/util/test/tests/Vulkan/VK_Vertex_Attr_Zoo.py +++ b/util/test/tests/Vulkan/VK_Vertex_Attr_Zoo.py @@ -77,7 +77,7 @@ def check_capture(self): continue in_ref[idx]['In' + key] = ref[idx][key] - in_ref[idx]['InUInt2'] = ref[idx]['UInt'] + ref[idx]['UInt1'] + ref[idx]['UInt2'] + in_ref[idx]['InUInt'] = ref[idx]['UInt'] + ref[idx]['UInt1'] + ref[idx]['UInt2'] # Copy the ref values and prepend 'Out' out_ref = {} @@ -120,7 +120,7 @@ def check_capture(self): pipe: rd.PipeState = self.controller.GetPipelineState() - self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) + self.check_pixel_value(pipe.GetOutputTargets()[0].resource, 0.5, 0.5, [0.0, 1.0, 0.0, 1.0]) rdtest.log.success("Triangle picked value is as expected")