Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make blending state explicit #1134

Merged
merged 1 commit into from Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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