Fixes for examples using push constants (now working fine on AMD too)

This commit is contained in:
saschawillems 2016-03-02 19:58:06 +01:00
parent c2306108c4
commit 852f4ad314
4 changed files with 10 additions and 10 deletions

View file

@ -172,18 +172,18 @@ public:
#undef sin_t #undef sin_t
#undef cos_t #undef cos_t
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.solid);
// Submit via push constant (rather than a UBO) // Submit via push constant (rather than a UBO)
vkCmdPushConstants( vkCmdPushConstants(
drawCmdBuffers[i], drawCmdBuffers[i],
pipelineLayout, pipelineLayout,
VK_SHADER_STAGE_VERTEX_BIT, VK_SHADER_STAGE_VERTEX_BIT,
VK_FLAGS_NONE, 0,
sizeof(pushConstants), sizeof(pushConstants),
pushConstants.data()); pushConstants.data());
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.solid);
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, NULL);
VkDeviceSize offsets[1] = { 0 }; VkDeviceSize offsets[1] = { 0 };
vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &meshes.scene.vertices.buf, offsets); vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &meshes.scene.vertices.buf, offsets);
vkCmdBindIndexBuffer(drawCmdBuffers[i], meshes.scene.indices.buf, 0, VK_INDEX_TYPE_UINT32); vkCmdBindIndexBuffer(drawCmdBuffers[i], meshes.scene.indices.buf, 0, VK_INDEX_TYPE_UINT32);
@ -355,7 +355,7 @@ public:
// inside push constants // inside push constants
VkPushConstantRange pushConstantRange = VkPushConstantRange pushConstantRange =
vkTools::initializers::pushConstantRange( vkTools::initializers::pushConstantRange(
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, VK_SHADER_STAGE_VERTEX_BIT,
sizeof(pushConstants), sizeof(pushConstants),
0); 0);

View file

@ -459,6 +459,9 @@ public:
break; break;
} }
// Render scene from cube face's point of view
vkCmdBeginRenderPass(offScreenCmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
// Update shader push constant block // Update shader push constant block
// Contains current face view matrix // Contains current face view matrix
vkCmdPushConstants( vkCmdPushConstants(
@ -469,11 +472,8 @@ public:
sizeof(glm::mat4), sizeof(glm::mat4),
&viewMatrix); &viewMatrix);
// Render scene from cube face's point of view
vkCmdBeginRenderPass(offScreenCmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
vkCmdBindDescriptorSets(offScreenCmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.offscreen, 0, 1, &descriptorSets.offscreen, 0, NULL);
vkCmdBindPipeline(offScreenCmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.offscreen); vkCmdBindPipeline(offScreenCmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.offscreen);
vkCmdBindDescriptorSets(offScreenCmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.offscreen, 0, 1, &descriptorSets.offscreen, 0, NULL);
VkDeviceSize offsets[1] = { 0 }; VkDeviceSize offsets[1] = { 0 };
vkCmdBindVertexBuffers(offScreenCmdBuffer, VERTEX_BUFFER_BIND_ID, 1, &meshes.scene.vertices.buf, offsets); vkCmdBindVertexBuffers(offScreenCmdBuffer, VERTEX_BUFFER_BIND_ID, 1, &meshes.scene.vertices.buf, offsets);
@ -820,7 +820,7 @@ public:
// Push constants for cube map face view matrices // Push constants for cube map face view matrices
VkPushConstantRange pushConstantRange = VkPushConstantRange pushConstantRange =
vkTools::initializers::pushConstantRange( vkTools::initializers::pushConstantRange(
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, VK_SHADER_STAGE_VERTEX_BIT,
sizeof(glm::mat4), sizeof(glm::mat4),
0); 0);