parent
3e1ec8deac
commit
3bcee3c01a
|
@ -764,7 +764,7 @@ void VulkanExample::getEnabledFeatures()
|
||||||
// Bind scene matrices descriptor to set 0
|
// Bind scene matrices descriptor to set 0
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 0, 1, &descriptorSet, 0, nullptr);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 0, 1, &descriptorSet, 0, nullptr);
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 6, 1, &skinDescriptorSet, 0, nullptr);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.pbrLayout, 6, 1, &skinDescriptorSet, 0, nullptr);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, wireframe ? wireframePipeline : solidPipeline);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, wireframe ? pipelines.wireframe : pipelines.solid);
|
||||||
glTFModel.draw(drawCmdBuffers[i], pipelineLayouts.pbrLayout);
|
glTFModel.draw(drawCmdBuffers[i], pipelineLayouts.pbrLayout);
|
||||||
vkCmdEndRenderPass(drawCmdBuffers[i]);
|
vkCmdEndRenderPass(drawCmdBuffers[i]);
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ void VulkanExample::getEnabledFeatures()
|
||||||
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport);
|
||||||
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
|
||||||
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.tonemappingLayout, 0, 1, &tonemappingDescriptorSet, 0, NULL);
|
vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.tonemappingLayout, 0, 1, &tonemappingDescriptorSet, 0, NULL);
|
||||||
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, toneMappingPipeline);
|
vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.toneMapping);
|
||||||
vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0);
|
vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0);
|
||||||
drawUI(drawCmdBuffers[i]);
|
drawUI(drawCmdBuffers[i]);
|
||||||
vkCmdEndRenderPass(drawCmdBuffers[i]);
|
vkCmdEndRenderPass(drawCmdBuffers[i]);
|
||||||
|
@ -1066,15 +1066,15 @@ void VulkanExample::getEnabledFeatures()
|
||||||
pipelineCI.pDynamicState = &dynamicStateCI;
|
pipelineCI.pDynamicState = &dynamicStateCI;
|
||||||
pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
|
pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
|
||||||
pipelineCI.pStages = shaderStages.data();
|
pipelineCI.pStages = shaderStages.data();
|
||||||
|
|
||||||
// Solid rendering pipeline
|
// Solid rendering pipeline
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &solidPipeline));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.solid));
|
||||||
|
|
||||||
// Wire frame rendering pipeline
|
// Wire frame rendering pipeline
|
||||||
if (deviceFeatures.fillModeNonSolid) {
|
if (deviceFeatures.fillModeNonSolid) {
|
||||||
rasterizationStateCI.polygonMode = VK_POLYGON_MODE_LINE;
|
rasterizationStateCI.polygonMode = VK_POLYGON_MODE_LINE;
|
||||||
rasterizationStateCI.lineWidth = 1.0f;
|
rasterizationStateCI.lineWidth = 1.0f;
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &wireframePipeline));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.wireframe));
|
||||||
}
|
}
|
||||||
//Create Tone Mapping render pipeline
|
//Create Tone Mapping render pipeline
|
||||||
prepareToneMappingPipeline();
|
prepareToneMappingPipeline();
|
||||||
|
@ -1082,10 +1082,10 @@ void VulkanExample::getEnabledFeatures()
|
||||||
|
|
||||||
void VulkanExample::prepareToneMappingPipeline()
|
void VulkanExample::prepareToneMappingPipeline()
|
||||||
{
|
{
|
||||||
if (toneMappingPipeline != VK_NULL_HANDLE)
|
if (pipelines.toneMapping != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
vkDestroyPipeline(device, toneMappingPipeline, nullptr);
|
vkDestroyPipeline(device, pipelines.toneMapping, nullptr);
|
||||||
toneMappingPipeline = VK_NULL_HANDLE;
|
pipelines.toneMapping = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
||||||
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
|
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
|
||||||
|
@ -1116,7 +1116,7 @@ void VulkanExample::getEnabledFeatures()
|
||||||
pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
|
pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
|
||||||
pipelineCI.pStages = shaderStages.data();
|
pipelineCI.pStages = shaderStages.data();
|
||||||
|
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &toneMappingPipeline));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.toneMapping));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare and initialize uniform buffer containing shader uniforms
|
// Prepare and initialize uniform buffer containing shader uniforms
|
||||||
|
|
|
@ -254,11 +254,11 @@ public:
|
||||||
VkDeviceMemory memory;
|
VkDeviceMemory memory;
|
||||||
} vertexStaging, indexStaging;
|
} vertexStaging, indexStaging;
|
||||||
|
|
||||||
|
struct Pipelines {
|
||||||
VkPipeline solidPipeline;
|
VkPipeline solid;
|
||||||
VkPipeline wireframePipeline = VK_NULL_HANDLE;
|
VkPipeline wireframe = VK_NULL_HANDLE;
|
||||||
VkPipeline toneMappingPipeline = VK_NULL_HANDLE;
|
VkPipeline toneMapping = VK_NULL_HANDLE;
|
||||||
|
} pipelines;
|
||||||
|
|
||||||
struct PipelineLayouts
|
struct PipelineLayouts
|
||||||
{
|
{
|
||||||
|
@ -359,10 +359,10 @@ public:
|
||||||
{
|
{
|
||||||
// Clean up used Vulkan resources
|
// Clean up used Vulkan resources
|
||||||
// Note : Inherited destructor cleans up resources stored in base class
|
// Note : Inherited destructor cleans up resources stored in base class
|
||||||
vkDestroyPipeline(device, solidPipeline, nullptr);
|
vkDestroyPipeline(device, pipelines.solid, nullptr);
|
||||||
vkDestroyPipeline(device, toneMappingPipeline, nullptr);
|
vkDestroyPipeline(device, pipelines.toneMapping, nullptr);
|
||||||
if (wireframePipeline != VK_NULL_HANDLE) {
|
if (pipelines.wireframe != VK_NULL_HANDLE) {
|
||||||
vkDestroyPipeline(device, wireframePipeline, nullptr);
|
vkDestroyPipeline(device, pipelines.wireframe, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
vkDestroyPipelineLayout(device, pipelineLayouts.pbrLayout, nullptr);
|
vkDestroyPipelineLayout(device, pipelineLayouts.pbrLayout, nullptr);
|
||||||
|
|
Loading…
Reference in New Issue