diff options
| author | 2021-05-21 21:37:13 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | ef7bd53f189a9bd11e4eebdcc142f60c2be8a504 (patch) | |
| tree | b2c1b5f285bfbaa22b060f5615b8cb3fb094d416 /src/shader_recompiler | |
| parent | glsl: Implement BF* (diff) | |
| download | yuzu-ef7bd53f189a9bd11e4eebdcc142f60c2be8a504.tar.gz yuzu-ef7bd53f189a9bd11e4eebdcc142f60c2be8a504.tar.xz yuzu-ef7bd53f189a9bd11e4eebdcc142f60c2be8a504.zip | |
glsl: Implement more Integer ops
Diffstat (limited to 'src/shader_recompiler')
3 files changed, 72 insertions, 119 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 5370af0c5..39c0ba859 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -210,8 +210,8 @@ void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view tru | |||
| 210 | std::string_view false_value); | 210 | std::string_view false_value); |
| 211 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 211 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, |
| 212 | std::string_view false_value); | 212 | std::string_view false_value); |
| 213 | void EmitSelectF32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 213 | void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 214 | std::string_view false_value); | 214 | std::string_view true_value, std::string_view false_value); |
| 215 | void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 215 | void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value, |
| 216 | std::string_view false_value); | 216 | std::string_view false_value); |
| 217 | void EmitBitCastU16F16(EmitContext& ctx); | 217 | void EmitBitCastU16F16(EmitContext& ctx); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp index 3f1b56a05..083d81ccb 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp | |||
| @@ -10,136 +10,108 @@ | |||
| 10 | #include "shader_recompiler/profile.h" | 10 | #include "shader_recompiler/profile.h" |
| 11 | 11 | ||
| 12 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 13 | void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 13 | void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 14 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 15 | ctx.AddU32("{}={}+{};", inst, a, b); | 14 | ctx.AddU32("{}={}+{};", inst, a, b); |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 17 | void EmitIAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 19 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 18 | ctx.AddU64("{}={}+{};", inst, a, b); |
| 20 | throw NotImplementedException("GLSL Instruction"); | ||
| 21 | } | 19 | } |
| 22 | 20 | ||
| 23 | void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 21 | void EmitISub32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 24 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 25 | ctx.AddU32("{}={}-{};", inst, a, b); | 22 | ctx.AddU32("{}={}-{};", inst, a, b); |
| 26 | } | 23 | } |
| 27 | 24 | ||
| 28 | void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 25 | void EmitISub64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 29 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 26 | ctx.AddU64("{}={}-{};", inst, a, b); |
| 30 | throw NotImplementedException("GLSL Instruction"); | ||
| 31 | } | 27 | } |
| 32 | 28 | ||
| 33 | void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 29 | void EmitIMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 34 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 30 | ctx.AddU32("{}={}*{};", inst, a, b); |
| 35 | throw NotImplementedException("GLSL Instruction"); | ||
| 36 | } | 31 | } |
| 37 | 32 | ||
| 38 | void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 33 | void EmitINeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 39 | [[maybe_unused]] std::string_view value) { | ||
| 40 | ctx.AddU32("{}=-{};", inst, value); | 34 | ctx.AddU32("{}=-{};", inst, value); |
| 41 | } | 35 | } |
| 42 | 36 | ||
| 43 | void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 37 | void EmitINeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 44 | [[maybe_unused]] std::string_view value) { | 38 | ctx.AddU64("{}=-{};", inst, value); |
| 45 | throw NotImplementedException("GLSL Instruction"); | ||
| 46 | } | 39 | } |
| 47 | 40 | ||
| 48 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 41 | void EmitIAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 49 | [[maybe_unused]] std::string_view value) { | ||
| 50 | ctx.AddU32("{}=abs({});", inst, value); | 42 | ctx.AddU32("{}=abs({});", inst, value); |
| 51 | } | 43 | } |
| 52 | 44 | ||
| 53 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 45 | void EmitIAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 54 | [[maybe_unused]] std::string_view value) { | 46 | ctx.AddU64("{}=abs({});", inst, value); |
| 55 | throw NotImplementedException("GLSL Instruction"); | ||
| 56 | } | 47 | } |
| 57 | 48 | ||
| 58 | void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 49 | void EmitShiftLeftLogical32(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 59 | [[maybe_unused]] std::string_view base, | 50 | std::string_view shift) { |
| 60 | [[maybe_unused]] std::string_view shift) { | ||
| 61 | ctx.AddU32("{}={}<<{};", inst, base, shift); | 51 | ctx.AddU32("{}={}<<{};", inst, base, shift); |
| 62 | } | 52 | } |
| 63 | 53 | ||
| 64 | void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 54 | void EmitShiftLeftLogical64(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 65 | [[maybe_unused]] std::string_view base, | 55 | std::string_view shift) { |
| 66 | [[maybe_unused]] std::string_view shift) { | ||
| 67 | ctx.AddU64("{}={}<<{};", inst, base, shift); | 56 | ctx.AddU64("{}={}<<{};", inst, base, shift); |
| 68 | } | 57 | } |
| 69 | 58 | ||
| 70 | void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 59 | void EmitShiftRightLogical32(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 71 | [[maybe_unused]] std::string_view base, | 60 | std::string_view shift) { |
| 72 | [[maybe_unused]] std::string_view shift) { | ||
| 73 | ctx.AddU32("{}={}>>{};", inst, base, shift); | 61 | ctx.AddU32("{}={}>>{};", inst, base, shift); |
| 74 | } | 62 | } |
| 75 | 63 | ||
| 76 | void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 64 | void EmitShiftRightLogical64(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 77 | [[maybe_unused]] std::string_view base, | 65 | std::string_view shift) { |
| 78 | [[maybe_unused]] std::string_view shift) { | ||
| 79 | ctx.AddU64("{}={}>>{};", inst, base, shift); | 66 | ctx.AddU64("{}={}>>{};", inst, base, shift); |
| 80 | } | 67 | } |
| 81 | 68 | ||
| 82 | void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 69 | void EmitShiftRightArithmetic32(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 83 | [[maybe_unused]] std::string_view base, | 70 | std::string_view shift) { |
| 84 | [[maybe_unused]] std::string_view shift) { | ||
| 85 | ctx.AddS32("{}=int({})>>{};", inst, base, shift); | 71 | ctx.AddS32("{}=int({})>>{};", inst, base, shift); |
| 86 | } | 72 | } |
| 87 | 73 | ||
| 88 | void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 74 | void EmitShiftRightArithmetic64(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 89 | [[maybe_unused]] std::string_view base, | 75 | std::string_view shift) { |
| 90 | [[maybe_unused]] std::string_view shift) { | ||
| 91 | ctx.AddU64("{}=int64_t({})>>{};", inst, base, shift); | 76 | ctx.AddU64("{}=int64_t({})>>{};", inst, base, shift); |
| 92 | } | 77 | } |
| 93 | 78 | ||
| 94 | void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 79 | void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 95 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 96 | ctx.AddU32("{}={}&{};", inst, a, b); | 80 | ctx.AddU32("{}={}&{};", inst, a, b); |
| 97 | } | 81 | } |
| 98 | 82 | ||
| 99 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 83 | void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 100 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 101 | ctx.AddU32("{}={}|{};", inst, a, b); | 84 | ctx.AddU32("{}={}|{};", inst, a, b); |
| 102 | } | 85 | } |
| 103 | 86 | ||
| 104 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 87 | void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 105 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 106 | ctx.AddU32("{}={}^{};", inst, a, b); | 88 | ctx.AddU32("{}={}^{};", inst, a, b); |
| 107 | } | 89 | } |
| 108 | 90 | ||
| 109 | void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 91 | void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 110 | [[maybe_unused]] std::string_view base, | 92 | std::string_view insert, std::string_view offset, std::string_view count) { |
| 111 | [[maybe_unused]] std::string_view insert, | ||
| 112 | [[maybe_unused]] std::string_view offset, | ||
| 113 | [[maybe_unused]] std::string_view count) { | ||
| 114 | ctx.AddU32("{}=bitfieldInsert({}, {}, int({}), int({}));", inst, base, insert, offset, count); | 93 | ctx.AddU32("{}=bitfieldInsert({}, {}, int({}), int({}));", inst, base, insert, offset, count); |
| 115 | } | 94 | } |
| 116 | 95 | ||
| 117 | void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 96 | void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 118 | [[maybe_unused]] std::string_view base, | 97 | std::string_view offset, std::string_view count) { |
| 119 | [[maybe_unused]] std::string_view offset, | ||
| 120 | [[maybe_unused]] std::string_view count) { | ||
| 121 | ctx.AddU32("{}=bitfieldExtract(int({}), int({}), int({}));", inst, base, offset, count); | 98 | ctx.AddU32("{}=bitfieldExtract(int({}), int({}), int({}));", inst, base, offset, count); |
| 122 | } | 99 | } |
| 123 | 100 | ||
| 124 | void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 101 | void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 125 | [[maybe_unused]] std::string_view base, | 102 | std::string_view offset, std::string_view count) { |
| 126 | [[maybe_unused]] std::string_view offset, | ||
| 127 | [[maybe_unused]] std::string_view count) { | ||
| 128 | ctx.AddU32("{}=bitfieldExtract({}, int({}), int({}));", inst, base, offset, count); | 103 | ctx.AddU32("{}=bitfieldExtract({}, int({}), int({}));", inst, base, offset, count); |
| 129 | } | 104 | } |
| 130 | 105 | ||
| 131 | void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 106 | void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 132 | [[maybe_unused]] std::string_view value) { | ||
| 133 | ctx.AddU32("{}=bitfieldReverse({});", inst, value); | 107 | ctx.AddU32("{}=bitfieldReverse({});", inst, value); |
| 134 | } | 108 | } |
| 135 | 109 | ||
| 136 | void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 110 | void EmitBitCount32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 137 | [[maybe_unused]] std::string_view value) { | 111 | ctx.AddU32("{}=bitCount({});", inst, value); |
| 138 | throw NotImplementedException("GLSL Instruction"); | ||
| 139 | } | 112 | } |
| 140 | 113 | ||
| 141 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 114 | void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 142 | [[maybe_unused]] std::string_view value) { | ||
| 143 | ctx.AddU32("{}=~{};", inst, value); | 115 | ctx.AddU32("{}=~{};", inst, value); |
| 144 | } | 116 | } |
| 145 | 117 | ||
| @@ -153,91 +125,75 @@ void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst | |||
| 153 | throw NotImplementedException("GLSL Instruction"); | 125 | throw NotImplementedException("GLSL Instruction"); |
| 154 | } | 126 | } |
| 155 | 127 | ||
| 156 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 128 | void EmitSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 157 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 158 | ctx.AddU32("{}=min(int({}), int({}));", inst, a, b); | 129 | ctx.AddU32("{}=min(int({}), int({}));", inst, a, b); |
| 159 | } | 130 | } |
| 160 | 131 | ||
| 161 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 132 | void EmitUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 162 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 163 | ctx.AddU32("{}=min(uint({}), uint({}));", inst, a, b); | 133 | ctx.AddU32("{}=min(uint({}), uint({}));", inst, a, b); |
| 164 | } | 134 | } |
| 165 | 135 | ||
| 166 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 136 | void EmitSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 167 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 168 | ctx.AddU32("{}=max(int({}), int({}));", inst, a, b); | 137 | ctx.AddU32("{}=max(int({}), int({}));", inst, a, b); |
| 169 | } | 138 | } |
| 170 | 139 | ||
| 171 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 140 | void EmitUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 172 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | ||
| 173 | ctx.AddU32("{}=max(uint({}), uint({}));", inst, a, b); | 141 | ctx.AddU32("{}=max(uint({}), uint({}));", inst, a, b); |
| 174 | } | 142 | } |
| 175 | 143 | ||
| 176 | void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 144 | void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, |
| 177 | [[maybe_unused]] std::string_view value, [[maybe_unused]] std::string_view min, | 145 | std::string_view max) { |
| 178 | [[maybe_unused]] std::string_view max) { | 146 | ctx.AddU32("{}=clamp(int({}), int({}), int({}));", inst, value, min, max); |
| 179 | throw NotImplementedException("GLSL Instruction"); | ||
| 180 | } | 147 | } |
| 181 | 148 | ||
| 182 | void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 149 | void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, |
| 183 | [[maybe_unused]] std::string_view value, [[maybe_unused]] std::string_view min, | 150 | std::string_view max) { |
| 184 | [[maybe_unused]] std::string_view max) { | 151 | ctx.AddU32("{}=clamp(uint({}), uint({}), uint({}));", inst, value, min, max); |
| 185 | throw NotImplementedException("GLSL Instruction"); | ||
| 186 | } | 152 | } |
| 187 | 153 | ||
| 188 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 154 | void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs) { |
| 189 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | ||
| 190 | ctx.AddU1("{}=int({})<int({});", inst, lhs, rhs); | 155 | ctx.AddU1("{}=int({})<int({});", inst, lhs, rhs); |
| 191 | } | 156 | } |
| 192 | 157 | ||
| 193 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 158 | void EmitULessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs) { |
| 194 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | ||
| 195 | ctx.AddU1("{}=uint({})<uint({)};", inst, lhs, rhs); | 159 | ctx.AddU1("{}=uint({})<uint({)};", inst, lhs, rhs); |
| 196 | } | 160 | } |
| 197 | 161 | ||
| 198 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 162 | void EmitIEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs) { |
| 199 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | ||
| 200 | ctx.AddU1("{}={}=={};", inst, lhs, rhs); | 163 | ctx.AddU1("{}={}=={};", inst, lhs, rhs); |
| 201 | } | 164 | } |
| 202 | 165 | ||
| 203 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 166 | void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 204 | [[maybe_unused]] std::string_view lhs, | 167 | std::string_view rhs) { |
| 205 | [[maybe_unused]] std::string_view rhs) { | ||
| 206 | ctx.AddU1("{}=int({})<=int({});", inst, lhs, rhs); | 168 | ctx.AddU1("{}=int({})<=int({});", inst, lhs, rhs); |
| 207 | } | 169 | } |
| 208 | 170 | ||
| 209 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 171 | void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 210 | [[maybe_unused]] std::string_view lhs, | 172 | std::string_view rhs) { |
| 211 | [[maybe_unused]] std::string_view rhs) { | ||
| 212 | ctx.AddU1("{}=uint({})<=uint({});", inst, lhs, rhs); | 173 | ctx.AddU1("{}=uint({})<=uint({});", inst, lhs, rhs); |
| 213 | } | 174 | } |
| 214 | 175 | ||
| 215 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 176 | void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 216 | [[maybe_unused]] std::string_view lhs, | 177 | std::string_view rhs) { |
| 217 | [[maybe_unused]] std::string_view rhs) { | ||
| 218 | ctx.AddU1("{}=int({})>int({});", inst, lhs, rhs); | 178 | ctx.AddU1("{}=int({})>int({});", inst, lhs, rhs); |
| 219 | } | 179 | } |
| 220 | 180 | ||
| 221 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 181 | void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 222 | [[maybe_unused]] std::string_view lhs, | 182 | std::string_view rhs) { |
| 223 | [[maybe_unused]] std::string_view rhs) { | ||
| 224 | ctx.AddU1("{}=uint({})>uint({});", inst, lhs, rhs); | 183 | ctx.AddU1("{}=uint({})>uint({});", inst, lhs, rhs); |
| 225 | } | 184 | } |
| 226 | 185 | ||
| 227 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 186 | void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs) { |
| 228 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { | ||
| 229 | ctx.AddU1("{}={}!={};", inst, lhs, rhs); | 187 | ctx.AddU1("{}={}!={};", inst, lhs, rhs); |
| 230 | } | 188 | } |
| 231 | 189 | ||
| 232 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 190 | void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 233 | [[maybe_unused]] std::string_view lhs, | 191 | std::string_view rhs) { |
| 234 | [[maybe_unused]] std::string_view rhs) { | ||
| 235 | ctx.AddU1("{}=int({})>=int({});", inst, lhs, rhs); | 192 | ctx.AddU1("{}=int({})>=int({});", inst, lhs, rhs); |
| 236 | } | 193 | } |
| 237 | 194 | ||
| 238 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 195 | void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 239 | [[maybe_unused]] std::string_view lhs, | 196 | std::string_view rhs) { |
| 240 | [[maybe_unused]] std::string_view rhs) { | ||
| 241 | ctx.AddU1("{}=uint({})>=uint({});", inst, lhs, rhs); | 197 | ctx.AddU1("{}=uint({})>=uint({});", inst, lhs, rhs); |
| 242 | } | 198 | } |
| 243 | } // namespace Shader::Backend::GLSL | 199 | } // namespace Shader::Backend::GLSL |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp index 4455b0f9f..a6bf18fb1 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp | |||
| @@ -28,10 +28,8 @@ void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::stri | |||
| 28 | throw NotImplementedException("GLSL Instruction"); | 28 | throw NotImplementedException("GLSL Instruction"); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void EmitSelectU32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, | 31 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 32 | [[maybe_unused]] std::string_view cond, | 32 | std::string_view true_value, std::string_view false_value) { |
| 33 | [[maybe_unused]] std::string_view true_value, | ||
| 34 | [[maybe_unused]] std::string_view false_value) { | ||
| 35 | ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value); | 33 | ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value); |
| 36 | } | 34 | } |
| 37 | 35 | ||
| @@ -47,10 +45,9 @@ void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::stri | |||
| 47 | throw NotImplementedException("GLSL Instruction"); | 45 | throw NotImplementedException("GLSL Instruction"); |
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | void EmitSelectF32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | 48 | void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 51 | [[maybe_unused]] std::string_view true_value, | 49 | std::string_view true_value, std::string_view false_value) { |
| 52 | [[maybe_unused]] std::string_view false_value) { | 50 | ctx.AddF32("{}={}?{}:{};", inst, cond, true_value, false_value); |
| 53 | throw NotImplementedException("GLSL Instruction"); | ||
| 54 | } | 51 | } |
| 55 | 52 | ||
| 56 | void EmitSelectF64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | 53 | void EmitSelectF64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, |