summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-02-07 19:37:26 -0500
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-02-07 16:37:26 -0800
commit23b36c5cb10c820c0b0f66000711d1013bc009f3 (patch)
treeb694305dcdecafd27ca785aae000fed610796480
parent4d593fe34ff89ce13882e47ccd95881ef4743c6b (diff)
* Improve test coverage of bit cast, particularly for asfloat. Make the values being cast between valid floats. (#832)
* Typo fix
-rw-r--r--source/slang/compiler.cpp2
-rw-r--r--tests/compute/bit-cast.slang13
2 files changed, 11 insertions, 4 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp
index c93f3f70c..21f56c9ee 100644
--- a/source/slang/compiler.cpp
+++ b/source/slang/compiler.cpp
@@ -1153,7 +1153,7 @@ SlangResult dissassembleDXILUsingDXC(
// It is possible that we are dynamically discovering entry
// points (using `[shader(...)]` attributes), so that the
// number of entry points on the compile request does not
- // match the number of entries in teh `entryPointOutputPaths`
+ // match the number of entries in the `entryPointOutputPaths`
// array.
//
String outputPath;
diff --git a/tests/compute/bit-cast.slang b/tests/compute/bit-cast.slang
index 050b84f30..324400a34 100644
--- a/tests/compute/bit-cast.slang
+++ b/tests/compute/bit-cast.slang
@@ -31,12 +31,19 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
}
{
- int4 i4 = int4(id, id + 1, id + 2, id + 3);
+ // 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);
uint3 u3 = asuint(f4.xyz);
float2 f2 = asfloat(u3.xy);
- int i1 = asint(id);
+ uint u1 = asuint(f2.x);
+
+ float f1 = asfloat(u1);
+ int i1 = asint(f1);
+
+ float f1_ = asfloat(i1);
+ int i1_ = asint(f1_);
- outputBuffer[id + 8] = i1;
+ outputBuffer[id + 8] = (int)asfloat(i1_);
}
} \ No newline at end of file