|
b9cec916
|
2025-08-12T19:44:18
|
|
WGSL: default uniforms gathered in interface block
The default uniform struct was being manually output by
OutputUniformBlocksAndSamplers(), which did not add the appropriate
@align(16) annotations to lay the struct out according to WGSL's
uniform address space layout requirements.
This CL uses Vulkan's method of gathering the default uniforms
into an interface block. The interface block will be output
normally by the traverser, including @align() annotations.
The variable declaring an instance of the interface block is
still output by OutputUniformBlocksAndSamplers() because it needs
special @group() and @binding() annotations.
Bug: angleproject:376553328
Change-Id: Ib3be7d51ffedefe5ec579a1c9aaf0a535146c694
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6795028
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Liza Burakova <liza@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
|
7e28089b
|
2025-07-31T18:44:01
|
|
WGSL: support bvecs in uniforms
WGSL does not allow booleans in the uniform address space.
The last CL uses u32s to represent bools in the uniform address
space, and this CL uses vecN<u32> to represent bvecN.
Bug: angleproject:376553328
Change-Id: Ibf9f1fbf230ca03dd3d4661ba599e5fb1cb26ac4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6808955
Reviewed-by: Liza Burakova <liza@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
|
|
cac1e824
|
2025-04-29T18:27:36
|
|
WGSL: Output driver uniform and UBO structs
This is the WGSL half of the change to implement driver uniforms.
Driver uniforms are implemented as a UBO and reuse the default
set of driver uniforms. User-provided UBOs don't yet have
variables outputted for them.
This requires moving MSL's ReduceInterfaceBlocks to the tree_ops
dir in order to change interface block definitions into struct
definitions.
Bug: angleproject:389145696
Change-Id: I27f3837b3d115f2ffac66cc545f3b60ca9f01cb6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6477564
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
|
4b69ba93
|
2025-04-28T16:45:56
|
|
WGPU: upload texture bind groups and configured samplers
GLSL samplers are split into separate sampler/texture variables
in WGSL. Before this CL, the WGSL translator generated shaders
that look like:
@group(1) @binding(@@@@@@) var ANGLE_sampler_samp2D :
sampler;
@group(1) @binding(@@@@@@) var ANGLE_texture_samp2D :
texture_2d<f32>;
@group(1) @binding(@@@@@@) var ANGLE_sampler_sampCube :
sampler;
@group(1) @binding(@@@@@@) var ANGLE_texture_sampCube :
texture_cube<f32>;
This CL replaces those with actual binding numbers
@group(1) @binding(0) var ANGLE_sampler_samp2D :
sampler;
@group(1) @binding(1) var ANGLE_texture_samp2D :
texture_2d<f32>;
...
Such that @binding(n*2) is the WGSL sampler variable corresponding
to the n-th GLSL sampler and @binding(n*2+1) is the WGSL texture
variable corresponding to the n-th GLSL sampler.
This CL then generates binding group layouts matching the above,
and uploads textures and configured samplers in bind groups.
This makes some of the deqp_gles2 tests 2d texture tests pass,
though some fail because they need a flipped y coordinate.
Not yet supported:
1. arrays of samplers
2. shadow samplers
3. cube textures
Bug: angleproject:389145696
Change-Id: I2ab18ae5ebb4d1289101266bd9451576aa04ce2a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6382272
Reviewed-by: Liza Burakova <liza@chromium.org>
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
|
0cdbc781
|
2025-03-06T11:22:18
|
|
WGSL: Output samplers, including samplers from structs
This output two WGSL variables for each GLSL sampler, including samplers
in structs. This does not output the correct types for the WGSL
variables, yet, nor does it generate texture access function calls.
It also can't deal with arrays of samplers, which are not allowed in
WGSL.
Note that WGSL does not allow structs containing samplers to be
arguments to a function, like Vulkan, nor does it allowed arrays of
samplers at all, unlike Vulkan. This deals with the former problem the
same way as Vulkan and Metal, by monomorphizing functions that take
unsupported arguments.
Bug: angleproject:389145696
Change-Id: I346688783dd2771c8fe6848b6783d948ed111783
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6253672
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
|
|
8ee72cc7
|
2025-01-13T13:44:31
|
|
WGSL: support matCx2 in uniforms
matCx2 in WGSL does not match std140 layout and so it needs to
be translated as array<ANGLE_wrapped_vec2, C> when in a uniform.
On use it needs to be converted to a WGSL-native matCx2.
This also includes the optimization of an array<matCx2> in a
uniform--when indexing into it, only the indexed element
will be converted to a native matCx2, instead of converting
the entire array and then indexing.
Bug: angleproject:376553328
Change-Id: I1d84471234b3d3cf4cf361ae89cb61675d5bf9a8
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6157788
Reviewed-by: Liza Burakova <liza@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
|
53ec86ab
|
2024-12-17T14:40:31
|
|
WGSL: support small stride arrays in uniforms
WGSL requires arrays in the uniform address space to have a stride
a multiple of 16.
This CL makes WGSL translator emit wrapper structs for array element
types used in the uniform address space, when the array stride is
not a multiple of 16. The exception is for structs that aren't
an aligned size of 16n, and for any types matCx2, since they are
(or will be) handled in different ways that ensure alignment to 16.
This should leave only f32, i32, u32, and vec2.
See https://www.w3.org/TR/WGSL/#example-67da5de6 for an example
of using a wrapper struct.
This requires converting arrays with a wrapper struct element type
to arrays with an unwrapped element type when they are first used;
this can be "optimized" later for the common case of accessing a
single array element, which can then be unwrapped immediately. This
CL generates WGSL conversion functions when necessary.
After this, the only types that can't yet be used in a uniform
are matCx2 and bools.
This is #2 in
https://docs.google.com/document/d/17Qku1QEbLDhvJS-JJ9lPQAbnuZtLxWhG-ha5eCUhtEY/edit?tab=t.0#bookmark=id.rt3slgehd4te
Bug: angleproject:376553328
Change-Id: I1edfa7f481a6cbf5b595643aae8728e67bc4b770
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6092038
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Liza Burakova <liza@chromium.org>
Reviewed-by: Matt Denton <mpdenton@google.com>
Commit-Queue: Matt Denton <mpdenton@google.com>
|
|
473798bf
|
2024-11-28T00:38:36
|
|
WGSL: @align appropriate struct members in uniforms.
Structs used in the uniform address space need to have certain
members aligned according to the uniform address space layout
constraints (substantially similar to std140).
This CL adds @align annotations where necessary, in structs used
in the uniform address space. Strictly speaking, it's okay to apply
@align annotations to all structs used in the WGSL program, but this
CL uses a pre-pass AST traverser to records all the structs used
in the uniform address space. This is to avoid more unreadable
generated code, and when more transformations are applied to
these structs in future CLs, less generated code overall.
After this, the only types that can't yet be used in a uniform
are matCx2, arrays with stride not divisble by 16 (except when the
array element type is a struct), and bools.
This is #1 in struct translation in
https://docs.google.com/document/d/17Qku1QEbLDhvJS-JJ9lPQAbnuZtLxWhG-ha5eCUhtEY/edit?tab=t.0#bookmark=id.rudfrn2o6jv1
Bug: angleproject:376553328
Change-Id: Ibff3414043a6ecb4a01ef8e3e71dad9c1066ddfd
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6056951
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Liza Burakova <liza@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
|
|
4a835cf2
|
2024-11-01T13:31:00
|
|
WebGPU: send uniforms to GPU for use in shader
Basic uniforms should now be accessible in the shader during a draw
call, rather than just via glGetUniform*().
This is unoptimized and creates a new GPU-side copy of all the uniforms,
every time any uniform changes.
This sets up the bind group layout for a pipeline and sets the bind
groups in the renderer pass. Right now these bind groups only contain
the default uniform blocks, but in the future will need to contain
textures, samplers, and non-default uniform blocks (UBOs).
Bug: angleproject:376553328
Change-Id: I50891b81ab2ee374d674213257f76319c0222120
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5980972
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Liza Burakova <liza@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
|
|
a6ee4641
|
2024-09-25T11:41:47
|
|
WGSL: Output default uniform block and accesses to it
Default uniforms are put into a WGSL struct, and all accesses
of those uniforms now output struct accesses.
Similarly to I/O vars and builtins, these are outputted in a
pre-pass, but in the future it might make sense to do what
Vulkan does and do an AST transformation to put the default
uniforms into a UBO which should be outputted similarly.
This does not handle bool, matCx2, or array of element size < 16.
Bug: angleproject:42267100
Change-Id: If29e2895a8aba3212b581813316af87273c1515c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5878759
Reviewed-by: Liza Burakova <liza@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
|