From 17c6c6044965629a3ae7e8ef004cc0b2ca657c55 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 4 Feb 2020 15:19:48 -0500 Subject: CUDA/C++ backend improvements (#1198) * WIP with vector float test. * vector-float test working. * Fixed remaing tests broken with init changes. * Improve 64bit-type-support.md * Disable tests broken on CI system for Dx. * WIP: Make type available for comparison. * Moved type conversion into TypeTextUtil. * Add text/type conversions from DownstreamCompiler to TypeTextUtil. * Allow compaison taking into account type. * Removed quantize in vector-float.slang test. --- tools/render-test/shader-input-layout.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tools/render-test/shader-input-layout.cpp') diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp index 44021c08a..40502a9ec 100644 --- a/tools/render-test/shader-input-layout.cpp +++ b/tools/render-test/shader-input-layout.cpp @@ -3,6 +3,7 @@ #include "shader-input-layout.h" #include "core/slang-token-reader.h" +#include "core/slang-type-text-util.h" #include "render.h" @@ -755,6 +756,14 @@ namespace renderer_test scalarType = elementTypeLayout->getScalarType(); } + if (scalarType != ScalarType::None && scalarType != ScalarType::Void) + { + UnownedStringSlice text = TypeTextUtil::asText(scalarType); + // Write out the type + writer.put("type: "); + writer.put(text); + writer.put("\n"); + } switch (scalarType) { @@ -765,7 +774,6 @@ namespace renderer_test case ScalarType::None: case ScalarType::Void: case ScalarType::Bool: - case ScalarType::Float16: { auto ptr = (const uint32_t*)data; const size_t size = sizeInBytes / sizeof(ptr[0]); @@ -776,6 +784,17 @@ namespace renderer_test } break; } + case ScalarType::Float16: + { + auto ptr = (const uint16_t*)data; + const size_t size = sizeInBytes / sizeof(ptr[0]); + for (size_t i = 0; i < size; ++i) + { + const float v = HalfToFloat(ptr[i]); + writer.print("%f\n", v); + } + break; + } case ScalarType::UInt32: { auto ptr = (const uint32_t*)data; -- cgit v1.2.3