Skip to content

Commit

Permalink
WIP: MSVC compatibility with vku::createPipelineStages.
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe2933 committed Aug 19, 2024
1 parent b59f78a commit edd67c4
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
24 changes: 24 additions & 0 deletions interface/vulkan/pipeline/DeferredLightRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,34 @@ namespace vk_deferred::vulkan::inline pipeline {
}),
} },
pipeline { device, nullptr, vku::getDefaultGraphicsPipelineCreateInfo(
#ifdef _MSC_VER
// TODO: due to the MSVC C++20 module bug, vku::createPipelineStages not works well. Use it instead when fixed.
vku::unsafeProxy({
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eVertex,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/light_volume.vert.spv", vk::ShaderStageFlagBits::eVertex }.code),
} },
"main",
},
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eFragment,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/deferred_lighting.frag.spv", vk::ShaderStageFlagBits::eFragment }.code),
} },
"main",
},
}),
#else
createPipelineStages(
device,
vku::Shader { COMPILED_SHADER_DIR "/light_volume.vert.spv", vk::ShaderStageFlagBits::eVertex },
vku::Shader { COMPILED_SHADER_DIR "/deferred_lighting.frag.spv", vk::ShaderStageFlagBits::eFragment }).get(),
#endif
*pipelineLayout, 1, true)
.setPVertexInputState(vku::unsafeAddress(vk::PipelineVertexInputStateCreateInfo {
{},
Expand Down
24 changes: 24 additions & 0 deletions interface/vulkan/pipeline/GBufferRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,34 @@ namespace vk_deferred::vulkan::inline pipeline {
}),
} },
pipeline { device, nullptr, vku::getDefaultGraphicsPipelineCreateInfo(
#ifdef _MSC_VER
// TODO: due to the MSVC C++20 module bug, vku::createPipelineStages not works well. Use it instead when fixed.
vku::unsafeProxy({
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eVertex,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/pn_instanced.vert.spv", vk::ShaderStageFlagBits::eVertex }.code),
} },
"main",
},
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eFragment,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/gbuffer.frag.spv", vk::ShaderStageFlagBits::eFragment }.code),
} },
"main",
},
}),
#else
createPipelineStages(
device,
vku::Shader { COMPILED_SHADER_DIR "/pn_instanced.vert.spv", vk::ShaderStageFlagBits::eVertex },
vku::Shader { COMPILED_SHADER_DIR "/gbuffer.frag.spv", vk::ShaderStageFlagBits::eFragment }).get(),
#endif
*pipelineLayout, 2, true)
.setPVertexInputState(vku::unsafeAddress(vk::PipelineVertexInputStateCreateInfo {
{},
Expand Down
24 changes: 24 additions & 0 deletions interface/vulkan/pipeline/ToneMappingRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,34 @@ namespace vk_deferred::vulkan::inline pipeline {
vku::unsafeProxy(*descriptorSetLayout),
} },
pipeline { device, nullptr, vku::getDefaultGraphicsPipelineCreateInfo(
#ifdef _MSC_VER
// TODO: due to the MSVC C++20 module bug, vku::createPipelineStages not works well. Use it instead when fixed.
vku::unsafeProxy({
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eVertex,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/full_triangle.vert.spv", vk::ShaderStageFlagBits::eVertex }.code),
} },
"main",
},
vk::PipelineShaderStageCreateInfo {
{},
vk::ShaderStageFlagBits::eFragment,
*vk::raii::ShaderModule { device, vk::ShaderModuleCreateInfo {
{},
vku::unsafeProxy(vku::Shader { COMPILED_SHADER_DIR "/rec709.frag.spv", vk::ShaderStageFlagBits::eFragment }.code),
} },
"main",
},
}),
#else
createPipelineStages(
device,
vku::Shader { COMPILED_SHADER_DIR "/full_triangle.vert.spv", vk::ShaderStageFlagBits::eVertex },
vku::Shader { COMPILED_SHADER_DIR "/rec709.frag.spv", vk::ShaderStageFlagBits::eFragment }).get(),
#endif
*pipelineLayout, 1)
.setRenderPass(*renderPass)
.setSubpass(2)
Expand Down

0 comments on commit edd67c4

Please sign in to comment.