|
9dc36791
|
2025-08-28T07:24:21
|
|
WGSL: Fix unused variable in translator
Test: Build with is_debug = false
Bug: angleproject:441701631
Change-Id: Ifa44bb5388788602e76c2ae2005bdd41d2c22dd4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6896036
Auto-Submit: Cody Northrop <cnorthrop@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
|
|
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>
|
|
ca3d732d
|
2025-07-24T16:22:31
|
|
WGSL: support bool in uniforms
WGSL does not allow booleans in the uniform address space.
This CL changes the translator to substitute u32 for bool
in the uniform address space, and convert it to bool on use.
Arrays of bools are obviously arrays of u32s, and those
will need special conversion functions to convert the entire
array<u32> to array<bool> if necessary.
This also includes the optimization of an array<bool> in a
uniform--when indexing into it, only the indexed element
will be converted to a native bool, instead of converting
the entire array and then indexing.
Note that substituting u32 for bool matches std140, so this
change requires no changes to layout of uniforms.
Also note that WGSL really likes explicit casts, so there's
not really a way to avoid inserting explicit casts everywhere
when using u32.
Bug: angleproject:376553328
Change-Id: I8f72e55c6b401c28ff622622df7a450b7032721f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6785609
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Liza Burakova <liza@chromium.org>
|
|
6a3ff5a1
|
2025-07-17T12:41:13
|
|
WGSL: extra debug logging for failure cases
Bug: angleproject:42267100
Change-Id: I8938526b60af71d15d4327bc10fa172117afef60
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6777200
Reviewed-by: Geoff Lang <geofflang@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>
|
|
00d99277
|
2025-03-19T17:22:24
|
|
[WGSL] Emit sampler types and texture lookup builtins
The split texture/sampler WGSL variables will now have the correct
types corresponding to their GLSL types.
Texture builtins are translated as faithfully as possible. There are
some issues with the translation:
1. Texture builtins using an implicit level-of-detail in a vertex
shader are supposed to sample from the base mip level. Right
now these are translated into WGSL functions that cannot be used
in a vertex shader at all.
2. Some texture builtins that take integer samplers do not have
corresponding WGSL versions, e.g. the sampling GLSL function
texture() takes integer samplers but the mostly equivalent
WGSL builtin, textureSample(), will only take float samplers.
3. A number of GLSL texture builtins are not supported in WGSL
when uses on shadow samplers, e.g. anything with a bias
parameter, an explicit LOD parameter, or explicit gradients,
Bug: angleproject:389145696
Change-Id: Idfd75721f88181db9643235b954629ac477163e4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6372082
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Liza Burakova <liza@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>
|
|
b1a0d60f
|
2025-01-08T15:10:41
|
|
WGSL: Fix accidentally overloaded functions
Small-stride arrays in uniforms with the same element type, but
different array sizes, would cause the WGSL generator to produce
conversion functions with the same name but different array sizes.
This CL puts the array size in the name of the function to
avoid overloading, which is unsupported in WGSL.
Bug: angleproject:376553328
Change-Id: I446e91ccb9da2872c88f1a4e05283aacc9d6f8b1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6160334
Commit-Queue: Matt Denton <mpdenton@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Matt Denton <mpdenton@google.com>
Reviewed-by: Liza Burakova <liza@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>
|