diff options
| author | 2021-05-25 01:52:02 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | 9cc1b8a873196dac5a97368df125816b5b195777 (patch) | |
| tree | 18e640848aa6e01707bc58479e3c776df0200440 /src/shader_recompiler/backend/glsl/emit_context.cpp | |
| parent | glsl: Revert ssbo aliasing. Storage Atomics impl (diff) | |
| download | yuzu-9cc1b8a873196dac5a97368df125816b5b195777.tar.gz yuzu-9cc1b8a873196dac5a97368df125816b5b195777.tar.xz yuzu-9cc1b8a873196dac5a97368df125816b5b195777.zip | |
glsl: F16x2 storage atomics
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 7986bf78f..a413219e3 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -39,6 +39,10 @@ void EmitContext::SetupExtensions(std::string& header) { | |||
| 39 | if (info.uses_atomic_f16x2_add || info.uses_atomic_f16x2_min || info.uses_atomic_f16x2_max) { | 39 | if (info.uses_atomic_f16x2_add || info.uses_atomic_f16x2_min || info.uses_atomic_f16x2_max) { |
| 40 | header += "#extension NV_shader_atomic_fp16_vector : enable\n"; | 40 | header += "#extension NV_shader_atomic_fp16_vector : enable\n"; |
| 41 | } | 41 | } |
| 42 | if (info.uses_fp16) { | ||
| 43 | // TODO: AMD | ||
| 44 | header += "#extension GL_NV_gpu_shader5 : enable\n"; | ||
| 45 | } | ||
| 42 | } | 46 | } |
| 43 | 47 | ||
| 44 | void EmitContext::DefineConstantBuffers() { | 48 | void EmitContext::DefineConstantBuffers() { |
| @@ -89,6 +93,18 @@ void EmitContext::DefineHelperFunctions() { | |||
| 89 | code += "uint CasFloatMax32x2(uint op_a,uint op_b){return " | 93 | code += "uint CasFloatMax32x2(uint op_a,uint op_b){return " |
| 90 | "packHalf2x16(max(unpackHalf2x16(op_a),unpackHalf2x16(op_b)));}\n"; | 94 | "packHalf2x16(max(unpackHalf2x16(op_a),unpackHalf2x16(op_b)));}\n"; |
| 91 | } | 95 | } |
| 96 | if (info.uses_atomic_f16x2_add) { | ||
| 97 | code += "uint CasFloatAdd16x2(uint op_a,uint op_b){return " | ||
| 98 | "packFloat2x16(unpackFloat2x16(op_a)+unpackFloat2x16(op_b));}\n"; | ||
| 99 | } | ||
| 100 | if (info.uses_atomic_f16x2_min) { | ||
| 101 | code += "uint CasFloatMin16x2(uint op_a,uint op_b){return " | ||
| 102 | "packFloat2x16(min(unpackFloat2x16(op_a),unpackFloat2x16(op_b)));}\n"; | ||
| 103 | } | ||
| 104 | if (info.uses_atomic_f16x2_max) { | ||
| 105 | code += "uint CasFloatMax16x2(uint op_a,uint op_b){return " | ||
| 106 | "packFloat2x16(max(unpackFloat2x16(op_a),unpackFloat2x16(op_b)));}\n"; | ||
| 107 | } | ||
| 92 | // TODO: Track this usage | 108 | // TODO: Track this usage |
| 93 | code += "uint CasMinS32(uint op_a,uint op_b){return uint(min(int(op_a),int(op_b)));}"; | 109 | code += "uint CasMinS32(uint op_a,uint op_b){return uint(min(int(op_a),int(op_b)));}"; |
| 94 | code += "uint CasMaxS32(uint op_a,uint op_b){return uint(max(int(op_a),int(op_b)));}"; | 110 | code += "uint CasMaxS32(uint op_a,uint op_b){return uint(max(int(op_a),int(op_b)));}"; |