writer/hlsl: Simplify UBO accesses for static indexing

Use the new semantic constant value information to significantly reduce the complex indexing logic emitted for UBO accesses.
This will dramatically reduce the number of `for` loops that are decayed to `while` loops.

Change-Id: I1b0adb5edde2b4ed39c6beafc2e28106b86e0edd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-07-13 12:18:13 +00:00
parent 71f619b6f1
commit 51cfe26bb7
46 changed files with 1712 additions and 191 deletions

View File

@@ -4,7 +4,6 @@ cbuffer cbuffer_v : register(b0, space0) {
[numthreads(1, 1, 1)]
void main() {
const uint scalar_offset = (0u) / 4;
const int use = (asint(v[scalar_offset / 4][scalar_offset % 4]) + 1);
const int use = (asint(v[0].x) + 1);
return;
}