diff options
| author | 2021-06-11 00:33:33 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:38 -0400 | |
| commit | 4759db28d0b98c79f9a630b63ba13c4cd0df9109 (patch) | |
| tree | 3cc20c600bf0733f464e3c844688b1cef766e191 /src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | |
| parent | glsl: Reorganize backend code, remove unneeded [[maybe_unused]] (diff) | |
| download | yuzu-4759db28d0b98c79f9a630b63ba13c4cd0df9109.tar.gz yuzu-4759db28d0b98c79f9a630b63ba13c4cd0df9109.tar.xz yuzu-4759db28d0b98c79f9a630b63ba13c4cd0df9109.zip | |
glsl: Address Rodrigo's feedback
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | 38 |
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 | ||
| 17 | void EmitConvertS16F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 17 | void 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 | ||
| 21 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 21 | void 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 | ||
| 31 | void EmitConvertS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 31 | void 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 | ||
| 35 | void EmitConvertS32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 35 | void 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 | ||
| 39 | void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 39 | void 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 | ||
| 44 | void EmitConvertS64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 44 | void 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 | ||
| 48 | void EmitConvertS64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 48 | void 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 | ||
| 52 | void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 52 | void 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 | ||
| 72 | void EmitConvertU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 72 | void 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 | ||
| 76 | void EmitConvertU32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 76 | void 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 | ||
| 80 | void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 80 | void 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 | ||
| 85 | void EmitConvertU64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 85 | void 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 | ||
| 89 | void EmitConvertU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 89 | void 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 | ||
| 93 | void EmitConvertU64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 93 | void 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 | ||
| 97 | void EmitConvertU32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 97 | void 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 | ||
| 101 | void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 101 | void 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 | ||
| 111 | void EmitConvertF32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 111 | void 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 | ||
| 115 | void EmitConvertF64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 115 | void 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 | ||
| 119 | void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 119 | void 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 | ||
| 173 | void EmitConvertF32S64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 173 | void 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 | ||
| 177 | void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 177 | void 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 | ||
| 182 | void EmitConvertF32U16(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 182 | void 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 | ||
| 186 | void EmitConvertF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 186 | void 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 | ||
| 190 | void EmitConvertF32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 190 | void 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 | ||
| 194 | void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 194 | void 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 | ||
| 222 | void EmitConvertF64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 222 | void 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 | ||
| 226 | void EmitConvertF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 226 | void 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 |