Merge pull request #2173 from js6i/fixup-2

Don't set MTLTextureUsageShaderAtomic if the pixel format does not support it.
This commit is contained in:
Bill Hollings 2024-03-07 10:19:28 -05:00 committed by GitHub
commit 5d21869b6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -291,7 +291,7 @@ id<MTLTexture> MVKBufferView::getMTLTexture() {
if ( mvkIsAnyFlagEnabled(_buffer->getUsage(), VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) ) {
usage |= MTLTextureUsageShaderWrite;
#if MVK_XCODE_15
if (getPhysicalDevice()->useNativeTextureAtomics())
if (getPhysicalDevice()->useNativeTextureAtomics() && (_mtlPixelFormat == MTLPixelFormatR32Sint || _mtlPixelFormat == MTLPixelFormatR32Uint || _mtlPixelFormat == MTLPixelFormatRG32Uint))
usage |= MTLTextureUsageShaderAtomic;
#endif
}

View File

@ -729,7 +729,7 @@ MTLTextureUsage MVKPixelFormats::getMTLTextureUsage(VkImageUsageFlags vkImageUsa
}
#if MVK_XCODE_15
if (supportAtomics) {
if (supportAtomics && (mtlFormat == MTLPixelFormatR32Uint || mtlFormat == MTLPixelFormatR32Sint || mtlFormat == MTLPixelFormatRG32Uint)) {
mvkEnableFlags(mtlUsage, MTLTextureUsageShaderAtomic);
}
#endif