From 74f2f47cb63b02638270beecd20acea1a0f5665e Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 27 Sep 2017 11:17:39 -0700 Subject: First attempt at a Linux build (#193) * First attempt at a Linux build - Fix up places where C++ idioms were written assuming lenient behavior of Microsoft's compiler - Add a few more alternatives for platform-specific behavior where Windows was the only platform accounted for. - Add a basic Makefile that can at least invoke our build, even if it isn't going good dependency tracking, etc. - Build `libslang.so` and `slangc` that depends on it, using a relative `RPATH` to make the binary portable (I hope) - Add an initial `.travis.yml` to see if we can trigger their build process. * Fixup: const bug in `List::Sort` I'm not clear why this gets picked up by the gcc *and* clang that Travis uses, but not the (newer) gcc I'm using on Ubuntu here, but I'm hoping it is just some missing `const` qualifiers. * Fixup: reorder specialization of "class info" Clang complains about things being specialized after being instantiated (implicilty), and I hope it is just the fact that I generate the class info for the roots of the hierarchy after the other cases. We'll see. * Fixup: add `platform.cpp` to unified/lumped build * Fixup: Windows uses `FreeLibrary` and not `UnloadLibrary` * Fixup: fix Windows project file to include new source file This obviously points to the fact that we are going to need to be generating these files sooner or later. --- source/slang/reflection.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'source/slang/reflection.cpp') diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp index b63240506..5e18e8cfd 100644 --- a/source/slang/reflection.cpp +++ b/source/slang/reflection.cpp @@ -223,7 +223,7 @@ SLANG_API SlangReflectionType* spReflectionType_GetElementType(SlangReflectionTy if(auto arrayType = dynamic_cast(type)) { - return (SlangReflectionType*) arrayType->BaseType.Ptr(); + return (SlangReflectionType*) arrayType->baseType.Ptr(); } else if( auto constantBufferType = dynamic_cast(type)) { @@ -299,7 +299,7 @@ SLANG_API SlangScalarType spReflectionType_GetScalarType(SlangReflectionType* in if(auto basicType = dynamic_cast(type)) { - switch (basicType->BaseType) + switch (basicType->baseType) { #define CASE(BASE, TAG) \ case BaseType::BASE: return SLANG_SCALAR_TYPE_##TAG @@ -330,7 +330,7 @@ SLANG_API SlangResourceShape spReflectionType_GetResourceShape(SlangReflectionTy while(auto arrayType = type->As()) { - type = arrayType->BaseType.Ptr(); + type = arrayType->baseType.Ptr(); } if(auto textureType = type->As()) @@ -363,7 +363,7 @@ SLANG_API SlangResourceAccess spReflectionType_GetResourceAccess(SlangReflection while(auto arrayType = type->As()) { - type = arrayType->BaseType.Ptr(); + type = arrayType->baseType.Ptr(); } if(auto textureType = type->As()) @@ -399,7 +399,7 @@ SLANG_API SlangReflectionType* spReflectionType_GetResourceResultType(SlangRefle while(auto arrayType = type->As()) { - type = arrayType->BaseType.Ptr(); + type = arrayType->baseType.Ptr(); } if (auto textureType = type->As()) @@ -1100,11 +1100,11 @@ static void emitReflectionTypeInfoJSON( { switch( type->getKind() ) { - case SLANG_TYPE_KIND_SAMPLER_STATE: + case slang::TypeReflection::Kind::SamplerState: write(writer, "\"kind\": \"samplerState\""); break; - case SLANG_TYPE_KIND_RESOURCE: + case slang::TypeReflection::Kind::Resource: { auto shape = type->getResourceShape(); auto access = type->getResourceAccess(); @@ -1163,7 +1163,7 @@ static void emitReflectionTypeInfoJSON( } break; - case SLANG_TYPE_KIND_CONSTANT_BUFFER: + case slang::TypeReflection::Kind::ConstantBuffer: write(writer, "\"kind\": \"constantBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); @@ -1172,7 +1172,7 @@ static void emitReflectionTypeInfoJSON( type->getElementType()); break; - case SLANG_TYPE_KIND_TEXTURE_BUFFER: + case slang::TypeReflection::Kind::TextureBuffer: write(writer, "\"kind\": \"textureBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); @@ -1181,7 +1181,7 @@ static void emitReflectionTypeInfoJSON( type->getElementType()); break; - case SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER: + case slang::TypeReflection::Kind::ShaderStorageBuffer: write(writer, "\"kind\": \"shaderStorageBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); @@ -1190,7 +1190,7 @@ static void emitReflectionTypeInfoJSON( type->getElementType()); break; - case SLANG_TYPE_KIND_SCALAR: + case slang::TypeReflection::Kind::Scalar: write(writer, "\"kind\": \"scalar\""); write(writer, ",\n"); emitReflectionScalarTypeInfoJSON( @@ -1198,7 +1198,7 @@ static void emitReflectionTypeInfoJSON( type->getScalarType()); break; - case SLANG_TYPE_KIND_VECTOR: + case slang::TypeReflection::Kind::Vector: write(writer, "\"kind\": \"vector\""); write(writer, ",\n"); write(writer, "\"elementCount\": "); @@ -1210,7 +1210,7 @@ static void emitReflectionTypeInfoJSON( type->getElementType()); break; - case SLANG_TYPE_KIND_MATRIX: + case slang::TypeReflection::Kind::Matrix: write(writer, "\"kind\": \"matrix\""); write(writer, ",\n"); write(writer, "\"rowCount\": "); @@ -1225,7 +1225,7 @@ static void emitReflectionTypeInfoJSON( type->getElementType()); break; - case SLANG_TYPE_KIND_ARRAY: + case slang::TypeReflection::Kind::Array: { auto arrayType = type; write(writer, "\"kind\": \"array\""); @@ -1238,7 +1238,7 @@ static void emitReflectionTypeInfoJSON( } break; - case SLANG_TYPE_KIND_STRUCT: + case slang::TypeReflection::Kind::Struct: { write(writer, "\"kind\": \"struct\",\n"); write(writer, "\"fields\": [\n"); @@ -1274,7 +1274,7 @@ static void emitReflectionTypeLayoutInfoJSON( emitReflectionTypeInfoJSON(writer, typeLayout->getType()); break; - case SLANG_TYPE_KIND_ARRAY: + case slang::TypeReflection::Kind::Array: { auto arrayTypeLayout = typeLayout; auto elementTypeLayout = arrayTypeLayout->getElementTypeLayout(); @@ -1296,7 +1296,7 @@ static void emitReflectionTypeLayoutInfoJSON( } break; - case SLANG_TYPE_KIND_STRUCT: + case slang::TypeReflection::Kind::Struct: { write(writer, "\"kind\": \"struct\",\n"); write(writer, "\"fields\": [\n"); @@ -1316,7 +1316,7 @@ static void emitReflectionTypeLayoutInfoJSON( } break; - case SLANG_TYPE_KIND_CONSTANT_BUFFER: + case slang::TypeReflection::Kind::ConstantBuffer: write(writer, "\"kind\": \"constantBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); @@ -1325,7 +1325,7 @@ static void emitReflectionTypeLayoutInfoJSON( typeLayout->getElementTypeLayout()); break; - case SLANG_TYPE_KIND_TEXTURE_BUFFER: + case slang::TypeReflection::Kind::TextureBuffer: write(writer, "\"kind\": \"textureBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); @@ -1334,7 +1334,7 @@ static void emitReflectionTypeLayoutInfoJSON( typeLayout->getElementTypeLayout()); break; - case SLANG_TYPE_KIND_SHADER_STORAGE_BUFFER: + case slang::TypeReflection::Kind::ShaderStorageBuffer: write(writer, "\"kind\": \"shaderStorageBuffer\""); write(writer, ",\n"); write(writer, "\"elementType\": "); -- cgit v1.2.3