mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #26714 - kunalmohan:gpu-render-pipeline, r=jdm
Implement GPURenderPipeline <!-- Please describe your changes on the following line: --> We need to wait for #26699 to merge before this. A significant amount of validation still needs to be added. I plan on doing that in a follow-up PR. r?@kvark --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
e0f3e9b980
16 changed files with 664 additions and 24 deletions
15
components/script/dom/webidls/GPUColorWrite.webidl
Normal file
15
components/script/dom/webidls/GPUColorWrite.webidl
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gpucolorwrite
|
||||
[Exposed=(Window, DedicatedWorker), Pref="dom.webgpu.enabled"]
|
||||
interface GPUColorWrite {
|
||||
const GPUColorWriteFlags RED = 0x1;
|
||||
const GPUColorWriteFlags GREEN = 0x2;
|
||||
const GPUColorWriteFlags BLUE = 0x4;
|
||||
const GPUColorWriteFlags ALPHA = 0x8;
|
||||
const GPUColorWriteFlags ALL = 0xF;
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
|
@ -22,7 +22,7 @@ interface GPUDevice : EventTarget {
|
|||
|
||||
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
|
||||
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
|
||||
// GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||
GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
|
||||
|
||||
GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
|
||||
// GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
|
||||
|
|
188
components/script/dom/webidls/GPURenderPipeline.webidl
Normal file
188
components/script/dom/webidls/GPURenderPipeline.webidl
Normal file
|
@ -0,0 +1,188 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://gpuweb.github.io/gpuweb/#gpurenderpipeline
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"]
|
||||
interface GPURenderPipeline {
|
||||
};
|
||||
GPURenderPipeline includes GPUObjectBase;
|
||||
|
||||
dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
|
||||
required GPUProgrammableStageDescriptor vertexStage;
|
||||
GPUProgrammableStageDescriptor fragmentStage;
|
||||
|
||||
required GPUPrimitiveTopology primitiveTopology;
|
||||
GPURasterizationStateDescriptor rasterizationState = {};
|
||||
required sequence<GPUColorStateDescriptor> colorStates;
|
||||
GPUDepthStencilStateDescriptor depthStencilState;
|
||||
GPUVertexStateDescriptor vertexState = {};
|
||||
|
||||
GPUSize32 sampleCount = 1;
|
||||
GPUSampleMask sampleMask = 0xFFFFFFFF;
|
||||
boolean alphaToCoverageEnabled = false;
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUSampleMask;
|
||||
|
||||
enum GPUPrimitiveTopology {
|
||||
"point-list",
|
||||
"line-list",
|
||||
"line-strip",
|
||||
"triangle-list",
|
||||
"triangle-strip"
|
||||
};
|
||||
|
||||
typedef [EnforceRange] long GPUDepthBias;
|
||||
|
||||
dictionary GPURasterizationStateDescriptor {
|
||||
GPUFrontFace frontFace = "ccw";
|
||||
GPUCullMode cullMode = "none";
|
||||
|
||||
GPUDepthBias depthBias = 0;
|
||||
float depthBiasSlopeScale = 0;
|
||||
float depthBiasClamp = 0;
|
||||
};
|
||||
|
||||
enum GPUFrontFace {
|
||||
"ccw",
|
||||
"cw"
|
||||
};
|
||||
|
||||
enum GPUCullMode {
|
||||
"none",
|
||||
"front",
|
||||
"back"
|
||||
};
|
||||
|
||||
dictionary GPUColorStateDescriptor {
|
||||
//required GPUTextureFormat format;
|
||||
|
||||
GPUBlendDescriptor alphaBlend = {};
|
||||
GPUBlendDescriptor colorBlend = {};
|
||||
GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL
|
||||
};
|
||||
|
||||
dictionary GPUBlendDescriptor {
|
||||
GPUBlendFactor srcFactor = "one";
|
||||
GPUBlendFactor dstFactor = "zero";
|
||||
GPUBlendOperation operation = "add";
|
||||
};
|
||||
|
||||
enum GPUBlendFactor {
|
||||
"zero",
|
||||
"one",
|
||||
"src-color",
|
||||
"one-minus-src-color",
|
||||
"src-alpha",
|
||||
"one-minus-src-alpha",
|
||||
"dst-color",
|
||||
"one-minus-dst-color",
|
||||
"dst-alpha",
|
||||
"one-minus-dst-alpha",
|
||||
"src-alpha-saturated",
|
||||
"blend-color",
|
||||
"one-minus-blend-color"
|
||||
};
|
||||
|
||||
enum GPUBlendOperation {
|
||||
"add",
|
||||
"subtract",
|
||||
"reverse-subtract",
|
||||
"min",
|
||||
"max"
|
||||
};
|
||||
|
||||
enum GPUStencilOperation {
|
||||
"keep",
|
||||
"zero",
|
||||
"replace",
|
||||
"invert",
|
||||
"increment-clamp",
|
||||
"decrement-clamp",
|
||||
"increment-wrap",
|
||||
"decrement-wrap"
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUStencilValue;
|
||||
|
||||
dictionary GPUDepthStencilStateDescriptor {
|
||||
//required GPUTextureFormat format;
|
||||
|
||||
boolean depthWriteEnabled = false;
|
||||
GPUCompareFunction depthCompare = "always";
|
||||
|
||||
GPUStencilStateFaceDescriptor stencilFront = {};
|
||||
GPUStencilStateFaceDescriptor stencilBack = {};
|
||||
|
||||
GPUStencilValue stencilReadMask = 0xFFFFFFFF;
|
||||
GPUStencilValue stencilWriteMask = 0xFFFFFFFF;
|
||||
};
|
||||
|
||||
dictionary GPUStencilStateFaceDescriptor {
|
||||
GPUCompareFunction compare = "always";
|
||||
GPUStencilOperation failOp = "keep";
|
||||
GPUStencilOperation depthFailOp = "keep";
|
||||
GPUStencilOperation passOp = "keep";
|
||||
};
|
||||
|
||||
enum GPUIndexFormat {
|
||||
"uint16",
|
||||
"uint32"
|
||||
};
|
||||
|
||||
enum GPUVertexFormat {
|
||||
"uchar2",
|
||||
"uchar4",
|
||||
"char2",
|
||||
"char4",
|
||||
"uchar2norm",
|
||||
"uchar4norm",
|
||||
"char2norm",
|
||||
"char4norm",
|
||||
"ushort2",
|
||||
"ushort4",
|
||||
"short2",
|
||||
"short4",
|
||||
"ushort2norm",
|
||||
"ushort4norm",
|
||||
"short2norm",
|
||||
"short4norm",
|
||||
"half2",
|
||||
"half4",
|
||||
"float",
|
||||
"float2",
|
||||
"float3",
|
||||
"float4",
|
||||
"uint",
|
||||
"uint2",
|
||||
"uint3",
|
||||
"uint4",
|
||||
"int",
|
||||
"int2",
|
||||
"int3",
|
||||
"int4"
|
||||
};
|
||||
|
||||
enum GPUInputStepMode {
|
||||
"vertex",
|
||||
"instance"
|
||||
};
|
||||
|
||||
dictionary GPUVertexStateDescriptor {
|
||||
GPUIndexFormat indexFormat = "uint32";
|
||||
sequence<GPUVertexBufferLayoutDescriptor?> vertexBuffers = [];
|
||||
};
|
||||
|
||||
dictionary GPUVertexBufferLayoutDescriptor {
|
||||
required GPUSize64 arrayStride;
|
||||
GPUInputStepMode stepMode = "vertex";
|
||||
required sequence<GPUVertexAttributeDescriptor> attributes;
|
||||
};
|
||||
|
||||
dictionary GPUVertexAttributeDescriptor {
|
||||
required GPUVertexFormat format;
|
||||
required GPUSize64 offset;
|
||||
|
||||
required GPUIndex32 shaderLocation;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue