diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-05-21 20:56:46 -0400 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-22 21:51:36 -0400 |
commit | 0f40b0e61ccc04216e0840e092dfe3051716b8b6 (patch) | |
tree | 7c12a0e010dd9aecef164b10a848085957f15358 /src/shader_recompiler/backend/glsl/emit_context.h | |
parent | fb75d122a242a5e43d36edc916e16a873f807acd (diff) |
glsl: Implement a few Integer instructions
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 81b970c142..f8cf8fdbca 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.h +++ b/src/shader_recompiler/backend/glsl/emit_context.h @@ -38,28 +38,46 @@ public: // code += '\n'; // } - template <typename... Args> - void AddU32(const char* format_str, IR::Inst& inst, Args&&... args) { - code += - fmt::format(format_str, reg_alloc.Define(inst, Type::U32), std::forward<Args>(args)...); + template <Type type, typename... Args> + void Add(const char* format_str, IR::Inst& inst, Args&&... args) { + code += fmt::format(format_str, reg_alloc.Define(inst, type), std::forward<Args>(args)...); // TODO: Remove this code += '\n'; } template <typename... Args> + void AddU1(const char* format_str, IR::Inst& inst, Args&&... args) { + Add<Type::U1>(format_str, inst, args...); + } + + template <typename... Args> + void AddU32(const char* format_str, IR::Inst& inst, Args&&... args) { + Add<Type::U32>(format_str, inst, args...); + } + + template <typename... Args> void AddS32(const char* format_str, IR::Inst& inst, Args&&... args) { - code += - fmt::format(format_str, reg_alloc.Define(inst, Type::S32), std::forward<Args>(args)...); - // TODO: Remove this - code += '\n'; + Add<Type::S32>(format_str, inst, args...); } template <typename... Args> void AddF32(const char* format_str, IR::Inst& inst, Args&&... args) { - code += - fmt::format(format_str, reg_alloc.Define(inst, Type::F32), std::forward<Args>(args)...); - // TODO: Remove this - code += '\n'; + Add<Type::F32>(format_str, inst, args...); + } + + template <typename... Args> + void AddU64(const char* format_str, IR::Inst& inst, Args&&... args) { + Add<Type::U64>(format_str, inst, args...); + } + + template <typename... Args> + void AddU32x2(const char* format_str, IR::Inst& inst, Args&&... args) { + Add<Type::U32x2>(format_str, inst, args...); + } + + template <typename... Args> + void AddF32x2(const char* format_str, IR::Inst& inst, Args&&... args) { + Add<Type::F32x2>(format_str, inst, args...); } template <typename... Args> @@ -75,6 +93,7 @@ public: const Profile& profile; private: + void SetupExtensions(std::string& header); void DefineConstantBuffers(); void DefineStorageBuffers(); }; |