MVKBuffer: Only set MTLTextureUsageShaderAtomic on views with supported pixel format.

This commit is contained in:
Jan Sikorski 2024-03-06 11:35:47 +01:00
parent b56c152a12
commit 69446d122d

View File

@ -292,7 +292,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
}