diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/bool-init.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/bool-op.slang | 16 | ||||
| -rw-r--r-- | tests/bugs/generic-constant-fold.slang | 4 | ||||
| -rw-r--r-- | tests/bugs/generic-default-matrix.slang | 4 | ||||
| -rw-r--r-- | tests/bugs/generic-default-value.slang | 4 | ||||
| -rw-r--r-- | tests/bugs/generic-uint-value-param.slang | 24 | ||||
| -rw-r--r-- | tests/bugs/generic-uint-value-param.slang.expected.txt | 5 | ||||
| -rw-r--r-- | tests/bugs/gh-1990.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/gh-487.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/gh-841.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/gh-841.slang.glsl | 2 | ||||
| -rw-r--r-- | tests/bugs/gl-33.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/meta-2.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/mutating/mutating-generic-method.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/nested-existential-dyndispatch.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/operator-overload.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/ssa-loop.slang | 4 | ||||
| -rw-r--r-- | tests/bugs/static-method.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/texture2d-ms.hlsl | 2 | ||||
| -rw-r--r-- | tests/bugs/vec-compare.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/vk-structured-buffer-load.hlsl | 4 |
21 files changed, 60 insertions, 31 deletions
diff --git a/tests/bugs/bool-init.slang b/tests/bugs/bool-init.slang index 51fa852f9..b073a52cc 100644 --- a/tests/bugs/bool-init.slang +++ b/tests/bugs/bool-init.slang @@ -16,7 +16,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) Thing thing = {}; int index = int(dispatchThreadID.x); - if (index % 3) + if (index % 3 != 0) { thing.a = (index & 1) != 0; } diff --git a/tests/bugs/bool-op.slang b/tests/bugs/bool-op.slang index 4d4b43221..911e23aa0 100644 --- a/tests/bugs/bool-op.slang +++ b/tests/bugs/bool-op.slang @@ -15,7 +15,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) uint uv = tid; int iv = int(tid); - bool2 bv2 = { tid & 1, tid > 10 }; + bool2 bv2 = { (tid & 1) != 0, tid > 10 }; float2 f2 = { float(tid), float(tid + 1) }; @@ -32,20 +32,20 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) r |= 0x0002; } - if (iv) + if (iv != 0) { r|= 0x0004; } - if (!iv) + if (!bool(iv)) { r|= 0x0008; - } - - if (uv) + } + + if (uv != 0) { r |= 0x0010; } - if (!uv) + if (!bool(uv)) { r |= 0x0020; } @@ -59,7 +59,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) r |= 0x0080; } - if (any(!f2)) + if (any(!bool2(f2))) { r |= 0x0100; } diff --git a/tests/bugs/generic-constant-fold.slang b/tests/bugs/generic-constant-fold.slang index 35aa2a042..b3de9cb07 100644 --- a/tests/bugs/generic-constant-fold.slang +++ b/tests/bugs/generic-constant-fold.slang @@ -29,8 +29,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { SomeStruct<true> a; SomeStruct<false> b; - SomeStruct<1> c; - SomeStruct<0> d; + SomeStruct<bool(1)> c; + SomeStruct<bool(0)> d; AnotherStruct<true> e; AnotherStruct<false> f; diff --git a/tests/bugs/generic-default-matrix.slang b/tests/bugs/generic-default-matrix.slang index 47fbe520e..a559f59b1 100644 --- a/tests/bugs/generic-default-matrix.slang +++ b/tests/bugs/generic-default-matrix.slang @@ -11,10 +11,10 @@ struct Another<let W : int, let H : int> [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { - int index = dispatchThreadID.x; + int index = int(dispatchThreadID.x); Another<2, 4> a = {}; - outputBuffer[index] = index + a.values[0].x; + outputBuffer[index] = index + int(a.values[0].x); } diff --git a/tests/bugs/generic-default-value.slang b/tests/bugs/generic-default-value.slang index b3805e317..32dc07cdc 100644 --- a/tests/bugs/generic-default-value.slang +++ b/tests/bugs/generic-default-value.slang @@ -14,10 +14,10 @@ struct Check<T> [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { - int index = dispatchThreadID.x; + int index = int(dispatchThreadID.x); Check<float> v = {}; - outputBuffer[index] = index + v.v; + outputBuffer[index] = index + int(v.v); } diff --git a/tests/bugs/generic-uint-value-param.slang b/tests/bugs/generic-uint-value-param.slang new file mode 100644 index 000000000..4d4059732 --- /dev/null +++ b/tests/bugs/generic-uint-value-param.slang @@ -0,0 +1,24 @@ +// generic-uint-value-param.slang + +//DIAGNOSTIC_TEST:SIMPLE: + +// Regression test to confirm that type checker +// doesn't report warnings for these constant coercions. + +struct BoolG<let v : bool> +{ } + +struct Test<let v : uint> +{ + int arr[v]; +} + +static const uint uv = 5; + +void t() +{ + BoolG<true> gt; + BoolG<bool(1)> gt2; + BoolG<1 != 2> gt3; + Test<uv> v; +}
\ No newline at end of file diff --git a/tests/bugs/generic-uint-value-param.slang.expected.txt b/tests/bugs/generic-uint-value-param.slang.expected.txt new file mode 100644 index 000000000..4c32e2510 --- /dev/null +++ b/tests/bugs/generic-uint-value-param.slang.expected.txt @@ -0,0 +1,5 @@ +result code = 0 +standard error = { +} +standard output = { +} diff --git a/tests/bugs/gh-1990.slang b/tests/bugs/gh-1990.slang index 758caf1a9..4baceee1f 100644 --- a/tests/bugs/gh-1990.slang +++ b/tests/bugs/gh-1990.slang @@ -59,5 +59,5 @@ void test<R : IInterface>(R r, int id) void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { Impl impl; - test(impl, dispatchThreadID.x); + test(impl, int(dispatchThreadID.x)); } diff --git a/tests/bugs/gh-487.slang b/tests/bugs/gh-487.slang index e425dabe2..f59a1ef7b 100644 --- a/tests/bugs/gh-487.slang +++ b/tests/bugs/gh-487.slang @@ -23,7 +23,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { uint tid = dispatchThreadID.x; - int inVal = tid; + int inVal = int(tid); int outVal = test(inVal); gBuffer[tid] = outVal; diff --git a/tests/bugs/gh-841.slang b/tests/bugs/gh-841.slang index becf741c1..44d8348e5 100644 --- a/tests/bugs/gh-841.slang +++ b/tests/bugs/gh-841.slang @@ -13,7 +13,7 @@ struct RasterVertex float4 main(RasterVertex v) : SV_Target { float4 result = v.c; - if(v.u & 1) + if((v.u & 1) != 0) result += 1.0; return result; } diff --git a/tests/bugs/gh-841.slang.glsl b/tests/bugs/gh-841.slang.glsl index da23c33f1..dd949521b 100644 --- a/tests/bugs/gh-841.slang.glsl +++ b/tests/bugs/gh-841.slang.glsl @@ -22,7 +22,7 @@ void main() vec4 result_0 = _S4.c_0; vec4 result_1; - if(bool(_S4.u_0 & uint(1))) + if((_S4.u_0 & uint(1))!=0) { result_1 = result_0 + 1.0; } diff --git a/tests/bugs/gl-33.slang b/tests/bugs/gl-33.slang index 3050115e5..255d47636 100644 --- a/tests/bugs/gl-33.slang +++ b/tests/bugs/gl-33.slang @@ -21,7 +21,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { uint tid = dispatchThreadID.x; - int val = tid; + int val = int(tid); val = test(val); gBuffer[tid] = val; diff --git a/tests/bugs/meta-2.slang b/tests/bugs/meta-2.slang index 6dd5541c4..d6b800e4c 100644 --- a/tests/bugs/meta-2.slang +++ b/tests/bugs/meta-2.slang @@ -11,7 +11,7 @@ struct GetValue<let N : int> [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { - int index = dispatchThreadID.x; + int index = int(dispatchThreadID.x); outputBuffer[index] = GetValue<10>::Value; } diff --git a/tests/bugs/mutating/mutating-generic-method.slang b/tests/bugs/mutating/mutating-generic-method.slang index 625e70101..58fe6f344 100644 --- a/tests/bugs/mutating/mutating-generic-method.slang +++ b/tests/bugs/mutating/mutating-generic-method.slang @@ -42,7 +42,7 @@ int test(int val) RWStructuredBuffer<int> outputBuffer; [numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) { int tid = dispatchThreadID.x; int val = test(tid); diff --git a/tests/bugs/nested-existential-dyndispatch.slang b/tests/bugs/nested-existential-dyndispatch.slang index b6689b54d..69eac42c9 100644 --- a/tests/bugs/nested-existential-dyndispatch.slang +++ b/tests/bugs/nested-existential-dyndispatch.slang @@ -40,7 +40,7 @@ struct AnyVal } [numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) { int index = dispatchThreadID.x; diff --git a/tests/bugs/operator-overload.slang b/tests/bugs/operator-overload.slang index b70b9b987..cc0306dd3 100644 --- a/tests/bugs/operator-overload.slang +++ b/tests/bugs/operator-overload.slang @@ -16,7 +16,7 @@ Vec2d operator+(Vec2d a, Vec2d b) } [numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) { int index = dispatchThreadID.x; diff --git a/tests/bugs/ssa-loop.slang b/tests/bugs/ssa-loop.slang index 4f15f8bed..21cf6e7f5 100644 --- a/tests/bugs/ssa-loop.slang +++ b/tests/bugs/ssa-loop.slang @@ -22,9 +22,9 @@ int test(int val) RWStructuredBuffer<int> gOutputBuffer; [numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) { - uint tid = dispatchThreadID.x; + int tid = dispatchThreadID.x; int inputVal = tid; int outputVal = test(inputVal); gOutputBuffer[tid] = outputVal; diff --git a/tests/bugs/static-method.slang b/tests/bugs/static-method.slang index 4f2d363f2..98e4a3273 100644 --- a/tests/bugs/static-method.slang +++ b/tests/bugs/static-method.slang @@ -25,7 +25,7 @@ int test(int t) } [numthreads(4)] -void computeMain(uint3 tid : SV_DispatchThreadID) +void computeMain(int3 tid : SV_DispatchThreadID) { int val = tid.x; val = test(val); diff --git a/tests/bugs/texture2d-ms.hlsl b/tests/bugs/texture2d-ms.hlsl index 8a898b299..1d8293937 100644 --- a/tests/bugs/texture2d-ms.hlsl +++ b/tests/bugs/texture2d-ms.hlsl @@ -6,5 +6,5 @@ Texture2DMS tex : register(t1); [numthreads(4, 4, 1)] void main(uint3 groupId : SV_GroupID) { - tex.Load(groupId.xy, 0); + tex.Load(int2(groupId.xy), 0); } diff --git a/tests/bugs/vec-compare.slang b/tests/bugs/vec-compare.slang index 184e57a49..59ef06d02 100644 --- a/tests/bugs/vec-compare.slang +++ b/tests/bugs/vec-compare.slang @@ -6,7 +6,7 @@ RWStructuredBuffer<int> outputBuffer; [numthreads(4,4,1)] -void computeMain(uint2 pixelIndex : SV_DispatchThreadID) +void computeMain(int2 pixelIndex : SV_DispatchThreadID) { // We will test floats, uints, and int vectors diff --git a/tests/bugs/vk-structured-buffer-load.hlsl b/tests/bugs/vk-structured-buffer-load.hlsl index ce862c0c8..d9e54d925 100644 --- a/tests/bugs/vk-structured-buffer-load.hlsl +++ b/tests/bugs/vk-structured-buffer-load.hlsl @@ -20,13 +20,13 @@ void HitMain(inout RayHitInfoPacked RayData, BuiltInTriangleIntersectionAttribut { float HitT = RayTCurrent(); RayData.PackedHitInfoA.x = HitT; - uint offs = 0; + int offs = 0; uint use_rcp = USE_RCP; float offsfloat = gParamBlock.sbuf.Load(offs); use_rcp |= HitT > 0.0; - if (use_rcp) + if (use_rcp != 0) RayData.PackedHitInfoA.y = rcp(offsfloat); else if ((use_rcp > 0) & (offsfloat == 0.0)) RayData.PackedHitInfoA.y = rsqrt(offsfloat + 1.0); |
