0

Allow SharedArrayBuffers in bufferData and bufferSubData.

Specify [AllowShared] for the ArrayBuffer arguments in the associated
overloads of these methods.

Revise the IDLExtendedAttributes.md documentation to indicate that
[AllowShared] may be applied to ArrayBuffer arguments in addition to
ArrayBufferView arguments.

Remove failure suppressions for the associated WebGL conformance
tests.

Bug: 1081973
Change-Id: I09e85fdc86d347d3591d3de4dc6b42187528760d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373712
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#957446}
This commit is contained in:
Kenneth Russell
2022-01-11 06:58:43 +00:00
committed by Chromium LUCI CQ
parent ae758cd0c6
commit 6b1f07659a
8 changed files with 17 additions and 15 deletions

@ -221,7 +221,6 @@ crbug.com/891861 conformance2/extensions/webgl-multi-draw-instanced-base-vertex-
crbug.com/1131224 conformance2/rendering/framebuffer-mismatched-attachment-targets.html [ Failure ]
crbug.com/1108086 [ no-passthrough ] conformance2/renderbuffers/framebuffer-object-attachment.html [ Failure ]
crbug.com/angleproject/4807 [ win angle-d3d11 passthrough ] conformance2/glsl3/switch-case.html [ Failure ]
crbug.com/1081973 conformance/buffers/buffer-data-and-buffer-sub-data.html [ Failure ]
crbug.com/1082533 [ mac intel ] conformance/textures/misc/texture-copying-and-deletion.html [ Failure ]
crbug.com/angleproject/5038 conformance/extensions/ext-color-buffer-half-float.html [ Failure ]
crbug.com/1136231 [ win passthrough ] conformance/extensions/s3tc-and-rgtc.html [ Failure ]

@ -293,7 +293,6 @@ crbug.com/1043953 [ chromeos chromeos-board-amd64-generic ] conformance/textures
# ========================
# Fails on all platforms
crbug.com/1081973 conformance/buffers/buffer-data-and-buffer-sub-data.html [ Failure ]
crbug.com/1082533 [ mac intel ] conformance/textures/misc/texture-copying-and-deletion.html [ Failure ]
# TODO(crbug.com/1136231): Uncomment suppressions for s3tc-and-rgtc.html below
# under crbug.com/963205 and crbug.com/964321 once these two failures are fixed.

@ -1452,7 +1452,7 @@ Usage: Applies to arguments of methods. See modules/webgl/WebGLRenderingContextB
### [AllowShared] _(p)_
Summary: `[AllowShared]` indicates that a parameter, which must be an ArrayBufferView (or subtype of, e.g. typed arrays), is allowed to be backed by a SharedArrayBuffer.
Summary: `[AllowShared]` indicates that a parameter, which must be an ArrayBufferView (or subtype of, e.g. typed arrays), is allowed to be backed by a SharedArrayBuffer. It also indicates that an ArrayBuffer parameter allows a SharedArrayBuffer to be passed.
Usage: `[AllowShared]` must be specified on a parameter to a method:
@ -1460,11 +1460,14 @@ Usage: `[AllowShared]` must be specified on a parameter to a method:
interface Context {
void bufferData1([AllowShared] ArrayBufferView buffer);
void bufferData2([AllowShared] Float32Array buffer);
void bufferData3([AllowShared] ArrayBuffer buffer);
}
```
A SharedArrayBuffer is a distinct type from an ArrayBuffer, but both types use ArrayBufferViews to view the data in the buffer. Most methods do not permit an ArrayBufferView that is backed by a SharedArrayBuffer, and will throw an exception. This attribute indicates that this method permits a shared ArrayBufferView.
When applied to an ArrayBuffer argument, the underlying C++ method called by the bindings receives a `DOMArrayBufferBase*` instead of `DOMArrayBuffer*`.
### [PermissiveDictionaryConversion] _(p, d)_
Summary: `[PermissiveDictionaryConversion]` relaxes the rules about what types of values may be passed for an argument of dictionary type.

@ -264,7 +264,7 @@ void WebGL2RenderingContextBase::bufferData(GLenum target,
}
void WebGL2RenderingContextBase::bufferData(GLenum target,
DOMArrayBuffer* data,
DOMArrayBufferBase* data,
GLenum usage) {
WebGLRenderingContextBase::bufferData(target, data, usage);
}
@ -298,7 +298,7 @@ void WebGL2RenderingContextBase::bufferSubData(
void WebGL2RenderingContextBase::bufferSubData(GLenum target,
int64_t offset,
DOMArrayBuffer* data) {
DOMArrayBufferBase* data) {
WebGLRenderingContextBase::bufferSubData(target, offset, data);
}

@ -42,11 +42,11 @@ class WebGL2RenderingContextBase : public WebGLRenderingContextBase {
// base class. This is because the above buffer{Sub}Data() hides the name
// from base class.
void bufferData(GLenum target, int64_t size, GLenum usage);
void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage);
void bufferData(GLenum target, DOMArrayBufferBase* data, GLenum usage);
void bufferData(GLenum target,
MaybeShared<DOMArrayBufferView> data,
GLenum usage);
void bufferSubData(GLenum target, int64_t offset, DOMArrayBuffer* data);
void bufferSubData(GLenum target, int64_t offset, DOMArrayBufferBase* data);
void bufferSubData(GLenum target,
int64_t offset,
const FlexibleArrayBufferView& data);

@ -2120,7 +2120,7 @@ void WebGLRenderingContextBase::bufferData(GLenum target,
}
void WebGLRenderingContextBase::bufferData(GLenum target,
DOMArrayBuffer* data,
DOMArrayBufferBase* data,
GLenum usage) {
if (isContextLost())
return;
@ -2128,7 +2128,7 @@ void WebGLRenderingContextBase::bufferData(GLenum target,
SynthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data");
return;
}
BufferDataImpl(target, data->ByteLength(), data->Data(), usage);
BufferDataImpl(target, data->ByteLength(), data->DataMaybeShared(), usage);
}
void WebGLRenderingContextBase::bufferData(GLenum target,
@ -2162,11 +2162,12 @@ void WebGLRenderingContextBase::BufferSubDataImpl(GLenum target,
void WebGLRenderingContextBase::bufferSubData(GLenum target,
int64_t offset,
DOMArrayBuffer* data) {
DOMArrayBufferBase* data) {
if (isContextLost())
return;
DCHECK(data);
BufferSubDataImpl(target, offset, data->ByteLength(), data->Data());
BufferSubDataImpl(target, offset, data->ByteLength(),
data->DataMaybeShared());
}
void WebGLRenderingContextBase::bufferSubData(

@ -193,11 +193,11 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
GLenum dst_alpha);
void bufferData(GLenum target, int64_t size, GLenum usage);
void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage);
void bufferData(GLenum target, DOMArrayBufferBase* data, GLenum usage);
void bufferData(GLenum target,
MaybeShared<DOMArrayBufferView> data,
GLenum usage);
void bufferSubData(GLenum target, int64_t offset, DOMArrayBuffer* data);
void bufferSubData(GLenum target, int64_t offset, DOMArrayBufferBase* data);
void bufferSubData(GLenum target,
int64_t offset,
const FlexibleArrayBufferView& data);

@ -482,9 +482,9 @@ interface mixin WebGLRenderingContextBase {
// https://www.khronos.org/bugzilla/show_bug.cgi?id=1172
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, [AllowShared] ArrayBufferView data, GLenum usage);
void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);
void bufferData(GLenum target, [AllowShared] ArrayBuffer? data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, [AllowShared, FlexibleArrayBufferView] ArrayBufferView data);
void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer data);
void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer data);
GLenum checkFramebufferStatus(GLenum target);
[NoAllocDirectCall] void clear(GLbitfield mask);