Skip to content

Commit

Permalink
[WebGPU] MTLTextureUsagePixelFormatView needs to be specified on comp…
Browse files Browse the repository at this point in the history
…ressed textures

https://bugs.webkit.org/show_bug.cgi?id=265929
<radar://119234400>

Reviewed by Tadeu Zagallo.

As we do not know in advance if createView will be called on a compressed
texture, set the flag pre-emptively instead of recreating the texture.

This approach could be revisited if we see performance issues.

* Source/WebGPU/WebGPU/Texture.mm:
(WebGPU::Texture::usage):

Canonical link: https://commits.webkit.org/271619@main
  • Loading branch information
mwyrzykowski committed Dec 6, 2023
1 parent cf2f494 commit d7430f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebGPU/WebGPU/Texture.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ static bool textureViewFormatCompatible(WGPUTextureFormat format1, WGPUTextureFo
result |= MTLTextureUsageShaderWrite;
if (usage & WGPUTextureUsage_RenderAttachment)
result |= MTLTextureUsageRenderTarget;
if (Texture::isDepthOrStencilFormat(format))
if (Texture::isDepthOrStencilFormat(format) || Texture::isCompressedFormat(format))
result |= MTLTextureUsagePixelFormatView;
return result;
}
Expand Down

0 comments on commit d7430f0

Please sign in to comment.