diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.h')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.h | 43 |
1 files changed, 31 insertions, 12 deletions
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 | }; |