Bug 1917059: feat(webgpu): expose ETC2 texture support r=webgpu-reviewers,webidl,teoxoy,smaug

Differential Revision: https://phabricator.services.mozilla.com/D221258
This commit is contained in:
Erich Gubler 2024-09-13 05:49:02 +00:00
parent c009eb9b14
commit 8e26b22133
4 changed files with 115 additions and 0 deletions

View File

@ -368,6 +368,36 @@ ffi::WGPUTextureFormat ConvertTextureFormat(
result.astc.block = ffi::WGPUAstcBlock_B12x12;
result.astc.channel = ffi::WGPUAstcChannel_UnormSrgb;
break;
case dom::GPUTextureFormat::Etc2_rgb8unorm:
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8Unorm;
break;
case dom::GPUTextureFormat::Etc2_rgb8unorm_srgb:
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8UnormSrgb;
break;
case dom::GPUTextureFormat::Etc2_rgb8a1unorm:
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8A1Unorm;
break;
case dom::GPUTextureFormat::Etc2_rgb8a1unorm_srgb:
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8A1UnormSrgb;
break;
case dom::GPUTextureFormat::Etc2_rgba8unorm:
result.tag = ffi::WGPUTextureFormat_Etc2Rgba8Unorm;
break;
case dom::GPUTextureFormat::Etc2_rgba8unorm_srgb:
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8UnormSrgb;
break;
case dom::GPUTextureFormat::Eac_r11unorm:
result.tag = ffi::WGPUTextureFormat_EacR11Unorm;
break;
case dom::GPUTextureFormat::Eac_r11snorm:
result.tag = ffi::WGPUTextureFormat_EacR11Snorm;
break;
case dom::GPUTextureFormat::Eac_rg11unorm:
result.tag = ffi::WGPUTextureFormat_EacRg11Unorm;
break;
case dom::GPUTextureFormat::Eac_rg11snorm:
result.tag = ffi::WGPUTextureFormat_EacRg11Snorm;
break;
}
// Clang will check for us that the switch above is exhaustive,

View File

@ -383,6 +383,19 @@ enum GPUTextureFormat {
"bc7-rgba-unorm",
"bc7-rgba-unorm-srgb",
// ETC2 compressed formats usable if "texture-compression-etc2" is both
// supported by the device/user agent and enabled in requestDevice.
"etc2-rgb8unorm",
"etc2-rgb8unorm-srgb",
"etc2-rgb8a1unorm",
"etc2-rgb8a1unorm-srgb",
"etc2-rgba8unorm",
"etc2-rgba8unorm-srgb",
"eac-r11unorm",
"eac-r11snorm",
"eac-rg11unorm",
"eac-rg11snorm",
// ASTC compressed formats usable if "texture-compression-astc" is both
// supported by the device/user agent and enabled in requestDevice.
"astc-4x4-unorm",

View File

@ -461,82 +461,102 @@
expected: FAIL
[:format="eac-r11snorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-r11snorm";canvasType="offscreen";enable_required_feature=true]
[:format="eac-r11snorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-r11snorm";canvasType="onscreen";enable_required_feature=true]
[:format="eac-r11unorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-r11unorm";canvasType="offscreen";enable_required_feature=true]
[:format="eac-r11unorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-r11unorm";canvasType="onscreen";enable_required_feature=true]
[:format="eac-rg11snorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11snorm";canvasType="offscreen";enable_required_feature=true]
[:format="eac-rg11snorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11snorm";canvasType="onscreen";enable_required_feature=true]
[:format="eac-rg11unorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11unorm";canvasType="offscreen";enable_required_feature=true]
[:format="eac-rg11unorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11unorm";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgb8a1unorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgb8a1unorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgb8a1unorm-srgb";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm-srgb";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgb8a1unorm-srgb";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm-srgb";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgb8unorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgb8unorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgb8unorm-srgb";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm-srgb";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgb8unorm-srgb";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm-srgb";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgba8unorm";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgba8unorm";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm";canvasType="onscreen";enable_required_feature=true]
[:format="etc2-rgba8unorm-srgb";canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm-srgb";canvasType="offscreen";enable_required_feature=true]
[:format="etc2-rgba8unorm-srgb";canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm-srgb";canvasType="onscreen";enable_required_feature=true]
@ -1062,82 +1082,102 @@
if os == "win": FAIL
[:viewFormats=["eac-r11snorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-r11snorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["eac-r11snorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-r11snorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["eac-r11unorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-r11unorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["eac-r11unorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-r11unorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["eac-rg11snorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-rg11snorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["eac-rg11snorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-rg11snorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["eac-rg11unorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-rg11unorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["eac-rg11unorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["eac-rg11unorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8a1unorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8a1unorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8a1unorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8a1unorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8a1unorm-srgb"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8a1unorm-srgb"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8a1unorm-srgb"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8a1unorm-srgb"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8unorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8unorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8unorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8unorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8unorm-srgb"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8unorm-srgb"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgb8unorm-srgb"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgb8unorm-srgb"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgba8unorm"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgba8unorm"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgba8unorm"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgba8unorm"\];canvasType="onscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgba8unorm-srgb"\];canvasType="offscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgba8unorm-srgb"\];canvasType="offscreen";enable_required_feature=true]
[:viewFormats=["etc2-rgba8unorm-srgb"\];canvasType="onscreen";enable_required_feature=false]
expected: FAIL
[:viewFormats=["etc2-rgba8unorm-srgb"\];canvasType="onscreen";enable_required_feature=true]
@ -1385,42 +1425,52 @@
[:format="depth32float-stencil8";enable_required_feature=true]
[:format="eac-r11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11snorm";enable_required_feature=true]
[:format="eac-r11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11unorm";enable_required_feature=true]
[:format="eac-rg11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11snorm";enable_required_feature=true]
[:format="eac-rg11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true]
[:format="etc2-rgb8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm";enable_required_feature=true]
[:format="etc2-rgb8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm-srgb";enable_required_feature=true]
[:format="etc2-rgba8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm";enable_required_feature=true]
[:format="etc2-rgba8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm-srgb";enable_required_feature=true]
@ -1643,42 +1693,52 @@
[:format="depth32float-stencil8";enable_required_feature=true]
[:format="eac-r11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11snorm";enable_required_feature=true]
[:format="eac-r11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11unorm";enable_required_feature=true]
[:format="eac-rg11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11snorm";enable_required_feature=true]
[:format="eac-rg11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true]
[:format="etc2-rgb8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm";enable_required_feature=true]
[:format="etc2-rgb8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm-srgb";enable_required_feature=true]
[:format="etc2-rgba8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm";enable_required_feature=true]
[:format="etc2-rgba8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm-srgb";enable_required_feature=true]
@ -1901,41 +1961,51 @@
[:format="depth32float-stencil8";enable_required_feature=true]
[:format="eac-r11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11snorm";enable_required_feature=true]
[:format="eac-r11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-r11unorm";enable_required_feature=true]
[:format="eac-rg11snorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11snorm";enable_required_feature=true]
[:format="eac-rg11unorm";enable_required_feature=false]
expected: FAIL
[:format="eac-rg11unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm";enable_required_feature=true]
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true]
[:format="etc2-rgb8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm";enable_required_feature=true]
[:format="etc2-rgb8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgb8unorm-srgb";enable_required_feature=true]
[:format="etc2-rgba8unorm";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm";enable_required_feature=true]
[:format="etc2-rgba8unorm-srgb";enable_required_feature=false]
expected: FAIL
[:format="etc2-rgba8unorm-srgb";enable_required_feature=true]

View File

@ -59,7 +59,9 @@
[cts.https.html?q=webgpu:examples:gpu,with_texture_compression,etc2:*]
implementation-status: backlog
[:textureCompressionETC2=false]
expected: FAIL
[:textureCompressionETC2=true]