summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp
index 8d823e466..777e290b4 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp
@@ -15,7 +15,7 @@ void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
15} 15}
16 16
17void EmitConvertS16F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 17void EmitConvertS16F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
18 ctx.AddS32("{}=int(float({}))&0xffff;", inst, value); 18 ctx.AddS32("{}=(int({})&0xffff)|(bitfieldExtract(int({}),31,1)<<15);", inst, value, value);
19} 19}
20 20
21void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 21void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -29,11 +29,11 @@ void EmitConvertS32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
29} 29}
30 30
31void EmitConvertS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 31void EmitConvertS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
32 ctx.AddS32("{}=int(float({}));", inst, value); 32 ctx.AddS32("{}=int({});", inst, value);
33} 33}
34 34
35void EmitConvertS32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 35void EmitConvertS32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
36 ctx.AddS32("{}=int(double({}));", inst, value); 36 ctx.AddS32("{}=int({});", inst, value);
37} 37}
38 38
39void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 39void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -42,11 +42,11 @@ void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
42} 42}
43 43
44void EmitConvertS64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 44void EmitConvertS64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
45 ctx.AddS64("{}=int64_t(double(float({})));", inst, value); 45 ctx.AddS64("{}=int64_t(double({}));", inst, value);
46} 46}
47 47
48void EmitConvertS64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 48void EmitConvertS64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
49 ctx.AddS64("{}=int64_t(double({}));", inst, value); 49 ctx.AddS64("{}=int64_t({});", inst, value);
50} 50}
51 51
52void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 52void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -70,11 +70,11 @@ void EmitConvertU32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
70} 70}
71 71
72void EmitConvertU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 72void EmitConvertU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
73 ctx.AddU32("{}=uint(float({}));", inst, value); 73 ctx.AddU32("{}=uint({});", inst, value);
74} 74}
75 75
76void EmitConvertU32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 76void EmitConvertU32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
77 ctx.AddU32("{}=uint(double({}));", inst, value); 77 ctx.AddU32("{}=uint({});", inst, value);
78} 78}
79 79
80void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 80void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -83,19 +83,19 @@ void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
83} 83}
84 84
85void EmitConvertU64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 85void EmitConvertU64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
86 ctx.AddU64("{}=uint64_t(float({}));", inst, value); 86 ctx.AddU64("{}=uint64_t({});", inst, value);
87} 87}
88 88
89void EmitConvertU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 89void EmitConvertU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
90 ctx.AddU64("{}=uint64_t(double({}));", inst, value); 90 ctx.AddU64("{}=uint64_t({});", inst, value);
91} 91}
92 92
93void EmitConvertU64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 93void EmitConvertU64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
94 ctx.AddU64("{}=uint64_t(uint({}));", inst, value); 94 ctx.AddU64("{}=uint64_t({});", inst, value);
95} 95}
96 96
97void EmitConvertU32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 97void EmitConvertU32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
98 ctx.AddU32("{}=uint(uint64_t({}));", inst, value); 98 ctx.AddU32("{}=uint({});", inst, value);
99} 99}
100 100
101void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 101void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -109,11 +109,11 @@ void EmitConvertF32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
109} 109}
110 110
111void EmitConvertF32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 111void EmitConvertF32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
112 ctx.AddF32("{}=float(double({}));", inst, value); 112 ctx.AddF32("{}=float({});", inst, value);
113} 113}
114 114
115void EmitConvertF64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 115void EmitConvertF64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
116 ctx.AddF64("{}=double(float({}));", inst, value); 116 ctx.AddF64("{}=double({});", inst, value);
117} 117}
118 118
119void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 119void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -171,7 +171,7 @@ void EmitConvertF32S32(EmitContext& ctx, IR::Inst& inst, std::string_view value)
171} 171}
172 172
173void EmitConvertF32S64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 173void EmitConvertF32S64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
174 ctx.AddF32("{}=float(double(int64_t({})));", inst, value); 174 ctx.AddF32("{}=float(int64_t({}));", inst, value);
175} 175}
176 176
177void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 177void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -180,15 +180,15 @@ void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In
180} 180}
181 181
182void EmitConvertF32U16(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 182void EmitConvertF32U16(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
183 ctx.AddF32("{}=float(uint({}&0xffff));", inst, value); 183 ctx.AddF32("{}=float({}&0xffff);", inst, value);
184} 184}
185 185
186void EmitConvertF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 186void EmitConvertF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
187 ctx.AddF32("{}=float(uint({}));", inst, value); 187 ctx.AddF32("{}=float({});", inst, value);
188} 188}
189 189
190void EmitConvertF32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 190void EmitConvertF32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
191 ctx.AddF32("{}=float(double(uint64_t({})));", inst, value); 191 ctx.AddF32("{}=float({});", inst, value);
192} 192}
193 193
194void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 194void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -220,11 +220,11 @@ void EmitConvertF64U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
220} 220}
221 221
222void EmitConvertF64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 222void EmitConvertF64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
223 ctx.AddF64("{}=double(uint({}));", inst, value); 223 ctx.AddF64("{}=double({});", inst, value);
224} 224}
225 225
226void EmitConvertF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { 226void EmitConvertF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
227 ctx.AddF64("{}=double(uint64_t({}));", inst, value); 227 ctx.AddF64("{}=double({});", inst, value);
228} 228}
229 229
230} // namespace Shader::Backend::GLSL 230} // namespace Shader::Backend::GLSL