glsl: Reusable typed variables. IADD32

This commit is contained in:
ameerj 2021-05-21 02:00:12 -04:00
parent faf4cd72c5
commit e221baccdd
6 changed files with 311 additions and 203 deletions

View file

@ -31,9 +31,33 @@ class EmitContext {
public:
explicit EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_);
// template <typename... Args>
// void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
// code += fmt::format(format_str, reg_alloc.Define(inst), std::forward<Args>(args)...);
// // TODO: Remove this
// code += '\n';
// }
template <typename... Args>
void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
code += fmt::format(format_str, reg_alloc.Define(inst), std::forward<Args>(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)...);
// TODO: Remove this
code += '\n';
}
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';
}
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';
}