From adaea0e993fd8db351b5dad92802e47ed6d0ec77 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 17 Aug 2022 23:08:34 -0700 Subject: Warning on lossy implicit casts. (#2367) * Warning on bool to float conversion. * Fix test cases. * Improve. * LanguageServer: don't show constant value for non constant variables. * Fix tests. * Fix warnings in tests. Co-authored-by: Yong He --- tests/cross-compile/array-of-buffers.slang | 2 +- tests/cross-compile/get-dimensions.slang | 6 +++--- tests/cross-compile/image-load.slang | 2 +- tests/cross-compile/simple-cross-compile.slang | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/cross-compile') diff --git a/tests/cross-compile/array-of-buffers.slang b/tests/cross-compile/array-of-buffers.slang index de87e6d9d..31738ccfc 100644 --- a/tests/cross-compile/array-of-buffers.slang +++ b/tests/cross-compile/array-of-buffers.slang @@ -27,6 +27,6 @@ float4 main() : SV_Target return cb [index] .f + sb1[index][index].f + sb2[index][index] - + float4(bb[index].Load(index*4)); + + float4(bb[index].Load(int(index*4))); } diff --git a/tests/cross-compile/get-dimensions.slang b/tests/cross-compile/get-dimensions.slang index 13874a6e2..65c2a1a70 100644 --- a/tests/cross-compile/get-dimensions.slang +++ b/tests/cross-compile/get-dimensions.slang @@ -35,7 +35,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) if (index == 0) { buffer0.GetDimensions(count, stride); - last = buffer0.Load(count - 1); + last = buffer0.Load(int(count - 1)); } else if (index == 1) { @@ -45,13 +45,13 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) else if (index == 2) { buffer2.GetDimensions(count, stride); - last = int(buffer2.Load(count -1)); + last = int(buffer2.Load(int(count - 1))); } else { buffer3.GetDimensions(count, stride); - last = buffer3.Load(count - 1).a; + last = buffer3.Load(int(count - 1)).a; } outputBuffer[index * 2] = int(count); diff --git a/tests/cross-compile/image-load.slang b/tests/cross-compile/image-load.slang index 7f125bd5a..dc80288e6 100644 --- a/tests/cross-compile/image-load.slang +++ b/tests/cross-compile/image-load.slang @@ -15,5 +15,5 @@ ParameterBlock gParams; void main(uint3 tid : SV_DispatchThreadID) { - float f = gParams.tex.Load(int3(tid.xy, tid.z)); + float f = gParams.tex.Load(int3(int2(tid.xy), int(tid.z))); } diff --git a/tests/cross-compile/simple-cross-compile.slang b/tests/cross-compile/simple-cross-compile.slang index e5fe9d3cc..b85d5cb53 100644 --- a/tests/cross-compile/simple-cross-compile.slang +++ b/tests/cross-compile/simple-cross-compile.slang @@ -19,7 +19,7 @@ int test(int val) if(c == Color.Red) { - if(val & 1) + if((val & 1) != 0) { c = Color.Blue; } -- cgit v1.2.3