diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 444ba276f..3bf4c6a9e 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -124,17 +124,17 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) { | |||
| 124 | const std::span interfaces(ctx.interfaces.data(), ctx.interfaces.size()); | 124 | const std::span interfaces(ctx.interfaces.data(), ctx.interfaces.size()); |
| 125 | spv::ExecutionModel execution_model{}; | 125 | spv::ExecutionModel execution_model{}; |
| 126 | switch (program.stage) { | 126 | switch (program.stage) { |
| 127 | case Shader::Stage::Compute: { | 127 | case Stage::Compute: { |
| 128 | const std::array<u32, 3> workgroup_size{program.workgroup_size}; | 128 | const std::array<u32, 3> workgroup_size{program.workgroup_size}; |
| 129 | execution_model = spv::ExecutionModel::GLCompute; | 129 | execution_model = spv::ExecutionModel::GLCompute; |
| 130 | ctx.AddExecutionMode(main, spv::ExecutionMode::LocalSize, workgroup_size[0], | 130 | ctx.AddExecutionMode(main, spv::ExecutionMode::LocalSize, workgroup_size[0], |
| 131 | workgroup_size[1], workgroup_size[2]); | 131 | workgroup_size[1], workgroup_size[2]); |
| 132 | break; | 132 | break; |
| 133 | } | 133 | } |
| 134 | case Shader::Stage::VertexB: | 134 | case Stage::VertexB: |
| 135 | execution_model = spv::ExecutionModel::Vertex; | 135 | execution_model = spv::ExecutionModel::Vertex; |
| 136 | break; | 136 | break; |
| 137 | case Shader::Stage::Geometry: | 137 | case Stage::Geometry: |
| 138 | execution_model = spv::ExecutionModel::Geometry; | 138 | execution_model = spv::ExecutionModel::Geometry; |
| 139 | ctx.AddCapability(spv::Capability::Geometry); | 139 | ctx.AddCapability(spv::Capability::Geometry); |
| 140 | ctx.AddCapability(spv::Capability::GeometryStreams); | 140 | ctx.AddCapability(spv::Capability::GeometryStreams); |
| @@ -172,7 +172,7 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) { | |||
| 172 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputVertices, program.output_vertices); | 172 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputVertices, program.output_vertices); |
| 173 | ctx.AddExecutionMode(main, spv::ExecutionMode::Invocations, program.invocations); | 173 | ctx.AddExecutionMode(main, spv::ExecutionMode::Invocations, program.invocations); |
| 174 | break; | 174 | break; |
| 175 | case Shader::Stage::Fragment: | 175 | case Stage::Fragment: |
| 176 | execution_model = spv::ExecutionModel::Fragment; | 176 | execution_model = spv::ExecutionModel::Fragment; |
| 177 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); | 177 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); |
| 178 | if (program.info.stores_frag_depth) { | 178 | if (program.info.stores_frag_depth) { |
| @@ -258,10 +258,14 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct | |||
| 258 | ctx.AddExtension("SPV_EXT_demote_to_helper_invocation"); | 258 | ctx.AddExtension("SPV_EXT_demote_to_helper_invocation"); |
| 259 | ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT); | 259 | ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT); |
| 260 | } | 260 | } |
| 261 | if (info.stores_layer) { | ||
| 262 | ctx.AddCapability(spv::Capability::ShaderLayer); | ||
| 263 | } | ||
| 261 | if (info.stores_viewport_index) { | 264 | if (info.stores_viewport_index) { |
| 262 | ctx.AddCapability(spv::Capability::MultiViewport); | 265 | ctx.AddCapability(spv::Capability::MultiViewport); |
| 263 | if (profile.support_viewport_index_layer_non_geometry && | 266 | } |
| 264 | ctx.stage != Shader::Stage::Geometry) { | 267 | if (info.stores_layer || info.stores_viewport_index) { |
| 268 | if (profile.support_viewport_index_layer_non_geometry && ctx.stage != Stage::Geometry) { | ||
| 265 | ctx.AddExtension("SPV_EXT_shader_viewport_index_layer"); | 269 | ctx.AddExtension("SPV_EXT_shader_viewport_index_layer"); |
| 266 | ctx.AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); | 270 | ctx.AddCapability(spv::Capability::ShaderViewportIndexLayerEXT); |
| 267 | } | 271 | } |