From 7ee65b14933ae59349a8cce2c3b5e586bbb2760a Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Mon, 6 May 2024 16:40:41 +0800 Subject: [PATCH 01/29] Add optional feature dual_source_blending --- spec/index.bs | 48 +++++++++++++++++++++++++ wgsl/index.bs | 44 +++++++++++++++++++++-- wgsl/syntax/attribute.syntax.bs.include | 2 ++ 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 857ed0ee04..7be37b4bd2 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -88,6 +88,7 @@ spec: WGSL; urlPrefix: https://gpuweb.github.io/gpuweb/wgsl/# type: dfn text: f16; url: f16 text: location; url: input-output-locations + text: blend_src; url: input-output-locations text: interpolation; url: interpolation text: pipeline-overridable; url: pipeline-overridable text: pipeline constant ID; url: pipeline-constant-id @@ -124,6 +125,7 @@ spec: WGSL; urlPrefix: https://gpuweb.github.io/gpuweb/wgsl/# text: frag_depth; url: built-in-values-frag_depth for: extension text: f16; url: extension-f16 + text: dual_source_blending; url: extension-dual_source_blending type: abstract-op text: SizeOf; url: sizeof spec: Internationalization Glossary; urlPrefix: https://www.w3.org/TR/i18n-glossary/# @@ -8075,6 +8077,14 @@ dictionary GPUFragmentState : {{GPUTextureSampleType/"uint"}} :: |output| must have an unsigned integer scalar type. + - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} + uses src1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, + {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}): + - |output| must have a [=blend_src=] attribute. + - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=] and |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or .{{GPUBlendComponent/dstFactor}} uses the source alpha @@ -8204,6 +8214,12 @@ location: RGBAsrc Color output by the fragment shader for the color attachment. If the shader doesn't return an alpha channel, src-alpha blend factors cannot be used. + + RGBAsrc1 + Color output by the fragment shader for the color attachment with + "@blend_src" attribute + equal to `1`. + If the shader doesn't return an alpha channel, src1-alpha blend factors cannot be used. RGBAdst Color currently in the color attachment. @@ -8235,6 +8251,10 @@ enum GPUBlendFactor { "src-alpha-saturated", "constant", "one-minus-constant", + "src1", + "one-minus-src1", + "src1-alpha", + "one-minus-src1-alpha", }; @@ -8287,6 +8307,18 @@ enum GPUBlendFactor { "one-minus-constant" (1 - Rconst, 1 - Gconst, 1 - Bconst, 1 - Aconst) + + "src1" + (Rsrc1, Gsrc1, Bsrc1, Asrc1) + + "one-minus-src1" + (1 - Rsrc1, 1 - Gsrc1, 1 - Bsrc1, 1 - Asrc1) + + "src1-alpha" + (Asrc1, Asrc1, Asrc1, Asrc1) + + "one-minus-src1-alpha" + (1 - Asrc1, 1 - Asrc1, 1 - Asrc1, 1 - Asrc1) @@ -15118,6 +15150,22 @@ This feature adds no [=optional API surfaces=]. Makes textures with formats {{GPUTextureFormat/"r32float"}}, {{GPUTextureFormat/"rg32float"}}, and {{GPUTextureFormat/"rgba32float"}} [=filterable=]. +

`"dual-source-blending"` + +Allows the use of [=attribute/blend_src=] in WGSL and simultaneously using both pixel shader outputs +(`@blend_src(0)` and `@blend_src(1)`) as inputs to a blending operation with the single color +attachment at [=attribute/location=] `0`. + +This feature adds the following [=optional API surfaces=]: +- Allows the use of the below {{GPUBlendFactor}}s: + - {{GPUBlendFactor/"src1"}} + - {{GPUBlendFactor/"one-minus-src1"}} + - {{GPUBlendFactor/"src1-alpha"}} + - {{GPUBlendFactor/"one-minus-src1-alpha"}} + +- New WGSL extensions: + - [=extension/dual_source_blending=] + # Appendices # {#appendices} ## Texture Format Capabilities ## {#texture-format-caps} diff --git a/wgsl/index.bs b/wgsl/index.bs index 4d9c858808..f6dec73216 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -1330,6 +1330,7 @@ The [=syntax/attribute=] names are: * `'interpolate'` * `'invariant'` * `'location'` +* `'blend_src'` * `'must_use'` * `'size'` * `'vertex'` @@ -1746,6 +1747,10 @@ The valid [=enable-extensions=] are listed in the following table. `f16` `"shader-f16"` The [=f16=] type is valid to use in the WGSL module. Otherwise, using [=f16=] (directly or indirectly) will result in a [=shader-creation error=]. + `dual_source_blending` + `"dual_source_blending"` + The attribute [=attribute/blend_src=] is valid to use in the WGSL module. Otherwise, using + [=attribute/blend_src=] will result in a [=shader-creation error=].
@@ -3094,12 +3099,13 @@ The following attributes can be applied to structure members: * [=attribute/align=] * [=attribute/builtin=] * [=attribute/location=] + * [=attribute/blend_src=] * [=attribute/interpolate=] * [=attribute/invariant=] * [=attribute/size=] -Attributes [=attribute/builtin=], [=attribute/location=], [=attribute/interpolate=], and [=attribute/invariant=] -are [=IO attributes=]. +Attributes [=attribute/builtin=], [=attribute/location=], [=attribute/blend_src=], +[=attribute/interpolate=], and [=attribute/invariant=] are [=IO attributes=]. An [=IO attribute=] on a member of a structure *S* has effect only when *S* is used as the type of a [=formal parameter=] or [=return type=] of an [=entry point=]. See [[#stage-inputs-outputs]]. @@ -8008,6 +8014,7 @@ WGSL defines the following attributes that can be applied to function parameters and return types: * [=attribute/builtin=] * [=attribute/location=] + * [=attribute/blend_src=] * [=attribute/interpolate=] * [=attribute/invariant=] @@ -8603,6 +8610,30 @@ path: syntax/location_attr.syntax.bs.include +
+path: syntax/blend_src_attr.syntax.bs.include
+
+ + + + + +
`blend_src` Attribute
Description + + Specifies a part of the [=fragment=] output when the feature [=extension/dual_source_blending=] + is enabled. + See [[#input-output-locations]]. + + [=shader-creation error|Must=] only be applied to a member of a [=structure=] type. + [=shader-creation error|Must=] only be applied to declarations of objects with [=numeric scalar=] + or [=numeric vector=] type. + [=shader-creation error|Must=] only be used as an output of the [=fragment=] shader stage. + +
Parameters + [=shader-creation error|Must=] be `0` or `1`.
+ +
+ ## `must_use` ## {#must-use-attr}
@@ -8910,6 +8941,7 @@ or to further describe the properties of an input or output.
 The IO attributes are:
 * [=attribute/builtin=]
 * [=attribute/location=]
+* [=attribute/blend_src=]
 * [=attribute/interpolate=]
 * [=attribute/invariant=]
 
@@ -9394,6 +9426,14 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on
 Locations [=shader-creation error|must not=] overlap within each of the following sets:
 * Members within a structure type.
     This applies to any structure, not just those used in shader stage inputs or outputs.
+    The optional [=attribute/blend_src=] attribute can only be specified together with the
+    [=attribute/location=] attribute on a [=fragment=] output. When [=attribute/blend_src=]
+    attribute is specified:
+    - There [=shader-creation error|must=] be exactly `2` [=fragment=] outputs with same
+        [=attribute/location=] attribute equal to `0`.
+    - The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one
+        [=fragment=] output, and `1` for another [=fragment=] output.
+
 * An entry point's shader stage inputs,
     i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.
 
diff --git a/wgsl/syntax/attribute.syntax.bs.include b/wgsl/syntax/attribute.syntax.bs.include
index f920f354b8..62484b19b1 100644
--- a/wgsl/syntax/attribute.syntax.bs.include
+++ b/wgsl/syntax/attribute.syntax.bs.include
@@ -23,6 +23,8 @@
 
     | [=syntax/location_attr=]
 
+    | [=syntax/blend_src_attr=]
+
     | [=syntax/must_use_attr=]
 
     | [=syntax/size_attr=]

From ba12281ad070b367e2bf44ff6a77de6438b96659 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Mon, 6 May 2024 16:53:33 +0800
Subject: [PATCH 02/29] Fix

---
 spec/index.bs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/spec/index.bs b/spec/index.bs
index 7be37b4bd2..8405693318 100644
--- a/spec/index.bs
+++ b/spec/index.bs
@@ -15151,10 +15151,11 @@ Makes textures with formats {{GPUTextureFormat/"r32float"}}, {{GPUTextureFormat/
 {{GPUTextureFormat/"rgba32float"}} [=filterable=].
 
 

`"dual-source-blending"` +

-Allows the use of [=attribute/blend_src=] in WGSL and simultaneously using both pixel shader outputs +Allows the use of [=blend_src=] in WGSL and simultaneously using both pixel shader outputs (`@blend_src(0)` and `@blend_src(1)`) as inputs to a blending operation with the single color -attachment at [=attribute/location=] `0`. +attachment at [=location=] `0`. This feature adds the following [=optional API surfaces=]: - Allows the use of the below {{GPUBlendFactor}}s: From 5583b8648e8491d6048beb92e3f67a300718ffb2 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 09:01:11 +0800 Subject: [PATCH 03/29] Add blend_src_attr.syntax.bs.include --- wgsl/index.bs | 2 +- wgsl/syntax/blend_src_attr.syntax.bs.include | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 wgsl/syntax/blend_src_attr.syntax.bs.include diff --git a/wgsl/index.bs b/wgsl/index.bs index f6dec73216..12d6935b4e 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8630,7 +8630,7 @@ path: syntax/blend_src_attr.syntax.bs.include Parameters - [=shader-creation error|Must=] be `0` or `1`.
+ [=shader-creation error|Must=] be `0` or `1`. diff --git a/wgsl/syntax/blend_src_attr.syntax.bs.include b/wgsl/syntax/blend_src_attr.syntax.bs.include new file mode 100644 index 0000000000..79b98cb489 --- /dev/null +++ b/wgsl/syntax/blend_src_attr.syntax.bs.include @@ -0,0 +1,5 @@ +
+ blend_src_attr : + + `'@'` `'blend_src'` `'('` [=syntax/expression=] `','` ? `')'` +
From 2d1ef2db7ce439c75bfa0eaf41e0d274f1d7ccab Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 09:10:40 +0800 Subject: [PATCH 04/29] Update wgsl/syntax.bnf --- wgsl/syntax.bnf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wgsl/syntax.bnf b/wgsl/syntax.bnf index cfdf33f7e4..42c64a9c15 100644 --- a/wgsl/syntax.bnf +++ b/wgsl/syntax.bnf @@ -109,6 +109,10 @@ binding_attr : '@' 'binding' '(' expression ',' ? ')' ; +blend_src_attr : + '@' 'blend_src' '(' expression ',' ? ')' +; + builtin_attr : '@' 'builtin' '(' builtin_value_name ',' ? ')' ; @@ -184,6 +188,7 @@ attribute : '@' ident_pattern_token argument_expression_list ? | align_attr | binding_attr +| blend_src_attr | builtin_attr | const_attr | diagnostic_attr From 8619b9393f7e79dbe408f11cbdc4cb9308b6d1dc Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 10:42:28 +0800 Subject: [PATCH 05/29] dos2unix --- wgsl/syntax/blend_src_attr.syntax.bs.include | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wgsl/syntax/blend_src_attr.syntax.bs.include b/wgsl/syntax/blend_src_attr.syntax.bs.include index 79b98cb489..1a60f36175 100644 --- a/wgsl/syntax/blend_src_attr.syntax.bs.include +++ b/wgsl/syntax/blend_src_attr.syntax.bs.include @@ -1,5 +1,5 @@ -
- blend_src_attr : - - `'@'` `'blend_src'` `'('` [=syntax/expression=] `','` ? `')'` -
+
+ blend_src_attr : + + `'@'` `'blend_src'` `'('` [=syntax/expression=] `','` ? `')'` +
From ba361534baeac882d875e1dd47f9e01e8ec4a5e6 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 10:59:41 +0800 Subject: [PATCH 06/29] Fix more wgsl include files --- wgsl/syntax/attribute.syntax.bs.include | 4 ++-- wgsl/wgsl.recursive.bs.include | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wgsl/syntax/attribute.syntax.bs.include b/wgsl/syntax/attribute.syntax.bs.include index 62484b19b1..044e1b1a4d 100644 --- a/wgsl/syntax/attribute.syntax.bs.include +++ b/wgsl/syntax/attribute.syntax.bs.include @@ -7,6 +7,8 @@ | [=syntax/binding_attr=] + | [=syntax/blend_src_attr=] + | [=syntax/builtin_attr=] | [=syntax/const_attr=] @@ -23,8 +25,6 @@ | [=syntax/location_attr=] - | [=syntax/blend_src_attr=] - | [=syntax/must_use_attr=] | [=syntax/size_attr=] diff --git a/wgsl/wgsl.recursive.bs.include b/wgsl/wgsl.recursive.bs.include index 5027ed9b23..d8ffdda1ac 100644 --- a/wgsl/wgsl.recursive.bs.include +++ b/wgsl/wgsl.recursive.bs.include @@ -45,6 +45,8 @@ | `'@'` `'binding'` `'('` [=recursive descent syntax/expression=] `','` ? `')'` + | `'@'` `'blend_src'` `'('` [=recursive descent syntax/expression=] `','` ? `')'` + | `'@'` `'builtin'` `'('` [=syntax/ident_pattern_token=] `','` ? `')'` | `'@'` `'diagnostic'` [=recursive descent syntax/diagnostic_control=] From e41e5f0379e5dd99e9e1ab962e9875f36f777ff3 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 14:34:24 +0800 Subject: [PATCH 07/29] Improve the statements --- spec/index.bs | 44 ++++++++++++++++++++++++++++---------------- wgsl/index.bs | 27 ++++++++++++++++++--------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 8405693318..885a9d3d5e 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8049,6 +8049,7 @@ dictionary GPUFragmentState - [$validating GPUProgrammableStage$]({{GPUShaderStage/FRAGMENT}}, |descriptor|, |layout|) succeeds. - |descriptor|.{{GPUFragmentState/targets}}.length must be ≤ |device|.{{device/[[limits]]}}.{{supported limits/maxColorAttachments}}. + - Set |UseDualSourceBlending| to `false`. - [=list/For each=] |index| of the [=list/indices=] of |descriptor|.{{GPUFragmentState/targets}} containing a non-`null` value |colorState|: - |colorState|.{{GPUColorTargetState/format}} must be listed in [[#plain-color-formats]] @@ -8077,24 +8078,35 @@ dictionary GPUFragmentState : {{GPUTextureSampleType/"uint"}} :: |output| must have an unsigned integer scalar type. - - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} - uses src1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, - {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}): - - |output| must have a [=blend_src=] attribute. - - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. - - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=] and - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} - or .{{GPUBlendComponent/dstFactor}} uses the source alpha - (is any of {{GPUBlendFactor/"src-alpha"}}, {{GPUBlendFactor/"one-minus-src-alpha"}}, - or {{GPUBlendFactor/"src-alpha-saturated"}}), then: - - |output| must have an alpha channel (that is, it must be a vec4). - + - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=]: + - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} + uses source1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, + {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + - Set |UseDualSourceBlending| to `true`. + - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} + or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the source alpha (is any of {{GPUBlendFactor/"src-alpha"}}, + {{GPUBlendFactor/"one-minus-src-alpha"}} or + {{GPUBlendFactor/"src-alpha-saturated"}}) and the [=blend_src=] attribute of + |output| is `0`, then: + - |output| must have an alpha channel (that is, it must be a vec4). Otherwise, since there is no shader output for the attachment: - - |colorState|.{{GPUColorTargetState/writeMask}} must be 0. + - If |UseDualSourceBlending| is `true`: + - All the [=shader stage output=] values of + [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) must have a + [=blend_src=] attribute. + - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. + - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the source1 alpha (is any of {{GPUBlendFactor/"src1-alpha"}} or + {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + - The [=shader stage output=] value of + [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) with [=blend_src=] + attribute equal to `1` must have an alpha channel (that is, it must be a vec4). - [$Validating GPUFragmentState's color attachment bytes per sample$](|device|, |descriptor|.{{GPUFragmentState/targets}}) succeeds.
diff --git a/wgsl/index.bs b/wgsl/index.bs index 12d6935b4e..f4f335181b 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9417,7 +9417,15 @@ Each input-output location can store a value up to 16 bytes in size. The byte size of a type is defined using the *SizeOf* column in [[#alignment-and-size]]. For example, a four-component vector of floating-point values occupies a single location. -IO locations are specified via the [=attribute/location=] attribute. +IO locations are specified via the [=attribute/location=] attribute. The IO locations of +[=fragment=] shader [=user-defined output datum|output=]s can also be specified via the both +[=attribute/location=] attribute and optional [=attribute/blend_src=] attribute when the feature +[=extension/dual_source_blending=] is enabled. The [=attribute/blend_src=] attribute can only be +specified on a [=fragment=] shader [=user-defined output datum|output=] and used to specify up to +two [=fragment=] shader [=user-defined output datum|output=]s for a given color attachment as the +inputs to the blend equation. By default the value of the [=attribute/blend_src=] attribute for a +[=fragment=] shader [=user-defined output datum|output=] is `0` when the [=attribute/blend_src=] +attribute is not specified in the shader. Each user-defined [=user-defined input datum|input=] and [=user-defined output datum|output=] [=shader-creation error|must=] have an explicitly specified IO location. Each structure member in the entry point IO [=shader-creation error|must=] be one of either a built-in value @@ -9426,17 +9434,18 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on Locations [=shader-creation error|must not=] overlap within each of the following sets: * Members within a structure type. This applies to any structure, not just those used in shader stage inputs or outputs. - The optional [=attribute/blend_src=] attribute can only be specified together with the - [=attribute/location=] attribute on a [=fragment=] output. When [=attribute/blend_src=] - attribute is specified: - - There [=shader-creation error|must=] be exactly `2` [=fragment=] outputs with same - [=attribute/location=] attribute equal to `0`. - - The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one - [=fragment=] output, and `1` for another [=fragment=] output. - * An entry point's shader stage inputs, i.e. locations for its formal parameters, or for the members of its formal parameters of structure type. +When [=attribute/blend_src=] attribute is specified: +* There [=shader-creation error|must=] be exactly `2` [=fragment=] shader + [=user-defined output datum|output=]s. +* The [=attribute/location=] attribute of all [=fragment=] shader + [=user-defined output datum|output=]s [=shader-creation error|must=] be `0`. +* The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one + [=fragment=] shader [=user-defined output datum|output=], and `1` for another [=fragment=] + shader [=user-defined output datum|output=]. + Note: Location numbering is distinct between inputs and outputs: Location numbers for an entry point's shader stage inputs do not conflict with location numbers for the entry point's shader stage outputs. From 9c596ab4f2870ff08bff211b0d210433c127daae Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 14:44:54 +0800 Subject: [PATCH 08/29] Fix --- spec/index.bs | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 885a9d3d5e..8aedfff028 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8080,33 +8080,36 @@ dictionary GPUFragmentState - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=]: - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} - uses source1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, - {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - - Set |UseDualSourceBlending| to `true`. + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} + uses source1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, + {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + - Set |UseDualSourceBlending| to `true`. - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} - or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} - uses the source alpha (is any of {{GPUBlendFactor/"src-alpha"}}, - {{GPUBlendFactor/"one-minus-src-alpha"}} or - {{GPUBlendFactor/"src-alpha-saturated"}}) and the [=blend_src=] attribute of - |output| is `0`, then: - - |output| must have an alpha channel (that is, it must be a vec4). + or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the source alpha (is any of {{GPUBlendFactor/"src-alpha"}}, + {{GPUBlendFactor/"one-minus-src-alpha"}} or + {{GPUBlendFactor/"src-alpha-saturated"}}) and the [=blend_src=] attribute of + |output| is `0`, then: + - |output| must have an alpha channel (that is, it must be a vec4). + Otherwise, since there is no shader output for the attachment: + - |colorState|.{{GPUColorTargetState/writeMask}} must be 0. - If |UseDualSourceBlending| is `true`: - All the [=shader stage output=] values of - [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) must have a - [=blend_src=] attribute. + [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) must have a + [=blend_src=] attribute. - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} - uses the source1 alpha (is any of {{GPUBlendFactor/"src1-alpha"}} or - {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - - The [=shader stage output=] value of - [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) with [=blend_src=] - attribute equal to `1` must have an alpha channel (that is, it must be a vec4). + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the source1 alpha (is any of {{GPUBlendFactor/"src1-alpha"}} or + {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + - The [=shader stage output=] value of + [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) with + [=blend_src=] attribute equal to `1` must have an alpha channel (that is, it + must be a vec4). - [$Validating GPUFragmentState's color attachment bytes per sample$](|device|, |descriptor|.{{GPUFragmentState/targets}}) succeeds. From cd5aaf6ad312180a66af868e589df261ed073b5a Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 7 May 2024 15:02:46 +0800 Subject: [PATCH 09/29] Improve the statements --- spec/index.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 8aedfff028..ba876ad20d 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8083,7 +8083,8 @@ dictionary GPUFragmentState |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} - uses source1 (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, + uses the second input of the corresponding blending unit (is any of + {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - Set |UseDualSourceBlending| to `true`. - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} @@ -8104,8 +8105,8 @@ dictionary GPUFragmentState - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} - uses the source1 alpha (is any of {{GPUBlendFactor/"src1-alpha"}} or - {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + uses the alpha channel of the second input of the corresponding blending unit (is any of + {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - The [=shader stage output=] value of [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) with [=blend_src=] attribute equal to `1` must have an alpha channel (that is, it From 1e5c07c885404cadecc97a8d86b15d642858e923 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 7 May 2024 18:58:12 -0700 Subject: [PATCH 10/29] Further refactoring of the api validation --- spec/index.bs | 77 +++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index ba876ad20d..7a8cffcb8f 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8049,20 +8049,32 @@ dictionary GPUFragmentState - [$validating GPUProgrammableStage$]({{GPUShaderStage/FRAGMENT}}, |descriptor|, |layout|) succeeds. - |descriptor|.{{GPUFragmentState/targets}}.length must be ≤ |device|.{{device/[[limits]]}}.{{supported limits/maxColorAttachments}}. - - Set |UseDualSourceBlending| to `false`. + - Let |entryPoint| be [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|). + - Let |usesDualSourceBlending| be `false`. - [=list/For each=] |index| of the [=list/indices=] of |descriptor|.{{GPUFragmentState/targets}} containing a non-`null` value |colorState|: - |colorState|.{{GPUColorTargetState/format}} must be listed in [[#plain-color-formats]] with {{GPUTextureUsage/RENDER_ATTACHMENT}} capability. + - |colorState|.{{GPUColorTargetState/writeMask}} must be < 16. - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=]: - The |colorState|.{{GPUColorTargetState/format}} must be [=blendable=]. - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}} must be a [=valid GPUBlendComponent=]. - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}} must be a [=valid GPUBlendComponent=]. - - |colorState|.{{GPUColorTargetState/writeMask}} must be < 16. - - If [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) has a - [=shader stage output=] value |output| with [=location=] attribute equal to |index|: + - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}}= + uses the second input of the corresponding blending unit (is any of + {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, + {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + + - Set |usesDualSourceBlending| to `true`. + - |entryPoint| must have a [=shader stage output=] with [=location=] equal to |index| + and [=blend_src=] equal to 1. + - For each [=shader stage output=] value |output| with [=location=] attribute equal to |index| + in |entryPoint|: - For each component in |colorState|.{{GPUColorTargetState/format}}, there must be a corresponding component in |output|. @@ -8078,39 +8090,32 @@ dictionary GPUFragmentState : {{GPUTextureSampleType/"uint"}} :: |output| must have an unsigned integer scalar type. - - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=]: - - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} - uses the second input of the corresponding blending unit (is any of - {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, - {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - - Set |UseDualSourceBlending| to `true`. - - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} - or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} - uses the source alpha (is any of {{GPUBlendFactor/"src-alpha"}}, - {{GPUBlendFactor/"one-minus-src-alpha"}} or - {{GPUBlendFactor/"src-alpha-saturated"}}) and the [=blend_src=] attribute of - |output| is `0`, then: - - |output| must have an alpha channel (that is, it must be a vec4). - - Otherwise, since there is no shader output for the attachment: - - - |colorState|.{{GPUColorTargetState/writeMask}} must be 0. - - If |UseDualSourceBlending| is `true`: - - All the [=shader stage output=] values of - [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) must have a - [=blend_src=] attribute. + - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=] and **either**: + - The [=blend_src=] attribute of |output| is omitted or 0 and + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the alpha channel of the first input of the corresponding blend unit (is any of + {{GPUBlendFactor/"src-alpha"}}, {{GPUBlendFactor/"one-minus-src-alpha"}} or + {{GPUBlendFactor/"src-alpha-saturated"}}) + - The [=blend_src=] attribute of |output| is 1 + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} + uses the alpha channel of the second input of the corresponding blending unit (is any of + {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + + Then: + + - |output| must have an alpha channel (that is, it must be a vec4). + - If |colorState|.{{GPUColorTargetState/writeMask}} is not 0: + - |entryPoint| must have a [=shader stage output=] with [=location=] equal to |index| + and [=blend_src=] omitted or equal to 0. + - If |usesDualSourceBlending| is `true`: + - All the [=shader stage output=] values of |entryPoint| must have a [=blend_src=] attribute. - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. - - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} - uses the alpha channel of the second input of the corresponding blending unit (is any of - {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - - The [=shader stage output=] value of - [$get the entry point$]({{GPUShaderStage/FRAGMENT}}, |descriptor|) with - [=blend_src=] attribute equal to `1` must have an alpha channel (that is, it - must be a vec4). + - Let |colorState| be |descriptor|.{{GPUFragmentState/targets}}[0]. + - If |colorState|.{{GPUColorTargetState/writeMask}} is not 0: + - |entryPoint| must have a [=shader stage output=] with [=location=] equal to 0 + and [=blend_src=] equal to 1. - [$Validating GPUFragmentState's color attachment bytes per sample$](|device|, |descriptor|.{{GPUFragmentState/targets}}) succeeds. From c2c5eb49f1fa61ce884e814837e5bc1e460accf8 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 7 May 2024 19:00:43 -0700 Subject: [PATCH 11/29] fix typos --- spec/index.bs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 7a8cffcb8f..838c4df1f6 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8065,14 +8065,12 @@ dictionary GPUFragmentState - If |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/srcFactor}} or - |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}}= + |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/alpha}}.{{GPUBlendComponent/dstFactor}} uses the second input of the corresponding blending unit (is any of {{GPUBlendFactor/"src1"}}, {{GPUBlendFactor/"one-minus-src1"}}, {{GPUBlendFactor/"src1-alpha"}}, {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: - Set |usesDualSourceBlending| to `true`. - - |entryPoint| must have a [=shader stage output=] with [=location=] equal to |index| - and [=blend_src=] equal to 1. - For each [=shader stage output=] value |output| with [=location=] attribute equal to |index| in |entryPoint|: From 4ca64525cac8ef056ba96dce47f4b22afb5bcaee Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Wed, 8 May 2024 13:37:59 +0800 Subject: [PATCH 12/29] Address reviewers' comments --- spec/index.bs | 4 ++-- wgsl/index.bs | 27 ++++++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index e8c85d51f0..cd954c14e9 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8148,11 +8148,11 @@ dictionary GPUFragmentState uses the alpha channel of the first input of the corresponding blend unit (is any of {{GPUBlendFactor/"src-alpha"}}, {{GPUBlendFactor/"one-minus-src-alpha"}} or {{GPUBlendFactor/"src-alpha-saturated"}}) - - The [=blend_src=] attribute of |output| is 1 + - The [=blend_src=] attribute of |output| is 1 and |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}} uses the alpha channel of the second input of the corresponding blending unit (is any of - {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}}), then: + {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}}) Then: diff --git a/wgsl/index.bs b/wgsl/index.bs index 7bc7c43713..be234da5c6 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8635,7 +8635,7 @@ path: syntax/blend_src_attr.syntax.bs.include Parameters - [=shader-creation error|Must=] be `0` or `1`. + [=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an i32 or u32 with value of `0` or `1`. @@ -9422,33 +9422,30 @@ Each input-output location can store a value up to 16 bytes in size. The byte size of a type is defined using the *SizeOf* column in [[#alignment-and-size]]. For example, a four-component vector of floating-point values occupies a single location. -IO locations are specified via the [=attribute/location=] attribute. The IO locations of -[=fragment=] shader [=user-defined output datum|output=]s can also be specified via the both -[=attribute/location=] attribute and optional [=attribute/blend_src=] attribute when the feature -[=extension/dual_source_blending=] is enabled. The [=attribute/blend_src=] attribute can only be -specified on a [=fragment=] shader [=user-defined output datum|output=] and used to specify up to -two [=fragment=] shader [=user-defined output datum|output=]s for a given color attachment as the -inputs to the blend equation. By default the value of the [=attribute/blend_src=] attribute for a -[=fragment=] shader [=user-defined output datum|output=] is `0` when the [=attribute/blend_src=] -attribute is not specified in the shader. - Each user-defined [=user-defined input datum|input=] and [=user-defined output datum|output=] [=shader-creation error|must=] have an explicitly specified IO location. Each structure member in the entry point IO [=shader-creation error|must=] be one of either a built-in value (see [[#builtin-inputs-outputs]]), or assigned a location. +A location can be specified via either the [=attribute/location=] attribute only or both the +[=attribute/location=] attribute and the [=attribute/blend_src=] attribute. The optional +[=attribute/blend_src=] attribute can only be specified on a [=fragment=] shader +[=user-defined output datum|output=] and used to specify up to two [=fragment=] shader +[=user-defined output datum|outputs=] for the only color attachment as the inputs to the blend +equation. + Locations [=shader-creation error|must not=] overlap within each of the following sets: * Members within a structure type. This applies to any structure, not just those used in shader stage inputs or outputs. * An entry point's shader stage inputs, i.e. locations for its formal parameters, or for the members of its formal parameters of structure type. -When [=attribute/blend_src=] attribute is specified: +When the [=attribute/blend_src=] attribute is specified: * There [=shader-creation error|must=] be exactly `2` [=fragment=] shader - [=user-defined output datum|output=]s. + [=user-defined output datum|outputs=]. * The [=attribute/location=] attribute of all [=fragment=] shader - [=user-defined output datum|output=]s [=shader-creation error|must=] be `0`. + [=user-defined output datum|outputs=] [=shader-creation error|must=] be `0`. * The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one - [=fragment=] shader [=user-defined output datum|output=], and `1` for another [=fragment=] + [=fragment=] shader [=user-defined output datum|output=], and `1` for the other [=fragment=] shader [=user-defined output datum|output=]. Note: Location numbering is distinct between inputs and outputs: From 0b8efef62cd5965dd1368e7ae8b9b912d8aef362 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Wed, 8 May 2024 13:46:42 +0800 Subject: [PATCH 13/29] Small fix --- wgsl/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index be234da5c6..6482f4c5e1 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9441,7 +9441,7 @@ Locations [=shader-creation error|must not=] overlap within each of the followin When the [=attribute/blend_src=] attribute is specified: * There [=shader-creation error|must=] be exactly `2` [=fragment=] shader - [=user-defined output datum|outputs=]. + [=user-defined output datum|user-defined outputs=]. * The [=attribute/location=] attribute of all [=fragment=] shader [=user-defined output datum|outputs=] [=shader-creation error|must=] be `0`. * The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one From 94a16894c1f331ee3441ea952dca371801b6c085 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 9 May 2024 15:46:13 +0800 Subject: [PATCH 14/29] Add `Feature` column in the `GPUBlendFactor` table --- spec/index.bs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/index.bs b/spec/index.bs index c5ca59d6b9..1ccc07a6d0 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8349,12 +8349,14 @@ enum GPUBlendFactor { GPUBlendFactor Blend factor RGBA components + [=Feature=] "zero" (0, 0, 0, 0) + "one" (1, 1, 1, 1) @@ -8394,6 +8396,7 @@ enum GPUBlendFactor { "src1" (Rsrc1, Gsrc1, Bsrc1, Asrc1) + {{GPUFeatureName/dual-source-blending}} "one-minus-src1" (1 - Rsrc1, 1 - Gsrc1, 1 - Bsrc1, 1 - Asrc1) From bafaa415f78d01f32dca20fdaf8baa851f4d922f Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Sat, 11 May 2024 11:33:03 +0800 Subject: [PATCH 15/29] Address Alan's comments --- wgsl/index.bs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index 6482f4c5e1..b17a4b0b6d 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8615,6 +8615,8 @@ path: syntax/location_attr.syntax.bs.include +## `blend_src` ## {#blend-src-attr} +
 path: syntax/blend_src_attr.syntax.bs.include
 
@@ -9422,19 +9424,14 @@ Each input-output location can store a value up to 16 bytes in size. The byte size of a type is defined using the *SizeOf* column in [[#alignment-and-size]]. For example, a four-component vector of floating-point values occupies a single location. +IO locations are specified via the [=attribute/location=] attribute. + Each user-defined [=user-defined input datum|input=] and [=user-defined output datum|output=] [=shader-creation error|must=] have an explicitly specified IO location. Each structure member in the entry point IO [=shader-creation error|must=] be one of either a built-in value (see [[#builtin-inputs-outputs]]), or assigned a location. -A location can be specified via either the [=attribute/location=] attribute only or both the -[=attribute/location=] attribute and the [=attribute/blend_src=] attribute. The optional -[=attribute/blend_src=] attribute can only be specified on a [=fragment=] shader -[=user-defined output datum|output=] and used to specify up to two [=fragment=] shader -[=user-defined output datum|outputs=] for the only color attachment as the inputs to the blend -equation. - Locations [=shader-creation error|must not=] overlap within each of the following sets: -* Members within a structure type. +* Members within a structure type for a given [=attribute/blenc_src=] value (a single set if none is specified). This applies to any structure, not just those used in shader stage inputs or outputs. * An entry point's shader stage inputs, i.e. locations for its formal parameters, or for the members of its formal parameters of structure type. From 7718b2118b4df944797959d5235481db1be245f4 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Sat, 11 May 2024 13:18:35 +0800 Subject: [PATCH 16/29] Fix typo --- wgsl/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index b17a4b0b6d..75db61c3b5 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9431,7 +9431,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on (see [[#builtin-inputs-outputs]]), or assigned a location. Locations [=shader-creation error|must not=] overlap within each of the following sets: -* Members within a structure type for a given [=attribute/blenc_src=] value (a single set if none is specified). +* Members within a structure type for a given [=attribute/blend_src=] value (a single set if none is specified). This applies to any structure, not just those used in shader stage inputs or outputs. * An entry point's shader stage inputs, i.e. locations for its formal parameters, or for the members of its formal parameters of structure type. From cb35343506272cdc8ae40fc47872bdc611c5ba78 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 16 May 2024 09:25:19 +0800 Subject: [PATCH 17/29] Sort builtins alphabetically. --- wgsl/index.bs | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index 784b2b037d..3b4ca9b405 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8411,6 +8411,32 @@ path: syntax/binding_attr.syntax.bs.include +## `blend_src` ## {#blend-src-attr} + +
+path: syntax/blend_src_attr.syntax.bs.include
+
+ + + + + +
`blend_src` Attribute
Description + + Specifies a part of the [=fragment=] output when the feature [=extension/dual_source_blending=] + is enabled. + See [[#input-output-locations]]. + + [=shader-creation error|Must=] only be applied to a member of a [=structure=] type. + [=shader-creation error|Must=] only be applied to declarations of objects with [=numeric scalar=] + or [=numeric vector=] type. + [=shader-creation error|Must=] only be used as an output of the [=fragment=] shader stage. + +
Parameters + [=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an i32 or u32 with value of `0` or `1`. + +
+ ## `builtin` ## {#builtin-attr}
@@ -8615,32 +8641,6 @@ path: syntax/location_attr.syntax.bs.include
 
 
 
-## `blend_src` ## {#blend-src-attr}
-
-
-path: syntax/blend_src_attr.syntax.bs.include
-
- - - - - -
`blend_src` Attribute
Description - - Specifies a part of the [=fragment=] output when the feature [=extension/dual_source_blending=] - is enabled. - See [[#input-output-locations]]. - - [=shader-creation error|Must=] only be applied to a member of a [=structure=] type. - [=shader-creation error|Must=] only be applied to declarations of objects with [=numeric scalar=] - or [=numeric vector=] type. - [=shader-creation error|Must=] only be used as an output of the [=fragment=] shader stage. - -
Parameters - [=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an i32 or u32 with value of `0` or `1`. - -
- ## `must_use` ## {#must-use-attr}

From 45b5c0ee7714f9f74083c407e18255ea706e5577 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Mon, 20 May 2024 14:26:48 +0800
Subject: [PATCH 18/29] Don't apply `location overlapping` rules on `blend_src`
 members

---
 wgsl/index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wgsl/index.bs b/wgsl/index.bs
index 3b4ca9b405..b977505879 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9431,7 +9431,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on
 (see [[#builtin-inputs-outputs]]), or assigned a location.
 
 Locations [=shader-creation error|must not=] overlap within each of the following sets:
-* Members within a structure type for a given [=attribute/blend_src=] value (a single set if none is specified).
+* Members within a structure type without a given [=attribute/blend_src=] value.
     This applies to any structure, not just those used in shader stage inputs or outputs.
 * An entry point's shader stage inputs,
     i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.

From fa9f445361a25ee1eb7a22f1dd7ff35a56914119 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Mon, 20 May 2024 14:34:40 +0800
Subject: [PATCH 19/29] `blend_src` can only be specified on fragment outputs

---
 wgsl/index.bs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/wgsl/index.bs b/wgsl/index.bs
index b977505879..c60a9b33a3 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9437,6 +9437,7 @@ Locations [=shader-creation error|must not=] overlap within each of the followin
     i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.
 
 When the [=attribute/blend_src=] attribute is specified:
+* [=attribute/blend_src=] can only be specified on [=fragment=] shader outputs.
 * There [=shader-creation error|must=] be exactly `2` [=fragment=] shader
     [=user-defined output datum|user-defined outputs=].
 * The [=attribute/location=] attribute of all [=fragment=] shader

From 34a2eb728bc312e4eab1acbd0ed2327f9efb7ba1 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Thu, 23 May 2024 13:44:29 +0800
Subject: [PATCH 20/29] Address Kai's comments

---
 wgsl/index.bs | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/wgsl/index.bs b/wgsl/index.bs
index 4a30ea4101..8c8225de95 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9432,21 +9432,17 @@ Each user-defined [=user-defined input datum|input=] and [=user-defined output d
 Each structure member in the entry point IO [=shader-creation error|must=] be one of either a built-in value
 (see [[#builtin-inputs-outputs]]), or assigned a location.
 
-Locations [=shader-creation error|must not=] overlap within each of the following sets:
-* Members within a structure type without a given [=attribute/blend_src=] value.
+
+For each set of outputs |outputs| in the following sets:
+* Members within a structure type,
     This applies to any structure, not just those used in shader stage inputs or outputs.
 * An entry point's shader stage inputs,
     i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.
 
-When the [=attribute/blend_src=] attribute is specified:
-* [=attribute/blend_src=] can only be specified on [=fragment=] shader outputs.
-* There [=shader-creation error|must=] be exactly `2` [=fragment=] shader
-    [=user-defined output datum|user-defined outputs=].
-* The [=attribute/location=] attribute of all [=fragment=] shader
-    [=user-defined output datum|outputs=] [=shader-creation error|must=] be `0`.
-* The value of [=attribute/blend_src=] attribute [=shader-creation error|must=] be `0` for one
-    [=fragment=] shader [=user-defined output datum|output=], and `1` for the other [=fragment=]
-    shader [=user-defined output datum|output=].
+The following [=shader-creation error|must=] be `true`:
+- |outputs| [=shader-creation error|must not=] contain two outputs with the same location and without a given [=attribute/blend_src=] attribute.
+- If any output in |outputs| specifies a [=attribute/blend_src=] attribute:
+    |outputs| must contain exactly 2 outputs, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`.
 
 Note: Location numbering is distinct between inputs and outputs:
 Location numbers for an entry point's shader stage inputs do not conflict with location numbers for the entry point's shader stage outputs.

From 9f4e8d79efbd8fa034002758bb5fdf3952f45274 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Thu, 23 May 2024 13:57:51 +0800
Subject: [PATCH 21/29] Small fix

---
 wgsl/index.bs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wgsl/index.bs b/wgsl/index.bs
index 8c8225de95..eb1e332caf 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9434,7 +9434,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on
 
 
 For each set of outputs |outputs| in the following sets:
-* Members within a structure type,
+* Members within a structure type.
     This applies to any structure, not just those used in shader stage inputs or outputs.
 * An entry point's shader stage inputs,
     i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.

From df42b25cf5d9097c4505362379c8e196f3c5a0ed Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Wed, 29 May 2024 14:59:58 +0800
Subject: [PATCH 22/29] Require all the @location(0) @blend_src(N) outputs have
 same type

As is required by Metal Shading Language:
```
5.2.3.5 Fragment Function Output Attributes
Multiple elements in the fragment function return type that use the
same color attachment index for blending needs to be declared with
the same data type.
```
---
 spec/index.bs | 25 ++++++++-----------------
 wgsl/index.bs |  3 ++-
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/spec/index.bs b/spec/index.bs
index 3356e522c3..66a8c6825b 100644
--- a/spec/index.bs
+++ b/spec/index.bs
@@ -8250,21 +8250,12 @@ dictionary GPUFragmentState
                             : {{GPUTextureSampleType/"uint"}}
                             :: |output| must have an unsigned integer scalar type.
                         
-                    - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=] and **either**:
-                        - The [=blend_src=] attribute of |output| is omitted or 0 and
-                            |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or
-                            |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}}
-                            uses the alpha channel of the first input of the corresponding blend unit (is any of
-                            {{GPUBlendFactor/"src-alpha"}}, {{GPUBlendFactor/"one-minus-src-alpha"}} or
-                            {{GPUBlendFactor/"src-alpha-saturated"}})
-                        - The [=blend_src=] attribute of |output| is 1 and
-                            |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}} or
-                            |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/dstFactor}}
-                            uses the alpha channel of the second input of the corresponding blending unit (is any of
-                            {{GPUBlendFactor/"src1-alpha"}} or {{GPUBlendFactor/"one-minus-src1-alpha"}})
-
-                        Then:
-
+                    - If |colorState|.{{GPUColorTargetState/blend}} is [=map/exist|provided=] and
+                        |colorState|.{{GPUColorTargetState/blend}}.{{GPUBlendState/color}}.{{GPUBlendComponent/srcFactor}}
+                        or .{{GPUBlendComponent/dstFactor}} uses the source alpha
+                        (is any of {{GPUBlendFactor/"src-alpha"}}, {{GPUBlendFactor/"one-minus-src-alpha"}},
+                        {{GPUBlendFactor/"src-alpha-saturated"}}, {{GPUBlendFactor/"src1-alpha"}} or
+                        {{GPUBlendFactor/"one-minus-src1-alpha"}}), then:
                         - |output| must have an alpha channel (that is, it must be a vec4).
 
                 - If |colorState|.{{GPUColorTargetState/writeMask}} is not 0:
@@ -8275,8 +8266,8 @@ dictionary GPUFragmentState
                 - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`.
                 - Let |colorState| be |descriptor|.{{GPUFragmentState/targets}}[0].
                 - If |colorState|.{{GPUColorTargetState/writeMask}} is not 0:
-                - |entryPoint| must have a [=shader stage output=] with [=location=] equal to 0
-                    and [=blend_src=] equal to 1.    
+                    - |entryPoint| must have a [=shader stage output=] with [=location=] equal to 0
+                        and [=blend_src=] equal to 1.
             - [$Validating GPUFragmentState's color attachment bytes per sample$](|device|, |descriptor|.{{GPUFragmentState/targets}}) succeeds.
         
 
diff --git a/wgsl/index.bs b/wgsl/index.bs
index c17845e115..0a8f42c096 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9442,7 +9442,8 @@ For each set of outputs |outputs| in the following sets:
 The following [=shader-creation error|must=] be `true`:
 - |outputs| [=shader-creation error|must not=] contain two outputs with the same location and without a given [=attribute/blend_src=] attribute.
 - If any output in |outputs| specifies a [=attribute/blend_src=] attribute:
-    |outputs| must contain exactly 2 outputs, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`.
+    - |outputs| [=shader-creation error|must=] contain exactly 2 outputs, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`.
+    - The outputs in |outputs| [=shader-creation error|must=] have same type.
 
 Note: Location numbering is distinct between inputs and outputs:
 Location numbers for an entry point's shader stage inputs do not conflict with location numbers for the entry point's shader stage outputs.

From c04f85942409aae07bea16959a9eb7d2dbefbe10 Mon Sep 17 00:00:00 2001
From: Jiawei Shao 
Date: Thu, 30 May 2024 14:58:29 +0800
Subject: [PATCH 23/29] Address reviewers' comments

---
 wgsl/index.bs | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/wgsl/index.bs b/wgsl/index.bs
index 8df7b5f791..4eab4f00b7 100644
--- a/wgsl/index.bs
+++ b/wgsl/index.bs
@@ -9464,17 +9464,19 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on
 (see [[#builtin-inputs-outputs]]), or assigned a location.
 
 
-For each set of outputs |outputs| in the following sets:
-* Members within a structure type.
-    This applies to any structure, not just those used in shader stage inputs or outputs.
-* An entry point's shader stage inputs,
-    i.e. locations for its formal parameters, or for the members of its formal parameters of structure type.
-
-The following [=shader-creation error|must=] be `true`:
-- |outputs| [=shader-creation error|must not=] contain two outputs with the same location and without a given [=attribute/blend_src=] attribute.
-- If any output in |outputs| specifies a [=attribute/blend_src=] attribute:
-    - |outputs| [=shader-creation error|must=] contain exactly 2 outputs, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`.
-    - The outputs in |outputs| [=shader-creation error|must=] have same type.
+
+ For each entry point defined in a WGSL module, let |inputs| be its set of shader stage inputs + (i.e. locations for its formal parameters, or for the members of its formal parameters of structure type). + - |inputs| [=shader-creation error|must not=] contain two entries with the same [=attribute/location=] value. +
+
+ For each structure type defined in a WGSL module (not just those used in shader stage inputs or outputs), + let |members| be the set of struct members with [=attribute/location=] attributes. + - If any entry in |members| specifies a [=attribute/blend_src=] attribute: + - |members| [=shader-creation error|must=] contain exactly `2` entries, + one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`. + - Otherwise, |members| [=shader-creation error|must not=] contain two entries with the same [=attribute/location=] value. +
Note: Location numbering is distinct between inputs and outputs: Location numbers for an entry point's shader stage inputs do not conflict with location numbers for the entry point's shader stage outputs. From 0f7d9443d7694631e15ec45a6d98c040c5b96e99 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 30 May 2024 16:34:21 +0800 Subject: [PATCH 24/29] Small fix --- spec/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/index.bs b/spec/index.bs index 8429e9affd..d2e02ddba8 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -8273,7 +8273,7 @@ dictionary GPUFragmentState and [=blend_src=] omitted or equal to 0. - If |usesDualSourceBlending| is `true`: - All the [=shader stage output=] values of |entryPoint| must have a [=blend_src=] attribute. - - |descriptor|.{{GPUFragmentState/targets}}.length must be `1`. + - |descriptor|.{{GPUFragmentState/targets}}.length must be 1. - Let |colorState| be |descriptor|.{{GPUFragmentState/targets}}[0]. - If |colorState|.{{GPUColorTargetState/writeMask}} is not 0: - |entryPoint| must have a [=shader stage output=] with [=location=] equal to 0 From 775c2d42b12352150a3c26db9841b9de55082144 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Wed, 5 Jun 2024 09:06:35 +0800 Subject: [PATCH 25/29] Require `@blend_src` must be used together with `@location` --- wgsl/index.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index 5c9a5e6581..7dc5a0f22a 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8433,7 +8433,8 @@ path: syntax/blend_src_attr.syntax.bs.include is enabled. See [[#input-output-locations]]. - [=shader-creation error|Must=] only be applied to a member of a [=structure=] type. + [=shader-creation error|Must=] only be applied to a member of a [=structure=] type with a + [=attribute/location=] attribute. [=shader-creation error|Must=] only be applied to declarations of objects with [=numeric scalar=] or [=numeric vector=] type. [=shader-creation error|Must=] only be used as an output of the [=fragment=] shader stage. From e3fad84198f01b36646fcc4aa6719681a4ec7554 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Fri, 7 Jun 2024 11:12:17 +0800 Subject: [PATCH 26/29] Require all the outputs with `@blend_src` have same type --- wgsl/index.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/wgsl/index.bs b/wgsl/index.bs index 93248277c4..a8de75db16 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9476,6 +9476,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on - If any entry in |members| specifies a [=attribute/blend_src=] attribute: - |members| [=shader-creation error|must=] contain exactly `2` entries, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`. + - All the |members| must have same data type. - Otherwise, |members| [=shader-creation error|must not=] contain two entries with the same [=attribute/location=] value. From 07cc9d719478fbc0b31aa1b6d0ee398729bbbe4f Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 11 Jun 2024 09:38:43 +0800 Subject: [PATCH 27/29] Address reviewer's comment --- wgsl/index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index a8de75db16..28085904a9 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9471,8 +9471,8 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on - |inputs| [=shader-creation error|must not=] contain two entries with the same [=attribute/location=] value.
- For each structure type defined in a WGSL module (not just those used in shader stage inputs or outputs), - let |members| be the set of struct members with [=attribute/location=] attributes. + For each structure type |S| defined in a WGSL module (not just those used in shader stage inputs or outputs), + let |members| be the set of members of |S| that have [=attribute/location=] attributes. - If any entry in |members| specifies a [=attribute/blend_src=] attribute: - |members| [=shader-creation error|must=] contain exactly `2` entries, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`. From d0f5259fcebda01d86a938aa292ac946befb8b46 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Tue, 11 Jun 2024 09:42:32 +0800 Subject: [PATCH 28/29] Remove tabs --- wgsl/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index 28085904a9..429e135c12 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -9472,7 +9472,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on
For each structure type |S| defined in a WGSL module (not just those used in shader stage inputs or outputs), - let |members| be the set of members of |S| that have [=attribute/location=] attributes. + let |members| be the set of members of |S| that have [=attribute/location=] attributes. - If any entry in |members| specifies a [=attribute/blend_src=] attribute: - |members| [=shader-creation error|must=] contain exactly `2` entries, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`. From b98a4b040eed40ee11620a5a7f4919a7d42530b9 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Wed, 12 Jun 2024 23:15:51 +0800 Subject: [PATCH 29/29] Small fixes --- wgsl/index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgsl/index.bs b/wgsl/index.bs index 429e135c12..9d7666b64a 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -8441,7 +8441,7 @@ path: syntax/blend_src_attr.syntax.bs.include Parameters - [=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an i32 or u32 with value of `0` or `1`. + [=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an [=i32=] or [=u32=] with value of `0` or `1`. @@ -9476,7 +9476,7 @@ Each structure member in the entry point IO [=shader-creation error|must=] be on - If any entry in |members| specifies a [=attribute/blend_src=] attribute: - |members| [=shader-creation error|must=] contain exactly `2` entries, one with `@location(0) @blend_src(0)` and one with `@location(0) @blend_src(1)`. - - All the |members| must have same data type. + - All the |members| [=shader-creation error|must=] have same data type. - Otherwise, |members| [=shader-creation error|must not=] contain two entries with the same [=attribute/location=] value.