diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-02-27 10:38:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-27 10:38:51 -0500 |
| commit | 3fc4813449f40872cff2320e66785619376cd119 (patch) | |
| tree | a3881ebf55d345ad64ec55081183aede536d4388 /tests | |
| parent | 13ad9c83e7617bf8afef1509e4becde19dd1f59d (diff) | |
* Add 'identity' version of bit casts (asint, asuint, asfloat) for scalar and vector (#864)
* Added identity bit casts for matrix (cos no op). We don't support matrix asint on glsl targets
* Added tests in bit-cast.slang
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/bit-cast.slang | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/compute/bit-cast.slang b/tests/compute/bit-cast.slang index 324400a34..a6c4813f0 100644 --- a/tests/compute/bit-cast.slang +++ b/tests/compute/bit-cast.slang @@ -13,10 +13,20 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { int4 i4 = int4(id, id + 1, id + 2, id + 3); + + // Identity - int vector + i4 = asint(i4); + uint3 u3 = asuint(i4.xyz); + // Identity - uint vec + u3 = asuint(u3); + int2 i2 = asint(u3.xy); uint u1 = asuint(i2.x); + // Identity - uint scalar + u1 = asuint(u1); + outputBuffer[id + 0] = int(u1); } @@ -27,18 +37,29 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) uint2 u2 = asuint(i3.xy); int i1 = asint(u2.x); + // Identity - int scalar + i1 = asint(i1); + outputBuffer[id + 4] = i1; } { // Make i4 holds id as floats so we know they are valid float values and not denormals int4 i4 = int4(asint(float(id)), asint(float(id + 1)), asint(float(id + 2)), asint(float(id + 3))); - float4 f4 = asfloat(i4); + float4 f4 = asfloat(asfloat(i4)); + + // Identity - float vector + f4 = asfloat(f4); + uint3 u3 = asuint(f4.xyz); float2 f2 = asfloat(u3.xy); uint u1 = asuint(f2.x); - float f1 = asfloat(u1); + float f1 = asfloat(asfloat(u1)); + + // Identity - float scalar + f1 = asfloat(f1); + int i1 = asint(f1); float f1_ = asfloat(i1); |
