summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-04 01:15:36 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commit8d8ce24f20649be639dbb3cc0f3edc90c6a6481e (patch)
treeb85e6fd9a9440cdfe6abaab483f5a98a8ee5159f /src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
parentglsl: Implement Images (diff)
downloadyuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.gz
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.bz2
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.lz
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.xz
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.zst
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp10
1 files changed, 8 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 8c54f0fb3..37ddd57d3 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -212,7 +212,11 @@ void EmitImageSampleDrefImplicitLod([[maybe_unused]] EmitContext& ctx,
}
} else {
if (ctx.stage == Stage::Fragment) {
- ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, cast, coords, dref, bias);
+ if (info.type == TextureType::ColorArrayCube) {
+ ctx.AddF32("{}=texture({},vec4({}),{});", inst, texture, coords, dref);
+ } else {
+ ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, cast, coords, dref, bias);
+ }
} else {
ctx.AddF32("{}=textureLod({},{}({},{}),0.0);", inst, texture, cast, coords, dref);
}
@@ -238,6 +242,7 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
throw NotImplementedException("EmitImageSampleDrefExplicitLod Lod clamp samples");
}
const auto texture{Texture(ctx, info, index)};
+ const auto cast{ShadowSamplerVecCast(info.type)};
if (!offset.IsEmpty()) {
const auto offset_str{CastToIntVec(ctx.var_alloc.Consume(offset), info)};
if (info.type == TextureType::ColorArrayCube) {
@@ -251,7 +256,8 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
if (info.type == TextureType::ColorArrayCube) {
ctx.AddF32("{}=textureLod({},{},{},{});", inst, texture, coords, dref, lod_lc);
} else {
- ctx.AddF32("{}=textureLod({},vec3({},{}),{});", inst, texture, coords, dref, lod_lc);
+ ctx.AddF32("{}=textureLod({},{}({},{}),{});", inst, texture, cast, coords, dref,
+ lod_lc);
}
}
}