diff options
| -rw-r--r-- | .github/workflows/macos.yml | 33 | ||||
| -rw-r--r-- | build/visual-studio/gfx-unit-test-tool/gfx-unit-test-tool.vcxproj.filters | 6 | ||||
| -rw-r--r-- | examples/model-viewer/main.cpp | 8 | ||||
| -rw-r--r-- | github_macos_build.sh | 21 | ||||
| -rw-r--r-- | premake5.lua | 3 | ||||
| -rw-r--r-- | slang.h | 9 | ||||
| -rw-r--r-- | source/core/slang-http.cpp | 2 | ||||
| -rw-r--r-- | source/core/unix/slang-unix-process.cpp | 4 | ||||
| -rw-r--r-- | tools/gfx/cpu/render-cpu.cpp | 2 |
9 files changed, 77 insertions, 11 deletions
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 000000000..700d9f6a4 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,33 @@ +name: MacOS Build CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: MacOS Build CI + + runs-on: macos-latest + + strategy: + matrix: + configuration: ['release'] # 'debug' + compiler: ['clang'] + platform: ['x64'] + + steps: + - uses: actions/checkout@v2.3.4 + with: + submodules: 'true' + fetch-depth: '0' + + - name: build + run: + CC=${{matrix.compiler}} + CONFIGURATION=${{matrix.configuration}} + ARCH=${{matrix.platform}} + source ./github_macos_build.sh +
\ No newline at end of file diff --git a/build/visual-studio/gfx-unit-test-tool/gfx-unit-test-tool.vcxproj.filters b/build/visual-studio/gfx-unit-test-tool/gfx-unit-test-tool.vcxproj.filters index 230aa3893..e96c7bfcc 100644 --- a/build/visual-studio/gfx-unit-test-tool/gfx-unit-test-tool.vcxproj.filters +++ b/build/visual-studio/gfx-unit-test-tool/gfx-unit-test-tool.vcxproj.filters @@ -44,6 +44,9 @@ <ClCompile Include="..\..\..\tools\gfx-unit-test\get-cmd-queue-handle-test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\tools\gfx-unit-test\get-supported-resource-states-test.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
<ClCompile Include="..\..\..\tools\gfx-unit-test\get-texture-resource-handle-test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -74,9 +77,6 @@ <ClCompile Include="..\..\..\tools\unit-test\slang-unit-test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\tools\gfx-unit-test\get-supported-resource-states-test.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\tools\gfx-unit-test\buffer-barrier-test.slang">
diff --git a/examples/model-viewer/main.cpp b/examples/model-viewer/main.cpp index 3b278fede..121e3fc4b 100644 --- a/examples/model-viewer/main.cpp +++ b/examples/model-viewer/main.cpp @@ -314,7 +314,7 @@ struct DirectionalLight : Light static const char* getTypeName() { return "DirectionalLight"; } - virtual void writeTo(ShaderCursor const& cursor) + virtual void writeTo(ShaderCursor const& cursor) override { cursor["direction"].setData(&direction, sizeof(direction)); cursor["intensity"].setData(&intensity, sizeof(intensity)); @@ -333,7 +333,7 @@ struct PointLight : Light static const char* getTypeName() { return "PointLight"; } - virtual void writeTo(ShaderCursor const& cursor) + virtual void writeTo(ShaderCursor const& cursor) override { cursor["position"].setData(&position, sizeof(position)); cursor["intensity"].setData(&intensity, sizeof(intensity)); @@ -594,7 +594,7 @@ struct LightEnv : public RefObject // The more interesting case is when we have a `LightArray<L,N>`, // in which case we need to fill in the first field (the light count)... // - uint32_t lightCount = uint32_t(lightTypeArray->lights.size()); + int32_t lightCount = int32_t(lightTypeArray->lights.size()); lightTypeCursor["count"].setData(&lightCount, sizeof(lightCount)); // // ... followed by an array of values of type `L` in the second field. @@ -603,7 +603,7 @@ struct LightEnv : public RefObject // not access the entries past that point. // auto arrayCursor = lightTypeCursor["lights"]; - for (size_t ii = 0; ii < lightCount; ++ii) + for (int32_t ii = 0; ii < lightCount; ++ii) { lightTypeArray->lights[ii]->writeTo(arrayCursor[ii]); } diff --git a/github_macos_build.sh b/github_macos_build.sh new file mode 100644 index 000000000..739088814 --- /dev/null +++ b/github_macos_build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Get premake +wget https://github.com/shader-slang/slang-binaries/blob/master/premake/premake-5.0.0-alpha16/bin/osx/premake5?raw=true -O premake5 +chmod u+x premake5 + +# generate slang-tag-version.h +git describe --tags | sed -e "s/\(.*\)/\#define SLANG_TAG_VERSION \"\1\"/" > slang-tag-version.h +cat slang-tag-version.h + +# Create the makefile +# +# NOTE! For now we disable stdlib embedding, because on OSX it produces an error when generating +# thinking it's creating a lib, but has no source +# +# --enable-embed-stdlib=true +./premake5 gmake --cc=${CC} --enable-xlib=false --arch=${ARCH} --deps=true --no-progress=true + +# Build the configuration +make config=${CONFIGURATION}_x64 -j`sysctl -n hw.ncpu` + + diff --git a/premake5.lua b/premake5.lua index dc6f1a552..064253d1b 100644 --- a/premake5.lua +++ b/premake5.lua @@ -203,9 +203,10 @@ newoption { -- TODO(JS): What's the point in the enable-xlib command line option if it's just overridden here? - if targetInfo.isWindows then + if targetInfo.isWindows or os.target() == "macosx" then enableXlib = false end + -- Even if we have the nvapi path, we only want to currently enable on windows targets enableNvapi = not not (os.isdir(nvapiPath) and targetInfo.isWindows and _OPTIONS["enable-nvapi"] == "true") @@ -490,13 +490,20 @@ extern "C" // Use SLANG_PTR_ macros to determine SlangInt/SlangUInt types. // This is used over say using size_t/ptrdiff_t/intptr_t/uintptr_t, because on some targets, these types are distinct from - // their uint_t/int_t equivalents and so produce ambiguity with function overloading. + // their uint_t/int_t equivalents and so produce ambiguity with function overloading. + // + // SlangSizeT is helpful as on some compilers size_t is distinct from a regular integer type and so overloading doesn't work. + // Casting to SlangSizeT works around this. #if SLANG_PTR_IS_64 typedef int64_t SlangInt; typedef uint64_t SlangUInt; + + typedef uint64_t SlangSizeT; #else typedef int32_t SlangInt; typedef uint32_t SlangUInt; + + typedef uint32_t SlangSizeT; #endif typedef bool SlangBool; diff --git a/source/core/slang-http.cpp b/source/core/slang-http.cpp index bb5994635..3da22ba9c 100644 --- a/source/core/slang-http.cpp +++ b/source/core/slang-http.cpp @@ -158,7 +158,7 @@ void HTTPHeader::reset() void HTTPHeader::append(StringBuilder& out) const { // Output the content length - out << g_contentLength << ": " << m_contentLength << "\r\n"; + out << g_contentLength << ": " << SlangSizeT(m_contentLength) << "\r\n"; // If either is set construct a content type if (m_mimeType.getLength() || m_encoding.getLength()) diff --git a/source/core/unix/slang-unix-process.cpp b/source/core/unix/slang-unix-process.cpp index 1f58f5725..991d905d9 100644 --- a/source/core/unix/slang-unix-process.cpp +++ b/source/core/unix/slang-unix-process.cpp @@ -19,6 +19,10 @@ #include <sys/wait.h> #include <unistd.h> +#if SLANG_OSX +# include <signal.h> +#endif + #include <time.h> namespace Slang { diff --git a/tools/gfx/cpu/render-cpu.cpp b/tools/gfx/cpu/render-cpu.cpp index a20ed3ebe..d17cf6ea8 100644 --- a/tools/gfx/cpu/render-cpu.cpp +++ b/tools/gfx/cpu/render-cpu.cpp @@ -873,7 +873,7 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL setData(ShaderOffset const& offset, void const* data, size_t size) override { - size = Math::Min(size, (size_t)m_data.getCount() - offset.uniformOffset); + size = Math::Min(size, size_t(m_data.getCount() - offset.uniformOffset)); memcpy((char*)m_data.getBuffer() + offset.uniformOffset, data, size); return SLANG_OK; } |
