Skip to content

Commit

Permalink
Reland "WebGPU: Add GPUProgrammablePassEncoder interface"
Browse files Browse the repository at this point in the history
Reason for revert:
Use of the GPUProgrammablePassEncoder and GPURenderEncoderBase
interfaces aren't installing the function templates properly.

According to the spec[1], the first identifier of `includes` statement
MUST reference a `interface`. It means that a `interface mixin` cannot
include the other `interface mixin`.
In this case, even though GPURenderEncoderBase is `interface mixin`, it
includes GPUProgrammablePassEncoder which is `interface mixin`.

Solution:
The problem should be fixed in spec side[2] and make final interfaces
include the mixins directly as follows:
  GPURenderBundleEncoder includes GPUProgrammablePassEncoder;
  GPURenderPassEncoder includes GPUProgrammablePassEncoder;

Original change's description:
> WebGPU: Add GPUProgrammablePassEncoder interface
>
> This is a spec match-up with[1]
>
> [1] gpuweb/gpuweb#459
>
> Bug: 877147
> Change-Id: I080324cbb083160ae84aa109623e311f24a875cb
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845132
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
> Cr-Commit-Position: refs/heads/master@{#704061}

[1] https://heycam.github.io/webidl/#includes-statement
[2] gpuweb/gpuweb#470

Bug: 1013649
Change-Id: Iaeb1ac69b0f1f7a779c341e7a92f6b29e28d3880
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857846
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705991}
  • Loading branch information
romandev authored and Commit Bot committed Oct 15, 2019
1 parent a59e78e commit f2a7bb6
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 63 deletions.
2 changes: 2 additions & 0 deletions third_party/blink/renderer/modules/modules_idl_files.gni
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,8 @@ modules_dependency_idl_files =
"webdatabase/window_web_database.idl",
"webgl/webgl2_rendering_context_base.idl",
"webgl/webgl_rendering_context_base.idl",
"webgpu/gpu_programmable_pass_encoder.idl",
"webgpu/gpu_render_encoder_base.idl",
"webgpu/navigator_gpu.idl",
"webmidi/navigator_web_midi.idl",
"webshare/navigator_share.idl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@
[
RuntimeEnabled=WebGPU
] interface GPUComputePassEncoder {
// GPUProgrammablePassEncoder methods
void setBindGroup(unsigned long index,
GPUBindGroup bindGroup,
optional sequence<GPUBufferSize> dynamicOffsets = []);
void pushDebugGroup(DOMString groupLabel);
void popDebugGroup();
void insertDebugMarker(DOMString markerLabel);

void setPipeline(GPUComputePipeline pipeline);

void dispatch(unsigned long x,
optional unsigned long y = 1,
optional unsigned long z = 1);
Expand All @@ -25,3 +16,4 @@

void endPass();
};
GPUComputePassEncoder includes GPUProgrammablePassEncoder;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://gpuweb.github.io/gpuweb/

[
RuntimeEnabled=WebGPU
] interface mixin GPUProgrammablePassEncoder {
void setBindGroup(unsigned long index, GPUBindGroup bindGroup,
optional sequence<GPUBufferSize> dynamicOffsets = []);

void pushDebugGroup(DOMString groupLabel);
void popDebugGroup();
void insertDebugMarker(DOMString markerLabel);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,7 @@
[
RuntimeEnabled=WebGPU
] interface GPURenderBundleEncoder {
// GPUProgrammablePassEncoder methods
void setBindGroup(unsigned long index,
GPUBindGroup bindGroup,
optional sequence<GPUBufferSize> dynamicOffsets = []);
void pushDebugGroup(DOMString groupLabel);
void popDebugGroup();
void insertDebugMarker(DOMString markerLabel);

// GPURenderEncoderBase methods
void setPipeline(GPURenderPipeline pipeline);
void setIndexBuffer(GPUBuffer buffer, optional GPUBufferSize offset = 0);
void setVertexBuffer(unsigned long slot,
GPUBuffer buffer,
optional GPUBufferSize offset = 0);
void draw(unsigned long vertexCount, unsigned long instanceCount,
unsigned long firstVertex,
unsigned long firstInstance);
void drawIndexed(unsigned long indexCount, unsigned long instanceCount,
unsigned long firstIndex,
long baseVertex,
unsigned long firstInstance);
void drawIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);
void drawIndexedIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);

// GPURenderBundleEncoder methods
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
};
GPURenderBundleEncoder includes GPUProgrammablePassEncoder;
GPURenderBundleEncoder includes GPURenderEncoderBase;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://gpuweb.github.io/gpuweb/

[
RuntimeEnabled=WebGPU
] interface mixin GPURenderEncoderBase {
void setPipeline(GPURenderPipeline pipeline);

void setIndexBuffer(GPUBuffer buffer, optional GPUBufferSize offset = 0);
void setVertexBuffer(unsigned long slot,
GPUBuffer buffer,
optional GPUBufferSize offset = 0);

void draw(unsigned long vertexCount, unsigned long instanceCount,
unsigned long firstVertex,
unsigned long firstInstance);
void drawIndexed(unsigned long indexCount, unsigned long instanceCount,
unsigned long firstIndex,
long baseVertex,
unsigned long firstInstance);

void drawIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);
void drawIndexedIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,18 @@
[
RuntimeEnabled=WebGPU
] interface GPURenderPassEncoder {
// GPUProgrammablePassEncoder methods
void setBindGroup(unsigned long index,
GPUBindGroup bindGroup,
optional sequence<GPUBufferSize> dynamicOffsets = []);
void pushDebugGroup(DOMString groupLabel);
void popDebugGroup();
void insertDebugMarker(DOMString markerLabel);

void setPipeline(GPURenderPipeline pipeline);

[RaisesException] void setBlendColor(GPUColor color);
void setStencilReference(unsigned long reference);
void setViewport(float x, float y,
float width, float height,
float minDepth, float maxDepth);

void setScissorRect(unsigned long x, unsigned long y,
unsigned long width, unsigned long height);
void setIndexBuffer(GPUBuffer buffer, optional GPUBufferSize offset = 0);
void setVertexBuffer(unsigned long slot,
GPUBuffer buffer,
optional GPUBufferSize offset = 0);
void draw(unsigned long vertexCount, unsigned long instanceCount,
unsigned long firstVertex,
unsigned long firstInstance);
void drawIndexed(unsigned long indexCount, unsigned long instanceCount,
unsigned long firstIndex,
long baseVertex,
unsigned long firstInstance);
void drawIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);
void drawIndexedIndirect(GPUBuffer indirectBuffer,
GPUBufferSize indirectOffset);

[RaisesException] void setBlendColor(GPUColor color);
void setStencilReference(unsigned long reference);

void executeBundles(sequence<GPURenderBundle> bundles);
void endPass();
};
GPURenderPassEncoder includes GPUProgrammablePassEncoder;
GPURenderPassEncoder includes GPURenderEncoderBase;

0 comments on commit f2a7bb6

Please sign in to comment.