|
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>
|
|
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>
|
|
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>
|