summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-06-22 17:36:59 -0400
committerGitHub <noreply@github.com>2018-06-22 17:36:59 -0400
commit4bbd0e70a246290ce5c0e0a80b951fec504b6844 (patch)
tree76dd986b5db8c6a29adae6b273391898245088c9
parent4fa0111bb35f260a06527f52f71552041827c7df (diff)
Feature/com helper (#606)
* Added Result definitions to the slang.h * Removed slang-result.h and added slang-com-helper.h * Move slang-com-ptr.h to be publically available. * Add SLANG_IUNKNOWN macros to simplify implementing interfaces. Use the SLANG_IUNKNOWN macros to in slang.c * Removed slang-defines.h added outstanding defines to slang.h * Include slang-com-ptr.h and slang-com-helper.h in archives built with CI. * Use spaces instead of tabs on appveyor.yml * Put operator== and != for Guid in global namespace. * Fix binary windows archive to have all the slang headers.
-rw-r--r--appveyor.yml7
-rw-r--r--slang-com-helper.h11
2 files changed, 13 insertions, 5 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 6d5265f69..b49e767f1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -81,13 +81,18 @@ after_build:
$env:SLANG_DEPLOY_PLATFORM = "win32"
}
$env:SLANG_BINARY_ARCHIVE = "slang-$($env:SLANG_VERSION)-$($env:SLANG_DEPLOY_PLATFORM).zip"
- $env:SLANG_SOURCE_ARCHIVE = "slang-$($env:SLANG_VERSION)-source.zip"
+
7z a "$env:SLANG_BINARY_ARCHIVE" slang.h
+ 7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-helper.h
+ 7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-ptr.h
7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.dll
7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.lib
7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang-glslang.dll
7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slangc.exe
7z a "$env:SLANG_BINARY_ARCHIVE" docs\*.md
+
+ $env:SLANG_SOURCE_ARCHIVE = "slang-$($env:SLANG_VERSION)-source.zip"
+
7z a "$env:SLANG_SOURCE_ARCHIVE" slang.h
7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-helper.h
7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-ptr.h
diff --git a/slang-com-helper.h b/slang-com-helper.h
index 1b4469db1..e108dcf00 100644
--- a/slang-com-helper.h
+++ b/slang-com-helper.h
@@ -37,8 +37,13 @@ typedef SlangResult Result;
// Alias SlangUUID to Slang::Guid
typedef SlangUUID Guid;
-SLANG_FORCE_INLINE bool operator==(const Guid& aIn, const Guid& bIn)
+} // namespace Slang
+
+// Operator == and != for Guid/SlangUUID
+
+SLANG_FORCE_INLINE bool operator==(const Slang::Guid& aIn, const Slang::Guid& bIn)
{
+ using namespace Slang;
// Use the largest type the honors the alignment of Guid
typedef uint32_t CmpType;
union GuidCompare
@@ -53,12 +58,11 @@ SLANG_FORCE_INLINE bool operator==(const Guid& aIn, const Guid& bIn)
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]) | (a[3] ^ b[3])) == 0;
}
-SLANG_FORCE_INLINE bool operator!=(const Guid& a, const Guid& b)
+SLANG_FORCE_INLINE bool operator!=(const Slang::Guid& a, const Slang::Guid& b)
{
return !(a == b);
}
-
/* !!!!!!!! Macros to simplify implementing COM interfaces !!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* Assumes underlying implementation has a member m_refCount that is initialized to 0 and can have ++ and -- operate on it.
@@ -101,7 +105,6 @@ SLANG_NO_THROW uint32_t SLANG_MCALL release() \
SLANG_IUNKNOWN_ADD_REF \
SLANG_IUNKNOWN_RELEASE
-} // namespace Slang
#endif // defined(__cplusplus)
#endif