diff options
| author | 2021-03-27 03:08:31 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:24 -0400 | |
| commit | 675a82416d7775dc7a252a5d8f5b704e6b8f2326 (patch) | |
| tree | 4964c92716029716255d75e26dcc033487df6b1e /src/shader_recompiler/backend/spirv/emit_spirv.cpp | |
| parent | vk_pipeline_cache: Fix pipeline and shader caches (diff) | |
| download | yuzu-675a82416d7775dc7a252a5d8f5b704e6b8f2326.tar.gz yuzu-675a82416d7775dc7a252a5d8f5b704e6b8f2326.tar.xz yuzu-675a82416d7775dc7a252a5d8f5b704e6b8f2326.zip | |
spirv: Remove dependencies on Environment when generating SPIR-V
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 4bed16e7b..2e7e6bb0c 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -126,12 +126,12 @@ Id DefineMain(EmitContext& ctx, IR::Program& program) { | |||
| 126 | return main; | 126 | return main; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | void DefineEntryPoint(Environment& env, const IR::Program& program, EmitContext& ctx, Id main) { | 129 | void DefineEntryPoint(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 (program.stage) { | 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{program.workgroup_size}; |
| 135 | execution_model = spv::ExecutionModel::GLCompute; | 135 | execution_model = spv::ExecutionModel::GLCompute; |
| 136 | ctx.AddExecutionMode(main, spv::ExecutionMode::LocalSize, workgroup_size[0], | 136 | ctx.AddExecutionMode(main, spv::ExecutionMode::LocalSize, workgroup_size[0], |
| 137 | workgroup_size[1], workgroup_size[2]); | 137 | workgroup_size[1], workgroup_size[2]); |
| @@ -148,7 +148,7 @@ void DefineEntryPoint(Environment& env, const IR::Program& program, EmitContext& | |||
| 148 | } | 148 | } |
| 149 | break; | 149 | break; |
| 150 | default: | 150 | default: |
| 151 | throw NotImplementedException("Stage {}", env.ShaderStage()); | 151 | throw NotImplementedException("Stage {}", program.stage); |
| 152 | } | 152 | } |
| 153 | ctx.AddEntryPoint(execution_model, main, "main", interfaces); | 153 | ctx.AddEntryPoint(execution_model, main, "main", interfaces); |
| 154 | } | 154 | } |
| @@ -267,11 +267,10 @@ Id PhiArgDef(EmitContext& ctx, IR::Inst* inst, size_t index) { | |||
| 267 | } | 267 | } |
| 268 | } // Anonymous namespace | 268 | } // Anonymous namespace |
| 269 | 269 | ||
| 270 | std::vector<u32> EmitSPIRV(const Profile& profile, Environment& env, IR::Program& program, | 270 | std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& binding) { |
| 271 | u32& binding) { | ||
| 272 | EmitContext ctx{profile, program, binding}; | 271 | EmitContext ctx{profile, program, binding}; |
| 273 | const Id main{DefineMain(ctx, program)}; | 272 | const Id main{DefineMain(ctx, program)}; |
| 274 | DefineEntryPoint(env, program, ctx, main); | 273 | DefineEntryPoint(program, ctx, main); |
| 275 | if (profile.support_float_controls) { | 274 | if (profile.support_float_controls) { |
| 276 | ctx.AddExtension("SPV_KHR_float_controls"); | 275 | ctx.AddExtension("SPV_KHR_float_controls"); |
| 277 | SetupDenormControl(profile, program, ctx, main); | 276 | SetupDenormControl(profile, program, ctx, main); |