From ea200663ffe33d7b4c739c0d84e9c21a3ae2ffa6 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 12 Aug 2019 16:28:18 -0400 Subject: Ability to set Paths on Pass Through/Back End Compilers (#1010) * Expanded prelude for some other resource types. Disable C++ output for ParameterGroup. * WIP: Layout for CPU. * Fixes to CPU layout. * WIP: The uniform is output, but the variable definition is not. * WIP: Entry point parameters to global scope in C++. Handling of resource types (in so far as outputting) * Some discussion of ABI and different input types. * WIP: More C++ support around resource types. * WIP: Split up variables into different structures on emit. * WIP: Emitting C++ with wrapping up of 'Context' * WIP: C++ code has access to semantic values. Wrap in struct so can use method calls to pass shared state. Disable legalizeResourceTypes and legalizeExistentialTypeLayout * Fix structured buffer layout for CPU. * Remove testing/handling of global uniforms on CPU path. Typo fix. Changed CPU tests to use new CPU calling convention. * Check globals are working. Initalize context to zero globals. * Order the global parameters for C++ ouput by their layout. Note - that layout isn't quite working correctly because the StructuredBuffer the int seems to be consuming uniform space. * Work around for reflection not having all data needed for layout ordering for C++ code. * Output constant buffers as pointers. * Entry point parameters accessed through pointer to struct. * WIP: Layout for CPU is reasonable for test case. * Only output 'f' after float literal if type marks as a float. * Cast construction works on C++. * Made IntrinsicOp::ConvertConstruct to make intent clearer. * C++ handling construction from scalar. Handle access of a scalar with .x. Check default initialization. * Comment about need for split of kIROp_construct. Release build works. * Added support from constructVectorFromScalar to C/C++ target. * Handling of in/out in C/C++. * First pass documentation CPU support. * Improvements to C++/C slang code generation documentation. * Small doc change to include need for mechansim to specify cpp compiler path. * WIP: Being able to set path for backends. * Better handling of swizzling - allow swizzling a scalar into a vector. * Fix missing/broken headers for path setting on session. * Fix for compiling using clang on Windows. * Remove Clang test code. * * Removed spSessionGetGlobalSession - no longer needed because SlangSession is slang::IGlobalSession alias. * Gave Session a ref count on spCreateSession, and have it checked on spDestroySession, so behaves correctly as ISlangUnknown Note that spDestroySession does a release (and checks the ref count on debug builds). It's behaviour could be the same as just release, but this seems closer to the original intention. --- source/core/slang-platform.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'source/core/slang-platform.cpp') diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index 4f4c805ac..e735216f4 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -197,4 +197,52 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); #endif // _WIN32 +/* static */PlatformKind PlatformUtil::getPlatformKind() +{ +#if SLANG_WINRT + return PlatformKind::WinRT; +#elif SLANG_XBOXONE + return PlatformKind::XBoxOne; +#elif SLANG_WIN64 + return PlatformKind::Win64; +#elif SLANG_X360 + return PlatformKind::X360; +#elif SLANG_WIN32 + return PlatformKind::Win32; +#elif SLANG_ANDROID + return PlatformKind::Android; +#elif SLANG_LINUX + return PlatformKind::Linux; +#elif SLANG_IOS + return PlatformKind::IOS; +#elif SLANG_OSX + return PlatformKind::OSX; +#elif SLANG_PS3 + return PlatformKind::PS3; +#elif SLANG_SLANG_PS4 + return PlatformKind::PS4; +#elif SLANG_PSP2 + return PlatformKind::PSP2; +#elif SLANG_WIIU + return PlatformKind::WIIU; +#else + return PlatformKind::Unknown; +#endif +} + +static const PlatformFlags s_familyFlags[int(PlatformFamily::CountOf)] = +{ + 0, // Unknown + PlatformFlag::WinRT | PlatformFlag::Win32 | PlatformFlag::Win64, // Windows + PlatformFlag::WinRT | PlatformFlag::Win32 | PlatformFlag::Win64 | PlatformFlag::X360 | PlatformFlag::XBoxOne, // Microsoft + PlatformFlag::Linux | PlatformFlag::Android, // Linux + PlatformFlag::IOS | PlatformFlag::OSX, // Apple + PlatformFlag::Linux | PlatformFlag::Android | PlatformFlag::IOS | PlatformFlag::OSX, // Unix +}; + +/* static */PlatformFlags PlatformUtil::getPlatformFlags(PlatformFamily family) +{ + return s_familyFlags[int(family)]; +} + } -- cgit v1.2.3