Commit 05a5d2c2 authored by Jiawei Shao's avatar Jiawei Shao Committed by Commit Bot

WebGPU: Add all BC formats to Blink

This patch adds all BC formats to Blink so that they can be used when
the extension "textureCompressionBC" is enabled.

BUG=chromium:996713

Change-Id: Ic35e9b6570d12273d09c8e688718509b4a88999a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975299Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Cr-Commit-Position: refs/heads/master@{#726613}
parent a0ccba08
...@@ -221,6 +221,50 @@ WGPUTextureFormat AsDawnEnum<WGPUTextureFormat>( ...@@ -221,6 +221,50 @@ WGPUTextureFormat AsDawnEnum<WGPUTextureFormat>(
return WGPUTextureFormat_Depth24PlusStencil8; return WGPUTextureFormat_Depth24PlusStencil8;
} }
// Block Compression (BC) formats
if (webgpu_enum == "bc1-rgba-unorm") {
return WGPUTextureFormat_BC1RGBAUnorm;
}
if (webgpu_enum == "bc1-rgba-unorm-srgb") {
return WGPUTextureFormat_BC1RGBAUnormSrgb;
}
if (webgpu_enum == "bc2-rgba-unorm") {
return WGPUTextureFormat_BC2RGBAUnorm;
}
if (webgpu_enum == "bc2-rgba-unorm-srgb") {
return WGPUTextureFormat_BC2RGBAUnormSrgb;
}
if (webgpu_enum == "bc3-rgba-unorm") {
return WGPUTextureFormat_BC3RGBAUnorm;
}
if (webgpu_enum == "bc3-rgba-unorm-srgb") {
return WGPUTextureFormat_BC3RGBAUnormSrgb;
}
if (webgpu_enum == "bc4-r-unorm") {
return WGPUTextureFormat_BC4RUnorm;
}
if (webgpu_enum == "bc4-r-snorm") {
return WGPUTextureFormat_BC4RSnorm;
}
if (webgpu_enum == "bc5-rg-unorm") {
return WGPUTextureFormat_BC5RGUnorm;
}
if (webgpu_enum == "bc5-rg-snorm") {
return WGPUTextureFormat_BC5RGSnorm;
}
if (webgpu_enum == "bc6h-rgb-ufloat") {
return WGPUTextureFormat_BC6HRGBUfloat;
}
if (webgpu_enum == "bc6h-rgb-sfloat") {
return WGPUTextureFormat_BC6HRGBSfloat;
}
if (webgpu_enum == "bc7-rgba-unorm") {
return WGPUTextureFormat_BC7RGBAUnorm;
}
if (webgpu_enum == "bc7-rgba-unorm-srgb") {
return WGPUTextureFormat_BC7RGBAUnormSrgb;
}
return WGPUTextureFormat_Force32; return WGPUTextureFormat_Force32;
} }
......
...@@ -65,5 +65,20 @@ enum GPUTextureFormat { ...@@ -65,5 +65,20 @@ enum GPUTextureFormat {
/* Depth / Stencil formats */ /* Depth / Stencil formats */
"depth32float", "depth32float",
"depth24plus", "depth24plus",
"depth24plus-stencil8" "depth24plus-stencil8",
/* Block Compression (BC) formats */
"bc1-rgba-unorm",
"bc1-rgba-unorm-srgb",
"bc2-rgba-unorm",
"bc2-rgba-unorm-srgb",
"bc3-rgba-unorm",
"bc3-rgba-unorm-srgb",
"bc4-r-unorm",
"bc4-r-snorm",
"bc5-rg-unorm",
"bc5-rg-snorm",
"bc6h-rgb-ufloat",
"bc6h-rgb-sfloat",
"bc7-rgba-unorm",
"bc7-rgba-unorm-srgb"
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment