diff options
Diffstat (limited to 'src/shader_recompiler/backend')
10 files changed, 398 insertions, 260 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 8eea6344f..b3a3e5647 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -12,6 +12,7 @@ EmitContext::EmitContext(IR::Program& program, [[maybe_unused]] Bindings& bindin | |||
| 12 | const Profile& profile_) | 12 | const Profile& profile_) |
| 13 | : info{program.info}, profile{profile_} { | 13 | : info{program.info}, profile{profile_} { |
| 14 | std::string header = "#version 450\n"; | 14 | std::string header = "#version 450\n"; |
| 15 | SetupExtensions(header); | ||
| 15 | if (program.stage == Stage::Compute) { | 16 | if (program.stage == Stage::Compute) { |
| 16 | header += fmt::format("layout(local_size_x={},local_size_y={},local_size_z={}) in;\n", | 17 | header += fmt::format("layout(local_size_x={},local_size_y={},local_size_z={}) in;\n", |
| 17 | program.workgroup_size[0], program.workgroup_size[1], | 18 | program.workgroup_size[0], program.workgroup_size[1], |
| @@ -23,6 +24,12 @@ EmitContext::EmitContext(IR::Program& program, [[maybe_unused]] Bindings& bindin | |||
| 23 | code += "void main(){\n"; | 24 | code += "void main(){\n"; |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 27 | void EmitContext::SetupExtensions(std::string& header) { | ||
| 28 | if (info.uses_int64) { | ||
| 29 | header += "#extension GL_ARB_gpu_shader_int64 : enable\n"; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 26 | void EmitContext::DefineConstantBuffers() { | 33 | void EmitContext::DefineConstantBuffers() { |
| 27 | if (info.constant_buffer_descriptors.empty()) { | 34 | if (info.constant_buffer_descriptors.empty()) { |
| 28 | return; | 35 | return; |
diff --git a/src/shader_recompiler/backend/glsl/emit_context.h b/src/shader_recompiler/backend/glsl/emit_context.h index 81b970c14..f8cf8fdbc 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.h +++ b/src/shader_recompiler/backend/glsl/emit_context.h | |||
| @@ -38,28 +38,46 @@ public: | |||
| 38 | // code += '\n'; | 38 | // code += '\n'; |
| 39 | // } | 39 | // } |
| 40 | 40 | ||
| 41 | template <typename... Args> | 41 | template <Type type, typename... Args> |
| 42 | void AddU32(const char* format_str, IR::Inst& inst, Args&&... args) { | 42 | void Add(const char* format_str, IR::Inst& inst, Args&&... args) { |
| 43 | code += | 43 | code += fmt::format(format_str, reg_alloc.Define(inst, type), std::forward<Args>(args)...); |
| 44 | fmt::format(format_str, reg_alloc.Define(inst, Type::U32), std::forward<Args>(args)...); | ||
| 45 | // TODO: Remove this | 44 | // TODO: Remove this |
| 46 | code += '\n'; | 45 | code += '\n'; |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | template <typename... Args> | 48 | template <typename... Args> |
| 49 | void AddU1(const char* format_str, IR::Inst& inst, Args&&... args) { | ||
| 50 | Add<Type::U1>(format_str, inst, args...); | ||
| 51 | } | ||
| 52 | |||
| 53 | template <typename... Args> | ||
| 54 | void AddU32(const char* format_str, IR::Inst& inst, Args&&... args) { | ||
| 55 | Add<Type::U32>(format_str, inst, args...); | ||
| 56 | } | ||
| 57 | |||
| 58 | template <typename... Args> | ||
| 50 | void AddS32(const char* format_str, IR::Inst& inst, Args&&... args) { | 59 | void AddS32(const char* format_str, IR::Inst& inst, Args&&... args) { |
| 51 | code += | 60 | Add<Type::S32>(format_str, inst, args...); |
| 52 | fmt::format(format_str, reg_alloc.Define(inst, Type::S32), std::forward<Args>(args)...); | ||
| 53 | // TODO: Remove this | ||
| 54 | code += '\n'; | ||
| 55 | } | 61 | } |
| 56 | 62 | ||
| 57 | template <typename... Args> | 63 | template <typename... Args> |
| 58 | void AddF32(const char* format_str, IR::Inst& inst, Args&&... args) { | 64 | void AddF32(const char* format_str, IR::Inst& inst, Args&&... args) { |
| 59 | code += | 65 | Add<Type::F32>(format_str, inst, args...); |
| 60 | fmt::format(format_str, reg_alloc.Define(inst, Type::F32), std::forward<Args>(args)...); | 66 | } |
| 61 | // TODO: Remove this | 67 | |
| 62 | code += '\n'; | 68 | template <typename... Args> |
| 69 | void AddU64(const char* format_str, IR::Inst& inst, Args&&... args) { | ||
| 70 | Add<Type::U64>(format_str, inst, args...); | ||
| 71 | } | ||
| 72 | |||
| 73 | template <typename... Args> | ||
| 74 | void AddU32x2(const char* format_str, IR::Inst& inst, Args&&... args) { | ||
| 75 | Add<Type::U32x2>(format_str, inst, args...); | ||
| 76 | } | ||
| 77 | |||
| 78 | template <typename... Args> | ||
| 79 | void AddF32x2(const char* format_str, IR::Inst& inst, Args&&... args) { | ||
| 80 | Add<Type::F32x2>(format_str, inst, args...); | ||
| 63 | } | 81 | } |
| 64 | 82 | ||
| 65 | template <typename... Args> | 83 | template <typename... Args> |
| @@ -75,6 +93,7 @@ public: | |||
| 75 | const Profile& profile; | 93 | const Profile& profile; |
| 76 | 94 | ||
| 77 | private: | 95 | private: |
| 96 | void SetupExtensions(std::string& header); | ||
| 78 | void DefineConstantBuffers(); | 97 | void DefineConstantBuffers(); |
| 79 | void DefineStorageBuffers(); | 98 | void DefineStorageBuffers(); |
| 80 | }; | 99 | }; |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp index f40f9900c..73cb66674 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp | |||
| @@ -25,4 +25,17 @@ static void Alias(IR::Inst& inst, const IR::Value& value) { | |||
| 25 | void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) { | 25 | void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) { |
| 26 | Alias(inst, value); | 26 | Alias(inst, value); |
| 27 | } | 27 | } |
| 28 | |||
| 29 | void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value) { | ||
| 30 | ctx.AddU1("{}={};", inst, ctx.reg_alloc.Consume(value)); | ||
| 31 | } | ||
| 32 | |||
| 33 | void EmitPackUint2x32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | ||
| 34 | ctx.AddU64("{}=packUint2x32({});", inst, value); | ||
| 35 | } | ||
| 36 | |||
| 37 | void EmitUnpackUint2x32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | ||
| 38 | ctx.AddU32x2("{}=unpackUint2x32({});", inst, value); | ||
| 39 | } | ||
| 40 | |||
| 28 | } // namespace Shader::Backend::GLSL | 41 | } // namespace Shader::Backend::GLSL |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp index e69de29bb..2a7d207a7 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp | |||
| @@ -0,0 +1,237 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string_view> | ||
| 6 | |||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | ||
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | ||
| 10 | #include "shader_recompiler/profile.h" | ||
| 11 | |||
| 12 | namespace Shader::Backend::GLSL { | ||
| 13 | void EmitCompositeConstructU32x2([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, | ||
| 14 | [[maybe_unused]] std::string_view e1, | ||
| 15 | [[maybe_unused]] std::string_view e2) { | ||
| 16 | ctx.AddU32x2("{}=uvec2({},{});", inst, e1, e2); | ||
| 17 | } | ||
| 18 | |||
| 19 | void EmitCompositeConstructU32x3([[maybe_unused]] EmitContext& ctx, | ||
| 20 | [[maybe_unused]] std::string_view e1, | ||
| 21 | [[maybe_unused]] std::string_view e2, | ||
| 22 | [[maybe_unused]] std::string_view e3) { | ||
| 23 | throw NotImplementedException("GLSL Instruction"); | ||
| 24 | } | ||
| 25 | |||
| 26 | void EmitCompositeConstructU32x4([[maybe_unused]] EmitContext& ctx, | ||
| 27 | [[maybe_unused]] std::string_view e1, | ||
| 28 | [[maybe_unused]] std::string_view e2, | ||
| 29 | [[maybe_unused]] std::string_view e3, | ||
| 30 | [[maybe_unused]] std::string_view e4) { | ||
| 31 | throw NotImplementedException("GLSL Instruction"); | ||
| 32 | } | ||
| 33 | |||
| 34 | void EmitCompositeExtractU32x2([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, | ||
| 35 | [[maybe_unused]] std::string_view composite, | ||
| 36 | [[maybe_unused]] u32 index) { | ||
| 37 | ctx.AddU32("{}={}[{}];", inst, composite, index); | ||
| 38 | } | ||
| 39 | |||
| 40 | void EmitCompositeExtractU32x3([[maybe_unused]] EmitContext& ctx, | ||
| 41 | [[maybe_unused]] std::string_view composite, | ||
| 42 | [[maybe_unused]] u32 index) { | ||
| 43 | throw NotImplementedException("GLSL Instruction"); | ||
| 44 | } | ||
| 45 | |||
| 46 | void EmitCompositeExtractU32x4([[maybe_unused]] EmitContext& ctx, | ||
| 47 | [[maybe_unused]] std::string_view composite, | ||
| 48 | [[maybe_unused]] u32 index) { | ||
| 49 | throw NotImplementedException("GLSL Instruction"); | ||
| 50 | } | ||
| 51 | |||
| 52 | void EmitCompositeInsertU32x2([[maybe_unused]] EmitContext& ctx, | ||
| 53 | [[maybe_unused]] std::string_view composite, | ||
| 54 | [[maybe_unused]] std::string_view object, | ||
| 55 | [[maybe_unused]] u32 index) { | ||
| 56 | throw NotImplementedException("GLSL Instruction"); | ||
| 57 | } | ||
| 58 | |||
| 59 | void EmitCompositeInsertU32x3([[maybe_unused]] EmitContext& ctx, | ||
| 60 | [[maybe_unused]] std::string_view composite, | ||
| 61 | [[maybe_unused]] std::string_view object, | ||
| 62 | [[maybe_unused]] u32 index) { | ||
| 63 | throw NotImplementedException("GLSL Instruction"); | ||
| 64 | } | ||
| 65 | |||
| 66 | void EmitCompositeInsertU32x4([[maybe_unused]] EmitContext& ctx, | ||
| 67 | [[maybe_unused]] std::string_view composite, | ||
| 68 | [[maybe_unused]] std::string_view object, | ||
| 69 | [[maybe_unused]] u32 index) { | ||
| 70 | throw NotImplementedException("GLSL Instruction"); | ||
| 71 | } | ||
| 72 | |||
| 73 | void EmitCompositeConstructF16x2([[maybe_unused]] EmitContext& ctx, | ||
| 74 | [[maybe_unused]] std::string_view e1, | ||
| 75 | [[maybe_unused]] std::string_view e2) { | ||
| 76 | throw NotImplementedException("GLSL Instruction"); | ||
| 77 | } | ||
| 78 | |||
| 79 | void EmitCompositeConstructF16x3([[maybe_unused]] EmitContext& ctx, | ||
| 80 | [[maybe_unused]] std::string_view e1, | ||
| 81 | [[maybe_unused]] std::string_view e2, | ||
| 82 | [[maybe_unused]] std::string_view e3) { | ||
| 83 | throw NotImplementedException("GLSL Instruction"); | ||
| 84 | } | ||
| 85 | |||
| 86 | void EmitCompositeConstructF16x4([[maybe_unused]] EmitContext& ctx, | ||
| 87 | [[maybe_unused]] std::string_view e1, | ||
| 88 | [[maybe_unused]] std::string_view e2, | ||
| 89 | [[maybe_unused]] std::string_view e3, | ||
| 90 | [[maybe_unused]] std::string_view e4) { | ||
| 91 | throw NotImplementedException("GLSL Instruction"); | ||
| 92 | } | ||
| 93 | |||
| 94 | void EmitCompositeExtractF16x2([[maybe_unused]] EmitContext& ctx, | ||
| 95 | [[maybe_unused]] std::string_view composite, | ||
| 96 | [[maybe_unused]] u32 index) { | ||
| 97 | throw NotImplementedException("GLSL Instruction"); | ||
| 98 | } | ||
| 99 | |||
| 100 | void EmitCompositeExtractF16x3([[maybe_unused]] EmitContext& ctx, | ||
| 101 | [[maybe_unused]] std::string_view composite, | ||
| 102 | [[maybe_unused]] u32 index) { | ||
| 103 | throw NotImplementedException("GLSL Instruction"); | ||
| 104 | } | ||
| 105 | |||
| 106 | void EmitCompositeExtractF16x4([[maybe_unused]] EmitContext& ctx, | ||
| 107 | [[maybe_unused]] std::string_view composite, | ||
| 108 | [[maybe_unused]] u32 index) { | ||
| 109 | throw NotImplementedException("GLSL Instruction"); | ||
| 110 | } | ||
| 111 | |||
| 112 | void EmitCompositeInsertF16x2([[maybe_unused]] EmitContext& ctx, | ||
| 113 | [[maybe_unused]] std::string_view composite, | ||
| 114 | [[maybe_unused]] std::string_view object, | ||
| 115 | [[maybe_unused]] u32 index) { | ||
| 116 | throw NotImplementedException("GLSL Instruction"); | ||
| 117 | } | ||
| 118 | |||
| 119 | void EmitCompositeInsertF16x3([[maybe_unused]] EmitContext& ctx, | ||
| 120 | [[maybe_unused]] std::string_view composite, | ||
| 121 | [[maybe_unused]] std::string_view object, | ||
| 122 | [[maybe_unused]] u32 index) { | ||
| 123 | throw NotImplementedException("GLSL Instruction"); | ||
| 124 | } | ||
| 125 | |||
| 126 | void EmitCompositeInsertF16x4([[maybe_unused]] EmitContext& ctx, | ||
| 127 | [[maybe_unused]] std::string_view composite, | ||
| 128 | [[maybe_unused]] std::string_view object, | ||
| 129 | [[maybe_unused]] u32 index) { | ||
| 130 | throw NotImplementedException("GLSL Instruction"); | ||
| 131 | } | ||
| 132 | |||
| 133 | void EmitCompositeConstructF32x2([[maybe_unused]] EmitContext& ctx, | ||
| 134 | [[maybe_unused]] std::string_view e1, | ||
| 135 | [[maybe_unused]] std::string_view e2) { | ||
| 136 | throw NotImplementedException("GLSL Instruction"); | ||
| 137 | } | ||
| 138 | |||
| 139 | void EmitCompositeConstructF32x3([[maybe_unused]] EmitContext& ctx, | ||
| 140 | [[maybe_unused]] std::string_view e1, | ||
| 141 | [[maybe_unused]] std::string_view e2, | ||
| 142 | [[maybe_unused]] std::string_view e3) { | ||
| 143 | throw NotImplementedException("GLSL Instruction"); | ||
| 144 | } | ||
| 145 | |||
| 146 | void EmitCompositeConstructF32x4([[maybe_unused]] EmitContext& ctx, | ||
| 147 | [[maybe_unused]] std::string_view e1, | ||
| 148 | [[maybe_unused]] std::string_view e2, | ||
| 149 | [[maybe_unused]] std::string_view e3, | ||
| 150 | [[maybe_unused]] std::string_view e4) { | ||
| 151 | throw NotImplementedException("GLSL Instruction"); | ||
| 152 | } | ||
| 153 | |||
| 154 | void EmitCompositeExtractF32x2([[maybe_unused]] EmitContext& ctx, | ||
| 155 | [[maybe_unused]] std::string_view composite, | ||
| 156 | [[maybe_unused]] u32 index) { | ||
| 157 | throw NotImplementedException("GLSL Instruction"); | ||
| 158 | } | ||
| 159 | |||
| 160 | void EmitCompositeExtractF32x3([[maybe_unused]] EmitContext& ctx, | ||
| 161 | [[maybe_unused]] std::string_view composite, | ||
| 162 | [[maybe_unused]] u32 index) { | ||
| 163 | throw NotImplementedException("GLSL Instruction"); | ||
| 164 | } | ||
| 165 | |||
| 166 | void EmitCompositeExtractF32x4([[maybe_unused]] EmitContext& ctx, | ||
| 167 | [[maybe_unused]] std::string_view composite, | ||
| 168 | [[maybe_unused]] u32 index) { | ||
| 169 | throw NotImplementedException("GLSL Instruction"); | ||
| 170 | } | ||
| 171 | |||
| 172 | void EmitCompositeInsertF32x2([[maybe_unused]] EmitContext& ctx, | ||
| 173 | [[maybe_unused]] std::string_view composite, | ||
| 174 | [[maybe_unused]] std::string_view object, | ||
| 175 | [[maybe_unused]] u32 index) { | ||
| 176 | throw NotImplementedException("GLSL Instruction"); | ||
| 177 | } | ||
| 178 | |||
| 179 | void EmitCompositeInsertF32x3([[maybe_unused]] EmitContext& ctx, | ||
| 180 | [[maybe_unused]] std::string_view composite, | ||
| 181 | [[maybe_unused]] std::string_view object, | ||
| 182 | [[maybe_unused]] u32 index) { | ||
| 183 | throw NotImplementedException("GLSL Instruction"); | ||
| 184 | } | ||
| 185 | |||
| 186 | void EmitCompositeInsertF32x4([[maybe_unused]] EmitContext& ctx, | ||
| 187 | [[maybe_unused]] std::string_view composite, | ||
| 188 | [[maybe_unused]] std::string_view object, | ||
| 189 | [[maybe_unused]] u32 index) { | ||
| 190 | throw NotImplementedException("GLSL Instruction"); | ||
| 191 | } | ||
| 192 | |||
| 193 | void EmitCompositeConstructF64x2([[maybe_unused]] EmitContext& ctx) { | ||
| 194 | throw NotImplementedException("GLSL Instruction"); | ||
| 195 | } | ||
| 196 | |||
| 197 | void EmitCompositeConstructF64x3([[maybe_unused]] EmitContext& ctx) { | ||
| 198 | throw NotImplementedException("GLSL Instruction"); | ||
| 199 | } | ||
| 200 | |||
| 201 | void EmitCompositeConstructF64x4([[maybe_unused]] EmitContext& ctx) { | ||
| 202 | throw NotImplementedException("GLSL Instruction"); | ||
| 203 | } | ||
| 204 | |||
| 205 | void EmitCompositeExtractF64x2([[maybe_unused]] EmitContext& ctx) { | ||
| 206 | throw NotImplementedException("GLSL Instruction"); | ||
| 207 | } | ||
| 208 | |||
| 209 | void EmitCompositeExtractF64x3([[maybe_unused]] EmitContext& ctx) { | ||
| 210 | throw NotImplementedException("GLSL Instruction"); | ||
| 211 | } | ||
| 212 | |||
| 213 | void EmitCompositeExtractF64x4([[maybe_unused]] EmitContext& ctx) { | ||
| 214 | throw NotImplementedException("GLSL Instruction"); | ||
| 215 | } | ||
| 216 | |||
| 217 | void EmitCompositeInsertF64x2([[maybe_unused]] EmitContext& ctx, | ||
| 218 | [[maybe_unused]] std::string_view composite, | ||
| 219 | [[maybe_unused]] std::string_view object, | ||
| 220 | [[maybe_unused]] u32 index) { | ||
| 221 | throw NotImplementedException("GLSL Instruction"); | ||
| 222 | } | ||
| 223 | |||
| 224 | void EmitCompositeInsertF64x3([[maybe_unused]] EmitContext& ctx, | ||
| 225 | [[maybe_unused]] std::string_view composite, | ||
| 226 | [[maybe_unused]] std::string_view object, | ||
| 227 | [[maybe_unused]] u32 index) { | ||
| 228 | throw NotImplementedException("GLSL Instruction"); | ||
| 229 | } | ||
| 230 | |||
| 231 | void EmitCompositeInsertF64x4([[maybe_unused]] EmitContext& ctx, | ||
| 232 | [[maybe_unused]] std::string_view composite, | ||
| 233 | [[maybe_unused]] std::string_view object, | ||
| 234 | [[maybe_unused]] u32 index) { | ||
| 235 | throw NotImplementedException("GLSL Instruction"); | ||
| 236 | } | ||
| 237 | } // namespace Shader::Backend::GLSL | ||
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index ff0c9cd95..51dbeb2c1 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -142,12 +142,14 @@ void EmitWriteSharedU16(EmitContext& ctx, std::string_view offset, std::string_v | |||
| 142 | void EmitWriteSharedU32(EmitContext& ctx, std::string_view offset, std::string_view value); | 142 | void EmitWriteSharedU32(EmitContext& ctx, std::string_view offset, std::string_view value); |
| 143 | void EmitWriteSharedU64(EmitContext& ctx, std::string_view offset, std::string_view value); | 143 | void EmitWriteSharedU64(EmitContext& ctx, std::string_view offset, std::string_view value); |
| 144 | void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_view value); | 144 | void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_view value); |
| 145 | void EmitCompositeConstructU32x2(EmitContext& ctx, std::string_view e1, std::string_view e2); | 145 | void EmitCompositeConstructU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view e1, |
| 146 | std::string_view e2); | ||
| 146 | void EmitCompositeConstructU32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, | 147 | void EmitCompositeConstructU32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, |
| 147 | std::string_view e3); | 148 | std::string_view e3); |
| 148 | void EmitCompositeConstructU32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, | 149 | void EmitCompositeConstructU32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, |
| 149 | std::string_view e3, std::string_view e4); | 150 | std::string_view e3, std::string_view e4); |
| 150 | void EmitCompositeExtractU32x2(EmitContext& ctx, std::string_view composite, u32 index); | 151 | void EmitCompositeExtractU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view composite, |
| 152 | u32 index); | ||
| 151 | void EmitCompositeExtractU32x3(EmitContext& ctx, std::string_view composite, u32 index); | 153 | void EmitCompositeExtractU32x3(EmitContext& ctx, std::string_view composite, u32 index); |
| 152 | void EmitCompositeExtractU32x4(EmitContext& ctx, std::string_view composite, u32 index); | 154 | void EmitCompositeExtractU32x4(EmitContext& ctx, std::string_view composite, u32 index); |
| 153 | void EmitCompositeInsertU32x2(EmitContext& ctx, std::string_view composite, std::string_view object, | 155 | void EmitCompositeInsertU32x2(EmitContext& ctx, std::string_view composite, std::string_view object, |
| @@ -218,8 +220,8 @@ void EmitBitCastU64F64(EmitContext& ctx); | |||
| 218 | void EmitBitCastF16U16(EmitContext& ctx); | 220 | void EmitBitCastF16U16(EmitContext& ctx); |
| 219 | void EmitBitCastF32U32(EmitContext& ctx, std::string_view value); | 221 | void EmitBitCastF32U32(EmitContext& ctx, std::string_view value); |
| 220 | void EmitBitCastF64U64(EmitContext& ctx); | 222 | void EmitBitCastF64U64(EmitContext& ctx); |
| 221 | void EmitPackUint2x32(EmitContext& ctx, std::string_view value); | 223 | void EmitPackUint2x32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 222 | void EmitUnpackUint2x32(EmitContext& ctx, std::string_view value); | 224 | void EmitUnpackUint2x32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 223 | void EmitPackFloat2x16(EmitContext& ctx, std::string_view value); | 225 | void EmitPackFloat2x16(EmitContext& ctx, std::string_view value); |
| 224 | void EmitUnpackFloat2x16(EmitContext& ctx, std::string_view value); | 226 | void EmitUnpackFloat2x16(EmitContext& ctx, std::string_view value); |
| 225 | void EmitPackHalf2x16(EmitContext& ctx, std::string_view value); | 227 | void EmitPackHalf2x16(EmitContext& ctx, std::string_view value); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp index a22313141..016bccd39 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | // Copyright 2021 yuzu Emulator Project | 1 | // Copyright 2021 yuzu Emulator Project |
| 3 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 4 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| @@ -48,7 +47,7 @@ void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in | |||
| 48 | 47 | ||
| 49 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 48 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 50 | [[maybe_unused]] std::string_view value) { | 49 | [[maybe_unused]] std::string_view value) { |
| 51 | throw NotImplementedException("GLSL Instruction"); | 50 | ctx.AddU32("{}=abs({});", inst, value); |
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 53 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -59,52 +58,52 @@ void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in | |||
| 59 | void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 58 | void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 60 | [[maybe_unused]] std::string_view base, | 59 | [[maybe_unused]] std::string_view base, |
| 61 | [[maybe_unused]] std::string_view shift) { | 60 | [[maybe_unused]] std::string_view shift) { |
| 62 | throw NotImplementedException("GLSL Instruction"); | 61 | ctx.AddU32("{}={}<<{};", inst, base, shift); |
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 64 | void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 66 | [[maybe_unused]] std::string_view base, | 65 | [[maybe_unused]] std::string_view base, |
| 67 | [[maybe_unused]] std::string_view shift) { | 66 | [[maybe_unused]] std::string_view shift) { |
| 68 | throw NotImplementedException("GLSL Instruction"); | 67 | ctx.AddU64("{}={}<<{};", inst, base, shift); |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 70 | void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 72 | [[maybe_unused]] std::string_view base, | 71 | [[maybe_unused]] std::string_view base, |
| 73 | [[maybe_unused]] std::string_view shift) { | 72 | [[maybe_unused]] std::string_view shift) { |
| 74 | throw NotImplementedException("GLSL Instruction"); | 73 | ctx.AddU32("{}={}>>{};", inst, base, shift); |
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 76 | void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 78 | [[maybe_unused]] std::string_view base, | 77 | [[maybe_unused]] std::string_view base, |
| 79 | [[maybe_unused]] std::string_view shift) { | 78 | [[maybe_unused]] std::string_view shift) { |
| 80 | throw NotImplementedException("GLSL Instruction"); | 79 | ctx.AddU64("{}={}>>{};", inst, base, shift); |
| 81 | } | 80 | } |
| 82 | 81 | ||
| 83 | void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 82 | void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 84 | [[maybe_unused]] std::string_view base, | 83 | [[maybe_unused]] std::string_view base, |
| 85 | [[maybe_unused]] std::string_view shift) { | 84 | [[maybe_unused]] std::string_view shift) { |
| 86 | throw NotImplementedException("GLSL Instruction"); | 85 | ctx.AddS32("{}=int({})>>{};", inst, base, shift); |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 88 | void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 90 | [[maybe_unused]] std::string_view base, | 89 | [[maybe_unused]] std::string_view base, |
| 91 | [[maybe_unused]] std::string_view shift) { | 90 | [[maybe_unused]] std::string_view shift) { |
| 92 | throw NotImplementedException("GLSL Instruction"); | 91 | ctx.AddU64("{}=int64_t({})>>{};", inst, base, shift); |
| 93 | } | 92 | } |
| 94 | 93 | ||
| 95 | void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 94 | void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 96 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 95 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 97 | throw NotImplementedException("GLSL Instruction"); | 96 | ctx.AddU32("{}={}&{};", inst, a, b); |
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 99 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 101 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 100 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 102 | throw NotImplementedException("GLSL Instruction"); | 101 | ctx.AddU32("{}={}|{};", inst, a, b); |
| 103 | } | 102 | } |
| 104 | 103 | ||
| 105 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 104 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 106 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 105 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 107 | throw NotImplementedException("GLSL Instruction"); | 106 | ctx.AddU32("{}={}^{};", inst, a, b); |
| 108 | } | 107 | } |
| 109 | 108 | ||
| 110 | void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 109 | void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -141,7 +140,7 @@ void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst | |||
| 141 | 140 | ||
| 142 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 141 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 143 | [[maybe_unused]] std::string_view value) { | 142 | [[maybe_unused]] std::string_view value) { |
| 144 | throw NotImplementedException("GLSL Instruction"); | 143 | ctx.AddU32("{}=~{};", inst, value); |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 147 | void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 146 | void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -156,22 +155,22 @@ void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst | |||
| 156 | 155 | ||
| 157 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 156 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 158 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 157 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 159 | throw NotImplementedException("GLSL Instruction"); | 158 | ctx.AddU32("{}=min(int({}), int({}));", inst, a, b); |
| 160 | } | 159 | } |
| 161 | 160 | ||
| 162 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 161 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 163 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 162 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 164 | throw NotImplementedException("GLSL Instruction"); | 163 | ctx.AddU32("{}=min(uint({}), uint({}));", inst, a, b); |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 167 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 166 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 168 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 167 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 169 | throw NotImplementedException("GLSL Instruction"); | 168 | ctx.AddU32("{}=max(int({}), int({}));", inst, a, b); |
| 170 | } | 169 | } |
| 171 | 170 | ||
| 172 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 171 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 173 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 172 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 174 | throw NotImplementedException("GLSL Instruction"); | 173 | ctx.AddU32("{}=max(uint({}), uint({}));", inst, a, b); |
| 175 | } | 174 | } |
| 176 | 175 | ||
| 177 | void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 176 | void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -188,57 +187,57 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& | |||
| 188 | 187 | ||
| 189 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 188 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 190 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | 189 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 191 | throw NotImplementedException("GLSL Instruction"); | 190 | ctx.AddU1("{}=int({})<int({});", inst, lhs, rhs); |
| 192 | } | 191 | } |
| 193 | 192 | ||
| 194 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 193 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 195 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | 194 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 196 | throw NotImplementedException("GLSL Instruction"); | 195 | ctx.AddU1("{}=uint({})<uint({)};", inst, lhs, rhs); |
| 197 | } | 196 | } |
| 198 | 197 | ||
| 199 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 198 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 200 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | 199 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 201 | throw NotImplementedException("GLSL Instruction"); | 200 | ctx.AddU1("{}={}=={};", inst, lhs, rhs); |
| 202 | } | 201 | } |
| 203 | 202 | ||
| 204 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 203 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 205 | [[maybe_unused]] std::string_view lhs, | 204 | [[maybe_unused]] std::string_view lhs, |
| 206 | [[maybe_unused]] std::string_view rhs) { | 205 | [[maybe_unused]] std::string_view rhs) { |
| 207 | throw NotImplementedException("GLSL Instruction"); | 206 | ctx.AddU1("{}=int({})<=int({});", inst, lhs, rhs); |
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 209 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 211 | [[maybe_unused]] std::string_view lhs, | 210 | [[maybe_unused]] std::string_view lhs, |
| 212 | [[maybe_unused]] std::string_view rhs) { | 211 | [[maybe_unused]] std::string_view rhs) { |
| 213 | throw NotImplementedException("GLSL Instruction"); | 212 | ctx.AddU1("{}=uint({})<=uint({});", inst, lhs, rhs); |
| 214 | } | 213 | } |
| 215 | 214 | ||
| 216 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 215 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 217 | [[maybe_unused]] std::string_view lhs, | 216 | [[maybe_unused]] std::string_view lhs, |
| 218 | [[maybe_unused]] std::string_view rhs) { | 217 | [[maybe_unused]] std::string_view rhs) { |
| 219 | throw NotImplementedException("GLSL Instruction"); | 218 | ctx.AddU1("{}=int({})>int({});", inst, lhs, rhs); |
| 220 | } | 219 | } |
| 221 | 220 | ||
| 222 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 221 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 223 | [[maybe_unused]] std::string_view lhs, | 222 | [[maybe_unused]] std::string_view lhs, |
| 224 | [[maybe_unused]] std::string_view rhs) { | 223 | [[maybe_unused]] std::string_view rhs) { |
| 225 | throw NotImplementedException("GLSL Instruction"); | 224 | ctx.AddU1("{}=uint({})>uint({});", inst, lhs, rhs); |
| 226 | } | 225 | } |
| 227 | 226 | ||
| 228 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 227 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 229 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | 228 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 230 | throw NotImplementedException("GLSL Instruction"); | 229 | ctx.AddU1("{}={}!={};", inst, lhs, rhs); |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 233 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 232 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 234 | [[maybe_unused]] std::string_view lhs, | 233 | [[maybe_unused]] std::string_view lhs, |
| 235 | [[maybe_unused]] std::string_view rhs) { | 234 | [[maybe_unused]] std::string_view rhs) { |
| 236 | throw NotImplementedException("GLSL Instruction"); | 235 | ctx.AddU1("{}=int({})>=int({});", inst, lhs, rhs); |
| 237 | } | 236 | } |
| 238 | 237 | ||
| 239 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 238 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 240 | [[maybe_unused]] std::string_view lhs, | 239 | [[maybe_unused]] std::string_view lhs, |
| 241 | [[maybe_unused]] std::string_view rhs) { | 240 | [[maybe_unused]] std::string_view rhs) { |
| 242 | throw NotImplementedException("GLSL Instruction"); | 241 | ctx.AddU1("{}=uint({})>=uint({});", inst, lhs, rhs); |
| 243 | } | 242 | } |
| 244 | } // namespace Shader::Backend::GLSL | 243 | } // namespace Shader::Backend::GLSL |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp index ff2b30eee..de350b154 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp | |||
| @@ -27,10 +27,6 @@ void EmitVoid(EmitContext& ctx) { | |||
| 27 | NotImplemented(); | 27 | NotImplemented(); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value) { | ||
| 31 | NotImplemented(); | ||
| 32 | } | ||
| 33 | |||
| 34 | void EmitReference(EmitContext&) { | 30 | void EmitReference(EmitContext&) { |
| 35 | NotImplemented(); | 31 | NotImplemented(); |
| 36 | } | 32 | } |
| @@ -359,208 +355,6 @@ void EmitWriteSharedU128(EmitContext& ctx, std::string_view offset, std::string_ | |||
| 359 | NotImplemented(); | 355 | NotImplemented(); |
| 360 | } | 356 | } |
| 361 | 357 | ||
| 362 | void EmitCompositeConstructU32x2(EmitContext& ctx, std::string_view e1, std::string_view e2) { | ||
| 363 | NotImplemented(); | ||
| 364 | } | ||
| 365 | |||
| 366 | void EmitCompositeConstructU32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 367 | std::string_view e3) { | ||
| 368 | NotImplemented(); | ||
| 369 | } | ||
| 370 | |||
| 371 | void EmitCompositeConstructU32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 372 | std::string_view e3, std::string_view e4) { | ||
| 373 | NotImplemented(); | ||
| 374 | } | ||
| 375 | |||
| 376 | void EmitCompositeExtractU32x2(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 377 | NotImplemented(); | ||
| 378 | } | ||
| 379 | |||
| 380 | void EmitCompositeExtractU32x3(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 381 | NotImplemented(); | ||
| 382 | } | ||
| 383 | |||
| 384 | void EmitCompositeExtractU32x4(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 385 | NotImplemented(); | ||
| 386 | } | ||
| 387 | |||
| 388 | void EmitCompositeInsertU32x2(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 389 | u32 index) { | ||
| 390 | NotImplemented(); | ||
| 391 | } | ||
| 392 | |||
| 393 | void EmitCompositeInsertU32x3(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 394 | u32 index) { | ||
| 395 | NotImplemented(); | ||
| 396 | } | ||
| 397 | |||
| 398 | void EmitCompositeInsertU32x4(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 399 | u32 index) { | ||
| 400 | NotImplemented(); | ||
| 401 | } | ||
| 402 | |||
| 403 | void EmitCompositeConstructF16x2(EmitContext& ctx, std::string_view e1, std::string_view e2) { | ||
| 404 | NotImplemented(); | ||
| 405 | } | ||
| 406 | |||
| 407 | void EmitCompositeConstructF16x3(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 408 | std::string_view e3) { | ||
| 409 | NotImplemented(); | ||
| 410 | } | ||
| 411 | |||
| 412 | void EmitCompositeConstructF16x4(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 413 | std::string_view e3, std::string_view e4) { | ||
| 414 | NotImplemented(); | ||
| 415 | } | ||
| 416 | |||
| 417 | void EmitCompositeExtractF16x2(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 418 | NotImplemented(); | ||
| 419 | } | ||
| 420 | |||
| 421 | void EmitCompositeExtractF16x3(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 422 | NotImplemented(); | ||
| 423 | } | ||
| 424 | |||
| 425 | void EmitCompositeExtractF16x4(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 426 | NotImplemented(); | ||
| 427 | } | ||
| 428 | |||
| 429 | void EmitCompositeInsertF16x2(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 430 | u32 index) { | ||
| 431 | NotImplemented(); | ||
| 432 | } | ||
| 433 | |||
| 434 | void EmitCompositeInsertF16x3(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 435 | u32 index) { | ||
| 436 | NotImplemented(); | ||
| 437 | } | ||
| 438 | |||
| 439 | void EmitCompositeInsertF16x4(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 440 | u32 index) { | ||
| 441 | NotImplemented(); | ||
| 442 | } | ||
| 443 | |||
| 444 | void EmitCompositeConstructF32x2(EmitContext& ctx, std::string_view e1, std::string_view e2) { | ||
| 445 | NotImplemented(); | ||
| 446 | } | ||
| 447 | |||
| 448 | void EmitCompositeConstructF32x3(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 449 | std::string_view e3) { | ||
| 450 | NotImplemented(); | ||
| 451 | } | ||
| 452 | |||
| 453 | void EmitCompositeConstructF32x4(EmitContext& ctx, std::string_view e1, std::string_view e2, | ||
| 454 | std::string_view e3, std::string_view e4) { | ||
| 455 | NotImplemented(); | ||
| 456 | } | ||
| 457 | |||
| 458 | void EmitCompositeExtractF32x2(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 459 | NotImplemented(); | ||
| 460 | } | ||
| 461 | |||
| 462 | void EmitCompositeExtractF32x3(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 463 | NotImplemented(); | ||
| 464 | } | ||
| 465 | |||
| 466 | void EmitCompositeExtractF32x4(EmitContext& ctx, std::string_view composite, u32 index) { | ||
| 467 | NotImplemented(); | ||
| 468 | } | ||
| 469 | |||
| 470 | void EmitCompositeInsertF32x2(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 471 | u32 index) { | ||
| 472 | NotImplemented(); | ||
| 473 | } | ||
| 474 | |||
| 475 | void EmitCompositeInsertF32x3(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 476 | u32 index) { | ||
| 477 | NotImplemented(); | ||
| 478 | } | ||
| 479 | |||
| 480 | void EmitCompositeInsertF32x4(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 481 | u32 index) { | ||
| 482 | NotImplemented(); | ||
| 483 | } | ||
| 484 | |||
| 485 | void EmitCompositeConstructF64x2(EmitContext& ctx) { | ||
| 486 | NotImplemented(); | ||
| 487 | } | ||
| 488 | |||
| 489 | void EmitCompositeConstructF64x3(EmitContext& ctx) { | ||
| 490 | NotImplemented(); | ||
| 491 | } | ||
| 492 | |||
| 493 | void EmitCompositeConstructF64x4(EmitContext& ctx) { | ||
| 494 | NotImplemented(); | ||
| 495 | } | ||
| 496 | |||
| 497 | void EmitCompositeExtractF64x2(EmitContext& ctx) { | ||
| 498 | NotImplemented(); | ||
| 499 | } | ||
| 500 | |||
| 501 | void EmitCompositeExtractF64x3(EmitContext& ctx) { | ||
| 502 | NotImplemented(); | ||
| 503 | } | ||
| 504 | |||
| 505 | void EmitCompositeExtractF64x4(EmitContext& ctx) { | ||
| 506 | NotImplemented(); | ||
| 507 | } | ||
| 508 | |||
| 509 | void EmitCompositeInsertF64x2(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 510 | u32 index) { | ||
| 511 | NotImplemented(); | ||
| 512 | } | ||
| 513 | |||
| 514 | void EmitCompositeInsertF64x3(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 515 | u32 index) { | ||
| 516 | NotImplemented(); | ||
| 517 | } | ||
| 518 | |||
| 519 | void EmitCompositeInsertF64x4(EmitContext& ctx, std::string_view composite, std::string_view object, | ||
| 520 | u32 index) { | ||
| 521 | NotImplemented(); | ||
| 522 | } | ||
| 523 | |||
| 524 | void EmitSelectU1(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 525 | std::string_view false_value) { | ||
| 526 | NotImplemented(); | ||
| 527 | } | ||
| 528 | |||
| 529 | void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 530 | std::string_view false_value) { | ||
| 531 | NotImplemented(); | ||
| 532 | } | ||
| 533 | |||
| 534 | void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 535 | std::string_view false_value) { | ||
| 536 | NotImplemented(); | ||
| 537 | } | ||
| 538 | |||
| 539 | void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 540 | std::string_view false_value) { | ||
| 541 | NotImplemented(); | ||
| 542 | } | ||
| 543 | |||
| 544 | void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 545 | std::string_view false_value) { | ||
| 546 | NotImplemented(); | ||
| 547 | } | ||
| 548 | |||
| 549 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 550 | std::string_view false_value) { | ||
| 551 | NotImplemented(); | ||
| 552 | } | ||
| 553 | |||
| 554 | void EmitSelectF32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 555 | std::string_view false_value) { | ||
| 556 | NotImplemented(); | ||
| 557 | } | ||
| 558 | |||
| 559 | void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 560 | std::string_view false_value) { | ||
| 561 | NotImplemented(); | ||
| 562 | } | ||
| 563 | |||
| 564 | void EmitBitCastU16F16(EmitContext& ctx) { | 358 | void EmitBitCastU16F16(EmitContext& ctx) { |
| 565 | NotImplemented(); | 359 | NotImplemented(); |
| 566 | } | 360 | } |
| @@ -585,14 +379,6 @@ void EmitBitCastF64U64(EmitContext& ctx) { | |||
| 585 | NotImplemented(); | 379 | NotImplemented(); |
| 586 | } | 380 | } |
| 587 | 381 | ||
| 588 | void EmitPackUint2x32(EmitContext& ctx, std::string_view value) { | ||
| 589 | NotImplemented(); | ||
| 590 | } | ||
| 591 | |||
| 592 | void EmitUnpackUint2x32(EmitContext& ctx, std::string_view value) { | ||
| 593 | NotImplemented(); | ||
| 594 | } | ||
| 595 | |||
| 596 | void EmitPackFloat2x16(EmitContext& ctx, std::string_view value) { | 382 | void EmitPackFloat2x16(EmitContext& ctx, std::string_view value) { |
| 597 | NotImplemented(); | 383 | NotImplemented(); |
| 598 | } | 384 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp index e69de29bb..86d38da98 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string_view> | ||
| 6 | |||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | ||
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | ||
| 10 | #include "shader_recompiler/profile.h" | ||
| 11 | |||
| 12 | namespace Shader::Backend::GLSL { | ||
| 13 | void EmitSelectU1([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 14 | [[maybe_unused]] std::string_view true_value, | ||
| 15 | [[maybe_unused]] std::string_view false_value) { | ||
| 16 | throw NotImplementedException("GLSL Instruction"); | ||
| 17 | } | ||
| 18 | |||
| 19 | void EmitSelectU8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 20 | [[maybe_unused]] std::string_view true_value, | ||
| 21 | [[maybe_unused]] std::string_view false_value) { | ||
| 22 | throw NotImplementedException("GLSL Instruction"); | ||
| 23 | } | ||
| 24 | |||
| 25 | void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 26 | [[maybe_unused]] std::string_view true_value, | ||
| 27 | [[maybe_unused]] std::string_view false_value) { | ||
| 28 | throw NotImplementedException("GLSL Instruction"); | ||
| 29 | } | ||
| 30 | |||
| 31 | void EmitSelectU32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 32 | [[maybe_unused]] std::string_view true_value, | ||
| 33 | [[maybe_unused]] std::string_view false_value) { | ||
| 34 | throw NotImplementedException("GLSL Instruction"); | ||
| 35 | } | ||
| 36 | |||
| 37 | void EmitSelectU64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 38 | [[maybe_unused]] std::string_view true_value, | ||
| 39 | [[maybe_unused]] std::string_view false_value) { | ||
| 40 | throw NotImplementedException("GLSL Instruction"); | ||
| 41 | } | ||
| 42 | |||
| 43 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 44 | [[maybe_unused]] std::string_view true_value, | ||
| 45 | [[maybe_unused]] std::string_view false_value) { | ||
| 46 | throw NotImplementedException("GLSL Instruction"); | ||
| 47 | } | ||
| 48 | |||
| 49 | void EmitSelectF32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 50 | [[maybe_unused]] std::string_view true_value, | ||
| 51 | [[maybe_unused]] std::string_view false_value) { | ||
| 52 | throw NotImplementedException("GLSL Instruction"); | ||
| 53 | } | ||
| 54 | |||
| 55 | void EmitSelectF64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 56 | [[maybe_unused]] std::string_view true_value, | ||
| 57 | [[maybe_unused]] std::string_view false_value) { | ||
| 58 | throw NotImplementedException("GLSL Instruction"); | ||
| 59 | } | ||
| 60 | |||
| 61 | } // namespace Shader::Backend::GLSL | ||
diff --git a/src/shader_recompiler/backend/glsl/reg_alloc.cpp b/src/shader_recompiler/backend/glsl/reg_alloc.cpp index f4886dbfd..3cfa16fea 100644 --- a/src/shader_recompiler/backend/glsl/reg_alloc.cpp +++ b/src/shader_recompiler/backend/glsl/reg_alloc.cpp | |||
| @@ -57,9 +57,10 @@ std::string RegAlloc::Consume(const IR::Value& value) { | |||
| 57 | std::string RegAlloc::Consume(IR::Inst& inst) { | 57 | std::string RegAlloc::Consume(IR::Inst& inst) { |
| 58 | const Id id{inst.Definition<Id>()}; | 58 | const Id id{inst.Definition<Id>()}; |
| 59 | inst.DestructiveRemoveUsage(); | 59 | inst.DestructiveRemoveUsage(); |
| 60 | if (!inst.HasUses()) { | 60 | // TODO: reuse variables of same type if possible |
| 61 | Free(id); | 61 | // if (!inst.HasUses()) { |
| 62 | } | 62 | // Free(id); |
| 63 | // } | ||
| 63 | return Representation(inst.Definition<Id>()); | 64 | return Representation(inst.Definition<Id>()); |
| 64 | } | 65 | } |
| 65 | 66 | ||
| @@ -69,14 +70,24 @@ std::string RegAlloc::GetType(Type type, u32 index) { | |||
| 69 | } | 70 | } |
| 70 | register_defined[index] = true; | 71 | register_defined[index] = true; |
| 71 | switch (type) { | 72 | switch (type) { |
| 73 | case Type::U1: | ||
| 74 | return "bool "; | ||
| 72 | case Type::U32: | 75 | case Type::U32: |
| 73 | return "uint "; | 76 | return "uint "; |
| 74 | case Type::S32: | 77 | case Type::S32: |
| 75 | return "int "; | 78 | return "int "; |
| 76 | case Type::F32: | 79 | case Type::F32: |
| 77 | return "float "; | 80 | return "float "; |
| 78 | default: | 81 | case Type::U64: |
| 82 | return "uint64_t "; | ||
| 83 | case Type::U32x2: | ||
| 84 | return "uvec2 "; | ||
| 85 | case Type::F32x2: | ||
| 86 | return "vec2 "; | ||
| 87 | case Type::Void: | ||
| 79 | return ""; | 88 | return ""; |
| 89 | default: | ||
| 90 | throw NotImplementedException("Type {}", type); | ||
| 80 | } | 91 | } |
| 81 | } | 92 | } |
| 82 | 93 | ||
diff --git a/src/shader_recompiler/backend/glsl/reg_alloc.h b/src/shader_recompiler/backend/glsl/reg_alloc.h index 9b98aab39..84ef7e822 100644 --- a/src/shader_recompiler/backend/glsl/reg_alloc.h +++ b/src/shader_recompiler/backend/glsl/reg_alloc.h | |||
| @@ -16,11 +16,14 @@ class Value; | |||
| 16 | 16 | ||
| 17 | namespace Shader::Backend::GLSL { | 17 | namespace Shader::Backend::GLSL { |
| 18 | enum class Type : u32 { | 18 | enum class Type : u32 { |
| 19 | U1, | ||
| 19 | U32, | 20 | U32, |
| 20 | S32, | 21 | S32, |
| 21 | F32, | 22 | F32, |
| 22 | U64, | 23 | U64, |
| 23 | F64, | 24 | F64, |
| 25 | U32x2, | ||
| 26 | F32x2, | ||
| 24 | Void, | 27 | Void, |
| 25 | }; | 28 | }; |
| 26 | 29 | ||