diff options
| author | 2021-05-22 01:52:03 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | 5e9095ef2203e7cddcaba84fa3b01cc0d940b634 (patch) | |
| tree | 3ecb46dfb2a04ed269ccb07eb85cfa7c8e44a99d /src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | |
| parent | glsl: Fixup build issues (diff) | |
| download | yuzu-5e9095ef2203e7cddcaba84fa3b01cc0d940b634.tar.gz yuzu-5e9095ef2203e7cddcaba84fa3b01cc0d940b634.tar.xz yuzu-5e9095ef2203e7cddcaba84fa3b01cc0d940b634.zip | |
glsl: Add many FP32/64 instructions
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | 253 |
1 files changed, 253 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp index e69de29bb..7ddc24c71 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | |||
| @@ -0,0 +1,253 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string_view> | ||
| 6 | |||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | ||
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | ||
| 10 | #include "shader_recompiler/profile.h" | ||
| 11 | |||
| 12 | namespace Shader::Backend::GLSL { | ||
| 13 | void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 14 | [[maybe_unused]] std::string_view value) { | ||
| 15 | throw NotImplementedException("GLSL Instruction"); | ||
| 16 | } | ||
| 17 | |||
| 18 | void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 19 | [[maybe_unused]] std::string_view value) { | ||
| 20 | throw NotImplementedException("GLSL Instruction"); | ||
| 21 | } | ||
| 22 | |||
| 23 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 24 | [[maybe_unused]] std::string_view value) { | ||
| 25 | throw NotImplementedException("GLSL Instruction"); | ||
| 26 | } | ||
| 27 | |||
| 28 | void EmitConvertS32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 29 | [[maybe_unused]] std::string_view value) { | ||
| 30 | throw NotImplementedException("GLSL Instruction"); | ||
| 31 | } | ||
| 32 | |||
| 33 | void EmitConvertS32F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 34 | [[maybe_unused]] std::string_view value) { | ||
| 35 | ctx.AddS32("{}=int({});", inst, value); | ||
| 36 | } | ||
| 37 | |||
| 38 | void EmitConvertS32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 39 | [[maybe_unused]] std::string_view value) { | ||
| 40 | ctx.AddS32("{}=int({});", inst, value); | ||
| 41 | } | ||
| 42 | |||
| 43 | void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 44 | [[maybe_unused]] std::string_view value) { | ||
| 45 | throw NotImplementedException("GLSL Instruction"); | ||
| 46 | } | ||
| 47 | |||
| 48 | void EmitConvertS64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 49 | [[maybe_unused]] std::string_view value) { | ||
| 50 | ctx.AddS64("{}=int64_t({});", inst, value); | ||
| 51 | } | ||
| 52 | |||
| 53 | void EmitConvertS64F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 54 | [[maybe_unused]] std::string_view value) { | ||
| 55 | ctx.AddS64("{}=int64_t({});", inst, value); | ||
| 56 | } | ||
| 57 | |||
| 58 | void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 59 | [[maybe_unused]] std::string_view value) { | ||
| 60 | throw NotImplementedException("GLSL Instruction"); | ||
| 61 | } | ||
| 62 | |||
| 63 | void EmitConvertU16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 64 | [[maybe_unused]] std::string_view value) { | ||
| 65 | throw NotImplementedException("GLSL Instruction"); | ||
| 66 | } | ||
| 67 | |||
| 68 | void EmitConvertU16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 69 | [[maybe_unused]] std::string_view value) { | ||
| 70 | throw NotImplementedException("GLSL Instruction"); | ||
| 71 | } | ||
| 72 | |||
| 73 | void EmitConvertU32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 74 | [[maybe_unused]] std::string_view value) { | ||
| 75 | throw NotImplementedException("GLSL Instruction"); | ||
| 76 | } | ||
| 77 | |||
| 78 | void EmitConvertU32F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 79 | [[maybe_unused]] std::string_view value) { | ||
| 80 | ctx.AddU32("{}=uint({});", inst, value); | ||
| 81 | } | ||
| 82 | |||
| 83 | void EmitConvertU32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 84 | [[maybe_unused]] std::string_view value) { | ||
| 85 | ctx.AddU32("{}=uint({});", inst, value); | ||
| 86 | } | ||
| 87 | |||
| 88 | void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 89 | [[maybe_unused]] std::string_view value) { | ||
| 90 | throw NotImplementedException("GLSL Instruction"); | ||
| 91 | } | ||
| 92 | |||
| 93 | void EmitConvertU64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 94 | [[maybe_unused]] std::string_view value) { | ||
| 95 | ctx.AddU64("{}=uint64_t({});", inst, value); | ||
| 96 | } | ||
| 97 | |||
| 98 | void EmitConvertU64F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 99 | [[maybe_unused]] std::string_view value) { | ||
| 100 | ctx.AddU64("{}=uint64_t({});", inst, value); | ||
| 101 | } | ||
| 102 | |||
| 103 | void EmitConvertU64U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 104 | [[maybe_unused]] std::string_view value) { | ||
| 105 | ctx.AddU64("{}=uint64_t({});", inst, value); | ||
| 106 | } | ||
| 107 | |||
| 108 | void EmitConvertU32U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 109 | [[maybe_unused]] std::string_view value) { | ||
| 110 | ctx.AddU32("{}=uint({});", inst, value); | ||
| 111 | } | ||
| 112 | |||
| 113 | void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 114 | [[maybe_unused]] std::string_view value) { | ||
| 115 | throw NotImplementedException("GLSL Instruction"); | ||
| 116 | } | ||
| 117 | |||
| 118 | void EmitConvertF32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 119 | [[maybe_unused]] std::string_view value) { | ||
| 120 | throw NotImplementedException("GLSL Instruction"); | ||
| 121 | } | ||
| 122 | |||
| 123 | void EmitConvertF32F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 124 | [[maybe_unused]] std::string_view value) { | ||
| 125 | ctx.AddF32("{}=float({});", inst, value); | ||
| 126 | } | ||
| 127 | |||
| 128 | void EmitConvertF64F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 129 | [[maybe_unused]] std::string_view value) { | ||
| 130 | ctx.AddF64("{}=double({});", inst, value); | ||
| 131 | } | ||
| 132 | |||
| 133 | void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 134 | [[maybe_unused]] std::string_view value) { | ||
| 135 | throw NotImplementedException("GLSL Instruction"); | ||
| 136 | } | ||
| 137 | |||
| 138 | void EmitConvertF16S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 139 | [[maybe_unused]] std::string_view value) { | ||
| 140 | throw NotImplementedException("GLSL Instruction"); | ||
| 141 | } | ||
| 142 | |||
| 143 | void EmitConvertF16S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 144 | [[maybe_unused]] std::string_view value) { | ||
| 145 | throw NotImplementedException("GLSL Instruction"); | ||
| 146 | } | ||
| 147 | |||
| 148 | void EmitConvertF16S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 149 | [[maybe_unused]] std::string_view value) { | ||
| 150 | throw NotImplementedException("GLSL Instruction"); | ||
| 151 | } | ||
| 152 | |||
| 153 | void EmitConvertF16U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 154 | [[maybe_unused]] std::string_view value) { | ||
| 155 | throw NotImplementedException("GLSL Instruction"); | ||
| 156 | } | ||
| 157 | |||
| 158 | void EmitConvertF16U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 159 | [[maybe_unused]] std::string_view value) { | ||
| 160 | throw NotImplementedException("GLSL Instruction"); | ||
| 161 | } | ||
| 162 | |||
| 163 | void EmitConvertF16U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 164 | [[maybe_unused]] std::string_view value) { | ||
| 165 | throw NotImplementedException("GLSL Instruction"); | ||
| 166 | } | ||
| 167 | |||
| 168 | void EmitConvertF16U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 169 | [[maybe_unused]] std::string_view value) { | ||
| 170 | throw NotImplementedException("GLSL Instruction"); | ||
| 171 | } | ||
| 172 | |||
| 173 | void EmitConvertF32S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 174 | [[maybe_unused]] std::string_view value) { | ||
| 175 | throw NotImplementedException("GLSL Instruction"); | ||
| 176 | } | ||
| 177 | |||
| 178 | void EmitConvertF32S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 179 | [[maybe_unused]] std::string_view value) { | ||
| 180 | throw NotImplementedException("GLSL Instruction"); | ||
| 181 | } | ||
| 182 | |||
| 183 | void EmitConvertF32S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 184 | [[maybe_unused]] std::string_view value) { | ||
| 185 | ctx.AddF32("{}=float({});", inst, value); | ||
| 186 | } | ||
| 187 | |||
| 188 | void EmitConvertF32S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 189 | [[maybe_unused]] std::string_view value) { | ||
| 190 | ctx.AddF32("{}=float({});", inst, value); | ||
| 191 | } | ||
| 192 | |||
| 193 | void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 194 | [[maybe_unused]] std::string_view value) { | ||
| 195 | throw NotImplementedException("GLSL Instruction"); | ||
| 196 | } | ||
| 197 | |||
| 198 | void EmitConvertF32U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 199 | [[maybe_unused]] std::string_view value) { | ||
| 200 | throw NotImplementedException("GLSL Instruction"); | ||
| 201 | } | ||
| 202 | |||
| 203 | void EmitConvertF32U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 204 | [[maybe_unused]] std::string_view value) { | ||
| 205 | ctx.AddF32("{}=float({});", inst, value); | ||
| 206 | } | ||
| 207 | |||
| 208 | void EmitConvertF32U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 209 | [[maybe_unused]] std::string_view value) { | ||
| 210 | ctx.AddF32("{}=float({});", inst, value); | ||
| 211 | } | ||
| 212 | |||
| 213 | void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 214 | [[maybe_unused]] std::string_view value) { | ||
| 215 | throw NotImplementedException("GLSL Instruction"); | ||
| 216 | } | ||
| 217 | |||
| 218 | void EmitConvertF64S16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 219 | [[maybe_unused]] std::string_view value) { | ||
| 220 | throw NotImplementedException("GLSL Instruction"); | ||
| 221 | } | ||
| 222 | |||
| 223 | void EmitConvertF64S32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 224 | [[maybe_unused]] std::string_view value) { | ||
| 225 | ctx.AddF64("{}=double({});", inst, value); | ||
| 226 | } | ||
| 227 | |||
| 228 | void EmitConvertF64S64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 229 | [[maybe_unused]] std::string_view value) { | ||
| 230 | ctx.AddF64("{}=double({});", inst, value); | ||
| 231 | } | ||
| 232 | |||
| 233 | void EmitConvertF64U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 234 | [[maybe_unused]] std::string_view value) { | ||
| 235 | throw NotImplementedException("GLSL Instruction"); | ||
| 236 | } | ||
| 237 | |||
| 238 | void EmitConvertF64U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 239 | [[maybe_unused]] std::string_view value) { | ||
| 240 | throw NotImplementedException("GLSL Instruction"); | ||
| 241 | } | ||
| 242 | |||
| 243 | void EmitConvertF64U32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 244 | [[maybe_unused]] std::string_view value) { | ||
| 245 | ctx.AddF64("{}=double({});", inst, value); | ||
| 246 | } | ||
| 247 | |||
| 248 | void EmitConvertF64U64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | ||
| 249 | [[maybe_unused]] std::string_view value) { | ||
| 250 | ctx.AddF64("{}=double({});", inst, value); | ||
| 251 | } | ||
| 252 | |||
| 253 | } // namespace Shader::Backend::GLSL | ||