Commit 45161529 authored by Jinho Bang's avatar Jinho Bang Committed by Commit Bot

WebGPU: Remove createBufferMappedAsync

Spec change:
  https://github.com/gpuweb/gpuweb/pull/516

Test change:
  https://github.com/gpuweb/cts/pull/100

Bug: 852089
Change-Id: I0ff5da9b131ba588ca7608b6966461ff67f5a0bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975388
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727370}
parent 3014b040
...@@ -133,43 +133,6 @@ HeapVector<ScriptValue> GPUDevice::createBufferMapped( ...@@ -133,43 +133,6 @@ HeapVector<ScriptValue> GPUDevice::createBufferMapped(
}); });
} }
ScriptPromise GPUDevice::createBufferMappedAsync(
ScriptState* script_state,
const GPUBufferDescriptor* descriptor,
ExceptionState& exception_state) {
GPUBuffer* gpu_buffer;
DOMArrayBuffer* array_buffer;
std::tie(gpu_buffer, array_buffer) =
GPUBuffer::CreateMapped(this, descriptor, exception_state);
v8::Isolate* isolate = script_state->GetIsolate();
v8::Local<v8::Object> creation_context = script_state->GetContext()->Global();
v8::Local<v8::Value> elements[] = {
ToV8(gpu_buffer, creation_context, isolate),
ToV8(array_buffer, creation_context, isolate),
};
ScriptValue result(isolate, v8::Array::New(isolate, elements, 2));
auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
ScriptPromise promise = resolver->Promise();
// TODO(enga): CreateBufferMappedAsync is intended to spend more time to
// create an optimal mapping for the buffer. It resolves the promise when the
// mapping is complete. Currently, there is always a staging buffer in the
// wire so this is already the optimal path and the promise is immediately
// resolved. When we can create a buffer such that the memory is mapped
// directly in the renderer process, this promise should be resolved
// asynchronously.
if (exception_state.HadException()) {
resolver->Reject(exception_state);
} else {
resolver->Resolve(result);
}
return promise;
}
GPUTexture* GPUDevice::createTexture(const GPUTextureDescriptor* descriptor, GPUTexture* GPUDevice::createTexture(const GPUTextureDescriptor* descriptor,
ExceptionState& exception_state) { ExceptionState& exception_state) {
return GPUTexture::Create(this, descriptor, exception_state); return GPUTexture::Create(this, descriptor, exception_state);
......
...@@ -72,9 +72,6 @@ class GPUDevice final : public EventTargetWithInlineData, ...@@ -72,9 +72,6 @@ class GPUDevice final : public EventTargetWithInlineData,
ScriptState* script_state, ScriptState* script_state,
const GPUBufferDescriptor* descriptor, const GPUBufferDescriptor* descriptor,
ExceptionState& exception_state); ExceptionState& exception_state);
ScriptPromise createBufferMappedAsync(ScriptState* script_state,
const GPUBufferDescriptor* descriptor,
ExceptionState& exception_state);
GPUTexture* createTexture(const GPUTextureDescriptor* descriptor, GPUTexture* createTexture(const GPUTextureDescriptor* descriptor,
ExceptionState& exception_state); ExceptionState& exception_state);
GPUSampler* createSampler(const GPUSamplerDescriptor* descriptor); GPUSampler* createSampler(const GPUSamplerDescriptor* descriptor);
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
GPUBuffer createBuffer(GPUBufferDescriptor descriptor); GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
[CallWith=ScriptState, RaisesException] GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor); [CallWith=ScriptState, RaisesException] GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor);
[CallWith=ScriptState, RaisesException] Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor);
[RaisesException] GPUTexture createTexture(GPUTextureDescriptor descriptor); [RaisesException] GPUTexture createTexture(GPUTextureDescriptor descriptor);
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
......
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