Title: [292203] trunk/Source/WebGPU
- Revision
- 292203
- Author
- [email protected]
- Date
- 2022-03-31 22:09:41 -0700 (Thu, 31 Mar 2022)
Log Message
[WebGPU] etc2-rgba8unorm and etc2-rgba8unorm-srgb are not handled
https://bugs.webkit.org/show_bug.cgi?id=238435
Reviewed by Dean Jackson.
They map to MTLPixelFormatEAC_RGBA8 and MTLPixelFormatEAC_RGBA8_sRGB.
* WebGPU/Texture.mm:
(WebGPU::pixelFormat):
(WebGPU::Device::createTexture):
Modified Paths
Diff
Modified: trunk/Source/WebGPU/ChangeLog (292202 => 292203)
--- trunk/Source/WebGPU/ChangeLog 2022-04-01 05:04:44 UTC (rev 292202)
+++ trunk/Source/WebGPU/ChangeLog 2022-04-01 05:09:41 UTC (rev 292203)
@@ -1,5 +1,18 @@
2022-03-31 Myles C. Maxfield <[email protected]>
+ [WebGPU] etc2-rgba8unorm and etc2-rgba8unorm-srgb are not handled
+ https://bugs.webkit.org/show_bug.cgi?id=238435
+
+ Reviewed by Dean Jackson.
+
+ They map to MTLPixelFormatEAC_RGBA8 and MTLPixelFormatEAC_RGBA8_sRGB.
+
+ * WebGPU/Texture.mm:
+ (WebGPU::pixelFormat):
+ (WebGPU::Device::createTexture):
+
+2022-03-31 Myles C. Maxfield <[email protected]>
+
[WebGPU] 2 texture formats need to be guarded behind optional extensions
https://bugs.webkit.org/show_bug.cgi?id=238433
Modified: trunk/Source/WebGPU/WebGPU/Texture.mm (292202 => 292203)
--- trunk/Source/WebGPU/WebGPU/Texture.mm 2022-04-01 05:04:44 UTC (rev 292202)
+++ trunk/Source/WebGPU/WebGPU/Texture.mm 2022-04-01 05:09:41 UTC (rev 292203)
@@ -1222,11 +1222,9 @@
return result;
}
-static std::optional<MTLPixelFormat> pixelFormat(WGPUTextureFormat textureFormat)
+static MTLPixelFormat pixelFormat(WGPUTextureFormat textureFormat)
{
switch (textureFormat) {
- case WGPUTextureFormat_Undefined:
- return std::nullopt;
case WGPUTextureFormat_R8Unorm:
return MTLPixelFormatR8Unorm;
case WGPUTextureFormat_R8Snorm:
@@ -1320,9 +1318,9 @@
case WGPUTextureFormat_ETC2RGB8A1UnormSrgb:
return MTLPixelFormatETC2_RGB8A1_sRGB;
case WGPUTextureFormat_ETC2RGBA8Unorm:
- return std::nullopt; // https://github.com/gpuweb/gpuweb/issues/2683 etc2-rgba8unorm and etc2-rgba8unorm-srgb do not exist in Metal
+ return MTLPixelFormatEAC_RGBA8;
case WGPUTextureFormat_ETC2RGBA8UnormSrgb:
- return std::nullopt; // https://github.com/gpuweb/gpuweb/issues/2683 etc2-rgba8unorm and etc2-rgba8unorm-srgb do not exist in Metal
+ return MTLPixelFormatEAC_RGBA8_sRGB;
case WGPUTextureFormat_EACR11Unorm:
return MTLPixelFormatEAC_R11Unorm;
case WGPUTextureFormat_EACR11Snorm:
@@ -1434,10 +1432,11 @@
case WGPUTextureFormat_BC6HRGBFloat:
case WGPUTextureFormat_BC7RGBAUnorm:
case WGPUTextureFormat_BC7RGBAUnormSrgb:
- return std::nullopt;
+ return MTLPixelFormatInvalid;
#endif
+ case WGPUTextureFormat_Undefined:
case WGPUTextureFormat_Force32:
- return std::nullopt;
+ return MTLPixelFormatInvalid;
}
}
@@ -1901,10 +1900,7 @@
return nullptr;
}
- if (auto pixelFormat = WebGPU::pixelFormat(descriptor.format))
- textureDescriptor.pixelFormat = pixelFormat.value();
- else
- return nullptr;
+ textureDescriptor.pixelFormat = pixelFormat(descriptor.format);
textureDescriptor.mipmapLevelCount = descriptor.mipLevelCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes