@@ -11,6 +11,7 @@ import vk_gltf_viewer.shader.node_mouse_picking_frag;
11
11
import vk_gltf_viewer.shader.node_mouse_picking_vert;
12
12
import vk_gltf_viewer.shader_selector.mask_node_mouse_picking_frag;
13
13
import vk_gltf_viewer.shader_selector.mask_node_mouse_picking_vert;
14
+ export import vk_gltf_viewer.vulkan.Gpu;
14
15
export import vk_gltf_viewer.vulkan.pipeline.PrepassPipelineConfig;
15
16
export import vk_gltf_viewer.vulkan.pipeline_layout.MousePicking;
16
17
import vk_gltf_viewer.vulkan.specialization_constants.SpecializationMap;
@@ -23,7 +24,7 @@ namespace vk_gltf_viewer::vulkan::inline pipeline {
23
24
class NodeMousePickingRenderPipeline <false > final : public vk::raii::Pipeline {
24
25
public:
25
26
NodeMousePickingRenderPipeline (
26
- const vk::raii::Device &device LIFETIMEBOUND,
27
+ const Gpu &gpu LIFETIMEBOUND,
27
28
const pl::MousePicking &pipelineLayout LIFETIMEBOUND,
28
29
const PrepassPipelineConfig<false > &config
29
30
);
@@ -38,7 +39,7 @@ namespace vk_gltf_viewer::vulkan::inline pipeline {
38
39
class NodeMousePickingRenderPipeline <true > final : public vk::raii::Pipeline {
39
40
public:
40
41
NodeMousePickingRenderPipeline (
41
- const vk::raii::Device &device LIFETIMEBOUND,
42
+ const Gpu &gpu LIFETIMEBOUND,
42
43
const pl::MousePicking &pipelineLayout LIFETIMEBOUND,
43
44
const PrepassPipelineConfig<true > &config
44
45
);
@@ -71,14 +72,14 @@ struct vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<false>::
71
72
};
72
73
73
74
vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<false >::NodeMousePickingRenderPipeline(
74
- const vk::raii::Device &device ,
75
+ const Gpu &gpu ,
75
76
const pl::MousePicking &pipelineLayout,
76
77
const PrepassPipelineConfig<false > &config
77
78
) : Pipeline { [&] -> Pipeline {
78
- return { device, nullptr , vk::StructureChain {
79
+ return { gpu. device , nullptr , vk::StructureChain {
79
80
vku::getDefaultGraphicsPipelineCreateInfo (
80
81
createPipelineStages (
81
- device,
82
+ gpu. device ,
82
83
vku::Shader {
83
84
shader::node_mouse_picking_vert,
84
85
vk::ShaderStageFlagBits::eVertex,
@@ -88,15 +89,12 @@ vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<false>::NodeMou
88
89
}),
89
90
},
90
91
vku::Shader { shader::node_mouse_picking_frag, vk::ShaderStageFlagBits::eFragment }).get (),
91
- *pipelineLayout, 0 , true )
92
+ // See doc about Gpu::Workaround::attachmentLessRenderPass.
93
+ *pipelineLayout, 0 , gpu.workaround .attachmentLessRenderPass )
92
94
.setPInputAssemblyState (vku::unsafeAddress (vk::PipelineInputAssemblyStateCreateInfo {
93
95
{},
94
96
config.topologyClass .value_or (vk::PrimitiveTopology::eTriangleList),
95
97
}))
96
- .setPDepthStencilState (vku::unsafeAddress (vk::PipelineDepthStencilStateCreateInfo {
97
- {},
98
- true , true , vk::CompareOp::eGreater, // Use reverse Z.
99
- }))
100
98
.setPDynamicState (vku::unsafeAddress (vk::PipelineDynamicStateCreateInfo {
101
99
{},
102
100
vku::unsafeProxy ({
@@ -109,7 +107,7 @@ vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<false>::NodeMou
109
107
vk::PipelineRenderingCreateInfo {
110
108
{},
111
109
{},
112
- vk::Format::eD32Sfloat,
110
+ gpu. workaround . attachmentLessRenderPass ? vk::Format::eD32Sfloat : vk::Format::eUndefined ,
113
111
},
114
112
}.get () };
115
113
}() } { }
@@ -142,14 +140,14 @@ struct vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<true>::F
142
140
};
143
141
144
142
vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<true >::NodeMousePickingRenderPipeline(
145
- const vk::raii::Device &device ,
143
+ const Gpu &gpu ,
146
144
const pl::MousePicking &pipelineLayout,
147
145
const PrepassPipelineConfig<true > &config
148
146
) : Pipeline { [&] -> Pipeline {
149
- return { device, nullptr , vk::StructureChain {
147
+ return { gpu. device , nullptr , vk::StructureChain {
150
148
vku::getDefaultGraphicsPipelineCreateInfo (
151
149
createPipelineStages (
152
- device,
150
+ gpu. device ,
153
151
vku::Shader {
154
152
std::apply (LIFT (shader_selector::mask_node_mouse_picking_vert), getVertexShaderVariants (config)),
155
153
vk::ShaderStageFlagBits::eVertex,
@@ -166,15 +164,12 @@ vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<true>::NodeMous
166
164
vku::unsafeProxy (getFragmentShaderSpecialization (config)),
167
165
}),
168
166
}).get (),
169
- *pipelineLayout, 0 , true )
167
+ // See doc about Gpu::Workaround::attachmentLessRenderPass.
168
+ *pipelineLayout, 0 , gpu.workaround .attachmentLessRenderPass )
170
169
.setPInputAssemblyState (vku::unsafeAddress (vk::PipelineInputAssemblyStateCreateInfo {
171
170
{},
172
171
config.topologyClass .value_or (vk::PrimitiveTopology::eTriangleList),
173
172
}))
174
- .setPDepthStencilState (vku::unsafeAddress (vk::PipelineDepthStencilStateCreateInfo {
175
- {},
176
- true , true , vk::CompareOp::eGreater, // Use reverse Z.
177
- }))
178
173
.setPDynamicState (vku::unsafeAddress (vk::PipelineDynamicStateCreateInfo {
179
174
{},
180
175
vku::unsafeProxy ({
@@ -187,7 +182,7 @@ vk_gltf_viewer::vulkan::pipeline::NodeMousePickingRenderPipeline<true>::NodeMous
187
182
vk::PipelineRenderingCreateInfo {
188
183
{},
189
184
{},
190
- vk::Format::eD32Sfloat,
185
+ gpu. workaround . attachmentLessRenderPass ? vk::Format::eD32Sfloat : vk::Format::eUndefined ,
191
186
},
192
187
}.get () };
193
188
}() } { }
0 commit comments