summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-05-29 20:10:24 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:36 +0200
commit59a692e9edf385d56f84f38006cf15fff4372d6b (patch)
treea50b887ea1d577e7cd4a0149fe19ad15f88ac481 /src
parentshader_recompiler: GCC fixes (diff)
downloadyuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar.gz
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar.bz2
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar.lz
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar.xz
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.tar.zst
yuzu-59a692e9edf385d56f84f38006cf15fff4372d6b.zip
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index 6962f2b91..68701ee52 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -26,8 +26,8 @@ std::string CastToIntVec(std::string_view value, const IR::TextureInstInfo& info
return fmt::format("int({})", value);
case TextureType::ColorArray1D:
case TextureType::Color2D:
- return fmt::format("ivec2({})", value);
case TextureType::ColorArray2D:
+ return fmt::format("ivec2({})", value);
case TextureType::Color3D:
case TextureType::ColorCube:
return fmt::format("ivec3({})", value);
@@ -65,7 +65,11 @@ void EmitImageSampleImplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unuse
ctx.Add("{}=textureOffset({},{},{}{});", texel, texture, coords,
CastToIntVec(ctx.reg_alloc.Consume(offset), info), bias);
} else {
- ctx.Add("{}=texture({},{}{});", texel, texture, coords, bias);
+ if (ctx.stage == Stage::Fragment) {
+ ctx.Add("{}=texture({},{}{});", texel, texture, coords, bias);
+ } else {
+ ctx.Add("{}=textureLod({},{},0.0);", texel, texture, coords);
+ }
}
return;
}
@@ -104,6 +108,7 @@ void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unuse
}
return;
}
+ // TODO: Query sparseTexels extension support
if (!offset.IsEmpty()) {
ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));",
*sparse_inst, texture, CastToIntVec(coords, info), lod_lc,
@@ -121,17 +126,7 @@ void EmitImageSampleDrefImplicitLod([[maybe_unused]] EmitContext& ctx,
[[maybe_unused]] std::string_view dref,
[[maybe_unused]] std::string_view bias_lc,
[[maybe_unused]] const IR::Value& offset) {
- const auto info{inst.Flags<IR::TextureInstInfo>()};
- if (info.has_bias) {
- throw NotImplementedException("Bias texture samples");
- }
- if (info.has_lod_clamp) {
- throw NotImplementedException("Lod clamp samples");
- }
- const auto bias{info.has_bias ? fmt::format(",{}", bias_lc) : ""};
- const auto texture{Texture(ctx, info, index)};
- const auto vec_cast{info.type == TextureType::ColorArrayCube ? "vec4" : "vec3"};
- ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, vec_cast, dref, coords, bias);
+ throw NotImplementedException("GLSL Instruction");
}
void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
@@ -148,6 +143,9 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
if (info.has_lod_clamp) {
throw NotImplementedException("Lod clamp samples");
}
+ if (!offset.IsEmpty()) {
+ throw NotImplementedException("textureLodOffset");
+ }
const auto texture{Texture(ctx, info, index)};
if (info.type == TextureType::ColorArrayCube) {
ctx.AddF32("{}=textureLod({},{},{},{});", inst, texture, coords, dref, lod_lc);