summaryrefslogtreecommitdiff
path: root/source/core/slang-platform.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-12 16:28:18 -0400
committerGitHub <noreply@github.com>2019-08-12 16:28:18 -0400
commitea200663ffe33d7b4c739c0d84e9c21a3ae2ffa6 (patch)
tree73fae6929c3114be15e84875e4e798ef5a3e563c /source/core/slang-platform.h
parent6fc2c37d9a4c408331db1b33deb3b46e74d2a7d2 (diff)
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<int> 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.
Diffstat (limited to 'source/core/slang-platform.h')
-rw-r--r--source/core/slang-platform.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/core/slang-platform.h b/source/core/slang-platform.h
index 0e6d12cb6..c3ad1c486 100644
--- a/source/core/slang-platform.h
+++ b/source/core/slang-platform.h
@@ -7,6 +7,58 @@
namespace Slang
{
+ enum class PlatformKind
+ {
+ Unknown,
+ WinRT,
+ XBoxOne,
+ Win64,
+ Win32,
+ X360,
+ Android,
+ Linux,
+ IOS,
+ OSX,
+ PS3,
+ PS4,
+ PSP2,
+ WIIU,
+ CountOf,
+ };
+
+ typedef uint32_t PlatformFlags;
+ struct PlatformFlag
+ {
+ enum Enum
+ {
+ Unknown = 1 << int(PlatformKind::Unknown),
+ WinRT = 1 << int(PlatformKind::WinRT),
+ XBoxOne = 1 << int(PlatformKind::XBoxOne),
+ Win64 = 1 << int(PlatformKind::Win64),
+ Win32 = 1 << int(PlatformKind::Win32),
+ X360 = 1 << int(PlatformKind::X360),
+ Android = 1 << int(PlatformKind::Android),
+ Linux = 1 << int(PlatformKind::Linux),
+ IOS = 1 << int(PlatformKind::IOS),
+ OSX = 1 << int(PlatformKind::OSX),
+ PS3 = 1 << int(PlatformKind::PS3),
+ PS4 = 1 << int(PlatformKind::PS4),
+ PSP2 = 1 << int(PlatformKind::PSP2),
+ WIIU = 1 << int(PlatformKind::WIIU),
+ };
+ };
+
+ enum class PlatformFamily
+ {
+ Unknown,
+ Windows,
+ Microsoft,
+ Linux,
+ Apple,
+ Unix,
+ CountOf,
+ };
+
// Interface for working with shared libraries
// in a platform-independent fashion.
struct SharedLibrary
@@ -66,6 +118,16 @@ namespace Slang
/// @param builderOut Append the string produced to builderOut
/// @return SLANG_OK if string is found and appended. Fail otherwise. SLANG_E_NOT_IMPLEMENTED if there is no impl for this platform.
static SlangResult appendResult(SlangResult res, StringBuilder& builderOut);
+
+ /// Get the platform kind as determined at compile time
+ static PlatformKind getPlatformKind();
+
+ /// Get the platforms that make up a family
+ static PlatformFlags getPlatformFlags(PlatformFamily family);
+
+ /// True if the kind is part of the family
+ static bool isFamily(PlatformFamily family, PlatformKind kind) { return (getPlatformFlags(family) & (PlatformFlags(1) << int(kind))) != 0; }
+
};
#ifndef _MSC_VER