Metal: Fix write-only qualifier on shader generation

A small logic issue caused all write-only image resources
to be tagged as read-write in all cases. This caused
correctness issues on Intel and AMD GPUs which
are resolved through this change.

Change also yields a small performance uplift
due to enabling improved non-dependent workload
scheduling.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/120528
This commit is contained in:
Jason Fielder
2024-04-11 18:17:40 +02:00
committed by Jeroen Bakker
parent 2582664f67
commit 5f86faf3a5

View File

@@ -1902,7 +1902,7 @@ void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateIn
case shader::ShaderCreateInfo::Resource::BindType::IMAGE: {
/* Flatten qualifier flags into final access state. */
MSLTextureSamplerAccess access;
if (bool(res.image.qualifiers & Qualifier::READ_WRITE)) {
if ((res.image.qualifiers & Qualifier::READ_WRITE) == Qualifier::READ_WRITE) {
access = MSLTextureSamplerAccess::TEXTURE_ACCESS_READWRITE;
}
else if (bool(res.image.qualifiers & Qualifier::WRITE)) {