diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-28 11:26:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-28 11:26:02 -0700 |
| commit | b8e31688c6826475b5199468aedea0bc44c0adc1 (patch) | |
| tree | 79b9227ef038d173d780a440035e616dc31104bb /tests | |
| parent | afe41a6c994a684cd646b4432a285ef959d0716b (diff) | |
| parent | d601921b71ed44835e8d4fa6f13ff7aefcf7649d (diff) | |
Merge pull request #48 from tfoleyNV/literal-suffix-fix
Fix handling of literal suffixes
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hlsl/simple/literal-typing.hlsl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/hlsl/simple/literal-typing.hlsl b/tests/hlsl/simple/literal-typing.hlsl new file mode 100644 index 000000000..71acb0d92 --- /dev/null +++ b/tests/hlsl/simple/literal-typing.hlsl @@ -0,0 +1,25 @@ +//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_5_0 -entry main + +// Confirm that we get the typing of literal suffixes correct + +// A type created to cause type-checking failures downstream +struct Bad { int bad; }; + +// We define two overloads for `foo()`. The "right" one takes +// an unsigned integer, and returns it. The "wrong" one takes +// a signed integer and returns a `Bad`. + +uint foo(uint x) { return x; } +Bad foo(int x) { Bad b; b.bad = x; return b; } + +// The shader entry point will call `foo()` on a literal +// with a suffix that should make it unsigned, so that +// we either respect the suffix and call the right overload, +// or ignore it and call the wrong one. + +RWStructuredBuffer<uint> b; +[numthreads(32,1,1)] +void main(uint3 tid : SV_DispatchThreadID) +{ + b[tid.x] = foo(99u); +}
\ No newline at end of file |
