summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_context.h
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-05-22 02:56:46 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:36 +0200
commit0f40b0e61ccc04216e0840e092dfe3051716b8b6 (patch)
tree7c12a0e010dd9aecef164b10a848085957f15358 /src/shader_recompiler/backend/glsl/emit_context.h
parentglsl: Use std::string_view for Emit function args. (diff)
downloadyuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar.gz
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar.bz2
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar.lz
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar.xz
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.tar.zst
yuzu-0f40b0e61ccc04216e0840e092dfe3051716b8b6.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_context.h')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.h43
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:
// 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();
};