diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 278c262f8..ddb86d070 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -281,11 +281,19 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) { | |||
| 281 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputTriangleStrip); | 281 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputTriangleStrip); |
| 282 | break; | 282 | break; |
| 283 | } | 283 | } |
| 284 | if (program.info.stores_point_size) { | 284 | if (program.info.stores[IR::Attribute::PointSize]) { |
| 285 | ctx.AddCapability(spv::Capability::GeometryPointSize); | 285 | ctx.AddCapability(spv::Capability::GeometryPointSize); |
| 286 | } | 286 | } |
| 287 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputVertices, program.output_vertices); | 287 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputVertices, program.output_vertices); |
| 288 | ctx.AddExecutionMode(main, spv::ExecutionMode::Invocations, program.invocations); | 288 | ctx.AddExecutionMode(main, spv::ExecutionMode::Invocations, program.invocations); |
| 289 | if (program.is_geometry_passthrough) { | ||
| 290 | if (ctx.profile.support_geometry_shader_passthrough) { | ||
| 291 | ctx.AddExtension("SPV_NV_geometry_shader_passthrough"); | ||
| 292 | ctx.AddCapability(spv::Capability::GeometryShaderPassthroughNV); | ||
| 293 | } else { | ||
| 294 | LOG_WARNING(Shader_SPIRV, "Geometry shader passthrough used with no support"); | ||
| 295 | } | ||
| 296 | } | ||
| 289 | break; | 297 | break; |
| 290 | case Stage::Fragment: | 298 | case Stage::Fragment: |
| 291 | execution_model = spv::ExecutionModel::Fragment; | 299 | execution_model = spv::ExecutionModel::Fragment; |
| @@ -377,20 +385,21 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct | |||
| 377 | ctx.AddExtension("SPV_EXT_demote_to_helper_invocation"); | 385 | ctx.AddExtension("SPV_EXT_demote_to_helper_invocation"); |
| 378 | ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT); | 386 | ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT); |
| 379 | } | 387 | } |
| 380 | if (info.stores_viewport_index) { | 388 | if (info.stores[IR::Attribute::ViewportIndex]) { |
| 381 | ctx.AddCapability(spv::Capability::MultiViewport); | 389 | ctx.AddCapability(spv::Capability::MultiViewport); |
| 382 | } | 390 | } |
| 383 | if (info.stores_viewport_mask && profile.support_viewport_mask) { | 391 | if (info.stores[IR::Attribute::ViewportMask] && profile.support_viewport_mask) { |
| 384 | ctx.AddExtension("SPV_NV_viewport_array2"); | 392 | ctx.AddExtension("SPV_NV_viewport_array2"); |
| 385 | ctx.AddCapability(spv::Capability::ShaderViewportMaskNV); | 393 | ctx.AddCapability(spv::Capability::ShaderViewportMaskNV); |
| 386 | } | 394 | } |
| 387 | if (info.stores_layer || info.stores_viewport_index) { | 395 | if (info.stores[IR::Attribute::Layer] || info.stores[IR::Attribute::ViewportIndex]) { |
| 388 | if (profile.support_viewport_index_layer_non_geometry && ctx.stage != Stage::Geometry) { | 396 | if (profile.support_viewport_index_layer_non_geometry && ctx.stage != Stage::Geometry) { |
| 389 | ctx.AddExtension("SPV_EXT_shader_viewport_index_layer"); | 397 | ctx.AddExtension("SPV_EXT_shader_viewport_index_layer"); |
| 390 | ctx.AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); | 398 | ctx.AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); |
| 391 | } | 399 | } |
| 392 | } | 400 | } |
| 393 | if (!profile.support_vertex_instance_id && (info.loads_instance_id || info.loads_vertex_id)) { | 401 | if (!profile.support_vertex_instance_id && |
| 402 | (info.loads[IR::Attribute::InstanceId] || info.loads[IR::Attribute::VertexId])) { | ||
| 394 | ctx.AddExtension("SPV_KHR_shader_draw_parameters"); | 403 | ctx.AddExtension("SPV_KHR_shader_draw_parameters"); |
| 395 | ctx.AddCapability(spv::Capability::DrawParameters); | 404 | ctx.AddCapability(spv::Capability::DrawParameters); |
| 396 | } | 405 | } |