summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-04-11 02:37:03 -0300
committerGravatar ameerj2021-07-22 21:51:27 -0400
commitab543f18213133b3076b81f30df386d5cb470e49 (patch)
tree7d34e2e5e168225a4e1d5a6750eae31174d2a530 /src/shader_recompiler/backend
parentshader: Move LaneId to the warp emission file and fix AMD (diff)
downloadyuzu-ab543f18213133b3076b81f30df386d5cb470e49.tar.gz
yuzu-ab543f18213133b3076b81f30df386d5cb470e49.tar.xz
yuzu-ab543f18213133b3076b81f30df386d5cb470e49.zip
spirv: Guard against typeless image reads on unsupported devices
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.cpp4
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
index 63ed92a5d..db7b3f1b2 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
@@ -238,11 +238,13 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct
238 ctx.AddCapability(spv::Capability::SubgroupVoteKHR); 238 ctx.AddCapability(spv::Capability::SubgroupVoteKHR);
239 } 239 }
240 } 240 }
241 if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) {
242 ctx.AddCapability(spv::Capability::StorageImageReadWithoutFormat);
243 }
241 // TODO: Track this usage 244 // TODO: Track this usage
242 ctx.AddCapability(spv::Capability::ImageGatherExtended); 245 ctx.AddCapability(spv::Capability::ImageGatherExtended);
243 ctx.AddCapability(spv::Capability::ImageQuery); 246 ctx.AddCapability(spv::Capability::ImageQuery);
244 ctx.AddCapability(spv::Capability::SampledBuffer); 247 ctx.AddCapability(spv::Capability::SampledBuffer);
245 ctx.AddCapability(spv::Capability::StorageImageReadWithoutFormat);
246} 248}
247} // Anonymous namespace 249} // Anonymous namespace
248 250
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
index dd261fd47..17266ce77 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
@@ -388,6 +388,10 @@ Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, I
388 388
389Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords) { 389Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords) {
390 const auto info{inst->Flags<IR::TextureInstInfo>()}; 390 const auto info{inst->Flags<IR::TextureInstInfo>()};
391 if (info.image_format == ImageFormat::Typeless && !ctx.profile.support_typeless_image_loads) {
392 // LOG_WARNING(..., "Typeless image read not supported by host");
393 return ctx.ConstantNull(ctx.U32[4]);
394 }
391 return Emit(&EmitContext::OpImageSparseRead, &EmitContext::OpImageRead, ctx, inst, ctx.U32[4], 395 return Emit(&EmitContext::OpImageSparseRead, &EmitContext::OpImageRead, ctx, inst, ctx.U32[4],
392 Image(ctx, index, info), coords, std::nullopt, std::span<const Id>{}); 396 Image(ctx, index, info), coords, std::nullopt, std::span<const Id>{});
393} 397}