src/tests/compiler_tests/WGSLOutput_test.cpp


Log

Author Commit Date CI Message
Matthew Denton 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>
Matthew Denton 7e462c22 2024-09-17T15:32:41 WGPU: Implement SetUniform() enough so GetUniform() works Lays out a shadow buffer for basic uniforms per-shadertype in std140, which is close to matching WGPU's layout. This does not actually pass the buffer to WGPU as a uniform buffer. GetUniform() just reads from the shadow buffer. This is copied from the VK backend and so some code is deduplicated. Bug: angleproject:42267100 Change-Id: I727dc9e09a7ccabbb617f148dd68590469883b07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5867444 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Matthew Denton c2a9300c 2024-09-10T19:33:33 WGSL: Rewrite input/output variables GLSL builtin variables and in/out variables correspond to WGSL's main function params and return value, so rewrite them accordingly. This is done by generating structs to use as main function params and return values, generating similar global structs, and copying the former into the latter so the rest of the program can just use the variables stored in the global structs. Bug: angleproject:42267100 Change-Id: Ic3e1196f6fb95b963ce03845096a59ea7599d608 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5835347 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Matthew Denton 35f01e7f 2024-06-26T14:30:27 ESSL -> WGSL: Support basic control flow If/else, while, do/while, for. Return, break, continue, discard Bug: angleproject:42267100 Change-Id: I0c8ef30b45aec639a07323e333db970d4c42dec0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5661103 Reviewed-by: Liza Burakova <liza@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Matthew Denton 89ef2812 2024-06-26T11:19:54 ESSL -> WGSL: unary and binary exprs, operators, array access Array indexing is always checked to be within bounds. For runtime-sized arrays, this requires emitting a clamp(). For now this includes a bug the left-side-expression (the array itself) has any side effects, which shouldn't actually be possible but may be in future versions of WGSL. Implementing unary, binary, and remaining aggregate expressions requires implementing operators, many of which do not have exact corresponding versions between GLSL and WGSL. This implements many operators but for simplicity leaves some unimplemented and some half-implemented. See WGSLOutput_test.cpp for some code examples. Bug: angleproject:42267100 Change-Id: I3737abb5dffd156deba0429fa86570270d711d3c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5651994 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Matthew Denton 7ca9f46a 2024-06-21T13:09:24 ESSL -> WGSL: Emit func calls, struct access, constants Also includes constructor calls, swizzles, and a slightly incorrect version of the ternary operator. The ternary operator doesn't exist in WGSL, only a non-short-circuiting select() builtin. For now the ternary is implemented with select() but that isn't correct if any of the true/false expressions have side effects, and may have perf implications by computing both true/false expressions. Constants are mostly done after this, however NaN and infinity are not valid constants in WGSL and it's unclear what we can do about this as WGPU implementations are allowed to assume NaNs and infinities are never operated on. Bug: angleproject:42267100 Change-Id: Ie6190091a7b95d3d372736ab7cea45868846e7be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5648990 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Matthew Denton a04239d8 2024-06-18T11:38:52 ESSL -> WGSL: Emit most types and function params This emits struct declarations, as well as array/matrix/vec types. As a result this also emits function parameters. Bug: angleproject:42267100 Change-Id: Ib9c7e543fd38f7c1dfa64d8e63b054fc5111b336 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5598298 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Matthew Denton af72bf7f 2024-05-24T15:00:44 ESSL -> WGSL: emit basic types This emits dimensionless types (no vectors, matrices, arrays). Function signatures will emit their return type (assuming it is dimensionless). Bug: angleproject:42267100 Change-Id: I0d2479f71408eb20b9c329a99c70a6bf6426a72f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5590384 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Matthew Denton d68395fe 2024-05-24T15:14:46 ESSL->WGSL: Emit basic function signatures ...signatures don't yet include types or parameters. See WGSLOutput_test.cpp for a sample translation. Bug: angleproject:8662 Change-Id: I93273156f72ba193441e737074bd1a8a054f2ea9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5582949 Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>