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

Add optional feature dual_source_blending #4621

Merged
merged 43 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7ee65b1
Add optional feature dual_source_blending
Jiawei-Shao May 6, 2024
ba12281
Fix
Jiawei-Shao May 6, 2024
5583b86
Add blend_src_attr.syntax.bs.include
Jiawei-Shao May 7, 2024
2d1ef2d
Update wgsl/syntax.bnf
Jiawei-Shao May 7, 2024
8619b93
dos2unix
Jiawei-Shao May 7, 2024
ba36153
Fix more wgsl include files
Jiawei-Shao May 7, 2024
e41e5f0
Improve the statements
Jiawei-Shao May 7, 2024
9c596ab
Fix
Jiawei-Shao May 7, 2024
cd5aaf6
Improve the statements
Jiawei-Shao May 7, 2024
1e5c07c
Further refactoring of the api validation
kainino0x May 8, 2024
c2c5eb4
fix typos
kainino0x May 8, 2024
43e53f1
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 8, 2024
4ca6452
Address reviewers' comments
Jiawei-Shao May 8, 2024
0b8efef
Small fix
Jiawei-Shao May 8, 2024
add28f1
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 9, 2024
94a1689
Add `Feature` column in the `GPUBlendFactor` table
Jiawei-Shao May 9, 2024
bafaa41
Address Alan's comments
Jiawei-Shao May 11, 2024
7718b21
Fix typo
Jiawei-Shao May 11, 2024
8aec9dc
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 14, 2024
7c8d300
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 16, 2024
cb35343
Sort builtins alphabetically.
Jiawei-Shao May 16, 2024
c084773
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 20, 2024
45b5c0e
Don't apply `location overlapping` rules on `blend_src` members
Jiawei-Shao May 20, 2024
fa9f445
`blend_src` can only be specified on fragment outputs
Jiawei-Shao May 20, 2024
b914f26
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 21, 2024
097aaf1
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 23, 2024
34a2eb7
Address Kai's comments
Jiawei-Shao May 23, 2024
9f4e8d7
Small fix
Jiawei-Shao May 23, 2024
939387a
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 29, 2024
df42b25
Require all the @location(0) @blend_src(N) outputs have same type
Jiawei-Shao May 29, 2024
0e2b419
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 30, 2024
c04f859
Address reviewers' comments
Jiawei-Shao May 30, 2024
0f7d944
Small fix
Jiawei-Shao May 30, 2024
3b66fbd
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao May 31, 2024
1b00d2a
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao Jun 5, 2024
775c2d4
Require `@blend_src` must be used together with `@location`
Jiawei-Shao Jun 5, 2024
66f5a8a
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao Jun 7, 2024
e3fad84
Require all the outputs with `@blend_src` have same type
Jiawei-Shao Jun 7, 2024
d5ffbb7
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao Jun 11, 2024
07cc9d7
Address reviewer's comment
Jiawei-Shao Jun 11, 2024
d0f5259
Remove tabs
Jiawei-Shao Jun 11, 2024
4bbb2fe
Merge branch 'main' into add-dual-source-blending
Jiawei-Shao Jun 12, 2024
b98a4b0
Small fixes
Jiawei-Shao Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address reviewers' comments
  • Loading branch information
Jiawei-Shao committed May 8, 2024
commit 4ca64525cac8ef056ba96dce47f4b22afb5bcaee
4 changes: 2 additions & 2 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
27 changes: 12 additions & 15 deletions wgsl/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -8635,7 +8635,7 @@ path: syntax/blend_src_attr.syntax.bs.include

<tr>
<td>Parameters
<td>[=shader-creation error|Must=] be `0` or `1`.
<td>[=shader-creation error|Must=] be a [=const-expression=] that [=resolves=] to an i32 or u32 with value of `0` or `1`.

</table>

Expand Down Expand Up @@ -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
Jiawei-Shao marked this conversation as resolved.
Show resolved Hide resolved
[=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.
Jiawei-Shao marked this conversation as resolved.
Show resolved Hide resolved

When [=attribute/blend_src=] attribute is specified:
When the [=attribute/blend_src=] attribute is specified:
kainino0x marked this conversation as resolved.
Show resolved Hide resolved
* 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:
Expand Down
Loading