summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-03 19:15:36 -0400
committerGravatar ameerj2021-07-22 21:51:37 -0400
commit8d8ce24f20649be639dbb3cc0f3edc90c6a6481e (patch)
treeb85e6fd9a9440cdfe6abaab483f5a98a8ee5159f /src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
parentglsl: Implement Images (diff)
downloadyuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.gz
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.tar.xz
yuzu-8d8ce24f20649be639dbb3cc0f3edc90c6a6481e.zip
glsl: Implement Load/WriteGlobal
along with some other misc changes and fixes
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,
212 } 212 }
213 } else { 213 } else {
214 if (ctx.stage == Stage::Fragment) { 214 if (ctx.stage == Stage::Fragment) {
215 ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, cast, coords, dref, bias); 215 if (info.type == TextureType::ColorArrayCube) {
216 ctx.AddF32("{}=texture({},vec4({}),{});", inst, texture, coords, dref);
217 } else {
218 ctx.AddF32("{}=texture({},{}({},{}){});", inst, texture, cast, coords, dref, bias);
219 }
216 } else { 220 } else {
217 ctx.AddF32("{}=textureLod({},{}({},{}),0.0);", inst, texture, cast, coords, dref); 221 ctx.AddF32("{}=textureLod({},{}({},{}),0.0);", inst, texture, cast, coords, dref);
218 } 222 }
@@ -238,6 +242,7 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
238 throw NotImplementedException("EmitImageSampleDrefExplicitLod Lod clamp samples"); 242 throw NotImplementedException("EmitImageSampleDrefExplicitLod Lod clamp samples");
239 } 243 }
240 const auto texture{Texture(ctx, info, index)}; 244 const auto texture{Texture(ctx, info, index)};
245 const auto cast{ShadowSamplerVecCast(info.type)};
241 if (!offset.IsEmpty()) { 246 if (!offset.IsEmpty()) {
242 const auto offset_str{CastToIntVec(ctx.var_alloc.Consume(offset), info)}; 247 const auto offset_str{CastToIntVec(ctx.var_alloc.Consume(offset), info)};
243 if (info.type == TextureType::ColorArrayCube) { 248 if (info.type == TextureType::ColorArrayCube) {
@@ -251,7 +256,8 @@ void EmitImageSampleDrefExplicitLod([[maybe_unused]] EmitContext& ctx,
251 if (info.type == TextureType::ColorArrayCube) { 256 if (info.type == TextureType::ColorArrayCube) {
252 ctx.AddF32("{}=textureLod({},{},{},{});", inst, texture, coords, dref, lod_lc); 257 ctx.AddF32("{}=textureLod({},{},{},{});", inst, texture, coords, dref, lod_lc);
253 } else { 258 } else {
254 ctx.AddF32("{}=textureLod({},vec3({},{}),{});", inst, texture, coords, dref, lod_lc); 259 ctx.AddF32("{}=textureLod({},{}({},{}),{});", inst, texture, cast, coords, dref,
260 lod_lc);
255 } 261 }
256 } 262 }
257} 263}