Removed no longer required pipeline duplicatiion
This commit is contained in:
parent
f27a032570
commit
b481b63c78
3 changed files with 6 additions and 17 deletions
|
|
@ -429,7 +429,7 @@ An updated version using ```VK_EXT_debug_utils``` along with an in-depth tutoria
|
||||||
|
|
||||||
Shows how to render a scene using a negative viewport height, making the Vulkan render setup more similar to other APIs like OpenGL. Also has several options for changing relevant pipeline state, and displaying meshes with OpenGL or Vulkan style coordinates. Details can be found in [this tutorial](https://www.saschawillems.de/tutorials/vulkan/flipping-viewport).
|
Shows how to render a scene using a negative viewport height, making the Vulkan render setup more similar to other APIs like OpenGL. Also has several options for changing relevant pipeline state, and displaying meshes with OpenGL or Vulkan style coordinates. Details can be found in [this tutorial](https://www.saschawillems.de/tutorials/vulkan/flipping-viewport).
|
||||||
|
|
||||||
#### [Variable rate shading (VK_NV_shading_rate_image)](examples/variablerateshading/)
|
#### [Variable rate shading (VK_KHR_fragment_shading_rate)](examples/variablerateshading/)
|
||||||
|
|
||||||
Uses a special image that contains variable shading rates to vary the number of fragment shader invocations across the framebuffer. This makes it possible to lower fragment shader invocations for less important/less noisy parts of the framebuffer.
|
Uses a special image that contains variable shading rates to vary the number of fragment shader invocations across the framebuffer. This makes it possible to lower fragment shader invocations for less important/less noisy parts of the framebuffer.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,8 @@ VulkanExample::VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
|
||||||
|
|
||||||
VulkanExample::~VulkanExample()
|
VulkanExample::~VulkanExample()
|
||||||
{
|
{
|
||||||
vkDestroyPipeline(device, basePipelines.masked, nullptr);
|
vkDestroyPipeline(device, pipelines.masked, nullptr);
|
||||||
vkDestroyPipeline(device, basePipelines.opaque, nullptr);
|
vkDestroyPipeline(device, pipelines.opaque, nullptr);
|
||||||
vkDestroyPipeline(device, shadingRatePipelines.masked, nullptr);
|
|
||||||
vkDestroyPipeline(device, shadingRatePipelines.opaque, nullptr);
|
|
||||||
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
||||||
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
|
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
|
||||||
vkDestroyImageView(device, shadingRateImage.view, nullptr);
|
vkDestroyImageView(device, shadingRateImage.view, nullptr);
|
||||||
|
|
@ -263,7 +261,6 @@ void VulkanExample::buildCommandBuffers()
|
||||||
vkCmdSetFragmentShadingRateKHR(drawCmdBuffers[i], &fragmentSize, combinerOps);
|
vkCmdSetFragmentShadingRateKHR(drawCmdBuffers[i], &fragmentSize, combinerOps);
|
||||||
|
|
||||||
// Render the scene
|
// Render the scene
|
||||||
Pipelines& pipelines = enableShadingRate ? shadingRatePipelines : basePipelines;
|
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.opaque);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.opaque);
|
||||||
scene.draw(drawCmdBuffers[i], vkglTF::RenderFlags::BindImages | vkglTF::RenderFlags::RenderOpaqueNodes, pipelineLayout);
|
scene.draw(drawCmdBuffers[i], vkglTF::RenderFlags::BindImages | vkglTF::RenderFlags::RenderOpaqueNodes, pipelineLayout);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.masked);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.masked);
|
||||||
|
|
@ -543,17 +540,12 @@ void VulkanExample::preparePipelines()
|
||||||
shaderStages[1].pSpecializationInfo = &specializationInfo;
|
shaderStages[1].pSpecializationInfo = &specializationInfo;
|
||||||
|
|
||||||
// Create pipeline without shading rate
|
// Create pipeline without shading rate
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &basePipelines.opaque));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.opaque));
|
||||||
specializationData.alphaMask = true;
|
specializationData.alphaMask = true;
|
||||||
rasterizationStateCI.cullMode = VK_CULL_MODE_NONE;
|
rasterizationStateCI.cullMode = VK_CULL_MODE_NONE;
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &basePipelines.masked));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.masked));
|
||||||
rasterizationStateCI.cullMode = VK_CULL_MODE_BACK_BIT;
|
rasterizationStateCI.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||||
specializationData.alphaMask = false;
|
specializationData.alphaMask = false;
|
||||||
|
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &shadingRatePipelines.opaque));
|
|
||||||
specializationData.alphaMask = true;
|
|
||||||
rasterizationStateCI.cullMode = VK_CULL_MODE_NONE;
|
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &shadingRatePipelines.masked));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanExample::prepareUniformBuffers()
|
void VulkanExample::prepareUniformBuffers()
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,7 @@ public:
|
||||||
struct Pipelines {
|
struct Pipelines {
|
||||||
VkPipeline opaque;
|
VkPipeline opaque;
|
||||||
VkPipeline masked;
|
VkPipeline masked;
|
||||||
};
|
} pipelines;
|
||||||
|
|
||||||
Pipelines basePipelines;
|
|
||||||
Pipelines shadingRatePipelines;
|
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayout;
|
VkPipelineLayout pipelineLayout;
|
||||||
VkDescriptorSet descriptorSet;
|
VkDescriptorSet descriptorSet;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue