diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-04-25 15:00:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-25 15:00:36 -0400 |
| commit | b5ca6352416995b5edd358623a6ae5db38d5e634 (patch) | |
| tree | 8fa30243c974a18565756956f77045e034a7524d /tools | |
| parent | c84e7c0fa526de51f380227a6667f723af36aea2 (diff) | |
Feature/uint int definition (#954)
* * Moved CPU determination macros to slang.h
* Determine SlangUInt/SlangInt from the pointer width (determined from CPU macros)
* Removed the UnambiguousInt and UnambigousUInt types - as a previous fragile work around
* Removed UInt/Int definition from smart-pointer.h as now in common.h
* * Remove ambiguity for PrettyWriter and ints
* Improve comment around SlangInt/UInt
* More fixes around ambiguity with PrettyWriter and integral types.
* Disable VK on OSX.
* Force CI to rebuild as spurious error.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gfx/render.h | 6 | ||||
| -rw-r--r-- | tools/slang-reflection-test/slang-reflection-test-main.cpp | 33 |
2 files changed, 27 insertions, 12 deletions
diff --git a/tools/gfx/render.h b/tools/gfx/render.h index eebeaa170..c95652cd0 100644 --- a/tools/gfx/render.h +++ b/tools/gfx/render.h @@ -13,6 +13,8 @@ #include "../../source/core/list.h" #include "../../source/core/dictionary.h" +#include "../../slang.h" + namespace gfx { using Slang::RefObject; @@ -25,8 +27,8 @@ using Slang::List; typedef SlangResult Result; // Had to move here, because Options needs types defined here -typedef intptr_t Int; -typedef uintptr_t UInt; +typedef SlangInt Int; +typedef SlangUInt UInt; // pre declare types class Surface; diff --git a/tools/slang-reflection-test/slang-reflection-test-main.cpp b/tools/slang-reflection-test/slang-reflection-test-main.cpp index 636b16a1b..a327f1960 100644 --- a/tools/slang-reflection-test/slang-reflection-test-main.cpp +++ b/tools/slang-reflection-test/slang-reflection-test-main.cpp @@ -77,18 +77,31 @@ static void write(PrettyWriter& writer, char const* text, size_t length = 0) } } -static void write(PrettyWriter& writer, SlangUInt val) +static void write(PrettyWriter& writer, uint64_t val) { adjust(writer); Slang::StdWriters::getOut().print("%llu", (unsigned long long)val); } -static void write(PrettyWriter& writer, int val) +static void write(PrettyWriter& writer, int64_t val) { adjust(writer); - Slang::StdWriters::getOut().print("%d", val); + Slang::StdWriters::getOut().print("%ll", (long long)val); } +static void write(PrettyWriter& writer, int32_t val) +{ + adjust(writer); + Slang::StdWriters::getOut().print("%d", int(val)); +} + +static void write(PrettyWriter& writer, uint32_t val) +{ + adjust(writer); + Slang::StdWriters::getOut().print("%u", (unsigned int)val); +} + + static void write(PrettyWriter& writer, float val) { adjust(writer); @@ -248,7 +261,7 @@ static void emitReflectionVarBindingInfoJSON( { write(writer, ",\n"); write(writer,"\"semanticIndex\": "); - write(writer, semanticIndex); + write(writer, int(semanticIndex)); } } } @@ -539,7 +552,7 @@ static void emitReflectionTypeInfoJSON( write(writer, "\"kind\": \"vector\""); write(writer, ",\n"); write(writer, "\"elementCount\": "); - write(writer, type->getElementCount()); + write(writer, int(type->getElementCount())); write(writer, ",\n"); write(writer, "\"elementType\": "); emitReflectionTypeJSON( @@ -551,10 +564,10 @@ static void emitReflectionTypeInfoJSON( write(writer, "\"kind\": \"matrix\""); write(writer, ",\n"); write(writer, "\"rowCount\": "); - write(writer, (SlangUInt)type->getRowCount()); + write(writer, type->getRowCount()); write(writer, ",\n"); write(writer, "\"columnCount\": "); - write(writer, (SlangUInt)type->getColumnCount()); + write(writer, type->getColumnCount()); write(writer, ",\n"); write(writer, "\"elementType\": "); emitReflectionTypeJSON( @@ -568,7 +581,7 @@ static void emitReflectionTypeInfoJSON( write(writer, "\"kind\": \"array\""); write(writer, ",\n"); write(writer, "\"elementCount\": "); - write(writer, arrayType->getElementCount()); + write(writer, int(arrayType->getElementCount())); write(writer, ",\n"); write(writer, "\"elementType\": "); emitReflectionTypeJSON(writer, arrayType->getElementType()); @@ -628,7 +641,7 @@ static void emitReflectionTypeLayoutInfoJSON( write(writer, "\"kind\": \"array\""); write(writer, ",\n"); write(writer, "\"elementCount\": "); - write(writer, arrayTypeLayout->getElementCount()); + write(writer, int(arrayTypeLayout->getElementCount())); write(writer, ",\n"); write(writer, "\"elementType\": "); emitReflectionTypeLayoutJSON( @@ -638,7 +651,7 @@ static void emitReflectionTypeLayoutInfoJSON( { write(writer, ",\n"); write(writer, "\"uniformStride\": "); - write(writer, arrayTypeLayout->getElementStride(SLANG_PARAMETER_CATEGORY_UNIFORM)); + write(writer, int(arrayTypeLayout->getElementStride(SLANG_PARAMETER_CATEGORY_UNIFORM))); } } break; |
