diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f3ca3e8..d51c3d30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,7 +119,7 @@ jobs: - name: Build (iOS) run: | - modules=("SDL3" "SDL3_image" "SDL3_ttf" "SDL3_mixer") + modules=("SDL3" "SDL3_image" "SDL3_ttf" "SDL3_mixer" "SDL_shadercross") architectures=("ios-arm64" "ios-arm64_x86_64-simulator") for module in "${modules[@]}"; do diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 31771073..9f48a3cd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,6 +34,7 @@ jobs: dotnet pack SDL3_image-CS/SDL3_image-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts dotnet pack SDL3_ttf-CS/SDL3_ttf-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts dotnet pack SDL3_mixer-CS/SDL3_mixer-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts + dotnet pack SDL3_shadercross-CS/SDL3_shadercross-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/.gitmodules b/.gitmodules index 9d6b2af3..ad5ce7fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ path = External/SDL_mixer url = https://github.com/libsdl-org/SDL_mixer.git branch = main +[submodule "External/SDL_shadercross"] + path = External/SDL_shadercross + url = https://github.com/libsdl-org/SDL_shadercross.git diff --git a/External/SDL_shadercross b/External/SDL_shadercross new file mode 160000 index 00000000..4ce74831 --- /dev/null +++ b/External/SDL_shadercross @@ -0,0 +1 @@ +Subproject commit 4ce748310f57d405b4eb2a79fbbc7e974d6491ec diff --git a/External/build.sh b/External/build.sh index ca01125b..f0316ac7 100755 --- a/External/build.sh +++ b/External/build.sh @@ -52,6 +52,7 @@ if [[ $BUILD_PLATFORM != 'Android' ]]; then wayland-scanner++ \ wayland-protocols \ meson \ + patchelf \ pkg-config$TARGET_APT_ARCH \ libasound2-dev$TARGET_APT_ARCH \ libdbus-1-dev$TARGET_APT_ARCH \ @@ -115,6 +116,7 @@ if [[ $RUNNER_OS == 'Linux' ]]; then git config --global --add safe.directory $PWD/SDL_image git config --global --add safe.directory $PWD/SDL_ttf git config --global --add safe.directory $PWD/SDL_mixer + git config --global --add safe.directory $PWD/SDL_shadercross fi CMAKE_INSTALL_PREFIX="$PWD/install_output" @@ -159,9 +161,20 @@ run_cmake() { cmake --build build/ --config $BUILD_TYPE --verbose cmake --install build/ --prefix $CMAKE_INSTALL_PREFIX --config $BUILD_TYPE + # Add loader rpath + if [[ $BUILD_PLATFORM == 'Linux' ]]; then + patchelf $CMAKE_INSTALL_PREFIX/$LIB_OUTPUT --add-rpath "\$ORIGIN" + elif [[ $BUILD_PLATFORM == 'macOS' ]]; then + install_name_tool $CMAKE_INSTALL_PREFIX/$LIB_OUTPUT -add_rpath "@loader_path" + fi + # Move build lib into correct folders cp $CMAKE_INSTALL_PREFIX/$LIB_OUTPUT ../../native/$NATIVE_PATH + if [[ $LIB_NAME == 'SDL_shadercross' ]]; then + cp $CMAKE_INSTALL_PREFIX/${OUTPUT_LIB/SDL3variant/spirv-cross-c-shared} ../../native/$NATIVE_PATH + fi + popd } @@ -181,4 +194,8 @@ run_cmake SDL_image ${OUTPUT_LIB/variant/_image} -DCMAKE_PREFIX_PATH=$CMAKE_PREF # See: https://github.com/libsdl-org/SDL_mixer/issues/745 run_cmake SDL_mixer ${OUTPUT_LIB/variant/_mixer} -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DSDLMIXER_MP3_MPG123=OFF -DSDLMIXER_FLAC_LIBFLAC=OFF -DSDLMIXER_DEPS_SHARED=OFF -DSDLMIXER_VENDORED=ON +# Build SDL_shadercross +run_cmake SDL_shadercross ${OUTPUT_LIB/variant/_shadercross} -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DSDLSHADERCROSS_DXC=OFF -DSDLSHADERCROSS_INSTALL=ON -DSDLSHADERCROSS_SHARED=ON -DSDLSHADERCROSS_VENDORED=ON + popd + diff --git a/README.md b/README.md index 48540480..df6b1b5d 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,13 @@ C# bindings for the [SDL3](https://github.com/libsdl-org/SDL) family of libraries. -| Product | Usage | Package | -|------------------------------------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) | -| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) | -| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) | -| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) | +| Product | Usage | Package | +|------------------------------------------------------------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------| +| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) | +| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) | +| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) | +| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) | +| [`SDL_shadercross`](https://github.com/libsdl-org/SDL_shadercross/tree/main) | `dotnet add package ppy.SDL3_shadercross-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_shadercross-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_shadercross-CS) | Contributions to keep the bindings up-to-date with upstream changes are welcome. If you have improvements or updates, feel free to submit a pull request. @@ -19,6 +20,7 @@ Contributions to keep the bindings up-to-date with upstream changes are welcome. | `SDL3_image-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `SDL3_ttf-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `SDL3_mixer-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| `SDL3_shadercross-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | ## Generating bindings diff --git a/README_nuget.md b/README_nuget.md index 2453519c..af7f25ec 100644 --- a/README_nuget.md +++ b/README_nuget.md @@ -1,11 +1,12 @@ C# bindings for the [SDL3](https://github.com/libsdl-org/SDL) family of libraries. -| Product | Usage | Package | -|------------------------------------------------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) | -| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) | -| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) | -| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) | +| Product | Usage | Package | +|------------------------------------------------------------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------| +| [`SDL`](https://github.com/libsdl-org/SDL/tree/main) | `dotnet add package ppy.SDL3-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3-CS) | +| [`SDL_image`](https://github.com/libsdl-org/SDL_image/tree/main) | `dotnet add package ppy.SDL3_image-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_image-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_image-CS) | +| [`SDL_ttf`](https://github.com/libsdl-org/SDL_ttf/tree/main) | `dotnet add package ppy.SDL3_ttf-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_ttf-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_ttf-CS) | +| [`SDL_mixer`](https://github.com/libsdl-org/SDL_mixer/tree/main) | `dotnet add package ppy.SDL3_mixer-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_mixer-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_mixer-CS) | +| [`SDL_shadercross`](https://github.com/libsdl-org/SDL_shadercross/tree/main) | `dotnet add package ppy.SDL3_shadercross-CS` | [![NuGet](https://img.shields.io/nuget/v/ppy.SDL3_shadercross-CS?label=nuget)](https://www.nuget.org/packages/ppy.SDL3_shadercross-CS) | Contributions to keep the bindings up-to-date with upstream changes are welcome. If you have improvements or updates, feel free to submit a pull request. @@ -16,4 +17,5 @@ Contributions to keep the bindings up-to-date with upstream changes are welcome. | `SDL3-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `SDL3_image-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | `SDL3_ttf-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| `SDL3_mixer-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | \ No newline at end of file +| `SDL3_mixer-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| `SDL3_shadercross-CS` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | diff --git a/SDL3-CS.Android.slnf b/SDL3-CS.Android.slnf index 4c6d3033..a363d4d1 100644 --- a/SDL3-CS.Android.slnf +++ b/SDL3-CS.Android.slnf @@ -8,7 +8,8 @@ "SDL3-CS\\SDL3-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3_mixer-CS\\SDL3_mixer-CS.csproj", - "SDL3_ttf-CS\\SDL3_ttf-CS.csproj" + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", + "SDL3_shadercross-CS\\SDL3_shadercross-CS.csproj" ] } -} \ No newline at end of file +} diff --git a/SDL3-CS.Desktop.slnf b/SDL3-CS.Desktop.slnf index d33a587e..c2767b53 100644 --- a/SDL3-CS.Desktop.slnf +++ b/SDL3-CS.Desktop.slnf @@ -8,7 +8,8 @@ "SDL3-CS\\SDL3-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3_mixer-CS\\SDL3_mixer-CS.csproj", - "SDL3_ttf-CS\\SDL3_ttf-CS.csproj" + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", + "SDL3_shadercross-CS\\SDL3_shadercross-CS.csproj" ] } -} \ No newline at end of file +} diff --git a/SDL3-CS.Tests/SDL3-CS.Tests.csproj b/SDL3-CS.Tests/SDL3-CS.Tests.csproj index fa3114e8..0363ac08 100644 --- a/SDL3-CS.Tests/SDL3-CS.Tests.csproj +++ b/SDL3-CS.Tests/SDL3-CS.Tests.csproj @@ -25,6 +25,7 @@ + diff --git a/SDL3-CS.iOS.slnf b/SDL3-CS.iOS.slnf index 4e9f6091..f8e31896 100644 --- a/SDL3-CS.iOS.slnf +++ b/SDL3-CS.iOS.slnf @@ -8,7 +8,8 @@ "SDL3-CS\\SDL3-CS.csproj", "SDL3_image-CS\\SDL3_image-CS.csproj", "SDL3_mixer-CS\\SDL3_mixer-CS.csproj", - "SDL3_ttf-CS\\SDL3_ttf-CS.csproj" + "SDL3_ttf-CS\\SDL3_ttf-CS.csproj", + "SDL3_shadercross-CS\\SDL3_shadercross-CS.csproj" ] } -} \ No newline at end of file +} diff --git a/SDL3-CS.sln b/SDL3-CS.sln index 63301ae7..9cdea7bd 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_image-CS", "SDL3_image EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3_mixer-CS", "SDL3_mixer-CS\SDL3_mixer-CS.csproj", "{421748C4-B51F-4B00-9637-566DBFD96E02}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3_shadercross-CS", "SDL3_shadercross-CS\SDL3_shadercross-CS.csproj", "{E98595B3-A9FA-4217-9F22-1023A7C55C2B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +75,10 @@ Global {421748C4-B51F-4B00-9637-566DBFD96E02}.Debug|Any CPU.Build.0 = Debug|Any CPU {421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.ActiveCfg = Release|Any CPU {421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.Build.0 = Release|Any CPU + {E98595B3-A9FA-4217-9F22-1023A7C55C2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E98595B3-A9FA-4217-9F22-1023A7C55C2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E98595B3-A9FA-4217-9F22-1023A7C55C2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E98595B3-A9FA-4217-9F22-1023A7C55C2B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SDL3-CS/Properties/AssemblyInfo.cs b/SDL3-CS/Properties/AssemblyInfo.cs index addb6e2c..695cca4c 100644 --- a/SDL3-CS/Properties/AssemblyInfo.cs +++ b/SDL3-CS/Properties/AssemblyInfo.cs @@ -9,3 +9,4 @@ [assembly: InternalsVisibleTo("SDL3_ttf-CS")] [assembly: InternalsVisibleTo("SDL3_image-CS")] [assembly: InternalsVisibleTo("SDL3_mixer-CS")] +[assembly: InternalsVisibleTo("SDL3_shadercross-CS")] diff --git a/SDL3_shadercross-CS/SDL3_shadercross-CS.csproj b/SDL3_shadercross-CS/SDL3_shadercross-CS.csproj new file mode 100644 index 00000000..609e6413 --- /dev/null +++ b/SDL3_shadercross-CS/SDL3_shadercross-CS.csproj @@ -0,0 +1,159 @@ + + + + net8.0;net8.0-android + net8.0 + 21 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + + ppy Pty Ltd + ppy Pty Ltd + Copyright (c) 2024 ppy Pty Ltd + ppy.SDL3_shadercross-CS + ppy.SDL3_shadercross-CS + Automated release. + MIT + https://github.com/ppy/SDL3-CS + README_nuget.md + https://github.com/ppy/SDL3-CS + + + + + + + + + + + + + + runtimes/win-x64/native + true + + + runtimes/win-x64/native + true + + + + runtimes/win-arm64/native + true + + + runtimes/win-x64/native + true + + + + runtimes/win-x86/native + true + + + runtimes/win-x64/native + true + + + + runtimes/osx-x64/native + true + + + runtimes/osx-arm64/native + true + + + + runtimes/osx-arm64/native + true + + + runtimes/osx-arm64/native + true + + + + runtimes/linux-x64/native + true + + + runtimes/linux-x64/native + true + + + + runtimes/linux-x86/native + true + + + runtimes/linux-x64/native + true + + + + runtimes/linux-arm64/native + true + + + runtimes/linux-x64/native + true + + + + runtimes/linux-arm/native + true + + + runtimes/linux-x64/native + true + + + + runtimes/ios/native/SDL3_shadercross.xcframework + true + + + + runtimes/android-arm/native + true + + + runtimes/android-arm/native + true + + + + runtimes/android-arm64/native + true + + + runtimes/android-arm/native + true + + + + runtimes/android-x64/native + true + + + runtimes/android-arm/native + true + + + + runtimes/android-x86/native + true + + + runtimes/android-arm/native + true + + + + diff --git a/SDL3_shadercross-CS/SDL3_shadercross/ClangSharp/SDL_shadercross.g.cs b/SDL3_shadercross-CS/SDL3_shadercross/ClangSharp/SDL_shadercross.g.cs new file mode 100644 index 00000000..4311b1e3 --- /dev/null +++ b/SDL3_shadercross-CS/SDL3_shadercross/ClangSharp/SDL_shadercross.g.cs @@ -0,0 +1,248 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public enum SDL_ShaderCross_IOVarType + { + SDL_SHADERCROSS_IOVAR_TYPE_UNKNOWN, + SDL_SHADERCROSS_IOVAR_TYPE_INT8, + SDL_SHADERCROSS_IOVAR_TYPE_UINT8, + SDL_SHADERCROSS_IOVAR_TYPE_INT16, + SDL_SHADERCROSS_IOVAR_TYPE_UINT16, + SDL_SHADERCROSS_IOVAR_TYPE_INT32, + SDL_SHADERCROSS_IOVAR_TYPE_UINT32, + SDL_SHADERCROSS_IOVAR_TYPE_INT64, + SDL_SHADERCROSS_IOVAR_TYPE_UINT64, + SDL_SHADERCROSS_IOVAR_TYPE_FLOAT16, + SDL_SHADERCROSS_IOVAR_TYPE_FLOAT32, + SDL_SHADERCROSS_IOVAR_TYPE_FLOAT64, + } + + public enum SDL_ShaderCross_ShaderStage + { + SDL_SHADERCROSS_SHADERSTAGE_VERTEX, + SDL_SHADERCROSS_SHADERSTAGE_FRAGMENT, + SDL_SHADERCROSS_SHADERSTAGE_COMPUTE, + } + + public unsafe partial struct SDL_ShaderCross_IOVarMetadata + { + [NativeTypeName("char *")] + public byte* name; + + [NativeTypeName("Uint32")] + public uint location; + + public SDL_ShaderCross_IOVarType vector_type; + + [NativeTypeName("Uint32")] + public uint vector_size; + } + + public unsafe partial struct SDL_ShaderCross_GraphicsShaderMetadata + { + [NativeTypeName("Uint32")] + public uint num_samplers; + + [NativeTypeName("Uint32")] + public uint num_storage_textures; + + [NativeTypeName("Uint32")] + public uint num_storage_buffers; + + [NativeTypeName("Uint32")] + public uint num_uniform_buffers; + + [NativeTypeName("Uint32")] + public uint num_inputs; + + public SDL_ShaderCross_IOVarMetadata* inputs; + + [NativeTypeName("Uint32")] + public uint num_outputs; + + public SDL_ShaderCross_IOVarMetadata* outputs; + } + + public partial struct SDL_ShaderCross_ComputePipelineMetadata + { + [NativeTypeName("Uint32")] + public uint num_samplers; + + [NativeTypeName("Uint32")] + public uint num_readonly_storage_textures; + + [NativeTypeName("Uint32")] + public uint num_readonly_storage_buffers; + + [NativeTypeName("Uint32")] + public uint num_readwrite_storage_textures; + + [NativeTypeName("Uint32")] + public uint num_readwrite_storage_buffers; + + [NativeTypeName("Uint32")] + public uint num_uniform_buffers; + + [NativeTypeName("Uint32")] + public uint threadcount_x; + + [NativeTypeName("Uint32")] + public uint threadcount_y; + + [NativeTypeName("Uint32")] + public uint threadcount_z; + } + + public unsafe partial struct SDL_ShaderCross_SPIRV_Info + { + [NativeTypeName("const Uint8 *")] + public byte* bytecode; + + [NativeTypeName("size_t")] + public nuint bytecode_size; + + [NativeTypeName("const char *")] + public byte* entrypoint; + + public SDL_ShaderCross_ShaderStage shader_stage; + + [NativeTypeName("bool")] + public SDLBool enable_debug; + + [NativeTypeName("const char *")] + public byte* name; + + public SDL_PropertiesID props; + } + + public unsafe partial struct SDL_ShaderCross_HLSL_Define + { + [NativeTypeName("char *")] + public byte* name; + + [NativeTypeName("char *")] + public byte* value; + } + + public unsafe partial struct SDL_ShaderCross_HLSL_Info + { + [NativeTypeName("const char *")] + public byte* source; + + [NativeTypeName("const char *")] + public byte* entrypoint; + + [NativeTypeName("const char *")] + public byte* include_dir; + + public SDL_ShaderCross_HLSL_Define* defines; + + public SDL_ShaderCross_ShaderStage shader_stage; + + [NativeTypeName("bool")] + public SDLBool enable_debug; + + [NativeTypeName("const char *")] + public byte* name; + + public SDL_PropertiesID props; + } + + public static unsafe partial class SDL3_shadercross + { + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool SDL_ShaderCross_Init(); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void SDL_ShaderCross_Quit(); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GPUShaderFormat SDL_ShaderCross_GetSPIRVShaderFormats(); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_TranspileMSLFromSPIRV([NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_TranspileHLSLFromSPIRV([NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_CompileDXBCFromSPIRV([NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_CompileDXILFromSPIRV([NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GPUShader* SDL_ShaderCross_CompileGraphicsShaderFromSPIRV(SDL_GPUDevice* device, [NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info, [NativeTypeName("const SDL_ShaderCross_GraphicsShaderMetadata *")] SDL_ShaderCross_GraphicsShaderMetadata* metadata, SDL_PropertiesID props); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GPUComputePipeline* SDL_ShaderCross_CompileComputePipelineFromSPIRV(SDL_GPUDevice* device, [NativeTypeName("const SDL_ShaderCross_SPIRV_Info *")] SDL_ShaderCross_SPIRV_Info* info, [NativeTypeName("const SDL_ShaderCross_ComputePipelineMetadata *")] SDL_ShaderCross_ComputePipelineMetadata* metadata, SDL_PropertiesID props); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_ShaderCross_GraphicsShaderMetadata* SDL_ShaderCross_ReflectGraphicsSPIRV([NativeTypeName("const Uint8 *")] byte* bytecode, [NativeTypeName("size_t")] nuint bytecode_size, SDL_PropertiesID props); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_ShaderCross_ComputePipelineMetadata* SDL_ShaderCross_ReflectComputeSPIRV([NativeTypeName("const Uint8 *")] byte* bytecode, [NativeTypeName("size_t")] nuint bytecode_size, SDL_PropertiesID props); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern SDL_GPUShaderFormat SDL_ShaderCross_GetHLSLShaderFormats(); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_CompileDXBCFromHLSL([NativeTypeName("const SDL_ShaderCross_HLSL_Info *")] SDL_ShaderCross_HLSL_Info* info, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_CompileDXILFromHLSL([NativeTypeName("const SDL_ShaderCross_HLSL_Info *")] SDL_ShaderCross_HLSL_Info* info, [NativeTypeName("size_t *")] nuint* size); + + [DllImport("SDL3_shadercross", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr SDL_ShaderCross_CompileSPIRVFromHLSL([NativeTypeName("const SDL_ShaderCross_HLSL_Info *")] SDL_ShaderCross_HLSL_Info* info, [NativeTypeName("size_t *")] nuint* size); + + [NativeTypeName("#define SDL_SHADERCROSS_MAJOR_VERSION 3")] + public const int SDL_SHADERCROSS_MAJOR_VERSION = 3; + + [NativeTypeName("#define SDL_SHADERCROSS_MINOR_VERSION 0")] + public const int SDL_SHADERCROSS_MINOR_VERSION = 0; + + [NativeTypeName("#define SDL_SHADERCROSS_MICRO_VERSION 0")] + public const int SDL_SHADERCROSS_MICRO_VERSION = 0; + + [NativeTypeName("#define SDL_SHADERCROSS_PROP_SPIRV_PSSL_COMPATIBILITY \"SDL.shadercross.spirv.pssl.compatibility\"")] + public static ReadOnlySpan SDL_SHADERCROSS_PROP_SPIRV_PSSL_COMPATIBILITY => "SDL.shadercross.spirv.pssl.compatibility"u8; + + [NativeTypeName("#define SDL_SHADERCROSS_PROP_SPIRV_MSL_VERSION \"SDL.shadercross.spirv.msl.version\"")] + public static ReadOnlySpan SDL_SHADERCROSS_PROP_SPIRV_MSL_VERSION => "SDL.shadercross.spirv.msl.version"u8; + } +}