Commit 7d7dc643 authored by Corentin Wallez's avatar Corentin Wallez Committed by Commit Bot

WebGPU: Remove deprecated APIs.

The PSA in https://hackmd.io/uH1MI9cnQBG9GGOZG20COw deprecates a number
of WebGPU APIs. Now that we are past the removal deadline we can remove
them from Blink and only keep the supported paths.

Bug: dawn:22
Change-Id: I9241e78db5578d6cb97593e9e3363b493fed481c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827873}
parent 598ed344
......@@ -231,10 +231,6 @@ WGPUTextureFormat AsDawnEnum<WGPUTextureFormat>(
if (webgpu_enum == "rgb10a2unorm") {
return WGPUTextureFormat_RGB10A2Unorm;
}
if (webgpu_enum == "rg11b10float") {
// Deprecated.
return WGPUTextureFormat_RG11B10Ufloat;
}
if (webgpu_enum == "rg11b10ufloat") {
return WGPUTextureFormat_RG11B10Ufloat;
}
......@@ -318,10 +314,6 @@ WGPUTextureFormat AsDawnEnum<WGPUTextureFormat>(
if (webgpu_enum == "bc6h-rgb-float") {
return WGPUTextureFormat_BC6HRGBFloat;
}
if (webgpu_enum == "bc6h-rgb-sfloat") {
// Deprecated.
return WGPUTextureFormat_BC6HRGBFloat;
}
if (webgpu_enum == "bc7-rgba-unorm") {
return WGPUTextureFormat_BC7RGBAUnorm;
}
......
......@@ -27,8 +27,7 @@ WGPUDeviceProperties AsDawnType(const GPUDeviceDescriptor* descriptor) {
// TODO(crbug.com/1048603): We should validate that the extension_set is a
// subset of the adapter's extension set.
requested_device_properties.textureCompressionBC =
extension_set.Contains("texture-compression-bc") ||
extension_set.Contains("textureCompressionBC");
extension_set.Contains("texture-compression-bc");
requested_device_properties.shaderFloat16 =
extension_set.Contains("shader-float16");
requested_device_properties.timestampQuery =
......@@ -82,7 +81,6 @@ void GPUAdapter::InitializeExtensionNameList() {
DCHECK(extension_name_list_.IsEmpty());
if (adapter_properties_.textureCompressionBC) {
extension_name_list_.emplace_back("texture-compression-bc");
extension_name_list_.emplace_back("textureCompressionBC");
}
if (adapter_properties_.shaderFloat16) {
extension_name_list_.emplace_back("shader-float16");
......
......@@ -7,8 +7,6 @@
enum GPUExtensionName {
"texture-compression-bc",
"timestamp-query",
// Non-standard extension name string. Remove after a transition period.
"textureCompressionBC",
"shader-float16"
};
......
......@@ -34,13 +34,6 @@ WGPUBindGroupLayoutEntry AsDawnType(
dawn_binding.textureComponentType = AsDawnEnum<WGPUTextureComponentType>(
webgpu_binding->textureComponentType());
dawn_binding.multisampled = webgpu_binding->multisampled();
if (dawn_binding.multisampled) {
device->AddConsoleWarning(
"Creating a GPUBindGroupLayoutEntry with entry.multisampled = true is "
"deprecated: set entry.type = \"multisampled-texture\" instead.");
}
dawn_binding.storageTextureFormat =
AsDawnEnum<WGPUTextureFormat>(webgpu_binding->storageTextureFormat());
......
......@@ -16,7 +16,6 @@ dictionary GPUBindGroupLayoutEntry {
GPUTextureViewDimension viewDimension = "2d";
GPUTextureComponentType textureComponentType = "float";
boolean multisampled = false;
GPUTextureFormat storageTextureFormat;
};
......
......@@ -79,12 +79,6 @@ GPUDevice::GPUDevice(ExecutionContext* execution_context,
GetProcs().deviceSetDeviceLostCallback(GetHandle(),
lost_callback_->UnboundCallback(),
lost_callback_->AsUserdata());
if (extension_name_list_.Contains("textureCompressionBC")) {
AddConsoleWarning(
"The extension name 'textureCompressionBC' is deprecated: use "
"'texture-compression-bc' instead");
}
}
GPUDevice::~GPUDevice() {
......
......@@ -109,26 +109,10 @@ void GPURenderBundleEncoder::setPipeline(GPURenderPipeline* pipeline) {
GetProcs().renderBundleEncoderSetPipeline(GetHandle(), pipeline->GetHandle());
}
void GPURenderBundleEncoder::setIndexBuffer(GPUBuffer* buffer,
uint64_t offset,
uint64_t size) {
device_->AddConsoleWarning(
"Calling setIndexBuffer without a GPUIndexFormat is deprecated.");
GetProcs().renderBundleEncoderSetIndexBuffer(GetHandle(), buffer->GetHandle(),
offset, size);
}
void GPURenderBundleEncoder::setIndexBuffer(GPUBuffer* buffer,
const WTF::String& format,
uint64_t offset,
uint64_t size,
ExceptionState& exception_state) {
if (format != "uint16" && format != "uint32") {
exception_state.ThrowTypeError(
"The provided value '" + format +
"' is not a valid enum value of type GPUIndexFormat.");
return;
}
uint64_t size) {
GetProcs().renderBundleEncoderSetIndexBufferWithFormat(
GetHandle(), buffer->GetHandle(), AsDawnEnum<WGPUIndexFormat>(format),
offset, size);
......
......@@ -47,12 +47,10 @@ class GPURenderBundleEncoder : public DawnObject<WGPURenderBundleEncoder>,
void insertDebugMarker(String markerLabel);
void setPipeline(GPURenderPipeline* pipeline);
void setIndexBuffer(GPUBuffer* buffer, uint64_t offset, uint64_t size);
void setIndexBuffer(GPUBuffer* buffer,
const WTF::String& format,
uint64_t offset,
uint64_t size,
ExceptionState& exception_state);
uint64_t size);
void setVertexBuffer(uint32_t slot,
const GPUBuffer* buffer,
uint64_t offset,
......
......@@ -10,17 +10,7 @@
void setPipeline(GPURenderPipeline pipeline);
void setIndexBuffer(GPUBuffer buffer,
optional GPUSize64 offset = 0,
optional GPUSize64 size = 0);
// TODO: the format argument here should be a GPUIndexFormat enum, but that
// is causing problems with the bindings generator when paired with the
// overload. The above overload is deprecated and will be removed soon,
// which will allow us to use the correct type here. In the meantime we'll
// validate that the given string is one of the expected enum values
// manually.
[RaisesException]
void setIndexBuffer(GPUBuffer buffer,
DOMString format,
GPUIndexFormat format,
optional GPUSize64 offset = 0,
optional GPUSize64 size = 0);
......
......@@ -108,26 +108,10 @@ void GPURenderPassEncoder::setScissorRect(uint32_t x,
GetProcs().renderPassEncoderSetScissorRect(GetHandle(), x, y, width, height);
}
void GPURenderPassEncoder::setIndexBuffer(GPUBuffer* buffer,
uint64_t offset,
uint64_t size) {
device_->AddConsoleWarning(
"Calling setIndexBuffer without a GPUIndexFormat is deprecated.");
GetProcs().renderPassEncoderSetIndexBuffer(GetHandle(), buffer->GetHandle(),
offset, size);
}
void GPURenderPassEncoder::setIndexBuffer(GPUBuffer* buffer,
const WTF::String& format,
uint64_t offset,
uint64_t size,
ExceptionState& exception_state) {
if (format != "uint16" && format != "uint32") {
exception_state.ThrowTypeError(
"The provided value '" + format +
"' is not a valid enum value of type GPUIndexFormat.");
return;
}
uint64_t size) {
GetProcs().renderPassEncoderSetIndexBufferWithFormat(
GetHandle(), buffer->GetHandle(), AsDawnEnum<WGPUIndexFormat>(format),
offset, size);
......
......@@ -53,12 +53,10 @@ class GPURenderPassEncoder : public DawnObject<WGPURenderPassEncoder>,
float minDepth,
float maxDepth);
void setScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
void setIndexBuffer(GPUBuffer* buffer, uint64_t offset, uint64_t size);
void setIndexBuffer(GPUBuffer* buffer,
const WTF::String& format,
uint64_t offset,
uint64_t size,
ExceptionState& exception_state);
uint64_t size);
void setVertexBuffer(uint32_t slot,
const GPUBuffer* buffer,
const uint64_t offset,
......
......@@ -246,28 +246,6 @@ GPURenderPipeline* GPURenderPipeline::Create(
isolate, webgpu_desc->vertexState(), exception_state);
WGPUVertexStateDescriptor dawn_vertex_state = std::get<0>(vertex_state_info);
// TODO(crbug.com/1121762): Remove these checks after a deprecation period.
if (dawn_vertex_state.indexFormat == WGPUIndexFormat_Undefined) {
dawn_vertex_state.indexFormat = WGPUIndexFormat_Uint32;
if (dawn_desc.primitiveTopology == WGPUPrimitiveTopology_LineStrip ||
dawn_desc.primitiveTopology == WGPUPrimitiveTopology_TriangleStrip) {
device->AddConsoleWarning(
"Creating a GPUVertexStateDescriptor with a default indexFormat is "
"deprecated: Specify an explicit GPUIndexFormat when using "
"'line-strip' or 'triangle-strip' primitive topologies.");
}
} else if (dawn_desc.primitiveTopology == WGPUPrimitiveTopology_PointList ||
dawn_desc.primitiveTopology == WGPUPrimitiveTopology_LineList ||
dawn_desc.primitiveTopology ==
WGPUPrimitiveTopology_TriangleList) {
device->AddConsoleWarning(
"Creating a GPUVertexStateDescriptor with an explicit indexFormat is "
"deprecated when using 'point-list', 'line-list', or 'triangle-list' "
"primitive topologies: Specify the GPUIndexFormat when calling "
"setIndexBuffer() instead.");
}
dawn_desc.vertexState = &dawn_vertex_state;
if (exception_state.HadException()) {
......
......@@ -27,14 +27,6 @@ WGPUTextureDescriptor AsDawnType(const GPUTextureDescriptor* webgpu_desc,
dawn_desc.dimension =
AsDawnEnum<WGPUTextureDimension>(webgpu_desc->dimension());
dawn_desc.size = AsDawnType(&webgpu_desc->size());
if (webgpu_desc->format() == "rg11b10float") {
device->AddConsoleWarning(
"rg11b10float is deprecated. Use rg11b10ufloat instead.");
}
if (webgpu_desc->format() == "bc6h-rgb-sfloat") {
device->AddConsoleWarning(
"bc6h-rgb-sfloat is deprecated. Use bc6h-rgb-float instead.");
}
dawn_desc.format = AsDawnEnum<WGPUTextureFormat>(webgpu_desc->format());
dawn_desc.mipLevelCount = webgpu_desc->mipLevelCount();
dawn_desc.sampleCount = webgpu_desc->sampleCount();
......
......@@ -50,7 +50,6 @@ enum GPUTextureFormat {
/* Packed 32 bit formats */
"rgb9e5ufloat",
"rgb10a2unorm",
"rg11b10float",
"rg11b10ufloat",
/* Normal 64 bit formats */
"rg32uint",
......@@ -80,7 +79,6 @@ enum GPUTextureFormat {
"bc5-rg-snorm",
"bc6h-rgb-ufloat",
"bc6h-rgb-float",
"bc6h-rgb-sfloat",
"bc7-rgba-unorm",
"bc7-rgba-unorm-srgb"
};
......@@ -38,6 +38,7 @@ wpt_internal/webgpu/cts.html?q=webgpu:api,validation,createBindGroupLayout:visib
wpt_internal/webgpu/cts.html?q=webgpu:api,validation,copyBufferToBuffer:copy_with_invalid_buffer: [ Failure ]
wpt_internal/webgpu/cts.html?q=webgpu:api,validation,encoding,cmds,compute_pass:* [ Failure ]
wpt_internal/webgpu/cts.html?q=webgpu:api,validation,render_pass,storeOp:* [ Failure ]
wpt_internal/webgpu/cts.html?q=webgpu:api,operation,render_pipeline,primitive_topology:* [ Failure ]
wpt_internal/webgpu/cts.html?q=webgpu:api,validation,buffer_mapping:mapAsync,invalidBuffer:* [ Failure ]
wpt_internal/webgpu/cts.html?q=webgpu:api,validation,buffer_mapping:mapAsync,offsetAndSizeAlignment,* [ Failure ]
......
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