diff options
| author | 2021-05-09 22:01:03 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:31 -0400 | |
| commit | 80813b1d144a7f0f11047e7348620b720def93a9 (patch) | |
| tree | 705aafbb73d550a9ee8f3b5fd24fae9c4beb46d3 /src/shader_recompiler/backend/glasm/emit_glasm.cpp | |
| parent | glasm: Add conversion instructions to GLASM (diff) | |
| download | yuzu-80813b1d144a7f0f11047e7348620b720def93a9.tar.gz yuzu-80813b1d144a7f0f11047e7348620b720def93a9.tar.xz yuzu-80813b1d144a7f0f11047e7348620b720def93a9.zip | |
glasm: Implement storage atomic ops
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index 0e4b189c9..e6e065e7f 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -149,6 +149,18 @@ void EmitInst(EmitContext& ctx, IR::Inst* inst) { | |||
| 149 | } | 149 | } |
| 150 | throw LogicError("Invalid opcode {}", inst->GetOpcode()); | 150 | throw LogicError("Invalid opcode {}", inst->GetOpcode()); |
| 151 | } | 151 | } |
| 152 | |||
| 153 | void SetupOptions(std::string& header, Info info) { | ||
| 154 | if (info.uses_int64_bit_atomics) { | ||
| 155 | header += "OPTION NV_shader_atomic_int64;"; | ||
| 156 | } | ||
| 157 | if (info.uses_atomic_f32_add) { | ||
| 158 | header += "OPTION NV_shader_atomic_float;"; | ||
| 159 | } | ||
| 160 | if (info.uses_atomic_f16x2_add || info.uses_atomic_f16x2_min || info.uses_atomic_f16x2_max) { | ||
| 161 | header += "OPTION NV_shader_atomic_fp16_vector;"; | ||
| 162 | } | ||
| 163 | } | ||
| 152 | } // Anonymous namespace | 164 | } // Anonymous namespace |
| 153 | 165 | ||
| 154 | std::string EmitGLASM(const Profile&, IR::Program& program, Bindings&) { | 166 | std::string EmitGLASM(const Profile&, IR::Program& program, Bindings&) { |
| @@ -160,6 +172,7 @@ std::string EmitGLASM(const Profile&, IR::Program& program, Bindings&) { | |||
| 160 | } | 172 | } |
| 161 | std::string header = "!!NVcp5.0\n" | 173 | std::string header = "!!NVcp5.0\n" |
| 162 | "OPTION NV_internal;"; | 174 | "OPTION NV_internal;"; |
| 175 | SetupOptions(header, program.info); | ||
| 163 | switch (program.stage) { | 176 | switch (program.stage) { |
| 164 | case Stage::Compute: | 177 | case Stage::Compute: |
| 165 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], | 178 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], |