Skip to content

Commit

Permalink
Fix lifetime issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe2933 committed Jan 8, 2025
1 parent fc68f7d commit 5e54fec
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
20 changes: 12 additions & 8 deletions interface/vulkan/pipeline/PrimitiveRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,28 @@ namespace vk_gltf_viewer::vulkan::inline pipeline {
const rp::Scene &sceneRenderPass
) const {
const auto vertexShaderSpecializationData = getVertexShaderSpecializationData();
const vk::SpecializationInfo vertexShaderSpecializationInfo {
SpecializationMap<VertexShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const VertexShaderSpecializationData> { vertexShaderSpecializationData },
};

const auto fragmentShaderSpecializationData = getFragmentShaderSpecializationData();
const vk::SpecializationInfo fragmentShaderSpecializationInfo {
SpecializationMap<FragmentShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const FragmentShaderSpecializationData> { fragmentShaderSpecializationData },
};

const vku::RefHolder pipelineStages = createPipelineStages(
device,
vku::Shader {
std::apply(LIFT(shader_selector::primitive_vert), getVertexShaderVariants()),
vk::ShaderStageFlagBits::eVertex,
vku::unsafeAddress(vk::SpecializationInfo {
SpecializationMap<VertexShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const VertexShaderSpecializationData> { vertexShaderSpecializationData },
}),
&vertexShaderSpecializationInfo,
},
vku::Shader {
std::apply(LIFT(shader_selector::primitive_frag), getFragmentShaderVariants()),
vk::ShaderStageFlagBits::eFragment,
vku::unsafeAddress(vk::SpecializationInfo {
SpecializationMap<FragmentShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const FragmentShaderSpecializationData> { fragmentShaderSpecializationData },
}),
&fragmentShaderSpecializationInfo,
});

switch (alphaMode) {
Expand Down
19 changes: 11 additions & 8 deletions interface/vulkan/pipeline/UnlitPrimitiveRenderer.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,28 @@ namespace vk_gltf_viewer::vulkan::inline pipeline {
const rp::Scene &sceneRenderPass
) const {
const auto vertexShaderSpecializationData = getVertexShaderSpecializationData();
const vk::SpecializationInfo vertexShaderSpecializationInfo {
SpecializationMap<VertexShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const VertexShaderSpecializationData> { vertexShaderSpecializationData },
};

const auto fragmentShaderSpecializationData = getFragmentShaderSpecializationData();
const vk::SpecializationInfo fragmentShaderSpecializationInfo {
SpecializationMap<FragmentShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const FragmentShaderSpecializationData> { fragmentShaderSpecializationData },
};

const vku::RefHolder pipelineStages = createPipelineStages(
device,
vku::Shader {
std::apply(LIFT(shader_selector::unlit_primitive_vert), getVertexShaderVariants()),
vk::ShaderStageFlagBits::eVertex,
vku::unsafeAddress(vk::SpecializationInfo {
SpecializationMap<VertexShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const VertexShaderSpecializationData> { vertexShaderSpecializationData },
}),
&vertexShaderSpecializationInfo
},
vku::Shader {
std::apply(LIFT(shader_selector::unlit_primitive_frag), getFragmentShaderVariants()),
vk::ShaderStageFlagBits::eFragment,
vku::unsafeAddress(vk::SpecializationInfo {
SpecializationMap<FragmentShaderSpecializationData>::value,
vk::ArrayProxyNoTemporaries<const FragmentShaderSpecializationData> { fragmentShaderSpecializationData },
}),
&fragmentShaderSpecializationInfo,
});

switch (alphaMode) {
Expand Down

0 comments on commit 5e54fec

Please sign in to comment.