diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index cee72f50d..4bed16e7b 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -126,10 +126,10 @@ Id DefineMain(EmitContext& ctx, IR::Program& program) { | |||
| 126 | return main; | 126 | return main; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | void DefineEntryPoint(Environment& env, EmitContext& ctx, Id main) { | 129 | void DefineEntryPoint(Environment& env, const IR::Program& program, EmitContext& ctx, Id main) { |
| 130 | const std::span interfaces(ctx.interfaces.data(), ctx.interfaces.size()); | 130 | const std::span interfaces(ctx.interfaces.data(), ctx.interfaces.size()); |
| 131 | spv::ExecutionModel execution_model{}; | 131 | spv::ExecutionModel execution_model{}; |
| 132 | switch (env.ShaderStage()) { | 132 | switch (program.stage) { |
| 133 | case Shader::Stage::Compute: { | 133 | case Shader::Stage::Compute: { |
| 134 | const std::array<u32, 3> workgroup_size{env.WorkgroupSize()}; | 134 | const std::array<u32, 3> workgroup_size{env.WorkgroupSize()}; |
| 135 | execution_model = spv::ExecutionModel::GLCompute; | 135 | execution_model = spv::ExecutionModel::GLCompute; |
| @@ -143,6 +143,9 @@ void DefineEntryPoint(Environment& env, EmitContext& ctx, Id main) { | |||
| 143 | case Shader::Stage::Fragment: | 143 | case Shader::Stage::Fragment: |
| 144 | execution_model = spv::ExecutionModel::Fragment; | 144 | execution_model = spv::ExecutionModel::Fragment; |
| 145 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); | 145 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); |
| 146 | if (program.info.stores_frag_depth) { | ||
| 147 | ctx.AddExecutionMode(main, spv::ExecutionMode::DepthReplacing); | ||
| 148 | } | ||
| 146 | break; | 149 | break; |
| 147 | default: | 150 | default: |
| 148 | throw NotImplementedException("Stage {}", env.ShaderStage()); | 151 | throw NotImplementedException("Stage {}", env.ShaderStage()); |
| @@ -235,6 +238,7 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct | |||
| 235 | } | 238 | } |
| 236 | // TODO: Track this usage | 239 | // TODO: Track this usage |
| 237 | ctx.AddCapability(spv::Capability::ImageGatherExtended); | 240 | ctx.AddCapability(spv::Capability::ImageGatherExtended); |
| 241 | ctx.AddCapability(spv::Capability::ImageQuery); | ||
| 238 | } | 242 | } |
| 239 | 243 | ||
| 240 | Id PhiArgDef(EmitContext& ctx, IR::Inst* inst, size_t index) { | 244 | Id PhiArgDef(EmitContext& ctx, IR::Inst* inst, size_t index) { |
| @@ -267,7 +271,7 @@ std::vector<u32> EmitSPIRV(const Profile& profile, Environment& env, IR::Program | |||
| 267 | u32& binding) { | 271 | u32& binding) { |
| 268 | EmitContext ctx{profile, program, binding}; | 272 | EmitContext ctx{profile, program, binding}; |
| 269 | const Id main{DefineMain(ctx, program)}; | 273 | const Id main{DefineMain(ctx, program)}; |
| 270 | DefineEntryPoint(env, ctx, main); | 274 | DefineEntryPoint(env, program, ctx, main); |
| 271 | if (profile.support_float_controls) { | 275 | if (profile.support_float_controls) { |
| 272 | ctx.AddExtension("SPV_KHR_float_controls"); | 276 | ctx.AddExtension("SPV_KHR_float_controls"); |
| 273 | SetupDenormControl(profile, program, ctx, main); | 277 | SetupDenormControl(profile, program, ctx, main); |