Skip to content

Commit

Permalink
Separate nullable blend descriptor (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Nov 23, 2020
1 parent 6eb23c2 commit 37b409f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
20 changes: 11 additions & 9 deletions samples/hello-cube.html
Expand Up @@ -169,15 +169,17 @@
};
const colorState = {
format: "bgra8unorm",
alphaBlend: {
srcFactor: "src-alpha",
dstFactor: "one-minus-src-alpha",
operation: "add"
},
colorBlend: {
srcFactor: "src-alpha",
dstFactor: "one-minus-src-alpha",
operation: "add"
blend: {
alpha: {
srcFactor: "src-alpha",
dstFactor: "one-minus-src-alpha",
operation: "add"
},
color: {
srcFactor: "src-alpha",
dstFactor: "one-minus-src-alpha",
operation: "add"
},
},
writeMask: GPUColorWriteBits.ALL
};
Expand Down
18 changes: 12 additions & 6 deletions spec/index.bs
Expand Up @@ -3822,12 +3822,18 @@ enum GPUCullMode {
dictionary GPUColorStateDescriptor {
required GPUTextureFormat format;

GPUBlendDescriptor alphaBlend = {};
GPUBlendDescriptor colorBlend = {};
GPUBlendDescriptor blend;
GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL
};
</script>

<script type=idl>
dictionary GPUBlendDescriptor {
required GPUBlendComponent color;
required GPUBlendComponent alpha;
};
</script>

<script type=idl>
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
interface GPUColorWrite {
Expand All @@ -3842,7 +3848,7 @@ interface GPUColorWrite {
#### Blend State #### {#blend-state}

<script type=idl>
dictionary GPUBlendDescriptor {
dictionary GPUBlendComponent {
GPUBlendFactor srcFactor = "one";
GPUBlendFactor dstFactor = "zero";
GPUBlendOperation operation = "add";
Expand Down Expand Up @@ -3886,9 +3892,9 @@ enum GPUBlendOperation {

1. |descriptor|.{{GPUColorStateDescriptor/format}} is listed in {#plain-color-formats}
with {{GPUTextureUsage/RENDER_ATTACHMENT}} capability.
1. |descriptor|.{{GPUColorStateDescriptor/alphaBlend}} and |descriptor|.{{GPUColorStateDescriptor/colorBlend}}
are either both defaults, or |descriptor|.{{GPUColorStateDescriptor/format}} has
{{GPUTextureComponentType/"float"}} component type.
1. |descriptor|.{{GPUColorStateDescriptor/blend}} is either `undefined`,
or the |descriptor|.{{GPUColorStateDescriptor/format}} is filterable
according to the {#plain-color-formats} table.
1. |descriptor|.{{GPUColorStateDescriptor/writeMask}} is less than 16.
</div>

Expand Down

0 comments on commit 37b409f

Please sign in to comment.