Add missing push constant to fix HLSL computeparticles

This commit is contained in:
Ben Clayton 2020-05-21 15:49:28 +01:00
parent e3234db041
commit 0da96cfc63
2 changed files with 24 additions and 6 deletions

View file

@ -18,7 +18,7 @@ Shaders written to mirror the GLSL versions at `eddd724`. There have been change
| computecullandlod | ☑ | ☑ | ☑ | ☑ | computecullandlod | ☑ | ☑ | ☑ | ☑
| computeheadless | ☑ | ☑ | ☑ | ☑ | computeheadless | ☑ | ☑ | ☑ | ☑
| computenbody | ☑ | ☑ | ☑ | ☑ | computenbody | ☑ | ☑ | ☑ | ☑
| computeparticles | ☑ | ❌ | ☑ | ❌ | computeparticles | ☑ | ❌ | ☑ | ☑
| computeraytracing | ☑ | ☑ | ☑ | ☑ | computeraytracing | ☑ | ☑ | ☑ | ☑
| computeshader | ☑ | ☑ | ☑ | ☑ | computeshader | ☑ | ☑ | ☑ | ☑
| conditionalrender | ☑ | ☑ | ☑ | ☑ | conditionalrender | ☑ | ☑ | ☑ | ☑

View file

@ -183,6 +183,15 @@ public:
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics.pipeline); vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics.pipeline);
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics.pipelineLayout, 0, 1, &graphics.descriptorSet, 0, NULL); vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics.pipelineLayout, 0, 1, &graphics.descriptorSet, 0, NULL);
glm::vec2 screendim = glm::vec2((float)width, (float)height);
vkCmdPushConstants(
drawCmdBuffers[i],
graphics.pipelineLayout,
VK_SHADER_STAGE_VERTEX_BIT,
0,
sizeof(glm::vec2),
&screendim);
VkDeviceSize offsets[1] = { 0 }; VkDeviceSize offsets[1] = { 0 };
vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &compute.storageBuffer.buffer, offsets); vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &compute.storageBuffer.buffer, offsets);
vkCmdDraw(drawCmdBuffers[i], PARTICLE_COUNT, 1, 0, 0); vkCmdDraw(drawCmdBuffers[i], PARTICLE_COUNT, 1, 0, 0);
@ -438,6 +447,15 @@ public:
&graphics.descriptorSetLayout, &graphics.descriptorSetLayout,
1); 1);
VkPushConstantRange pushConstantRange =
vks::initializers::pushConstantRange(
VK_SHADER_STAGE_VERTEX_BIT,
sizeof(glm::vec2),
0);
pipelineLayoutCreateInfo.pushConstantRangeCount = 1;
pipelineLayoutCreateInfo.pPushConstantRanges = &pushConstantRange;
VK_CHECK_RESULT(vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, nullptr, &graphics.pipelineLayout)); VK_CHECK_RESULT(vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, nullptr, &graphics.pipelineLayout));
} }