Add test that we don't crash on draws with new viewports

This commit is contained in:
baldurk
2020-07-27 16:17:13 +01:00
parent 1c6c671781
commit 624da2fb25
2 changed files with 24 additions and 10 deletions
+20 -10
View File
@@ -478,7 +478,17 @@ void main()
pipeCreateInfo.inputAssemblyState.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
pipeCreateInfo.layout = asm_layout;
VkPipeline asm_pipe = createGraphicsPipeline(pipeCreateInfo);
VkPipeline asm_pipe;
{
vkh::GraphicsPipelineCreateInfo asm_info = pipeCreateInfo;
asm_info.viewportState.viewports.clear();
asm_info.viewportState.scissors.clear();
asm_info.viewportState.viewportCount = 0;
asm_info.viewportState.scissorCount = 0;
asm_pipe = createGraphicsPipeline(asm_info);
}
{
// invalid handle - should not be used because the flag for derived pipelines is not used
@@ -1321,6 +1331,15 @@ void main()
popMarker(cmd);
}
uint32_t idx = 1;
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_pipe);
vkCmdPushConstants(cmd, asm_layout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, 4, &idx);
vkh::cmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_layout, 0,
{asm_descset}, {});
setMarker(cmd, "ASM Draw");
vkCmdDraw(cmd, 4, 1, 0, 0);
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipe);
vkCmdSetViewport(cmd, 0, 1, &mainWindow->viewport);
vkCmdSetScissor(cmd, 0, 1, &mainWindow->scissor);
@@ -1351,15 +1370,6 @@ void main()
VkRect2D sc = {100, 100, 10, 10};
vkCmdSetScissor(cmd, 0, 1, &sc);
uint32_t idx = 1;
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_pipe);
vkCmdPushConstants(cmd, asm_layout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, 4, &idx);
vkh::cmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_layout, 0,
{asm_descset}, {});
setMarker(cmd, "ASM Draw");
vkCmdDraw(cmd, 4, 1, 0, 0);
if(EXT_transform_feedback)
{
VkDeviceSize offs = 0;
@@ -146,6 +146,8 @@ class VK_Parameter_Zoo(rdtest.TestCase):
self.check(not binding.binds[2].dynamicallyUsed)
self.check(not binding.binds[3].dynamicallyUsed)
self.check(len(vkpipe.viewportScissor.viewportScissors) == 0)
postvs_data = self.get_postvs(draw, rd.MeshDataStage.VSOut, 0, draw.numIndices)
postvs_ref = {
@@ -173,6 +175,8 @@ class VK_Parameter_Zoo(rdtest.TestCase):
self.check_mesh_data(postvs_ref, postvs_data)
rdtest.log.success("ASM Draw is as expected")
# Check for resource leaks
if len(self.controller.GetStructuredFile().chunks) > 500:
raise rdtest.TestFailureException(