diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index 71eb3ac2b..4381ed351 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -120,7 +120,17 @@ void EmitImageSampleDrefImplicitLod([[maybe_unused]] EmitContext& ctx, | |||
| 120 | [[maybe_unused]] std::string_view dref, | 120 | [[maybe_unused]] std::string_view dref, |
| 121 | [[maybe_unused]] std::string_view bias_lc, | 121 | [[maybe_unused]] std::string_view bias_lc, |
| 122 | [[maybe_unused]] const IR::Value& offset) { | 122 | [[maybe_unused]] const IR::Value& offset) { |
| 123 | throw NotImplementedException("GLSL Instruction"); | 123 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 124 | if (info.has_bias) { | ||
| 125 | throw NotImplementedException("Bias texture samples"); | ||
| 126 | } | ||
| 127 | if (info.has_lod_clamp) { | ||
| 128 | throw NotImplementedException("Lod clamp samples"); | ||
| 129 | } | ||
| 130 | const auto bias{info.has_bias ? fmt::format(",{}", bias_lc) : ""}; | ||
| 131 | const auto texture{Texture(ctx, info, index)}; | ||
| 132 | const auto vec_cast{info.type == TextureType::ColorArrayCube ? "vec4" : "vec3"}; | ||
| 133 | ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, vec_cast, dref, coords, bias); | ||
| 124 | } | 134 | } |
| 125 | 135 | ||
| 126 | void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx, | 136 | void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx, |
| @@ -130,7 +140,19 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx, | |||
| 130 | [[maybe_unused]] std::string_view dref, | 140 | [[maybe_unused]] std::string_view dref, |
| 131 | [[maybe_unused]] std::string_view lod_lc, | 141 | [[maybe_unused]] std::string_view lod_lc, |
| 132 | [[maybe_unused]] const IR::Value& offset) { | 142 | [[maybe_unused]] const IR::Value& offset) { |
| 133 | throw NotImplementedException("GLSL Instruction"); | 143 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 144 | if (info.has_bias) { | ||
| 145 | throw NotImplementedException("Bias texture samples"); | ||
| 146 | } | ||
| 147 | if (info.has_lod_clamp) { | ||
| 148 | throw NotImplementedException("Lod clamp samples"); | ||
| 149 | } | ||
| 150 | const auto texture{Texture(ctx, info, index)}; | ||
| 151 | if (info.type == TextureType::ColorArrayCube) { | ||
| 152 | ctx.AddF32("{}=textureLod({},{},{},{});", inst, texture, coords, dref, lod_lc); | ||
| 153 | } else { | ||
| 154 | ctx.AddF32("{}=textureLod({},vec3({},{}),{});", inst, texture, coords, dref, lod_lc); | ||
| 155 | } | ||
| 134 | } | 156 | } |
| 135 | 157 | ||
| 136 | void EmitImageGather([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 158 | void EmitImageGather([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |