diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-03-01 01:50:19 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-01 01:50:19 +0800 |
| commit | d979b5048009c3909cfc13476a78a12ae5f4d61b (patch) | |
| tree | 550815d37916be845fb0aa1dcc6131960c2bf517 /tests/language-feature/bitfield/zero-width.slang | |
| parent | 21f86773771c26da8bf3c458642e51b1728d419c (diff) | |
Add support for bitfields (#3639)
* Add support for bitfields
Closes https://github.com/shader-slang/slang/issues/3559
* Set scopes for syntsized bitfield accessors
* Simplify generated code for bitfield accessors
* spelling
* regenerate vs project
* warnings
Diffstat (limited to 'tests/language-feature/bitfield/zero-width.slang')
| -rw-r--r-- | tests/language-feature/bitfield/zero-width.slang | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/language-feature/bitfield/zero-width.slang b/tests/language-feature/bitfield/zero-width.slang new file mode 100644 index 000000000..457b31456 --- /dev/null +++ b/tests/language-feature/bitfield/zero-width.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type + +// CHECK: 123 +// CHECK-NEXT: 4567 +// CHECK-NEXT: 1 +// CHECK-NEXT: 0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +struct S { + int foo : 8; + int breaker : 0; + int bar : 24; +}; + +[numthreads(1, 1, 1)] +void computeMain() +{ + S s; + s.foo = 123; + s.bar = 4567; + s.breaker = 9999; + outputBuffer[0] = s.foo; + outputBuffer[1] = s.bar; + outputBuffer[2] = sizeof(S) == sizeof(int) * 2; + outputBuffer[3] = s.breaker; +} |
