参照されないプロジェクトを削除しビルド構成を整理
検索条件に一致するファイルはありません
@@ -62,19 +62,7 @@ jobs:
|
||||
run: dotnet pack src\ComputeSharp.Dxc\ComputeSharp.Dxc.csproj -c Release
|
||||
- name: Build ComputeSharp.D3D12MemoryAllocator package
|
||||
run: dotnet pack src\ComputeSharp.D3D12MemoryAllocator\ComputeSharp.D3D12MemoryAllocator.csproj -c Release
|
||||
- name: Build ComputeSharp.D2D1 package
|
||||
run: dotnet pack src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj -c Release
|
||||
- name: Build ComputeSharp.Pix package
|
||||
run: dotnet pack src\ComputeSharp.Pix\ComputeSharp.Pix.csproj -c Release
|
||||
- name: Build ComputeSharp.Uwp package
|
||||
run: msbuild src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj /restore -t:pack /p:Configuration=Release
|
||||
- name: Build ComputeSharp.WinUI package
|
||||
run: msbuild src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj /restore -t:pack /p:Configuration=Release
|
||||
- name: Build ComputeSharp.D2D1.Uwp package
|
||||
run: msbuild src\ComputeSharp.D2D1.Uwp\ComputeSharp.D2D1.Uwp.csproj /restore -t:pack /p:Configuration=Release
|
||||
- name: Build ComputeSharp.D2D1.WinUI package
|
||||
run: msbuild src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj /restore -t:pack /p:Configuration=Release
|
||||
|
||||
|
||||
# Upload the packages to the pipeline artifacts
|
||||
- name: Upload package artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -99,37 +87,9 @@ jobs:
|
||||
# DirectX 12 unit tests
|
||||
- name: Run ComputeSharp.Tests
|
||||
run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj -c Release /p:Platform=x64 -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DisableDynamicCompilation
|
||||
run: dotnet test tests\ComputeSharp.Tests.DisableDynamicCompilation\ComputeSharp.Tests.DisableDynamicCompilation.csproj -c Release /p:Platform=x64 -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.GlobalStatements
|
||||
run: dotnet run --project tests\ComputeSharp.Tests.GlobalStatements\ComputeSharp.Tests.GlobalStatements.csproj -c Release /p:Platform=x64 -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.Internals
|
||||
run: dotnet test tests\ComputeSharp.Tests.Internals\ComputeSharp.Tests.Internals.csproj -c Release /p:Platform=x64 -v n -l "console;verbosity=detailed"
|
||||
|
||||
# Run the source generator tests as well (even though they're not really runtime specific)
|
||||
- name: Run ComputeSharp.Tests.SourceGenerators
|
||||
run: dotnet test tests\ComputeSharp.Tests.SourceGenerators\ComputeSharp.Tests.SourceGenerators.csproj -v n -l "console;verbosity=detailed"
|
||||
|
||||
# DirectX 12 device lost unit tests.
|
||||
# These tests are run one class at a time to ensure there's no accidental conflicts between any of them. This is because
|
||||
# the code paths being tested in this project are heavily dependent on process-wide mutable state (ie. DirectX 12 devices).
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "DeviceDisposal"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=DeviceDisposal" -c Release -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "DeviceLost"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=DeviceLost" -c Release -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "GetDefaultDevice"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=GetDefaultDevice" -c Release -v n -l "console;verbosity=detailed"
|
||||
|
||||
# D2D1 unit tests
|
||||
- name: Run ComputeSharp.D2D1.Tests
|
||||
run: dotnet test tests\ComputeSharp.D2D1.Tests\ComputeSharp.D2D1.Tests.csproj -c Release -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.D2D1.Tests.AssemblyLevelAttributes
|
||||
run: dotnet test tests\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj -c Release -v n -l "console;verbosity=detailed"
|
||||
|
||||
# Run the D2D1 source generators tests as well
|
||||
- name: Run ComputeSharp.D2D1.Tests.SourceGenerators
|
||||
run: dotnet test tests\ComputeSharp.D2D1.Tests.SourceGenerators\ComputeSharp.D2D1.Tests.SourceGenerators.csproj -v n -l "console;verbosity=detailed"
|
||||
|
||||
# Run all unit tests using D3D12MA
|
||||
run-tests-d3d12ma:
|
||||
needs: [build-solution]
|
||||
@@ -140,277 +100,15 @@ jobs:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# D3D12MA tests (main ComputeSharp tests, as well as the device lost ones)
|
||||
# D3D12MA tests (main ComputeSharp tests)
|
||||
- name: Run ComputeSharp.Tests
|
||||
run: dotnet test tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj -c Release /p:Platform=x64 /p:UseD3D12MemoryAllocator=true -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "DeviceDisposal"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=DeviceDisposal" -c Release /p:UseD3D12MemoryAllocator=true -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "DeviceLost"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=DeviceLost" -c Release /p:UseD3D12MemoryAllocator=true -v n -l "console;verbosity=detailed"
|
||||
- name: Run ComputeSharp.Tests.DeviceLost "GetDefaultDevice"
|
||||
run: dotnet test tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj --filter "TestCategory=GetDefaultDevice" -c Release /p:UseD3D12MemoryAllocator=true -v n -l "console;verbosity=detailed"
|
||||
|
||||
# Run all Win2D tests (separately, as they need VS Test)
|
||||
run-tests-win2d:
|
||||
needs: [build-solution]
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
# Build the D2D1 WinAppSDK unit tests
|
||||
- name: Build ComputeSharp.D2D1.WinUI.Tests
|
||||
run: msbuild tests\ComputeSharp.D2D1.WinUI.Tests\ComputeSharp.D2D1.WinUI.Tests.csproj /restore -t:build /p:Configuration=Release /p:Platform=x64
|
||||
|
||||
# Run the D2D1 WinAppSDK unit tests with VS Test
|
||||
- name: Run ComputeSharp.D2D1.WinUI.Tests
|
||||
run: >
|
||||
$vs_path = vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop -requiresAny -property installationPath;
|
||||
$vstest_path = join-path $vs_path 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe';
|
||||
& $vstest_path /Platform:x64 tests\ComputeSharp.D2D1.WinUI.Tests\bin\x64\Release\net8.0-windows10.0.22621.0\win-x64\ComputeSharp.D2D1.WinUI.Tests.build.appxrecipe
|
||||
|
||||
# Build the D2D1 WinAppSDK source generators tests
|
||||
- name: Build ComputeSharp.D2D1.WinUI.Tests.SourceGenerators
|
||||
run: msbuild tests\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj /restore -t:build /p:Configuration=Release /p:Platform=x64
|
||||
|
||||
# Run the D2D1 WinAppSDK source generators tests (same as above)
|
||||
- name: Run ComputeSharp.D2D1.WinUI.Tests.SourceGenerators
|
||||
run: >
|
||||
$vs_path = vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop -requiresAny -property installationPath;
|
||||
$vstest_path = join-path $vs_path 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe';
|
||||
& $vstest_path /Platform:x64 tests\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators\bin\x64\Release\net8.0-windows10.0.22621.0\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.dll
|
||||
|
||||
# Run all the local samples to ensure they build and run with no errors
|
||||
run-samples:
|
||||
needs: [build-solution]
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and run ComputeSharp.Sample
|
||||
run: >
|
||||
dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n;
|
||||
samples\ComputeSharp.Sample\bin\x64\Release\net8.0\win-x64\ComputeSharp.Sample.exe
|
||||
- name: Build and run ComputeSharp.Sample.FSharp
|
||||
run: >
|
||||
dotnet build samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n;
|
||||
samples\ComputeSharp.Sample.FSharp\bin\x64\Release\net8.0\win-x64\ComputeSharp.Sample.FSharp.exe
|
||||
- name: Build and run ComputeSharp.ImageProcessing.csproj
|
||||
run: >
|
||||
dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n;
|
||||
samples\ComputeSharp.ImageProcessing\bin\x64\Release\net8.0\win-x64\ComputeSharp.ImageProcessing.exe
|
||||
|
||||
# Run the NativeAOT samples as well
|
||||
run-samples-aot:
|
||||
needs: [build-solution]
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [x64, arm64]
|
||||
runs-on: windows-2022
|
||||
env:
|
||||
CI_RUNNER_SAMPLES_INTEGRATION_TESTS: true
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
# Publish the NativeAOT CLI sample (optimized for speed)
|
||||
- name: Publish ComputeSharp.SwapChain.Cli with NativeAOT (speed)
|
||||
run: >
|
||||
$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
|
||||
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -r win-${{matrix.platform}} -v n
|
||||
|
||||
# If on x64, also run it (this script will launch it and let it run for 2 seconds, before closing it).
|
||||
# Note: for this and all other equivalent tests below, we're only throwing on failures that are not
|
||||
# -1073741510 (STATUS_CONTROL_C_EXIT). That error is sometimes thrown when running the test in the CI.
|
||||
# We don't want to fail in that case, as it still means the sample has in fact ran with no problems.
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Run ComputeSharp.SwapChain.Cli (speed)
|
||||
run: >
|
||||
$process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe -PassThru);
|
||||
sleep -Seconds 2;
|
||||
try
|
||||
{
|
||||
$process.CloseMainWindow() | Out-Null;
|
||||
$process.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne -1073741510) { throw $process.ExitCode; }
|
||||
|
||||
# Upload the binary (to track binary size trends)
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Upload NativeAOT CLI sample (speed)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: computesharp.cli.opt-speed.exe
|
||||
path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe
|
||||
if-no-files-found: error
|
||||
|
||||
# Publish the NativeAOT CLI sample (optimized for size, and reflection-free)
|
||||
- name: Publish ComputeSharp.SwapChain.Cli with NativeAOT (size)
|
||||
run: >
|
||||
$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
|
||||
$env:COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED='true';
|
||||
$env:COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION='true';
|
||||
git clean -fdx;
|
||||
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -r win-${{matrix.platform}} -v n
|
||||
|
||||
# Again only on x64, also run the sample and validate it works correctly
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Run ComputeSharp.SwapChain.Cli (size)
|
||||
run: >
|
||||
$process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe -PassThru);
|
||||
sleep -Seconds 2;
|
||||
try
|
||||
{
|
||||
$process.CloseMainWindow() | Out-Null;
|
||||
$process.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne -1073741510) { throw $process.ExitCode; }
|
||||
|
||||
# Upload the binary again (with a different name)
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Upload NativeAOT CLI sample (size)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: computesharp.cli.opt-size.exe
|
||||
path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe
|
||||
if-no-files-found: error
|
||||
|
||||
# Also publish the Win2D sample (with R2R)
|
||||
- name: Publish ComputeSharp.SwapChain.D2D1.Cli (R2R)
|
||||
run: >
|
||||
$env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_R2R='true';
|
||||
$env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT='false';
|
||||
git clean -fdx;
|
||||
msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Just like for the DX12 sample, run it on x64 to validate it works correctly
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Run ComputeSharp.SwapChain.D2D1.Cli (R2R)
|
||||
run: >
|
||||
$process = (Start-Process samples\ComputeSharp.SwapChain.D2D1.Cli\bin\x64\Release\net8.0-windows10.0.22621\win-x64\publish\computesharp.d2d1.cli.exe -PassThru);
|
||||
sleep -Seconds 2;
|
||||
try
|
||||
{
|
||||
$process.CloseMainWindow() | Out-Null;
|
||||
$process.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne -1073741510) { throw $process.ExitCode; }
|
||||
|
||||
# Publish the Win2D sample again (with NativeAOT)
|
||||
- name: Publish ComputeSharp.SwapChain.D2D1.Cli (NativeAOT)
|
||||
run: >
|
||||
$env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_R2R='false';
|
||||
$env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT='true';
|
||||
git clean -fdx;
|
||||
msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Verify that the Win2D NativeAOT sample also runs correctly
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Run ComputeSharp.SwapChain.D2D1.Cli (NativeAOT)
|
||||
run: >
|
||||
$process = (Start-Process samples\ComputeSharp.SwapChain.D2D1.Cli\bin\x64\Release\net8.0-windows10.0.22621\win-x64\publish\computesharp.d2d1.cli.exe -PassThru);
|
||||
sleep -Seconds 2;
|
||||
try
|
||||
{
|
||||
$process.CloseMainWindow() | Out-Null;
|
||||
$process.WaitForExit();
|
||||
}
|
||||
catch { }
|
||||
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne -1073741510) { throw $process.ExitCode; }
|
||||
|
||||
# Publish the native library as a NativeAOT shared library
|
||||
- name: Publish ComputeSharp.NativeLibrary
|
||||
run: dotnet publish samples\ComputeSharp.NativeLibrary\ComputeSharp.NativeLibrary.csproj -r win-${{matrix.platform}} -v n
|
||||
|
||||
# Publish the WinRT component with NativeAOT as well
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Publish ComputeSharp.NativeLibrary.WinRT
|
||||
run: >
|
||||
msbuild samples\ComputeSharp.NativeLibrary.WinRT\ComputeSharp.NativeLibrary.WinRT.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Publish the WinUI 3 sample app with NativeAOT
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Publish ComputeSharp.SwapChain.WinUI
|
||||
run: >
|
||||
msbuild samples\ComputeSharp.SwapChain.WinUI\ComputeSharp.SwapChain.WinUI.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Publish the D2D1 UWP (CoreApplication) sample app with NativeAOT
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Publish ComputeSharp.SwapChain.D2D1.Uwp
|
||||
run: >
|
||||
msbuild samples\ComputeSharp.SwapChain.D2D1.Uwp\ComputeSharp.SwapChain.D2D1.Uwp.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Publish the D2D1 UWP sample app again with NativeAOT, with Xbox support
|
||||
- if: matrix.platform == 'x64'
|
||||
name: Publish ComputeSharp.SwapChain.D2D1.Uwp (Xbox)
|
||||
run: >
|
||||
$env:EXPERIMENTAL_XBOX_SUPPORT='true';
|
||||
msbuild samples\ComputeSharp.SwapChain.D2D1.Uwp\ComputeSharp.SwapChain.D2D1.Uwp.csproj /restore -t:publish
|
||||
/p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}}
|
||||
|
||||
# Download the NuGet packages generated in the previous job and use them
|
||||
# to build and run the sample project referencing them. This is used as
|
||||
# a test to ensure the NuGet packages work in a consuming project.
|
||||
verify-packages:
|
||||
needs: [build-packages]
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Create local NuGet feed
|
||||
run: mkdir artifacts
|
||||
- name: Download package artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nuget_packages
|
||||
path: artifacts
|
||||
- name: Build and run ComputeSharp.NuGet
|
||||
run: dotnet run --project tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -r win-x64 --no-self-contained -v n
|
||||
- name: Build and run ComputeSharp.Dxc.NuGet
|
||||
run: dotnet run --project tests\ComputeSharp.Dxc.NuGet\ComputeSharp.Dxc.NuGet.csproj -c Release -r win-x64 --no-self-contained -v n
|
||||
- name: Build and run ComputeSharp.Pix.NuGet
|
||||
run: dotnet run --project tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -c Release -r win-x64 --no-self-contained -v n
|
||||
|
||||
# Run the extra tests to validate a number of build and publishing configurations.
|
||||
# This is used to ensure the native dependencies can always be loaded correctly
|
||||
# regardless of whether the app is shipping with R2R, self-contained, etc.
|
||||
- name: Run ComputeSharp.Tests.NativeLibrariesResolver
|
||||
run: dotnet test tests\ComputeSharp.Tests.NativeLibrariesResolver\ComputeSharp.Tests.NativeLibrariesResolver.csproj -v n -l "console;verbosity=detailed"
|
||||
|
||||
# Also run the NativeAOT publishing tests
|
||||
- name: Publish and run ComputeSharp.NuGet with NativeAOT
|
||||
run: >
|
||||
$env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true';
|
||||
dotnet publish tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -r win-x64 -v n;
|
||||
tests\ComputeSharp.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.NuGet.exe
|
||||
- name: Publish and run ComputeSharp.Dxc.NuGet with NativeAOT
|
||||
run: >
|
||||
$env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true';
|
||||
dotnet publish tests\ComputeSharp.Dxc.NuGet\ComputeSharp.Dxc.NuGet.csproj -r win-x64 -v n;
|
||||
tests\ComputeSharp.Dxc.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.Dxc.NuGet.exe
|
||||
- name: Publish and run ComputeSharp.Pix.NuGet with NativeAOT
|
||||
run: >
|
||||
$env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true';
|
||||
dotnet publish tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -r win-x64 -v n;
|
||||
tests\ComputeSharp.Pix.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.Pix.NuGet.exe
|
||||
|
||||
# ビルドした NuGet パッケージ(.nupkg)を GitHub Release として公開する。
|
||||
# GitHub Packages や Azure DevOps への push はフォークでは認証できず失敗する(403)ため、
|
||||
# 代わりに自動生成のリリースノートを付けたリリースを作成し、.nupkg を資産として添付する。
|
||||
publish-release:
|
||||
needs: [run-tests, run-tests-d3d12ma, run-tests-win2d, run-samples, run-samples-aot, verify-packages]
|
||||
needs: [run-tests, run-tests-d3d12ma, build-packages]
|
||||
runs-on: windows-2022
|
||||
if: ${{github.event_name == 'push'}}
|
||||
permissions:
|
||||
|
||||
@@ -6,10 +6,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp", "src\Compute
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Benchmark", "samples\ComputeSharp.Benchmark\ComputeSharp.Benchmark.csproj", "{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.ImageProcessing", "samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj", "{524CC5DD-1DEE-4A30-9515-AB90965E5207}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests", "tests\ComputeSharp.Tests\ComputeSharp.Tests.csproj", "{E91F4D24-922A-4921-A8D7-9C45A143C45D}"
|
||||
@@ -32,74 +28,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_Solution
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SourceGenerators", "src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj", "{EB52CB67-4162-4722-874B-44EA8DA5450E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Sample", "samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj", "{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.SourceGenerators", "tests\ComputeSharp.Tests.SourceGenerators\ComputeSharp.Tests.SourceGenerators.csproj", "{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.NativeLibrariesResolver", "tests\ComputeSharp.Tests.NativeLibrariesResolver\ComputeSharp.Tests.NativeLibrariesResolver.csproj", "{BF52326F-E415-49E6-8595-62762216762B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain", "samples\ComputeSharp.SwapChain\ComputeSharp.SwapChain.csproj", "{E7C9247D-016B-4819-AF9F-0E9B3591E04B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain.Cli", "samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj", "{C12D7ACE-98ED-4813-8118-6667C34F484F}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ComputeSharp.Sample.FSharp", "samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj", "{7C625EC4-F599-4350-A915-F046DF2406D3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Sample.FSharp.Shaders", "samples\ComputeSharp.Sample.FSharp.Shaders\ComputeSharp.Sample.FSharp.Shaders.csproj", "{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.Win32.D3D12", "src\ComputeSharp.Win32.D3D12\ComputeSharp.Win32.D3D12.shproj", "{514FF00E-BBF0-4D55-A47C-EEEB6208ADCE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.WinUI", "src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj", "{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain.WinUI", "samples\ComputeSharp.SwapChain.WinUI\ComputeSharp.SwapChain.WinUI.csproj", "{0071701E-B9C5-4098-BE5F-EF556C4553C6}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.Shaders", "samples\ComputeSharp.SwapChain.Shaders\ComputeSharp.SwapChain.Shaders.shproj", "{0800BD51-499D-44C2-9417-FD1F7FDFE9C4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.DisableDynamicCompilation", "tests\ComputeSharp.Tests.DisableDynamicCompilation\ComputeSharp.Tests.DisableDynamicCompilation.csproj", "{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Dxc", "src\ComputeSharp.Dxc\ComputeSharp.Dxc.csproj", "{76C66257-FDAA-47AB-85E7-EF757EAB10C0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1", "src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj", "{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.Win32.D2D1", "src\ComputeSharp.Win32.D2D1\ComputeSharp.Win32.D2D1.shproj", "{9DA1DA9F-F8B2-4B25-BE80-C21F773029E3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Core", "src\ComputeSharp.Core\ComputeSharp.Core.csproj", "{764BC0F5-0C5E-49AD-ABAA-E3874C0F3286}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Core.SourceGenerators", "src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj", "{BFB003D1-788B-48DE-8065-39479C162CB0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.SourceGenerators", "src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj", "{E44053BD-A761-47FB-AA78-087A599672EA}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SourceGeneration", "src\ComputeSharp.SourceGeneration\ComputeSharp.SourceGeneration.shproj", "{51D5A422-D3A5-4C4D-8A6D-A048940BF279}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SourceGeneration.Hlsl", "src\ComputeSharp.SourceGeneration.Hlsl\ComputeSharp.SourceGeneration.Hlsl.shproj", "{9AC496A3-BBF0-4C8F-A50D-A20BF01C5E05}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Tests", "tests\ComputeSharp.D2D1.Tests\ComputeSharp.D2D1.Tests.csproj", "{209C95A3-FA53-431B-B688-3299CA6C29D2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Tests.AssemblyLevelAttributes", "tests\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj", "{94178D51-0097-4AD2-B3D0-827E40D62F2E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Pix", "src\ComputeSharp.Pix\ComputeSharp.Pix.csproj", "{14EF12A3-90E6-4683-BD71-9896AF87026B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Dxc.NuGet", "ComputeSharp.Dxc.NuGet", "{CBA545B4-31EF-4E9F-A1A8-2A1290B54046}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
tests\ComputeSharp.Dxc.NuGet\ComputeSharp.Dxc.NuGet.csproj = tests\ComputeSharp.Dxc.NuGet\ComputeSharp.Dxc.NuGet.csproj
|
||||
tests\ComputeSharp.Dxc.NuGet\Program.cs = tests\ComputeSharp.Dxc.NuGet\Program.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Pix.NuGet", "ComputeSharp.Pix.NuGet", "{C0B903AA-F32C-4760-B4B6-199AC4FE1C5A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj = tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj
|
||||
tests\ComputeSharp.Pix.NuGet\Program.cs = tests\ComputeSharp.Pix.NuGet\Program.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.NuGet", "ComputeSharp.NuGet", "{E3403F19-A0D8-4317-8A54-322C7A13F2A2}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj = tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj
|
||||
tests\ComputeSharp.NuGet\Program.cs = tests\ComputeSharp.NuGet\Program.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.DeviceLost", "tests\ComputeSharp.Tests.DeviceLost\ComputeSharp.Tests.DeviceLost.csproj", "{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.GlobalStatements", "tests\ComputeSharp.Tests.GlobalStatements\ComputeSharp.Tests.GlobalStatements.csproj", "{669A414F-3B46-4B55-B587-061AF63C3067}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B86A48A7-18BD-4946-B995-3CE26B092DDF}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Directory.Build.BeforeMicrosoftNETSdkTargets.targets = src\Directory.Build.BeforeMicrosoftNETSdkTargets.targets
|
||||
@@ -107,10 +49,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B86A48A7-18B
|
||||
src\Directory.Build.targets = src\Directory.Build.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.Shaders.D2D1", "samples\ComputeSharp.SwapChain.Shaders.D2D1\ComputeSharp.SwapChain.Shaders.D2D1.shproj", "{F8BF7666-7CCF-4FE4-B055-2EBA4BCD4564}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.WinUI", "src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj", "{BD9E6556-357E-4C20-BFCD-FB131F9372FA}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{568E7009-5C13-4153-9C94-0AC7A3E6883C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
samples\Directory.Build.props = samples\Directory.Build.props
|
||||
@@ -124,8 +62,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{B54B6DCA
|
||||
tests\Directory.Build.targets = tests\Directory.Build.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain.D2D1.Cli", "samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj", "{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{345F62CF-5320-4531-A087-DA5B488FDDE6}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
assets\icon.ico = assets\icon.ico
|
||||
@@ -133,14 +69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{345F62
|
||||
assets\icon_highres.png = assets\icon_highres.png
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.WinUI.Tests", "tests\ComputeSharp.D2D1.WinUI.Tests\ComputeSharp.D2D1.WinUI.Tests.csproj", "{73C32D0F-64DB-4674-84E9-8FCC41228474}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D3D12MemoryAllocator", "src\ComputeSharp.D3D12MemoryAllocator\ComputeSharp.D3D12MemoryAllocator.csproj", "{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.CodeFixers", "src\ComputeSharp.D2D1.CodeFixers\ComputeSharp.D2D1.CodeFixers.csproj", "{54654960-54B5-4E19-B3ED-993591CA39E5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Tests.SourceGenerators", "tests\ComputeSharp.D2D1.Tests.SourceGenerators\ComputeSharp.D2D1.Tests.SourceGenerators.csproj", "{59A17380-24A0-4BD7-9012-B105A9E7D46F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Win32", "Win32", "{D991153C-A34D-4042-B76F-822ADB111DD0}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.CodeFixing", "src\ComputeSharp.CodeFixing\ComputeSharp.CodeFixing.shproj", "{29F6E256-BA0E-4F3B-854E-50839D67C6DD}"
|
||||
@@ -165,38 +95,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "arm64", "arm64", "{B4F6A41C
|
||||
libs\arm64\WinPixEventRuntime_UAP.dll = libs\arm64\WinPixEventRuntime_UAP.dll
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.NativeLibrary", "samples\ComputeSharp.NativeLibrary\ComputeSharp.NativeLibrary.csproj", "{1A3E20B3-F711-41C0-82EA-3B53A575955C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.NativeLibrary.WinRT", "samples\ComputeSharp.NativeLibrary.WinRT\ComputeSharp.NativeLibrary.WinRT.csproj", "{551EF4FB-F34F-412A-B3E6-E345797560ED}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.UI", "src\ComputeSharp.UI\ComputeSharp.UI.shproj", "{1CD1D9C5-7E00-43FB-A8C3-CFE98A885D3B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Uwp", "src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj", "{2C4C1A6B-7E38-41EC-84D9-007676571441}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.D2D1.UI", "src\ComputeSharp.D2D1.UI\ComputeSharp.D2D1.UI.shproj", "{A2A2171B-0BAF-4A2A-BFB3-3357EF714BF0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Uwp", "src\ComputeSharp.D2D1.Uwp\ComputeSharp.D2D1.Uwp.csproj", "{716DF19E-69BA-4A9C-9CA4-BFD196152F46}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain.D2D1.Uwp", "samples\ComputeSharp.SwapChain.D2D1.Uwp\ComputeSharp.SwapChain.D2D1.Uwp.csproj", "{9FBE070E-A210-4CEF-9F04-61C2B269C600}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1.WinUI.SourceGenerators", "src\ComputeSharp.D2D1.WinUI.SourceGenerators\ComputeSharp.D2D1.WinUI.SourceGenerators.csproj", "{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.WinUI.Tests.SourceGenerators", "tests\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators\ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj", "{916331A5-1EA6-41D7-B199-2E50C513EFDE}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.D2D1.UI.SourceGenerators", "src\ComputeSharp.D2D1.UI.SourceGenerators\ComputeSharp.D2D1.UI.SourceGenerators.shproj", "{D20E610F-EB37-46E7-B028-04784D7400D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1.Uwp.SourceGenerators", "src\ComputeSharp.D2D1.Uwp.SourceGenerators\ComputeSharp.D2D1.Uwp.SourceGenerators.csproj", "{690C4014-A06B-44DB-B717-AEA4CAFA9D68}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.D2D1.UI.CodeFixers", "src\ComputeSharp.D2D1.UI.CodeFixers\ComputeSharp.D2D1.UI.CodeFixers.shproj", "{CE85DC5A-E455-42FE-9B64-0D5F0D7EE366}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1.WinUI.CodeFixers", "src\ComputeSharp.D2D1.WinUI.CodeFixers\ComputeSharp.D2D1.WinUI.CodeFixers.csproj", "{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1.Uwp.CodeFixers", "src\ComputeSharp.D2D1.Uwp.CodeFixers\ComputeSharp.D2D1.Uwp.CodeFixers.csproj", "{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.SwapChain.Uwp", "samples\ComputeSharp.SwapChain.Uwp\ComputeSharp.SwapChain.Uwp.csproj", "{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.UI", "samples\ComputeSharp.SwapChain.UI\ComputeSharp.SwapChain.UI.shproj", "{6BC471C6-72F9-43CF-AE1E-F6D3E5ED3129}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -213,22 +111,6 @@ Global
|
||||
{314EB353-E7E3-4146-8111-685CC83EC1DE}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{314EB353-E7E3-4146-8111-685CC83EC1DE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{314EB353-E7E3-4146-8111-685CC83EC1DE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E91F4D24-922A-4921-A8D7-9C45A143C45D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E91F4D24-922A-4921-A8D7-9C45A143C45D}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E91F4D24-922A-4921-A8D7-9C45A143C45D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@@ -253,90 +135,6 @@ Global
|
||||
{EB52CB67-4162-4722-874B-44EA8DA5450E}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{EB52CB67-4162-4722-874B-44EA8DA5450E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EB52CB67-4162-4722-874B-44EA8DA5450E}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BF52326F-E415-49E6-8595-62762216762B}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Debug|x64.Build.0 = Debug|x64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Release|x64.ActiveCfg = Release|x64
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B}.Release|x64.Build.0 = Release|x64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Debug|x64.Build.0 = Debug|x64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Release|x64.ActiveCfg = Release|x64
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F}.Release|x64.Build.0 = Release|x64
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Debug|x64.Build.0 = Debug|x64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Release|x64.ActiveCfg = Release|x64
|
||||
{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}.Release|x64.Build.0 = Release|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|x64.Build.0 = Debug|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.ActiveCfg = Release|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.Build.0 = Release|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.Deploy.0 = Release|x64
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Release|x64.Build.0 = Release|Any CPU
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -345,14 +143,6 @@ Global
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Release|x64.ActiveCfg = Release|x64
|
||||
{76C66257-FDAA-47AB-85E7-EF757EAB10C0}.Release|x64.Build.0 = Release|x64
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}.Release|x64.Build.0 = Release|Any CPU
|
||||
{764BC0F5-0C5E-49AD-ABAA-E3874C0F3286}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{764BC0F5-0C5E-49AD-ABAA-E3874C0F3286}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{764BC0F5-0C5E-49AD-ABAA-E3874C0F3286}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@@ -369,82 +159,6 @@ Global
|
||||
{BFB003D1-788B-48DE-8065-39479C162CB0}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{BFB003D1-788B-48DE-8065-39479C162CB0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BFB003D1-788B-48DE-8065-39479C162CB0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E44053BD-A761-47FB-AA78-087A599672EA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E}.Release|x64.Build.0 = Release|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{14EF12A3-90E6-4683-BD71-9896AF87026B}.Release|x64.Build.0 = Release|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC}.Release|x64.Build.0 = Release|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Debug|x64.Build.0 = Debug|x64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Release|x64.ActiveCfg = Release|x64
|
||||
{BD9E6556-357E-4C20-BFCD-FB131F9372FA}.Release|x64.Build.0 = Release|x64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Debug|x64.Build.0 = Debug|x64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Release|x64.ActiveCfg = Release|x64
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A}.Release|x64.Build.0 = Release|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|x64.Build.0 = Debug|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|x64.ActiveCfg = Release|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|x64.Build.0 = Release|x64
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474}.Release|x64.Deploy.0 = Release|x64
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@@ -453,22 +167,6 @@ Global
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E017B3B6-C7D3-4E53-A7F6-1036178E98C3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{54654960-54B5-4E19-B3ED-993591CA39E5}.Release|x64.Build.0 = Release|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@@ -477,145 +175,20 @@ Global
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9B4448B1-200F-4966-8A13-A508691B3003}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C}.Release|x64.Build.0 = Release|Any CPU
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Debug|x64.Build.0 = Debug|x64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Release|x64.ActiveCfg = Release|x64
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED}.Release|x64.Build.0 = Release|x64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Debug|x64.Build.0 = Debug|x64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Release|x64.ActiveCfg = Release|x64
|
||||
{2C4C1A6B-7E38-41EC-84D9-007676571441}.Release|x64.Build.0 = Release|x64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Debug|x64.Build.0 = Debug|x64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Release|x64.ActiveCfg = Release|x64
|
||||
{716DF19E-69BA-4A9C-9CA4-BFD196152F46}.Release|x64.Build.0 = Release|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|x64.Build.0 = Debug|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|x64.ActiveCfg = Release|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|x64.Build.0 = Release|x64
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600}.Release|x64.Deploy.0 = Release|x64
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{FEBEC83A-FE70-4D4B-9B00-76DB31E75F17}.Release|x64.Build.0 = Release|Any CPU
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Debug|x64.Build.0 = Debug|x64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Release|x64.ActiveCfg = Release|x64
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE}.Release|x64.Build.0 = Release|x64
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{690C4014-A06B-44DB-B717-AEA4CAFA9D68}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9D3C872E-D64E-47E7-BDC8-077A151DBB7D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8BE73DB3-16E0-41F4-A87F-0C2AB43856A2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|x64.Build.0 = Debug|x64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|x64.ActiveCfg = Release|x64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|x64.Build.0 = Release|x64
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8}.Release|x64.Deploy.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{34AFE6E6-9A4C-4C3F-AE69-DD3693086DAF} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{524CC5DD-1DEE-4A30-9515-AB90965E5207} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{E91F4D24-922A-4921-A8D7-9C45A143C45D} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{E889E6D6-A814-4950-AAC1-68F1ECFC5BD6} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{7048DEEA-0A6F-46A0-B951-B682A8F1CB75} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{BBBD0ADD-F2F9-49A3-BD5E-D223F0735D8B} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{BF52326F-E415-49E6-8595-62762216762B} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{E7C9247D-016B-4819-AF9F-0E9B3591E04B} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{C12D7ACE-98ED-4813-8118-6667C34F484F} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{7C625EC4-F599-4350-A915-F046DF2406D3} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{514FF00E-BBF0-4D55-A47C-EEEB6208ADCE} = {D991153C-A34D-4042-B76F-822ADB111DD0}
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{0800BD51-499D-44C2-9417-FD1F7FDFE9C4} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{9DA1DA9F-F8B2-4B25-BE80-C21F773029E3} = {D991153C-A34D-4042-B76F-822ADB111DD0}
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{94178D51-0097-4AD2-B3D0-827E40D62F2E} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{CBA545B4-31EF-4E9F-A1A8-2A1290B54046} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{C0B903AA-F32C-4760-B4B6-199AC4FE1C5A} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{E3403F19-A0D8-4317-8A54-322C7A13F2A2} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{5DE90C85-ED26-4B5A-A0D7-2FF966A210AC} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{669A414F-3B46-4B55-B587-061AF63C3067} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{B86A48A7-18BD-4946-B995-3CE26B092DDF} = {1A9C4108-F61A-4ABE-B5CF-F524521EAE2D}
|
||||
{F8BF7666-7CCF-4FE4-B055-2EBA4BCD4564} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{568E7009-5C13-4153-9C94-0AC7A3E6883C} = {1A9C4108-F61A-4ABE-B5CF-F524521EAE2D}
|
||||
{B54B6DCA-6EAB-46A8-83D3-15154659F47F} = {1A9C4108-F61A-4ABE-B5CF-F524521EAE2D}
|
||||
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{73C32D0F-64DB-4674-84E9-8FCC41228474} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{59A17380-24A0-4BD7-9012-B105A9E7D46F} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{79FD7862-4707-4DE0-8777-3872558E4C1C} = {A5013F9B-92EC-419F-B0B3-3D6B721E7104}
|
||||
{B4F6A41C-AA9A-4302-92B3-AC64CF2E30F5} = {A5013F9B-92EC-419F-B0B3-3D6B721E7104}
|
||||
{1A3E20B3-F711-41C0-82EA-3B53A575955C} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{551EF4FB-F34F-412A-B3E6-E345797560ED} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{9FBE070E-A210-4CEF-9F04-61C2B269C600} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{916331A5-1EA6-41D7-B199-2E50C513EFDE} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{6A861D53-2DBD-4B4F-8543-90DC8C0F2DC8} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{6BC471C6-72F9-43CF-AE1E-F6D3E5ED3129} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Engines;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Benchmark.Blas;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that benchmarks the APIs in the <see cref="BlasHelpers"/> class, on both CPU and GPU.
|
||||
/// </summary>
|
||||
[SimpleJob(RunStrategy.Monitoring)]
|
||||
public class BlasBenchmark : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of samples.
|
||||
/// </summary>
|
||||
private const int C = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The nummber of rows in the <see cref="x"/> matrix.
|
||||
/// </summary>
|
||||
private const int N = 512;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="x"/> matrix (same as the number of rows in the <see cref="w"/> matrix)
|
||||
/// </summary>
|
||||
private const int M = 512;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="w"/> matrix.
|
||||
/// </summary>
|
||||
private const int P = 256;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor.
|
||||
/// </summary>
|
||||
private float[]? x;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor.
|
||||
/// </summary>
|
||||
private float[]? w;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor.
|
||||
/// </summary>
|
||||
private float[]? b;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor.
|
||||
/// </summary>
|
||||
private float[]? y;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? bufferX;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? bufferW;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? bufferB;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float>? bufferY;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="Random"/> instance to initialize the tensors.
|
||||
/// </summary>
|
||||
private readonly Random random = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session.
|
||||
/// </summary>
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
// Creates a new random normalized float[] array of a given size
|
||||
float[] CreateRandomArray(int size)
|
||||
{
|
||||
float[] array = ArrayPool<float>.Shared.Rent(size);
|
||||
|
||||
foreach (ref float x in array.AsSpan())
|
||||
{
|
||||
x = (float)this.random.NextDouble();
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
this.x = CreateRandomArray(C * N * M);
|
||||
this.w = CreateRandomArray(M * P);
|
||||
this.b = CreateRandomArray(P);
|
||||
this.y = CreateRandomArray(C * N * P);
|
||||
|
||||
this.bufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x);
|
||||
this.bufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w);
|
||||
this.bufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b);
|
||||
this.bufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(this.y);
|
||||
|
||||
Cpu();
|
||||
GpuWithNoTemporaryBuffers();
|
||||
GpuWithTemporaryBuffers();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
{
|
||||
ArrayPool<float>.Shared.Return(this.x!);
|
||||
ArrayPool<float>.Shared.Return(this.w!);
|
||||
ArrayPool<float>.Shared.Return(this.b!);
|
||||
ArrayPool<float>.Shared.Return(this.y!);
|
||||
|
||||
this.bufferX!.Dispose();
|
||||
this.bufferW!.Dispose();
|
||||
this.bufferB!.Dispose();
|
||||
this.bufferY!.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the CPU.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
public void Cpu()
|
||||
{
|
||||
BlasHelpers.FullyConnectedForwardCpu(C, N, M, P, this.x!, this.w!, this.b!, this.y!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the GPU.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void GpuWithNoTemporaryBuffers()
|
||||
{
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, this.bufferX!, this.bufferW!, this.bufferB!, this.bufferY!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a fully connected forward operation on the GPU, creating temporary GPU buffers to perform the operations.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void GpuWithTemporaryBuffers()
|
||||
{
|
||||
using ReadOnlyBuffer<float> x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x!);
|
||||
using ReadOnlyBuffer<float> w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w!);
|
||||
using ReadOnlyBuffer<float> b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b!);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(this.y!.Length);
|
||||
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, x, w, b, y);
|
||||
|
||||
y.CopyTo(this.y);
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputeSharp.Benchmark.Blas;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that contains primitives to run certain operations of a neural network.
|
||||
/// </summary>
|
||||
internal static partial class BlasHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes the forward pass on a fully connected layer on the CPU.
|
||||
/// </summary>
|
||||
/// <param name="c">The number of samples in the input tensor.</param>
|
||||
/// <param name="n">The number of rows in the input matrix.</param>
|
||||
/// <param name="m">The number of columns in the input matrix.</param>
|
||||
/// <param name="p">The number of columns in the output matrix.</param>
|
||||
/// <param name="x">The input tensor.</param>
|
||||
/// <param name="w">The weights tensor.</param>
|
||||
/// <param name="b">The bias tensor.</param>
|
||||
/// <param name="y">The result tensor.</param>
|
||||
public static void FullyConnectedForwardCpu(int c, int n, int m, int p, float[] x, float[] w, float[] b, float[] y)
|
||||
{
|
||||
void Kernel(int s)
|
||||
{
|
||||
ref float rx = ref x[s * n * m];
|
||||
ref float rw = ref w[0];
|
||||
ref float rb = ref b[0];
|
||||
ref float ry = ref y[s * n * p];
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int x_offset = i * m;
|
||||
int y_offset = i * p;
|
||||
|
||||
for (int j = 0; j < p; j++)
|
||||
{
|
||||
float result = 0f;
|
||||
|
||||
for (int k = 0; k < m; k++)
|
||||
{
|
||||
result += Unsafe.Add(ref rx, x_offset + k) * Unsafe.Add(ref rw, (k * p) + j);
|
||||
}
|
||||
|
||||
Unsafe.Add(ref ry, y_offset + j) = result + Unsafe.Add(ref rb, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ = Parallel.For(0, c, Kernel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the forward pass on a fully connected layer on the GPU.
|
||||
/// </summary>
|
||||
/// <param name="device">The device to run the computation on.</param>
|
||||
/// <param name="c">The number of samples in the input tensor.</param>
|
||||
/// <param name="n">The number of rows in the input matrix.</param>
|
||||
/// <param name="m">The number of columns in the input matrix.</param>
|
||||
/// <param name="p">The number of columns in the output matrix.</param>
|
||||
/// <param name="x">The input tensor.</param>
|
||||
/// <param name="w">The weights tensor.</param>
|
||||
/// <param name="b">The bias tensor.</param>
|
||||
/// <param name="y">The result tensor.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void FullyConnectedForwardGpu(
|
||||
GraphicsDevice device,
|
||||
int c,
|
||||
int n,
|
||||
int m,
|
||||
int p,
|
||||
ReadOnlyBuffer<float> x,
|
||||
ReadOnlyBuffer<float> w,
|
||||
ReadOnlyBuffer<float> b,
|
||||
ReadWriteBuffer<float> y)
|
||||
{
|
||||
device.For(c, n, p, new FullyConnectedForwardKernel(n, m, p, x, w, b, y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Kernel for <see cref="FullyConnectedForwardGpu"/>.
|
||||
/// </summary>
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XYZ)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public readonly partial struct FullyConnectedForwardKernel(
|
||||
int n,
|
||||
int m,
|
||||
int p,
|
||||
ReadOnlyBuffer<float> x,
|
||||
ReadOnlyBuffer<float> w,
|
||||
ReadOnlyBuffer<float> b,
|
||||
ReadWriteBuffer<float> y) : IComputeShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int x_offset = (ThreadIds.X * n * m) + (ThreadIds.Y * m);
|
||||
float result = 0f;
|
||||
|
||||
for (int k = 0; k < m; k++)
|
||||
{
|
||||
result += x[x_offset + k] * w[(k * p) + ThreadIds.Z];
|
||||
}
|
||||
|
||||
y[(ThreadIds.X * n * p) + (ThreadIds.Y * p) + ThreadIds.Z] = result + b[ThreadIds.Z];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Primitives\Complex64.cs" Link="Imaging\Primitives\Complex64.cs" />
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Primitives\ComplexVector4.cs" Link="Imaging\Primitives\ComplexVector4.cs" />
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Processors\HlslBokehBlurProcessor.cs" Link="Imaging\Processors\HlslBokehBlurProcessor.cs" />
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Processors\HlslBokehBlurProcessor.Implementation.cs" Link="Imaging\Processors\HlslBokehBlurProcessor.Implementation.cs" />
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Processors\HlslGaussianBlurProcessor.cs" Link="Imaging\Processors\HlslGaussianBlurProcessor.cs" />
|
||||
<Compile Include="..\ComputeSharp.ImageProcessing\Processors\HlslGaussianBlurProcessor.Implementation.cs" Link="Imaging\Processors\HlslGaussianBlurProcessor.Implementation.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\ComputeSharp.ImageProcessing\city.jpg" Link="Imaging\city.jpg" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,122 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
|
||||
#pragma warning disable CA1063, IDE0052
|
||||
|
||||
namespace ComputeSharp.Benchmark.Blas;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that benchmarks the shader dispatch times.
|
||||
/// </summary>
|
||||
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
|
||||
[MemoryDiagnoser]
|
||||
public partial class DispatchingBenchmark : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The test buffer.
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float>? buffer;
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session.
|
||||
/// </summary>
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
this.buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(128);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
{
|
||||
this.buffer!.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a single shader, manually.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public void Compute_Single()
|
||||
{
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a single shader through a compute context.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public void Compute_Single_WithContext()
|
||||
{
|
||||
using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a single shader through a compute context, asynchronously.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public async Task Compute_Single_WithContext_Async()
|
||||
{
|
||||
await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes two empty compute shaders one by one.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public void Compute_Multiple()
|
||||
{
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes two empty compute shaders in a batch.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public void Compute_Multiple_WithContext()
|
||||
{
|
||||
using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
context.Barrier(this.buffer!);
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes two empty compute shaders in a batch, asynchronously.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public async Task Compute_Multiple_WithContext_Async()
|
||||
{
|
||||
await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
context.Barrier(this.buffer!);
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.X)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct TestShader(ReadWriteBuffer<float> buffer) : IComputeShader
|
||||
{
|
||||
private readonly ReadWriteBuffer<float> buffer = buffer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Engines;
|
||||
using ComputeSharp.BokehBlur.Processors;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors.Convolution;
|
||||
using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Benchmark.Imaging;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that benchmarks the image processors against the reference in ImageSharp.
|
||||
/// </summary>
|
||||
[SimpleJob(RunStrategy.Monitoring)]
|
||||
[CategoriesColumn]
|
||||
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
|
||||
public class ImagingBenchmark : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The loaded image.
|
||||
/// </summary>
|
||||
private Image<ImageSharpRgba32>? image;
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session.
|
||||
/// </summary>
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
Configuration.Default.PreferContiguousImageBuffers = true;
|
||||
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging", "city.jpg");
|
||||
|
||||
this.image = Image.Load<ImageSharpRgba32>(path);
|
||||
|
||||
Bokeh_Cpu();
|
||||
Bokeh_Gpu();
|
||||
Gaussian_Cpu();
|
||||
Gaussian_Gpu();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
{
|
||||
this.image!.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a bokeh blur effect on the CPU.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
[BenchmarkCategory("BOKEH")]
|
||||
public void Bokeh_Cpu()
|
||||
{
|
||||
this.image!.Mutate(c => c.ApplyProcessor(new BokehBlurProcessor(80, 2, 3)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a bokeh blur effect on the GPU.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("BOKEH")]
|
||||
public void Bokeh_Gpu()
|
||||
{
|
||||
this.image!.Mutate(c => c.ApplyProcessor(new HlslBokehBlurProcessor(80, 2)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a gaussian blur effect on the CPU.
|
||||
/// </summary>
|
||||
[Benchmark(Baseline = true)]
|
||||
[BenchmarkCategory("GAUSSIAN")]
|
||||
public void Gaussian_Cpu()
|
||||
{
|
||||
this.image!.Mutate(c => c.ApplyProcessor(new GaussianBlurProcessor(80)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a gaussian blur effect on the GPU.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
[BenchmarkCategory("GAUSSIAN")]
|
||||
public void Gaussian_Gpu()
|
||||
{
|
||||
this.image!.Mutate(c => c.ApplyProcessor(new HlslGaussianBlurProcessor(80)));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Reflection;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
||||
// =================
|
||||
// BenchmarkDotNet
|
||||
// ================
|
||||
// In order to run this benchmark, switch to Release mode and either run select
|
||||
// it as the startup project for the solution and run it without the debugger
|
||||
// (CTRL + F5), or compile it and then go to its bin\Release\net8.0 folder,
|
||||
// open a cmd prompt and run "dotnet ComputeSharp.Benchmark.dll".
|
||||
BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
|
||||
@@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="city.jpg" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.BokehBlur.Processors;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors;
|
||||
using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32;
|
||||
|
||||
Configuration.Default.PreferContiguousImageBuffers = true;
|
||||
|
||||
Console.WriteLine(">> Loading image");
|
||||
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "city.jpg");
|
||||
using Image<ImageSharpRgba32> image = Image.Load<ImageSharpRgba32>(path);
|
||||
|
||||
// Apply a series of processors and save the results
|
||||
foreach ((string Name, IImageProcessor Processor) effect in new (string Name, IImageProcessor Processor)[]
|
||||
{
|
||||
("bokeh", new HlslBokehBlurProcessor(80, 2)),
|
||||
("gaussian", new HlslGaussianBlurProcessor(80))
|
||||
})
|
||||
{
|
||||
Console.WriteLine($">> Applying {effect.Name}");
|
||||
|
||||
using Image copy = image.Clone(c => c.ApplyProcessor(effect.Processor));
|
||||
|
||||
Console.WriteLine($">> Saving {effect.Name} to disk");
|
||||
|
||||
string targetPath = Path.GetDirectoryName(path)!;
|
||||
|
||||
while (Path.GetFileName(targetPath) != "ComputeSharp.ImageProcessing")
|
||||
{
|
||||
targetPath = Path.GetDirectoryName(targetPath)!;
|
||||
}
|
||||
|
||||
targetPath = Path.Combine(targetPath, $"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}");
|
||||
|
||||
copy.Save(targetPath);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<CsWinRTComponent>true</CsWinRTComponent>
|
||||
|
||||
<!--
|
||||
CsWinRT uses the assembly name to find the root namespace to use to crawl for exported types.
|
||||
We are changing this to exclude the 'WinRT' suffix, since that is not actually necessary.
|
||||
-->
|
||||
<AssemblyName>ComputeSharp.NativeLibrary</AssemblyName>
|
||||
|
||||
<!-- CsWinRT size saving options (also disabling some features that aren't needed) -->
|
||||
<CsWinRTEnableDynamicObjectsSupport>false</CsWinRTEnableDynamicObjectsSupport>
|
||||
<CsWinRTUseExceptionResourceKeys>true</CsWinRTUseExceptionResourceKeys>
|
||||
<CsWinRTEnableDefaultCustomTypeMappings>false</CsWinRTEnableDefaultCustomTypeMappings>
|
||||
<CsWinRTEnableICustomPropertyProviderSupport>false</CsWinRTEnableICustomPropertyProviderSupport>
|
||||
<CsWinRTEnableIReferenceSupport>false</CsWinRTEnableIReferenceSupport>
|
||||
<CsWinRTEnableIDynamicInterfaceCastableSupport>false</CsWinRTEnableIDynamicInterfaceCastableSupport>
|
||||
|
||||
<!--
|
||||
WinRT component warning suppression due to a default MSVC warning:
|
||||
"LNK4104: export of symbol 'DllCanUnloadNow' should be PRIVATE".
|
||||
See: https://github.com/dotnet/runtime/issues/98047.
|
||||
-->
|
||||
<NoWarn>$(NoWarn);LNK4104</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- NativeAOT configuration -->
|
||||
<PropertyGroup>
|
||||
<PublishAot>true</PublishAot>
|
||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<OptimizationPreference>Size</OptimizationPreference>
|
||||
<StackTraceSupport>false</StackTraceSupport>
|
||||
<IlcGenerateMstatFile>false</IlcGenerateMstatFile>
|
||||
<IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI.SourceGenerators\ComputeSharp.D2D1.WinUI.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,70 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace ComputeSharp.NativeLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// A hello world effect that displays a color gradient.
|
||||
/// </summary>
|
||||
public sealed partial class HelloWorldEffect : CanvasEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="PixelShaderEffect{T}"/> node in use.
|
||||
/// </summary>
|
||||
private static readonly CanvasEffectNode<PixelShaderEffect<Shader>> EffectNode = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time since the start of the application.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial float Time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dispatch area for the current output.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial Rect DispatchArea { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterOutputNode(EffectNode, new PixelShaderEffect<Shader>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ConfigureEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.GetNode(EffectNode).ConstantBuffer = new Shader(
|
||||
time: Time,
|
||||
dispatchSize: new int2(
|
||||
x: (int)double.Round(DispatchArea.Width),
|
||||
y: (int)double.Round(DispatchArea.Height)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A hello world effect that displays a color gradient.
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DEffectDisplayName(nameof(HelloWorldEffect))]
|
||||
[D2DEffectDescription("A hello world effect that displays a color gradient.")]
|
||||
[D2DEffectCategory("Render")]
|
||||
[D2DEffectAuthor("ComputeSharp.D2D1")]
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct Shader(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 uv = xy / (float2)dispatchSize;
|
||||
float3 color = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)));
|
||||
|
||||
return new(color, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- NativeAOT configuration -->
|
||||
<PropertyGroup>
|
||||
<PublishAot>true</PublishAot>
|
||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<OptimizationPreference>Size</OptimizationPreference>
|
||||
<StackTraceSupport>false</StackTraceSupport>
|
||||
|
||||
<!-- Unsupported size saving options, can be experimented with to investigate binary size -->
|
||||
<IlcFoldIdenticalMethodBodies>false</IlcFoldIdenticalMethodBodies>
|
||||
<IlcDisableReflection>false</IlcDisableReflection>
|
||||
|
||||
<!-- Enable generating files to inspect the binary size with sizoscope (https://github.com/MichalStrehovsky/sizoscope) -->
|
||||
<IlcGenerateMstatFile>true</IlcGenerateMstatFile>
|
||||
<IlcGenerateDgmlFile>true</IlcGenerateDgmlFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,84 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using ComputeSharp;
|
||||
using ComputeSharp.D2D1;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
|
||||
[assembly: SupportedOSPlatform("windows6.1")]
|
||||
|
||||
/// <summary>
|
||||
/// Native exports for the library.
|
||||
/// </summary>
|
||||
public static unsafe class Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers the <see cref="HelloWorld"/> effect into a target <c>ID2D1Factory1</c> instance.
|
||||
/// </summary>
|
||||
/// <param name="d2D1Factory1"><inheritdoc cref="D2D1PixelShaderEffect.RegisterForD2D1Factory1" path="/param[@name='d2D1Factory1']/node()"/></param>
|
||||
/// <param name="effectId"><inheritdoc cref="D2D1PixelShaderEffect.RegisterForD2D1Factory1" path="/param[@name='effectId']/node()"/></param>
|
||||
/// <returns>The <c>HRESULT</c> for the operation.</returns>
|
||||
[UnmanagedCallersOnly(EntryPoint = nameof(RegisterHelloWorldEffect))]
|
||||
public static int RegisterHelloWorldEffect(void* d2D1Factory1, Guid* effectId)
|
||||
{
|
||||
try
|
||||
{
|
||||
D2D1PixelShaderEffect.RegisterForD2D1Factory1<HelloWorld>(d2D1Factory1, out *effectId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Marshal.GetHRForException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the constant buffer for the input <c>ID2D1Effect</c> (assumed to be <see cref="HelloWorld"/>).
|
||||
/// </summary>
|
||||
/// <param name="d2D1Effect"><inheritdoc cref="D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect" path="/param[@name='d2D1Effect']/node()"/></param>
|
||||
/// <param name="time"><inheritdoc cref="HelloWorld(float, Int2)" path="/param[@name='time']/node()"/></param>
|
||||
/// <param name="dispatchWidth">The horizontal dispatch size for the current output.</param>
|
||||
/// <param name="dispatchHeight">The vertical dispatch size for the current output.</param>
|
||||
/// <returns></returns>
|
||||
[UnmanagedCallersOnly(EntryPoint = nameof(SetHelloWorldEffectConstantBuffer))]
|
||||
public static int SetHelloWorldEffectConstantBuffer(void* d2D1Effect, float time, int dispatchWidth, int dispatchHeight)
|
||||
{
|
||||
try
|
||||
{
|
||||
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(d2D1Effect, new HelloWorld(time, new int2(dispatchWidth, dispatchHeight)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Marshal.GetHRForException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A hello world effect that displays a color gradient.
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DEffectDisplayName(nameof(HelloWorld))]
|
||||
[D2DEffectDescription("A hello world effect that displays a color gradient.")]
|
||||
[D2DEffectCategory("Render")]
|
||||
[D2DEffectAuthor("ComputeSharp.D2D1")]
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct HelloWorld(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 uv = xy / (float2)dispatchSize;
|
||||
float3 color = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)));
|
||||
|
||||
return new(color, 1f);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace ComputeSharp.Sample.FSharp.Shaders;
|
||||
|
||||
/// <summary>
|
||||
/// A sample shader thaat just multiplies items in a buffer by two.
|
||||
/// </summary>
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.X)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public readonly partial struct MultiplyByTwo(ReadWriteBuffer<float> buffer) : IComputeShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="9.0.202" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\ComputeSharp.Sample.FSharp.Shaders\ComputeSharp.Sample.FSharp.Shaders.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,51 +0,0 @@
|
||||
// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp
|
||||
|
||||
open System
|
||||
open System.Globalization
|
||||
open System.Linq
|
||||
open ComputeSharp
|
||||
open ComputeSharp.Sample.FSharp.Shaders
|
||||
|
||||
/// <summary>Prints a matrix in a properly formatted way.</summary>
|
||||
/// <param name="array">The input <see langword="float"/> array representing the matrix to print.</param>
|
||||
/// <param name="width">The width of the array to print.</param>
|
||||
/// <param name="height">The height of the array to print.</param>
|
||||
/// <param name="name">The name of the matrix to print.</param>
|
||||
let printMatrix (array : float32[]) width height (name : string) =
|
||||
let pad = 48 - name.Length
|
||||
let title = $"%s{new string('=', pad / 2)} %s{name} %s{new string('=', (pad + 1) / 2)}"
|
||||
let numberWidth = Math.Max(array.Max().ToString(CultureInfo.InvariantCulture).Length, 4)
|
||||
|
||||
printfn "%s" title
|
||||
|
||||
for i in 0 .. height - 1 do
|
||||
let row = array.[i * width .. (i + 1) * width - 1]
|
||||
let text = String.Join(",", [for x in row -> x.ToString(CultureInfo.InvariantCulture).PadLeft(numberWidth)])
|
||||
|
||||
printfn "%s" text
|
||||
|
||||
printfn "%s" (new string('=', 50))
|
||||
|
||||
[<EntryPoint>]
|
||||
let main _ =
|
||||
|
||||
let array = [| for i in 1 .. 100 -> (float32)i |]
|
||||
|
||||
// Create the graphics buffer
|
||||
use buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array)
|
||||
|
||||
let shader = new MultiplyByTwo(buffer)
|
||||
|
||||
// Run the shader (passed by reference)
|
||||
GraphicsDevice.GetDefault().For(100, &shader)
|
||||
|
||||
// Print the initial matrix
|
||||
printMatrix array 10 10 "BEFORE"
|
||||
|
||||
// Get the data back
|
||||
buffer.CopyTo array
|
||||
|
||||
// Print the updated matrix
|
||||
printMatrix array 10 10 "AFTER"
|
||||
|
||||
0
|
||||
@@ -1,13 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace ComputeSharp.Sample;
|
||||
|
||||
/// <summary>
|
||||
/// Internal helpers for the sample to format values.
|
||||
/// </summary>
|
||||
internal static class Formatting
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints a matrix in a properly formatted way.
|
||||
/// </summary>
|
||||
/// <param name="array">The input <see langword="float"/> array representing the matrix to print.</param>
|
||||
/// <param name="width">The width of the array to print.</param>
|
||||
/// <param name="height">The height of the array to print.</param>
|
||||
/// <param name="name">The name of the matrix to print.</param>
|
||||
public static void PrintMatrix(float[] array, int width, int height, string name)
|
||||
{
|
||||
int pad = 48 - name.Length;
|
||||
string title = $"{new string('=', pad / 2)} {name} {new string('=', (pad + 1) / 2)}";
|
||||
|
||||
Console.WriteLine(title);
|
||||
|
||||
int numberWidth = Math.Max(array.Max().ToString(CultureInfo.InvariantCulture).Length, 4);
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
float[] row = [.. array.AsSpan(i * width, width)];
|
||||
string text = string.Join(",", row.Select(x => x.ToString(CultureInfo.InvariantCulture).PadLeft(numberWidth)));
|
||||
|
||||
Console.WriteLine(text);
|
||||
}
|
||||
|
||||
Console.WriteLine(new string('=', 50));
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ComputeSharp;
|
||||
using ComputeSharp.Sample;
|
||||
|
||||
float[] array = [.. Enumerable.Range(1, 100)];
|
||||
|
||||
// Create the graphics buffer
|
||||
using ReadWriteBuffer<float> gpuBuffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
GraphicsDevice.GetDefault().For(100, new MultiplyByTwo(gpuBuffer));
|
||||
|
||||
// Print the initial matrix
|
||||
Formatting.PrintMatrix(array, 10, 10, "BEFORE");
|
||||
|
||||
// Get the data back
|
||||
gpuBuffer.CopyTo(array);
|
||||
|
||||
// Print the updated matrix
|
||||
Formatting.PrintMatrix(array, 10, 10, "AFTER");
|
||||
|
||||
/// <summary>
|
||||
/// The sample kernel that multiples all items by two.
|
||||
/// </summary>
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.X)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct MultiplyByTwo(ReadWriteBuffer<float> buffer) : IComputeShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
|
||||
<!--
|
||||
When running in the CI, set the executable type to be 'Exe', so that a console will
|
||||
be available and the PowerShell test script will be able to await the published app.
|
||||
When not in the CI, use 'WinExe' instead so that the render window will open directly.
|
||||
-->
|
||||
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' == 'true'">Exe</OutputType>
|
||||
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' != 'true'">WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<AssemblyName>computesharp.cli</AssemblyName>
|
||||
|
||||
<!-- When explicitly optimizing for size, strip the icon (which adds about 100 KB of binary size) -->
|
||||
<ApplicationIcon Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' != 'true'">..\..\assets\icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
NativeAOT settings (NativeAOT publishing + reflection-free mode).
|
||||
Note: the COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT environment variable is used to trigger
|
||||
publishing with NativeAOT so that this project won't cause build errors in the CI. This is
|
||||
because NativeAOT doesn't support cross-compiling, but the CI will also build the solution
|
||||
targeting Arm64, from a VM running on x64, which would then fail due to mismatched RIDs.
|
||||
-->
|
||||
<PropertyGroup Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT)' == 'true'">
|
||||
<PublishAot>true</PublishAot>
|
||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<StackTraceSupport>false</StackTraceSupport>
|
||||
<OptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' == 'true'">Size</OptimizationPreference>
|
||||
<OptimizationPreference Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED)' != 'true'">Speed</OptimizationPreference>
|
||||
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
|
||||
<IlcDisableReflection Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION)' == 'true'">true</IlcDisableReflection>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
Manually set all configuration switches to trim unused features. These are usually set automatically by the
|
||||
.targets file included in ComputeSharp, but since this project is directly referencing the project and not
|
||||
going through NuGet, it can't rely on that, so it's just copying those three directives here.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<RuntimeHostConfigurationOption Include="COMPUTESHARP_ENABLE_DEBUG_OUTPUT" Value="false" Trim="true" />
|
||||
<RuntimeHostConfigurationOption Include="COMPUTESHARP_ENABLE_DEVICE_REMOVED_EXTENDED_DATA" Value="false" Trim="true" />
|
||||
<RuntimeHostConfigurationOption Include="COMPUTESHARP_ENABLE_GPU_TIMEOUT" Value="true" Trim="true" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- If requested, also reference the UPX compression package -->
|
||||
<ItemGroup Condition="'$(PUBLISH_AOT_COMPRESSED)' == 'true'">
|
||||
<PackageReference Include="PublishAotCompressed" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.26100.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Backend\Win32Application.cs" Link="Backend\Win32Application.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Backend\Win32ApplicationRunner.cs" Link="Backend\Win32ApplicationRunner.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\ComputeSharp.SwapChain.Shaders\ComputeSharp.SwapChain.Shaders.projitems" Label="Shared" />
|
||||
</Project>
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp;
|
||||
using ComputeSharp.SwapChain.Backend;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
// Accepted inputs:
|
||||
// - []
|
||||
// - [<SHADER_NAME>]
|
||||
if (args is [] or [_])
|
||||
{
|
||||
// If there are no args, just run the default shader
|
||||
if (args is not [string shaderName])
|
||||
{
|
||||
shaderName = nameof(ColorfulInfinity);
|
||||
}
|
||||
|
||||
// This CLI shader is heavily tuned for the smallest binary size possible when doing NativeAOT publish builds.
|
||||
// As a result, the code is intentionally not really standard, and pulling all sorts of tricks to minimize the
|
||||
// final binary size. These are callback functions to draw a shader, which are passed to the shared Win32 runner
|
||||
// as function pointers. This is done to avoid the additional binary size increase due to delegate instantiations.
|
||||
// Similarly, there is a single type hosting all rendering code to avoid per-shader reified generic instantiations.
|
||||
static void _0(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new HelloWorld((float)time.TotalSeconds));
|
||||
static void _1(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new ColorfulInfinity((float)time.TotalSeconds));
|
||||
static void _2(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new FractalTiling((float)time.TotalSeconds));
|
||||
static void _3(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new TwoTiledTruchet((float)time.TotalSeconds));
|
||||
static void _4(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new MengerJourney((float)time.TotalSeconds));
|
||||
static void _5(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new Octagrams((float)time.TotalSeconds));
|
||||
static void _6(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new ProteanClouds((float)time.TotalSeconds));
|
||||
static void _7(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new ExtrudedTruchetPattern((float)time.TotalSeconds));
|
||||
static void _8(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new PyramidPattern((float)time.TotalSeconds));
|
||||
static void _9(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new TriangleGridContouring((float)time.TotalSeconds));
|
||||
static void _A(IReadWriteNormalizedTexture2D<float4> texture, TimeSpan time) => texture.GraphicsDevice.ForEach(texture, new TerracedHills((float)time.TotalSeconds));
|
||||
|
||||
unsafe
|
||||
{
|
||||
// Get the requested shader, if possible
|
||||
delegate*<IReadWriteNormalizedTexture2D<float4>, TimeSpan, void> shaderCallback = shaderName.ToLowerInvariant() switch
|
||||
{
|
||||
"helloworld" => &_0,
|
||||
"colorfulinfinity" => &_1,
|
||||
"fractaltiling" => &_2,
|
||||
"twotiledtruchet" => &_3,
|
||||
"mengerjourney" => &_4,
|
||||
"octagrams" => &_5,
|
||||
"proteanclouds" => &_6,
|
||||
"extrudedtruchetpattern" => &_7,
|
||||
"pyramidpattern" => &_8,
|
||||
"trianglegridcontouring" => &_9,
|
||||
"terracedhills" => &_A,
|
||||
_ => null
|
||||
};
|
||||
|
||||
// Initialize the application instance and run it
|
||||
if (shaderCallback is not null)
|
||||
{
|
||||
Win32Application? application = new(shaderCallback);
|
||||
|
||||
return Win32ApplicationRunner.Run(application, "ComputeSharp", "ComputeSharp");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return E.E_INVALIDARG;
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp.D2D1;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
/// <summary>
|
||||
/// An base effect for an animated pixel shader.
|
||||
/// </summary>
|
||||
internal abstract partial class PixelShaderEffect : CanvasEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the total elapsed time.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial TimeSpan ElapsedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the screen width in raw pixels.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial int ScreenWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the screen height in raw pixels.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial int ScreenHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An effect for an animated pixel shader.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of pixel shader to render.</typeparam>
|
||||
/// <param name="factory">The input <typeparamref name="T"/> factory.</param>
|
||||
public sealed partial class For<T>(For<T>.Factory factory) : PixelShaderEffect
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="PixelShaderEffect{T}"/> node in use.
|
||||
/// </summary>
|
||||
private static readonly CanvasEffectNode<PixelShaderEffect<T>> Effect = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ConfigureEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.GetNode(Effect).ConstantBuffer = factory(ElapsedTime, ScreenWidth, ScreenHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A factory of a given shader instance.
|
||||
/// </summary>
|
||||
/// <param name="elapsedTime">The total elapsed time.</param>
|
||||
/// <param name="screenWidth">The screen width in raw pixels.</param>
|
||||
/// <param name="screenHeight">The screen height in raw pixels.</param>
|
||||
/// <returns>A shader instance to render.</returns>
|
||||
public delegate T Factory(TimeSpan elapsedTime, int screenWidth, int screenHeight);
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.UI.Windowing;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
using BitmapSize = Windows.Graphics.Imaging.BitmapSize;
|
||||
using CanvasDevice = Microsoft.Graphics.Canvas.CanvasDevice;
|
||||
using CanvasDrawingSession = Microsoft.Graphics.Canvas.CanvasDrawingSession;
|
||||
using CanvasSwapChain = Microsoft.Graphics.Canvas.CanvasSwapChain;
|
||||
using DirectXPixelFormat = Windows.Graphics.DirectX.DirectXPixelFormat;
|
||||
|
||||
/// <summary>
|
||||
/// A simple Win32 application handling a D2D swapchain.
|
||||
/// </summary>
|
||||
internal sealed class Win32Application
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="CanvasDevice"/> instance to use.
|
||||
/// </summary>
|
||||
private CanvasDevice? canvasDevice;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CanvasSwapChain"/> instance to use to render frames.
|
||||
/// </summary>
|
||||
private CanvasSwapChain? canvasSwapChain;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the window has been resized and requires the buffers to be updated.
|
||||
/// </summary>
|
||||
private volatile bool isResizePending;
|
||||
|
||||
/// <summary>
|
||||
/// The current screen width in raw pixels.
|
||||
/// </summary>
|
||||
private uint screenWidth;
|
||||
|
||||
/// <summary>
|
||||
/// The current screen height in raw pixels.
|
||||
/// </summary>
|
||||
private uint screenHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Raised whenever a draw operation can be performed.
|
||||
/// </summary>
|
||||
public event EventHandler<DrawEventArgs>? Draw;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the current application.
|
||||
/// </summary>
|
||||
/// <param name="appWindow">The window to show.</param>
|
||||
[MemberNotNull(nameof(canvasDevice))]
|
||||
[MemberNotNull(nameof(canvasSwapChain))]
|
||||
public unsafe void OnInitialize(AppWindow appWindow)
|
||||
{
|
||||
// Create a new canvas device, which will handle DX11/D2D initialization
|
||||
CanvasDevice canvasDevice = new();
|
||||
CanvasSwapChain canvasSwapChain = CanvasSwapChain.CreateForWindowId(
|
||||
resourceCreator: canvasDevice,
|
||||
windowId: appWindow.Id,
|
||||
width: this.screenWidth = 1,
|
||||
height: this.screenHeight = 1,
|
||||
dpi: 96.0f);
|
||||
|
||||
// Save the Win2D objects for later use
|
||||
this.canvasDevice = canvasDevice;
|
||||
this.canvasSwapChain = canvasSwapChain;
|
||||
|
||||
// Request a resize before the first draw operation
|
||||
this.isResizePending = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the current application.
|
||||
/// </summary>
|
||||
public void OnResize()
|
||||
{
|
||||
this.isResizePending = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current application.
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
public void OnUpdate(TimeSpan time)
|
||||
{
|
||||
if (this.isResizePending)
|
||||
{
|
||||
// Resize the swapchain if needed (the size is calculated automatically)
|
||||
this.canvasSwapChain!.ResizeBuffers(
|
||||
newWidth: 0,
|
||||
newHeight: 0,
|
||||
newDpi: 96.0f,
|
||||
newFormat: DirectXPixelFormat.Unknown,
|
||||
bufferCount: 0);
|
||||
|
||||
BitmapSize bitmapSize = this.canvasSwapChain!.SizeInPixels;
|
||||
|
||||
this.screenWidth = bitmapSize.Width;
|
||||
this.screenHeight = bitmapSize.Height;
|
||||
|
||||
this.isResizePending = false;
|
||||
}
|
||||
|
||||
// Create the drawing session and invoke all registered draw handler
|
||||
using (CanvasDrawingSession canvasDrawingSession = this.canvasSwapChain!.CreateDrawingSession(default))
|
||||
{
|
||||
Draw?.Invoke(this, new DrawEventArgs
|
||||
{
|
||||
ScreenWidth = this.screenWidth,
|
||||
ScreenHeight = this.screenHeight,
|
||||
TotalTime = time,
|
||||
DrawingSession = canvasDrawingSession
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for v-sync
|
||||
this.canvasSwapChain.WaitForVerticalBlank();
|
||||
|
||||
// Present the new frame
|
||||
this.canvasSwapChain.Present(syncInterval: 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arguments for <see cref="Draw"/>.
|
||||
/// </summary>
|
||||
public sealed class DrawEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the screen width in raw pixels.
|
||||
/// </summary>
|
||||
public required uint ScreenWidth { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the screen height in raw pixels.
|
||||
/// </summary>
|
||||
public required uint ScreenHeight { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total time for the rendering loop.
|
||||
/// </summary>
|
||||
public required TimeSpan TotalTime { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CanvasDrawingSession"/> instance to use.
|
||||
/// </summary>
|
||||
public required CanvasDrawingSession DrawingSession { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Windows.UI;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
/// <summary>
|
||||
/// A helper class to manage the creation and execution of Win32 applications.
|
||||
/// </summary>
|
||||
internal static unsafe class Win32ApplicationRunner
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs a specified application and starts the main loop to update its state. This is the entry point for a given application,
|
||||
/// and it should be called as soon as the process is launched, excluding any other additional initialization needed.
|
||||
/// </summary>
|
||||
/// <param name="application">The input application instance to run.</param>
|
||||
/// <param name="windowTitle">The title to use for the window being opened.</param>
|
||||
public static void Run(Win32Application application, string windowTitle)
|
||||
{
|
||||
// Create the 'AppWindow' instance (a thin wrapper for an 'HWND')
|
||||
AppWindow appWindow = AppWindow.Create();
|
||||
|
||||
appWindow.Title = windowTitle;
|
||||
appWindow.TitleBar.ExtendsContentIntoTitleBar = true;
|
||||
|
||||
// Transparent colors for the title bar
|
||||
appWindow.TitleBar.ForegroundColor = Colors.Transparent;
|
||||
appWindow.TitleBar.BackgroundColor = Colors.Transparent;
|
||||
appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||
appWindow.TitleBar.InactiveBackgroundColor = Colors.Transparent;
|
||||
appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||
|
||||
// Theme aware colors for the title bar
|
||||
appWindow.TitleBar.ButtonForegroundColor = Colors.White;
|
||||
appWindow.TitleBar.ButtonHoverForegroundColor = Colors.White;
|
||||
appWindow.TitleBar.ButtonPressedForegroundColor = Colors.White;
|
||||
appWindow.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF);
|
||||
appWindow.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF);
|
||||
appWindow.TitleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF);
|
||||
appWindow.TitleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0);
|
||||
|
||||
// Initialize the application
|
||||
application.OnInitialize(appWindow);
|
||||
|
||||
// Setup the render thread that enables smooth resizing of the window
|
||||
Thread renderThread = new(static args =>
|
||||
{
|
||||
(Win32Application application, CancellationToken token) = ((Win32Application, CancellationToken))args!;
|
||||
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
application.OnUpdate(stopwatch.Elapsed);
|
||||
}
|
||||
});
|
||||
|
||||
CancellationTokenSource tokenSource = new();
|
||||
|
||||
// Start the render thread before activating the window.
|
||||
// This allows the app to show up while already drawing.
|
||||
renderThread.Start((application, tokenSource.Token));
|
||||
|
||||
// Register a callback to monitor resize operations
|
||||
appWindow.Changed += (s, e) =>
|
||||
{
|
||||
if (e.DidSizeChange)
|
||||
{
|
||||
application.OnResize();
|
||||
}
|
||||
};
|
||||
|
||||
DispatcherQueueController dispatcherQueueController = DispatcherQueueController.CreateOnCurrentThread();
|
||||
|
||||
// Bind the window to a 'DispatcherQueue' instance, so it can flow the exit message
|
||||
appWindow.AssociateWithDispatcherQueue(dispatcherQueueController.DispatcherQueue);
|
||||
|
||||
// Enqueue the exit message when the window is closed. This ensures that
|
||||
// the process actually terminates after closing the window, as expected.
|
||||
appWindow.Closing += static (s, e) => s.DispatcherQueue.EnqueueEventLoopExit();
|
||||
|
||||
// Display the window
|
||||
appWindow.Show(activateWindow: true);
|
||||
|
||||
// Process any messages in the queue
|
||||
dispatcherQueueController.DispatcherQueue.RunEventLoop(DispatcherRunOptions.QuitOnlyLocalLoop, deferral: null);
|
||||
|
||||
tokenSource.Cancel();
|
||||
|
||||
// Wait for the render thread to stop before terminating
|
||||
renderThread.Join();
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' == 'true'">Exe</OutputType>
|
||||
<OutputType Condition="'$(CI_RUNNER_SAMPLES_INTEGRATION_TESTS)' != 'true'">WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621</TargetFramework>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<AssemblyName>computesharp.d2d1.cli</AssemblyName>
|
||||
<ApplicationIcon>..\..\assets\icon.ico</ApplicationIcon>
|
||||
|
||||
<!--
|
||||
Use WinAppSDK in self-contained mode, because the sample app is unpackaged.
|
||||
This keeps things simple, without the need to manage dynamic dependencies.
|
||||
-->
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
<!--
|
||||
Generate a .pdb file to avoid IIDOptimizer build errors.
|
||||
See: https://github.com/microsoft/CsWinRT/issues/1478.
|
||||
-->
|
||||
<DebugType>full</DebugType>
|
||||
|
||||
<!-- Suppress warnings for using directives inside namespaces (needed to avoid some WinRT conflicts) -->
|
||||
<NoWarn>$(NoWarn);IDE0065</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- CsWinRT size saving options (same as in ComputeSharp.NativeLibrary.WinRT) -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTEnableDynamicObjectsSupport>false</CsWinRTEnableDynamicObjectsSupport>
|
||||
<CsWinRTUseExceptionResourceKeys>true</CsWinRTUseExceptionResourceKeys>
|
||||
<CsWinRTEnableDefaultCustomTypeMappings>false</CsWinRTEnableDefaultCustomTypeMappings>
|
||||
<CsWinRTEnableICustomPropertyProviderSupport>false</CsWinRTEnableICustomPropertyProviderSupport>
|
||||
<CsWinRTEnableIDynamicInterfaceCastableSupport>false</CsWinRTEnableIDynamicInterfaceCastableSupport>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Options for R2R publishing -->
|
||||
<PropertyGroup Condition="'$(COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_R2R)' == 'true'">
|
||||
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<SelfContained>true</SelfContained>
|
||||
|
||||
<!-- Using 'PublishSingleFile' requires 'EnableMsixTooling' for embedded resources.pri generation-->
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Same optional NativeAOT property group as in ComputeSharp.SwapChain.Cli -->
|
||||
<PropertyGroup Condition="'$(COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT)' == 'true'">
|
||||
<PublishAot>true</PublishAot>
|
||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<StackTraceSupport>false</StackTraceSupport>
|
||||
<OptimizationPreference>Speed</OptimizationPreference>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.26100.2" />
|
||||
|
||||
<!--
|
||||
Reference CsWinRT locally for the source generators (see comments in ComputeSharp.D2D1.WinUI).
|
||||
Note that this is an executable and not a library, so we must drop the 'PrivateAssets' here.
|
||||
-->
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Note: using SetPlatform="Platform=AnyCPU" for the analyzers to avoid issues (see https://github.com/dotnet/roslyn/issues/70148) -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" SetPlatform="Platform=AnyCPU" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" SetPlatform="Platform=AnyCPU" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI.SourceGenerators\ComputeSharp.D2D1.WinUI.SourceGenerators.csproj" SetPlatform="Platform=AnyCPU" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\ComputeSharp.SwapChain.Shaders.D2D1\ComputeSharp.SwapChain.Shaders.D2D1.projitems" Label="Shared" />
|
||||
</Project>
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp.SwapChain.D2D1.Backend;
|
||||
using ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
// Accepted inputs:
|
||||
// - []
|
||||
// - [<SHADER_NAME>]
|
||||
if (args is [] or [_])
|
||||
{
|
||||
// If there are no args, just run the default shader
|
||||
if (args is not [string shaderName])
|
||||
{
|
||||
shaderName = nameof(ColorfulInfinity);
|
||||
}
|
||||
|
||||
// Get the requested shader, if possible
|
||||
PixelShaderEffect? effect = shaderName.ToLowerInvariant() switch
|
||||
{
|
||||
"helloworld" => new PixelShaderEffect.For<HelloWorld>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"colorfulinfinity" => new PixelShaderEffect.For<ColorfulInfinity>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"fractaltiling" => new PixelShaderEffect.For<FractalTiling>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"twotiledtruchet" => new PixelShaderEffect.For<TwoTiledTruchet>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"mengerjourney" => new PixelShaderEffect.For<MengerJourney>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"octagrams" => new PixelShaderEffect.For<Octagrams>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"proteanclouds" => new PixelShaderEffect.For<ProteanClouds>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"pyramidpattern" => new PixelShaderEffect.For<PyramidPattern>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"trianglegridcontouring" => new PixelShaderEffect.For<TriangleGridContouring>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
"terracedhills" => new PixelShaderEffect.For<TerracedHills>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
_ => null
|
||||
};
|
||||
|
||||
// If a shader is found, run it
|
||||
if (effect is not null)
|
||||
{
|
||||
Win32Application application = new();
|
||||
|
||||
application.Draw += (_, e) =>
|
||||
{
|
||||
// Set the effect properties
|
||||
effect.ElapsedTime = e.TotalTime;
|
||||
effect.ScreenWidth = (int)e.ScreenWidth;
|
||||
effect.ScreenHeight = (int)e.ScreenHeight;
|
||||
|
||||
// Draw the effect
|
||||
e.DrawingSession.DrawImage(effect);
|
||||
};
|
||||
|
||||
Win32ApplicationRunner.Run(application, "ComputeSharp.D2D1");
|
||||
|
||||
return S.S_OK;
|
||||
}
|
||||
|
||||
// If no shader matches, check if help was requested
|
||||
if (shaderName is "-h")
|
||||
{
|
||||
Console.WriteLine($"""
|
||||
Available shaders:
|
||||
|
||||
- {nameof(HelloWorld)}
|
||||
- {nameof(ColorfulInfinity)}
|
||||
- {nameof(FractalTiling)}
|
||||
- {nameof(TwoTiledTruchet)}
|
||||
- {nameof(MengerJourney)}
|
||||
- {nameof(Octagrams)}
|
||||
- {nameof(ProteanClouds)}
|
||||
- {nameof(PyramidPattern)}
|
||||
- {nameof(TriangleGridContouring)}
|
||||
- {nameof(TerracedHills)}
|
||||
""");
|
||||
|
||||
return S.S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return E.E_INVALIDARG;
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
@@ -1,120 +0,0 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.SwapChain.D2D1.Backend;
|
||||
using ComputeSharp.SwapChain.D2D1.Extensions;
|
||||
using ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A sample app rendering D2D shaders into a <see cref="CoreWindow"/> instance.
|
||||
/// </summary>
|
||||
public sealed partial class App : IFrameworkViewSource, IFrameworkView
|
||||
{
|
||||
/// <summary>
|
||||
/// The collection of available pixel shader effects.
|
||||
/// </summary>
|
||||
private static readonly PixelShaderEffect[] Effects =
|
||||
[
|
||||
new PixelShaderEffect.For<ColorfulInfinity>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<FractalTiling>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<TwoTiledTruchet>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<MengerJourney>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<Octagrams>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<ProteanClouds>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<PyramidPattern>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<TriangleGridContouring>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height))),
|
||||
new PixelShaderEffect.For<TerracedHills>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CoreApplicationView"/> for the current app instance.
|
||||
/// </summary>
|
||||
private CoreApplicationView? applicationView;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CoreWindow"/> used to display the app content.
|
||||
/// </summary>
|
||||
private CoreWindow? window;
|
||||
|
||||
/// <summary>
|
||||
/// The currently selected effect (one of the items in <see cref="Effects"/>).
|
||||
/// </summary>
|
||||
private PixelShaderEffect selectedEffect = Effects[0];
|
||||
|
||||
/// <summary>
|
||||
/// The entry point for the application.
|
||||
/// </summary>
|
||||
public static void Main()
|
||||
{
|
||||
CoreApplication.Run(new App());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IFrameworkView CreateView()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MemberNotNull(nameof(applicationView))]
|
||||
public void Initialize(CoreApplicationView applicationView)
|
||||
{
|
||||
this.applicationView = applicationView;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MemberNotNull(nameof(window))]
|
||||
public void SetWindow(CoreWindow window)
|
||||
{
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Load(string entryPoint)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Run()
|
||||
{
|
||||
this.applicationView!.TitleBar.ExtendViewIntoTitleBar = true;
|
||||
|
||||
ApplicationView.GetForCurrentView().TitleBar.StyleTitleBarForExtendedIntoViewMode();
|
||||
|
||||
// Switch the shader to use when pressing the number keys
|
||||
this.window!.CharacterReceived += (s, e) =>
|
||||
{
|
||||
if (e.KeyCode is >= '1' and <= '9')
|
||||
{
|
||||
this.selectedEffect = Effects[(int)(e.KeyCode - '1')];
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
};
|
||||
|
||||
CoreWindowApplication application = new();
|
||||
|
||||
application.Draw += (s, e) =>
|
||||
{
|
||||
PixelShaderEffect effect = this.selectedEffect;
|
||||
|
||||
// Set the effect properties
|
||||
effect.ElapsedTime = e.TotalTime;
|
||||
effect.ScreenWidth = (int)e.ScreenWidth;
|
||||
effect.ScreenHeight = (int)e.ScreenHeight;
|
||||
|
||||
// Draw the effect
|
||||
e.DrawingSession.DrawImage(effect);
|
||||
};
|
||||
|
||||
CoreWindowApplicationRunner.Run(application, this.window);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Uninitialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
変更前 幅: | 高さ: | サイズ: 432 B |
|
変更前 幅: | 高さ: | サイズ: 8.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 796 B |
|
変更前 幅: | 高さ: | サイズ: 2.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.2 KiB |
@@ -1,142 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Windows.Graphics.Display;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
/// <summary>
|
||||
/// A simple <see cref="CoreWindow"/> application handling a D2D swapchain.
|
||||
/// </summary>
|
||||
internal sealed class CoreWindowApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="CanvasDevice"/> instance to use.
|
||||
/// </summary>
|
||||
private CanvasDevice? canvasDevice;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CanvasSwapChain"/> instance to use to render frames.
|
||||
/// </summary>
|
||||
private CanvasSwapChain? canvasSwapChain;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the window has been resized and requires the buffers to be updated.
|
||||
/// </summary>
|
||||
private volatile bool isResizePending;
|
||||
|
||||
/// <summary>
|
||||
/// The current screen width in raw pixels.
|
||||
/// </summary>
|
||||
private uint screenWidth;
|
||||
|
||||
/// <summary>
|
||||
/// The current screen height in raw pixels.
|
||||
/// </summary>
|
||||
private uint screenHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Raised whenever a draw operation can be performed.
|
||||
/// </summary>
|
||||
public event EventHandler<DrawEventArgs>? Draw;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the current application.
|
||||
/// </summary>
|
||||
/// <param name="window">The <see cref="CoreWindow"/> instance.</param>
|
||||
[MemberNotNull(nameof(canvasDevice))]
|
||||
[MemberNotNull(nameof(canvasSwapChain))]
|
||||
public unsafe void OnInitialize(CoreWindow window)
|
||||
{
|
||||
// Create a new canvas device, which will handle DX11/D2D initialization
|
||||
CanvasDevice canvasDevice = new();
|
||||
|
||||
// Create the swapchain for rendering (it is automatically tied to the window)
|
||||
CanvasSwapChain canvasSwapChain = CanvasSwapChain.CreateForCoreWindow(
|
||||
resourceCreator: canvasDevice,
|
||||
coreWindow: window,
|
||||
dpi: DisplayInformation.GetForCurrentView().LogicalDpi);
|
||||
|
||||
// Save the Win2D objects for later use
|
||||
this.canvasDevice = canvasDevice;
|
||||
this.canvasSwapChain = canvasSwapChain;
|
||||
|
||||
// Store the initial size of the screen
|
||||
this.screenWidth = canvasSwapChain.SizeInPixels.Width;
|
||||
this.screenHeight = canvasSwapChain.SizeInPixels.Height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the current application.
|
||||
/// </summary>
|
||||
public void OnResize()
|
||||
{
|
||||
this.isResizePending = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current application.
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
public void OnUpdate(TimeSpan time)
|
||||
{
|
||||
if (this.isResizePending)
|
||||
{
|
||||
// Resize the swapchain if needed (the size is calculated automatically)
|
||||
this.canvasSwapChain!.ResizeBuffers(0, 0);
|
||||
|
||||
BitmapSize bitmapSize = this.canvasSwapChain!.SizeInPixels;
|
||||
|
||||
this.screenWidth = bitmapSize.Width;
|
||||
this.screenHeight = bitmapSize.Height;
|
||||
|
||||
this.isResizePending = false;
|
||||
}
|
||||
|
||||
// Create the drawing session and invoke all registered draw handler
|
||||
using (CanvasDrawingSession canvasDrawingSession = this.canvasSwapChain!.CreateDrawingSession(default))
|
||||
{
|
||||
Draw?.Invoke(this, new DrawEventArgs
|
||||
{
|
||||
ScreenWidth = this.screenWidth,
|
||||
ScreenHeight = this.screenHeight,
|
||||
TotalTime = time,
|
||||
DrawingSession = canvasDrawingSession
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for v-sync
|
||||
this.canvasSwapChain.WaitForVerticalBlank();
|
||||
|
||||
// Present the new frame
|
||||
this.canvasSwapChain.Present(syncInterval: 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arguments for <see cref="Draw"/>.
|
||||
/// </summary>
|
||||
public sealed class DrawEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the screen width in raw pixels.
|
||||
/// </summary>
|
||||
public required uint ScreenWidth { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the screen height in raw pixels.
|
||||
/// </summary>
|
||||
public required uint ScreenHeight { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total time for the rendering loop.
|
||||
/// </summary>
|
||||
public required TimeSpan TotalTime { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CanvasDrawingSession"/> instance to use.
|
||||
/// </summary>
|
||||
public required CanvasDrawingSession DrawingSession { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
/// <summary>
|
||||
/// A helper class to manage the creation and execution of <see cref="CoreWindow"/> applications.
|
||||
/// </summary>
|
||||
internal static class CoreWindowApplicationRunner
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs a specified application and starts the main loop to update its state. This is the entry point for a given application,
|
||||
/// and it should be called as soon as the process is launched, excluding any other additional initialization needed.
|
||||
/// </summary>
|
||||
/// <param name="application">The input application instance to run.</param>
|
||||
/// <param name="window">The <see cref="CoreWindow"/> instance.</param>
|
||||
public static void Run(CoreWindowApplication application, CoreWindow window)
|
||||
{
|
||||
// Initialize the application
|
||||
application.OnInitialize(window);
|
||||
|
||||
// Setup the render thread that enables smooth resizing of the window
|
||||
Thread renderThread = new(static args =>
|
||||
{
|
||||
(CoreWindowApplication application, CancellationToken token) = ((CoreWindowApplication, CancellationToken))args!;
|
||||
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
application.OnUpdate(stopwatch.Elapsed);
|
||||
}
|
||||
});
|
||||
|
||||
CancellationTokenSource tokenSource = new();
|
||||
|
||||
// Start the render thread before activating the window.
|
||||
// This allows the app to show up while already drawing.
|
||||
renderThread.Start((application, tokenSource.Token));
|
||||
|
||||
// Register a callback to monitor resize operations
|
||||
window.ResizeCompleted += (s, e) => application.OnResize();
|
||||
|
||||
// Activate the window
|
||||
window.Activate();
|
||||
|
||||
// Process any messages in the queue
|
||||
window.Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessUntilQuit);
|
||||
|
||||
tokenSource.Cancel();
|
||||
|
||||
// Wait for the render thread to stop before terminating
|
||||
renderThread.Join();
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp.D2D1;
|
||||
using ComputeSharp.D2D1.Descriptors;
|
||||
using ComputeSharp.D2D1.Uwp;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Backend;
|
||||
|
||||
/// <summary>
|
||||
/// An base effect for an animated pixel shader.
|
||||
/// </summary>
|
||||
internal abstract partial class PixelShaderEffect : CanvasEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the total elapsed time.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial TimeSpan ElapsedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the screen width in raw pixels.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial int ScreenWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the screen height in raw pixels.
|
||||
/// </summary>
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public partial int ScreenHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An effect for an animated pixel shader.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of pixel shader to render.</typeparam>
|
||||
/// <param name="factory">The input <typeparamref name="T"/> factory.</param>
|
||||
public sealed partial class For<T>(For<T>.Factory factory) : PixelShaderEffect
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="PixelShaderEffect{T}"/> node in use.
|
||||
/// </summary>
|
||||
private static readonly CanvasEffectNode<PixelShaderEffect<T>> Effect = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ConfigureEffectGraph(CanvasEffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.GetNode(Effect).ConstantBuffer = factory(ElapsedTime, ScreenWidth, ScreenHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A factory of a given shader instance.
|
||||
/// </summary>
|
||||
/// <param name="elapsedTime">The total elapsed time.</param>
|
||||
/// <param name="screenWidth">The screen width in raw pixels.</param>
|
||||
/// <param name="screenHeight">The screen height in raw pixels.</param>
|
||||
/// <returns>A shader instance to render.</returns>
|
||||
public delegate T Factory(TimeSpan elapsedTime, int screenWidth, int screenHeight);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<UseUwp>true</UseUwp>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
<EnableXamlCompilerTargetsForUwpApps>false</EnableXamlCompilerTargetsForUwpApps>
|
||||
|
||||
<!-- Temporary workaround until VS 17.14 GA -->
|
||||
<MicrosoftWindowsSdkBuildToolsMSIXPackageVersion>1.3.20250314.1</MicrosoftWindowsSdkBuildToolsMSIXPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- NativeAOT settings, and size saving options for unnecessary features (optimize for speed otherwise) -->
|
||||
<PropertyGroup>
|
||||
<PublishAot>true</PublishAot>
|
||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<StackTraceSupport>false</StackTraceSupport>
|
||||
<OptimizationPreference>Speed</OptimizationPreference>
|
||||
<CsWinRTEnableDynamicObjectsSupport>false</CsWinRTEnableDynamicObjectsSupport>
|
||||
<CsWinRTUseExceptionResourceKeys>true</CsWinRTUseExceptionResourceKeys>
|
||||
<CsWinRTEnableDefaultCustomTypeMappings>false</CsWinRTEnableDefaultCustomTypeMappings>
|
||||
<CsWinRTEnableICustomPropertyProviderSupport>false</CsWinRTEnableICustomPropertyProviderSupport>
|
||||
<CsWinRTEnableIDynamicInterfaceCastableSupport>false</CsWinRTEnableIDynamicInterfaceCastableSupport>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
If experimental support for Xbox is enabled, link against 'WindowsApp.lib'.
|
||||
Additionally, set the AppContainer switch, as Xbox might be validating that.
|
||||
-->
|
||||
<ItemGroup Condition="'$(EXPERIMENTAL_XBOX_SUPPORT)' == 'true'">
|
||||
<LinkerArg Include="/APPCONTAINER /DEFAULTLIB:WindowsApp.lib WindowsApp.lib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.Uwp.SourceGenerators\ComputeSharp.D2D1.Uwp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.Uwp\ComputeSharp.D2D1.Uwp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Shared projects for the D2D1 shaders -->
|
||||
<Import Project="..\ComputeSharp.SwapChain.Shaders.D2D1\ComputeSharp.SwapChain.Shaders.D2D1.projitems" Label="Shared" />
|
||||
</Project>
|
||||
@@ -1,33 +0,0 @@
|
||||
using Windows.UI;
|
||||
using Windows.UI.ViewManagement;
|
||||
|
||||
namespace ComputeSharp.SwapChain.D2D1.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for <see cref="ApplicationViewTitleBar"/>.
|
||||
/// </summary>
|
||||
internal static class ApplicationViewTitleBarExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Styles the title bar to look correctly when the view is expanded into it.
|
||||
/// </summary>
|
||||
/// <param name="titleBar">The input title bar.</param>
|
||||
public static void StyleTitleBarForExtendedIntoViewMode(this ApplicationViewTitleBar titleBar)
|
||||
{
|
||||
// Transparent colors
|
||||
titleBar.ForegroundColor = Colors.Transparent;
|
||||
titleBar.BackgroundColor = Colors.Transparent;
|
||||
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||
titleBar.InactiveBackgroundColor = Colors.Transparent;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||
|
||||
// Theme aware colors
|
||||
titleBar.ButtonForegroundColor = Colors.White;
|
||||
titleBar.ButtonHoverForegroundColor = Colors.White;
|
||||
titleBar.ButtonPressedForegroundColor = Colors.White;
|
||||
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
|
||||
IgnorableNamespaces="uap uap5 mp">
|
||||
|
||||
<Identity
|
||||
Name="b0b35275-65a6-4b18-96bf-8b79fb4bb0bf"
|
||||
Publisher="CN=Sergio"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="b0b35275-65a6-4b18-96bf-8b79fb4bb0bf" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>ComputeSharp Sample App (Core)</DisplayName>
|
||||
<PublisherDisplayName>Sergio Pedri</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="ComputeSharp.SwapChain.D2D1.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="ComputeSharp Sample App (Core)"
|
||||
Description="A sample app for ComputeSharp using CoreApplication and Win2D"
|
||||
BackgroundColor="#005491"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" uap5:Optional="true" BackgroundColor="transparent" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<Platform>ARM64</Platform>
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
|
||||
<PublishAot>true</PublishAot>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<Platform>x64</Platform>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
|
||||
<PublishAot>true</PublishAot>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ComputeSharp.SwapChain.D2D1.Uwp": {
|
||||
"commandName": "MsixPackage"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A shader creating an abstract and colorful animation.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/WtjyzR"/>.
|
||||
/// <para>Created by Benoit Marini.</para>
|
||||
/// <para>License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct ColorfulInfinity(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
/// The total number of layers for the final animation.
|
||||
/// </summary>
|
||||
private const float NumberOfLayers = 16.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The number of iterations to calculate a texel value.
|
||||
/// </summary>
|
||||
private const int NumberOfIterations = 23;
|
||||
|
||||
/// <summary>
|
||||
/// Makes some magic happen.
|
||||
/// </summary>
|
||||
private float4 Tex(float3 p)
|
||||
{
|
||||
float t = time + 78.0f;
|
||||
float4 o = new(p.X, p.Y, p.Z, 3.0f * Hlsl.Sin(t * 0.1f));
|
||||
float4 dec =
|
||||
new float4(1.0f, 0.9f, 0.1f, 0.15f) +
|
||||
new float4(0.06f * Hlsl.Cos(t * 0.1f), 0, 0, 0.14f * Hlsl.Cos(t * 0.23f));
|
||||
|
||||
for (int i = 0; i++ < NumberOfIterations;)
|
||||
{
|
||||
o.XZYW = Hlsl.Abs((o / Hlsl.Dot(o, o)) - dec);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 uv = (xy - ((float2)dispatchSize * 0.5f)) / dispatchSize.Y;
|
||||
float3 col = 0;
|
||||
float t = time * 0.3f;
|
||||
|
||||
for (float i = 0.0f; i <= 1.0f; i += 1.0f / NumberOfLayers)
|
||||
{
|
||||
float d = Hlsl.Frac(i + t);
|
||||
float s = Hlsl.Lerp(5.0f, 0.5f, d);
|
||||
float f = d * Hlsl.SmoothStep(1.0f, 0.9f, d);
|
||||
|
||||
col += Tex(new float3(uv.X * s, uv.Y * s, i * 4.0f)).XYZ * f;
|
||||
}
|
||||
|
||||
col /= NumberOfLayers;
|
||||
col *= new float3(2, 1.0f, 2.0f);
|
||||
col = Hlsl.Pow(col, 0.5f);
|
||||
|
||||
return new(col.X, col.Y, col.Z, 1.0f);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' < '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>f8bf7666-7ccf-4fe4-b055-2eba4bcd4564</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>ComputeSharp.SwapChain.Shaders.D2D1</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ColorfulInfinity.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ContouredLayers.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)FractalTiling.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HelloWorld.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MengerJourney.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Octagrams.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ProteanClouds.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)PyramidPattern.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)TerracedHills.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)TriangleGridContouring.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)TwoTiledTruchet.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>f8bf7666-7ccf-4fe4-b055-2eba4bcd4564</ProjectGuid>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="ComputeSharp.SwapChain.Shaders.D2D1.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,203 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// Constructing some concise contoured layers, then applying various edge and shading effects to produce some faux depth.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/3lj3zt"/>.
|
||||
/// <para>Created by Shane.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct ContouredLayers(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
/// The background texture to sample.
|
||||
/// </summary>
|
||||
[D2DResourceTextureIndex(0)]
|
||||
private readonly D2D1ResourceTexture2D<float4> texture;
|
||||
|
||||
// float3 to float hash.
|
||||
private static float Hash21(float2 p)
|
||||
{
|
||||
return Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289))) * 45758.5453f);
|
||||
}
|
||||
|
||||
// float2 to float2 hash.
|
||||
private float2 Hash22(float2 p)
|
||||
{
|
||||
float n = Hlsl.Sin(Hlsl.Dot(p, new float2(1, 113)));
|
||||
|
||||
p = Hlsl.Frac(new float2(262144, 32768) * n);
|
||||
|
||||
return Hlsl.Sin((p * 6.2831853f) + time);
|
||||
}
|
||||
|
||||
// float2 to float2 hash.
|
||||
private static float2 Hash22B(float2 p)
|
||||
{
|
||||
float n = Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289)));
|
||||
|
||||
return (Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f) - 1.0f;
|
||||
}
|
||||
|
||||
// Smooth 2D noise
|
||||
private static float Noise2D(float2 p)
|
||||
{
|
||||
float2 i = Hlsl.Floor(p);
|
||||
|
||||
p -= i;
|
||||
|
||||
float4 v = default;
|
||||
|
||||
v.X = Hlsl.Dot(Hash22B(i), p);
|
||||
v.Y = Hlsl.Dot(Hash22B(i + float2.UnitX), p - float2.UnitX);
|
||||
v.Z = Hlsl.Dot(Hash22B(i + float2.UnitY), p - float2.UnitY);
|
||||
v.W = Hlsl.Dot(Hash22B(i + 1.0f), p - 1.0f);
|
||||
|
||||
p = p * p * (3.0f - (2.0f * p));
|
||||
|
||||
return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y);
|
||||
}
|
||||
|
||||
// Based on IQ's gradient noise formula.
|
||||
private float Noise2D3G(float2 p)
|
||||
{
|
||||
float2 i = Hlsl.Floor(p);
|
||||
|
||||
p -= i;
|
||||
|
||||
float4 v = default;
|
||||
|
||||
v.X = Hlsl.Dot(Hash22(i), p);
|
||||
v.Y = Hlsl.Dot(Hash22(i + float2.UnitX), p - float2.UnitX);
|
||||
v.Z = Hlsl.Dot(Hash22(i + float2.UnitY), p - float2.UnitY);
|
||||
v.W = Hlsl.Dot(Hash22(i + 1.0f), p - 1.0f);
|
||||
|
||||
p = p * p * p * ((p * ((p * 6.0f) - 15.0f)) + 10.0f);
|
||||
|
||||
return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y);
|
||||
}
|
||||
|
||||
// Map function with noise layers
|
||||
private float MapNoise(float3 p, float i)
|
||||
{
|
||||
return (Noise2D3G(p.XY * 3.0f) * 0.66f) + (Noise2D3G(p.XY * 6.0f) * 0.34f) + (i / 10.0f * 1.0f) - 0.15f;
|
||||
}
|
||||
|
||||
// 2D derivative function.
|
||||
private float3 GetNormal(in float3 p, float m, float i)
|
||||
{
|
||||
float2 e = new(0.001f, 0);
|
||||
|
||||
return new float3(m - MapNoise(p - e.XYY, i), m - MapNoise(p - e.YXY, i), 0.0f) / e.X * 1.4142f;
|
||||
}
|
||||
|
||||
// The map layer and its derivative
|
||||
private float4 MapLayer(in float3 p, float i)
|
||||
{
|
||||
float4 d = default;
|
||||
|
||||
d.X = MapNoise(p, i);
|
||||
d.YZW = GetNormal(p, d.X, i);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
// Layer color. Based on the shade, layer number and smoothing factor.
|
||||
private float3 GetColor(float2 p, float sh, float fi)
|
||||
{
|
||||
float3 tx = this.texture.Sample(p + Hash21(new float2(sh, fi))).XYZ;
|
||||
|
||||
tx *= tx;
|
||||
|
||||
float3 col;
|
||||
|
||||
col = (float3)1.0f * (1.0f - (0.75f / (1.0f + (sh * sh * 2.0f))));
|
||||
col = Hlsl.Min(col * tx * 3.0f, 1.0f);
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
// A hatch-like algorithm, or a stipple... or some kind of textured pattern.
|
||||
private float Hatch(float2 p, float res)
|
||||
{
|
||||
p *= res / 16.0f;
|
||||
|
||||
float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f);
|
||||
|
||||
float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f);
|
||||
if (hRnd > 0.66f)
|
||||
{
|
||||
hatch = hRnd;
|
||||
}
|
||||
|
||||
hatch = (hatch * 0.75f) + 0.5f;
|
||||
|
||||
return hatch;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 fragCoord = new(xy.X, dispatchSize.Y - xy.Y);
|
||||
float res = Hlsl.Min(dispatchSize.Y, 700.0f);
|
||||
float2 uv = (fragCoord - ((float2)dispatchSize * 0.5f)) / res;
|
||||
float sf = 1.0f / dispatchSize.Y;
|
||||
float3 col = GetColor(uv, 0.0f, 0.0f);
|
||||
float pL = 0.0f;
|
||||
float hatch = Hatch(uv, res);
|
||||
|
||||
col *= hatch;
|
||||
|
||||
const int lNum = 5;
|
||||
float flNum = lNum;
|
||||
|
||||
for (int i = 0; i < lNum; i++)
|
||||
{
|
||||
float fi = i;
|
||||
|
||||
hatch = Hatch(uv + Hlsl.Sin(new float2(41.0f, 289.0f) * (fi + 1.0f)), res);
|
||||
|
||||
float4 c = MapLayer(new float3(uv, 1.0f), fi);
|
||||
float4 cSh = MapLayer(new float3(uv - (new float2(0.03f, -0.03f) * (((flNum - fi) / flNum * 0.5f) + 0.5f)), 1.0f), fi);
|
||||
float sh = (fi + 1.0f) / flNum;
|
||||
float3 lCol = GetColor(uv, sh, fi + 1.0f);
|
||||
float3 ld = Hlsl.Normalize(new float3(-1, 1, -0.25f));
|
||||
float3 n = Hlsl.Normalize(new float3(0.0f, 0.0f, -1.0f) + c.YZW);
|
||||
float diff = Hlsl.Max(Hlsl.Dot(ld, n), 0.0f);
|
||||
|
||||
diff *= 2.5f;
|
||||
|
||||
float3 eCol = lCol * (diff + 1.0f);
|
||||
float sfL = sf * Hlsl.Length(c.YZX) * 2.0f;
|
||||
float sfLSh = sf * Hlsl.Length(cSh.YZX) * 6.0f;
|
||||
const float shF = 0.5f;
|
||||
|
||||
col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfLSh, Hlsl.Max(cSh.X, pL))) * shF);
|
||||
col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfL * 3.0f, c.X)) * 0.25f);
|
||||
col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X)) * 0.85f);
|
||||
col = Hlsl.Lerp(col, eCol * hatch, 1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + (Hlsl.Length(c.YZX) * 0.003f)));
|
||||
col = Hlsl.Lerp(col, lCol * hatch, 1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + (Hlsl.Length(c.YZX) * 0.006f)));
|
||||
|
||||
pL = c.X;
|
||||
}
|
||||
|
||||
col *= Hlsl.Lerp(new float3(1.8f, 1, 0.7f).ZYX, new float3(1.8f, 1, 0.7f).XZY, Noise2D(uv * 2.0f));
|
||||
|
||||
float3 rn3 = Noise2D((uv * dispatchSize.Y / 1.0f) + 1.7f) - Noise2D((uv * dispatchSize.Y / 1.0f) + 3.4f);
|
||||
|
||||
col *= 0.93f + (0.07f * rn3.XYZ) + (0.07f * Hlsl.Dot(rn3, new float3(0.299f, 0.587f, 0.114f)));
|
||||
|
||||
uv = fragCoord / dispatchSize.XY;
|
||||
|
||||
col *= Hlsl.Pow(Hlsl.Abs(16.0f * uv.X * uv.Y * (1.0f - uv.X) * (1.0f - uv.Y)), 0.0625f);
|
||||
|
||||
return new float4(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A shader creating a fractal tiling animation.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/Ml2GWy"/>.
|
||||
/// <para>Created by Inigo Quilez.</para>
|
||||
/// <para>License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct FractalTiling(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 position = (((float2)(256 * xy)) / dispatchSize.X) + time;
|
||||
float4 color = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float2 a = Hlsl.Floor(position);
|
||||
float2 b = Hlsl.Frac(position);
|
||||
float4 w = Hlsl.Frac(
|
||||
(Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * time)) +
|
||||
new float4(0.035f, 0.01f, 0, 0.7f))
|
||||
* 13.545317f);
|
||||
|
||||
color.XYZ += w.XYZ *
|
||||
2.0f * Hlsl.SmoothStep(0.45f, 0.55f, w.W) *
|
||||
Hlsl.Sqrt(16.0f * b.X * b.Y * (1.0f - b.X) * (1.0f - b.Y));
|
||||
|
||||
position /= 2.0f;
|
||||
color /= 2.0f;
|
||||
}
|
||||
|
||||
color.XYZ = Hlsl.Pow(color.XYZ, new float3(0.7f, 0.8f, 0.5f));
|
||||
color.W = 1.0f;
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A simple shader to get started with based on shadertoy new shader template.
|
||||
/// Ported from <see href="https://www.shadertoy.com/new"/>.
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct HelloWorld(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
|
||||
// Normalized screen space UV coordinates from 0.0 to 1.0
|
||||
float2 uv = xy / (float2)dispatchSize;
|
||||
|
||||
// Time varying pixel color
|
||||
float3 col = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)));
|
||||
|
||||
// Output to screen
|
||||
return new(col, 1f);
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A shader creating a flythrough in a Menger system.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/Mdf3z7"/>.
|
||||
/// <para>Created by Syntopia.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct MengerJourney(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
private const int MaxSteps = 30;
|
||||
private const float MinimumDistance = 0.0009f;
|
||||
private const float NormalDistance = 0.0002f;
|
||||
private const int Iterations = 7;
|
||||
private const float Scale = 3.0f;
|
||||
private const float FieldOfView = 1.0f;
|
||||
private const float Jitter = 0.05f;
|
||||
private const float FudgeFactor = 0.7f;
|
||||
private const float NonLinearPerspective = 2.0f;
|
||||
private const float Ambient = 0.32184f;
|
||||
private const float Diffuse = 0.5f;
|
||||
|
||||
private static readonly float3 LightDir = 1.0f;
|
||||
private static readonly float3 LightColor = new(1.0f, 1.0f, 0.858824f);
|
||||
private static readonly float3 LightDir2 = new(1.0f, -1.0f, 1.0f);
|
||||
private static readonly float3 LightColor2 = new(0, 0.333333f, 1.0f);
|
||||
private static readonly float3 Offset = new(0.92858f, 0.92858f, 0.32858f);
|
||||
|
||||
/// <summary>
|
||||
/// Rotates a given <see cref="float2"/> value by a specified amount.
|
||||
/// </summary>
|
||||
private static float2 Rotate(float2 v, float a)
|
||||
{
|
||||
return new((Hlsl.Cos(a) * v.X) + (Hlsl.Sin(a) * v.Y), (-Hlsl.Sin(a) * v.X) + (Hlsl.Cos(a) * v.Y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the light at a specified normal and starting color.
|
||||
/// Uses two light sources and no specular lights.
|
||||
/// </summary>
|
||||
private static float3 GetLight(in float3 color, in float3 normal)
|
||||
{
|
||||
float3 lightDir = Hlsl.Normalize(LightDir);
|
||||
float diffuse = Hlsl.Max(0.0f, Hlsl.Dot(-normal, lightDir));
|
||||
|
||||
float3 lightDir2 = Hlsl.Normalize(LightDir2);
|
||||
float diffuse2 = Hlsl.Max(0.0f, Hlsl.Dot(-normal, lightDir2));
|
||||
|
||||
return
|
||||
(diffuse * Diffuse * (LightColor * color)) +
|
||||
(diffuse2 * Diffuse * (LightColor2 * color));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DE: Infinitely tiled Menger IFS.
|
||||
/// For more info on KIFS, see <a href="http://www.fractalforums.com/3d-fractal-generation/kaleidoscopic-%28escape-time-ifs%29/"/>
|
||||
/// </summary>
|
||||
private float DE(float3 z)
|
||||
{
|
||||
// Performs the GLSL mod function.
|
||||
static float3 Mod(float3 x, float y)
|
||||
{
|
||||
return x - (y * Hlsl.Floor(x / y));
|
||||
}
|
||||
|
||||
z = Hlsl.Abs(1.0f - Mod(z, 2.0f));
|
||||
|
||||
float d = 1000.0f;
|
||||
|
||||
for (int n = 0; n < Iterations; n++)
|
||||
{
|
||||
z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(time / 8.0f)));
|
||||
z = Hlsl.Abs(z);
|
||||
|
||||
if (z.X < z.Y) { z.XY = z.YX; }
|
||||
|
||||
if (z.X < z.Z) { z.XZ = z.ZX; }
|
||||
|
||||
if (z.Y < z.Z) { z.YZ = z.ZY; }
|
||||
|
||||
z = (Scale * z) - (Offset * (Scale - 1.0f));
|
||||
|
||||
if (z.Z < -0.5f * Offset.Z * (Scale - 1.0f))
|
||||
{
|
||||
z.Z += Offset.Z * (Scale - 1.0f);
|
||||
}
|
||||
|
||||
d = Hlsl.Min(d, Hlsl.Length(z) * Hlsl.Pow(Scale, -n - 1.0f));
|
||||
}
|
||||
|
||||
return d - 0.001f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the finite difference normal at a given position.
|
||||
/// </summary>
|
||||
private float3 GetNormal(in float3 pos)
|
||||
{
|
||||
float3 e = new(0.0f, NormalDistance, 0.0f);
|
||||
|
||||
return Hlsl.Normalize(new float3(
|
||||
DE(pos + e.YXX) - DE(pos - e.YXX),
|
||||
DE(pos + e.XYX) - DE(pos - e.XYX),
|
||||
DE(pos + e.XXY) - DE(pos - e.XXY)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a ray march operation on a specific position.
|
||||
/// </summary>
|
||||
private float4 RayMarch(in float3 from, float3 dir, in float2 fragCoord)
|
||||
{
|
||||
// Computes a pseudo-random number
|
||||
static float Rand(float2 co)
|
||||
{
|
||||
return Hlsl.Frac(Hlsl.Cos(Hlsl.Dot(co, new float2(4.898f, 7.23f))) * 23421.631f);
|
||||
}
|
||||
|
||||
float totalDistance = Jitter * Rand(fragCoord.XY + time);
|
||||
float3 dir2 = dir;
|
||||
float distance = 0;
|
||||
int steps = 0;
|
||||
float3 pos = 0;
|
||||
|
||||
for (int i = 0; i < MaxSteps; i++)
|
||||
{
|
||||
dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(time / 4.0f) * NonLinearPerspective);
|
||||
pos = from + (totalDistance * dir);
|
||||
distance = DE(pos) * FudgeFactor;
|
||||
totalDistance += distance;
|
||||
|
||||
if (distance < MinimumDistance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
steps = i;
|
||||
}
|
||||
|
||||
float smoothStep = steps + (distance / MinimumDistance);
|
||||
float ao = 1.1f - (smoothStep / MaxSteps);
|
||||
float3 normal = GetNormal(pos - (dir * NormalDistance * 3.0f));
|
||||
float3 color = 1.0f;
|
||||
float3 light = GetLight(color, normal);
|
||||
|
||||
color = ((color * Ambient) + light) * ao;
|
||||
|
||||
return new(color.X, color.Y, color.Z, 1.0f);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float3 camPos = 0.5f * time * new float3(1.0f, 0.0f, 0.0f);
|
||||
float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(time), 0.0f * Hlsl.Sin(0.4f * time));
|
||||
float3 camDir = Hlsl.Normalize(target - camPos);
|
||||
float3 camUp = new(0.0f, 1.0f, 0.0f);
|
||||
|
||||
camUp = Hlsl.Normalize(camUp - (Hlsl.Dot(camDir, camUp) * camDir));
|
||||
|
||||
float3 camRight = Hlsl.Normalize(Hlsl.Cross(camDir, camUp));
|
||||
float2 coord = -1.0f + (2.0f * (float2)xy / (float2)dispatchSize);
|
||||
|
||||
coord.X *= dispatchSize.X / (float)dispatchSize.Y;
|
||||
|
||||
float3 rayDir = Hlsl.Normalize(camDir + (((coord.X * camRight) + (coord.Y * camUp)) * FieldOfView));
|
||||
|
||||
return RayMarch(camPos, rayDir, xy);
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A shader creating an octagram animation, inspired by arabesque.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/tlVGDt"/>.
|
||||
/// <para>Created by whisky_shusuky.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct Octagrams(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
private static float2x2 Rotate(float a)
|
||||
{
|
||||
float c = Hlsl.Cos(a);
|
||||
float s = Hlsl.Sin(a);
|
||||
|
||||
return new(c, s, -s, c);
|
||||
}
|
||||
|
||||
private static float Box(float3 pos, float scale)
|
||||
{
|
||||
static float SDBox(float3 p, float3 b)
|
||||
{
|
||||
float3 q = Hlsl.Abs(p) - b;
|
||||
|
||||
return Hlsl.Length(Hlsl.Max(q, 0.0f)) +
|
||||
Hlsl.Min(Hlsl.Max(q.X, Hlsl.Max(q.Y, q.Z)), 0.0f);
|
||||
}
|
||||
|
||||
pos *= scale;
|
||||
|
||||
float b = SDBox(pos, new(0.4f, 0.4f, 0.1f)) / 1.5f;
|
||||
|
||||
pos.XY *= 5.0f;
|
||||
pos.Y -= 3.5f;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.75f));
|
||||
|
||||
return -b;
|
||||
}
|
||||
|
||||
private static float BoxSet(float3 pos, float gTime)
|
||||
{
|
||||
float3 pos_origin = pos;
|
||||
|
||||
pos = pos_origin;
|
||||
pos.Y += Hlsl.Sin(gTime * 0.4f) * 2.5f;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f));
|
||||
|
||||
float box1 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f));
|
||||
|
||||
pos = pos_origin;
|
||||
pos.Y -= Hlsl.Sin(gTime * 0.4f) * 2.5f;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f));
|
||||
|
||||
float box2 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f));
|
||||
|
||||
pos = pos_origin;
|
||||
pos.X += Hlsl.Sin(gTime * 0.4f) * 2.5f;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f));
|
||||
|
||||
float box3 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f));
|
||||
|
||||
pos = pos_origin;
|
||||
pos.X -= Hlsl.Sin(gTime * 0.4f) * 2.5f;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f));
|
||||
|
||||
float box4 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f));
|
||||
|
||||
pos = pos_origin;
|
||||
pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f));
|
||||
|
||||
float box5 = Box(pos, 0.5f) * 6.0f;
|
||||
|
||||
pos = pos_origin;
|
||||
|
||||
float box6 = Box(pos, 0.5f) * 6.0f;
|
||||
float result = Hlsl.Max(Hlsl.Max(Hlsl.Max(Hlsl.Max(Hlsl.Max(box1, box2), box3), box4), box5), box6);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 p = (((float2)xy * 2.0f) - dispatchSize) / Hlsl.Min(dispatchSize.X, dispatchSize.Y);
|
||||
float3 ro = new(0.0f, -0.2f, time * 4.0f);
|
||||
float3 ray = Hlsl.Normalize(new float3(p, 1.5f));
|
||||
|
||||
ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(time * 0.03f) * 5.0f));
|
||||
ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(time * 0.05f) * 0.2f));
|
||||
|
||||
float t = 0.1f;
|
||||
float ac = 0.0f;
|
||||
|
||||
for (int i = 0; i < 99; i++)
|
||||
{
|
||||
static float3 Mod(float3 x, float y)
|
||||
{
|
||||
return x - (y * Hlsl.Floor(x / y));
|
||||
}
|
||||
|
||||
float3 pos = ro + (ray * t);
|
||||
|
||||
pos = Mod(pos - 2.0f, 4.0f) - 2.0f;
|
||||
|
||||
float gTime = time - (i * 0.01f);
|
||||
float d = BoxSet(pos, gTime);
|
||||
|
||||
d = Hlsl.Max(Hlsl.Abs(d), 0.01f);
|
||||
ac += Hlsl.Exp(-d * 23.0f);
|
||||
t += d * 0.55f;
|
||||
}
|
||||
|
||||
float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(time)), 0.5f + (Hlsl.Sin(time) * 0.2f));
|
||||
float4 color = new(col, 1);
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// Fully procedural 3D animated volume with three evaluations per step (for shading).
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/3l23Rh"/>.
|
||||
/// <para>Created by nimitz (twitter: @stormoid).</para>
|
||||
/// <para>License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct ProteanClouds(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
private static readonly float3x3 M3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f;
|
||||
|
||||
private static float2x2 Rotate(in float a)
|
||||
{
|
||||
float c = Hlsl.Cos(a);
|
||||
float s = Hlsl.Sin(a);
|
||||
|
||||
return new(c, s, -s, c);
|
||||
}
|
||||
|
||||
private static float LinStep(in float mn, in float mx, in float x)
|
||||
{
|
||||
return Hlsl.Clamp((x - mn) / (mx - mn), 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
private static float2 Disp(float t)
|
||||
{
|
||||
return new float2(Hlsl.Sin(t * 0.22f) * 1.0f, Hlsl.Cos(t * 0.175f) * 1.0f) * 2.0f;
|
||||
}
|
||||
|
||||
private float2 Map(float3 p, float prm1, float2 bsMo)
|
||||
{
|
||||
float3 p2 = p;
|
||||
|
||||
p2.XY -= Disp(p.Z).XY;
|
||||
p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + time) * (0.1f + (prm1 * 0.05f))) + (time * 0.09f)));
|
||||
|
||||
float cl = Hlsl.Dot(p2.XY, p2.XY);
|
||||
float d = 0.0f;
|
||||
|
||||
p *= 0.61f;
|
||||
|
||||
float z = 1.0f;
|
||||
float trk = 1.0f;
|
||||
float dspAmp = 0.1f + (prm1 * 0.2f);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (time * trk * 0.8f)) * dspAmp;
|
||||
d -= Hlsl.Abs(Hlsl.Dot(Hlsl.Cos(p), Hlsl.Sin(p.YZX)) * z);
|
||||
z *= 0.57f;
|
||||
trk *= 1.4f;
|
||||
|
||||
p = Hlsl.Mul(p, M3);
|
||||
}
|
||||
|
||||
d = Hlsl.Abs(d + (prm1 * 3.0f)) + (prm1 * 0.3f) - 2.5f + bsMo.Y;
|
||||
|
||||
return new float2(d + (cl * 0.2f) + 0.25f, cl);
|
||||
}
|
||||
|
||||
private float4 Render(float3 ro, float3 rd, float prm1, float2 bsMo)
|
||||
{
|
||||
float4 rez = 0;
|
||||
float t = 1.5f;
|
||||
float fogT = 0;
|
||||
|
||||
for (int i = 0; i < 130; i++)
|
||||
{
|
||||
if (rez.A > 0.99f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
float3 pos = ro + (t * rd);
|
||||
float2 mpv = Map(pos, prm1, bsMo);
|
||||
float den = Hlsl.Clamp(mpv.X - 0.3f, 0.0f, 1.0f) * 1.12f;
|
||||
float dn = Hlsl.Clamp(mpv.X + 2.0f, 0.0f, 3.0f);
|
||||
float4 col = 0f;
|
||||
|
||||
if (mpv.X > 0.6f)
|
||||
{
|
||||
|
||||
col = new float4((Hlsl.Sin(new float3(5.0f, 0.4f, 0.2f) + (mpv.Y * 0.1f) + (Hlsl.Sin(pos.Z * 0.4f) * 0.5f) + 1.8f) * 0.5f) + 0.5f, 0.08f);
|
||||
col *= den * den * den;
|
||||
col.RGB *= LinStep(4.0f, -2.5f, mpv.X) * 2.3f;
|
||||
|
||||
float dif = Hlsl.Clamp((den - Map(pos + 0.8f, prm1, bsMo).X) / 9.0f, 0.001f, 1.0f);
|
||||
|
||||
dif += Hlsl.Clamp((den - Map(pos + 0.35f, prm1, bsMo).X) / 2.5f, 0.001f, 1.0f);
|
||||
col.XYZ *= den * (new float3(0.005f, 0.045f, 0.075f) + (1.5f * new float3(0.033f, 0.07f, 0.03f) * dif));
|
||||
}
|
||||
|
||||
float fogC = Hlsl.Exp((t * 0.2f) - 2.2f);
|
||||
|
||||
col += new float4(0.06f, 0.11f, 0.11f, 0.1f) * Hlsl.Clamp(fogC - fogT, 0.0f, 1.0f);
|
||||
fogT = fogC;
|
||||
rez += col * (1.0f - rez.A);
|
||||
t += Hlsl.Clamp(0.5f - (dn * dn * 0.05f), 0.09f, 0.3f);
|
||||
}
|
||||
|
||||
return Hlsl.Clamp(rez, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
private static float GetSaturation(float3 c)
|
||||
{
|
||||
float mi = Hlsl.Min(Hlsl.Min(c.X, c.Y), c.Z);
|
||||
float ma = Hlsl.Max(Hlsl.Max(c.X, c.Y), c.Z);
|
||||
|
||||
return (ma - mi) / (ma + (float)1e-7);
|
||||
}
|
||||
|
||||
private static float3 ILerp(in float3 a, in float3 b, in float x)
|
||||
{
|
||||
float3 ic = Hlsl.Lerp(a, b, x) + new float3((float)1e-6, 0.0f, 0.0f);
|
||||
float sd = Hlsl.Abs(GetSaturation(ic) - Hlsl.Lerp(GetSaturation(a), GetSaturation(b), x));
|
||||
float3 dir = Hlsl.Normalize(new float3((2.0f * ic.X) - ic.Y - ic.Z, (2.0f * ic.Y) - ic.X - ic.Z, (2.0f * ic.Z) - ic.Y - ic.X));
|
||||
float lgt = Hlsl.Dot(1.0f, ic);
|
||||
float ff = Hlsl.Dot(dir, Hlsl.Normalize(ic));
|
||||
|
||||
ic += 1.5f * dir * sd * ff * lgt;
|
||||
|
||||
return Hlsl.Clamp(ic, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 q = (float2)xy / dispatchSize;
|
||||
float2 p = (xy - (0.5f * (float2)dispatchSize)) / dispatchSize.Y;
|
||||
float2 bsMo = -0.5f * (float2)dispatchSize / dispatchSize.Y;
|
||||
float scaledTime = time * 3.0f;
|
||||
float3 ro = new(0, 0, scaledTime);
|
||||
|
||||
ro += new float3(Hlsl.Sin(time) * 0.5f, Hlsl.Sin(time * 1.0f) * 0.0f, 0);
|
||||
|
||||
float dspAmp = 0.85f;
|
||||
|
||||
ro.XY += Disp(ro.Z) * dspAmp;
|
||||
|
||||
float tgtDst = 3.5f;
|
||||
float3 target = Hlsl.Normalize(ro - new float3(Disp(scaledTime + tgtDst) * dspAmp, scaledTime + tgtDst));
|
||||
|
||||
ro.X -= bsMo.X * 2.0f;
|
||||
|
||||
float3 rightdir = Hlsl.Normalize(Hlsl.Cross(target, new float3(0, 1, 0)));
|
||||
float3 updir = Hlsl.Normalize(Hlsl.Cross(rightdir, target));
|
||||
|
||||
rightdir = Hlsl.Normalize(Hlsl.Cross(updir, target));
|
||||
|
||||
float3 rd = Hlsl.Normalize((((p.X * rightdir) + (p.Y * updir)) * 1.0f) - target);
|
||||
|
||||
rd.XY = Hlsl.Mul(rd.XY, Rotate((-Disp(scaledTime + 3.5f).X * 0.2f) + bsMo.X));
|
||||
|
||||
float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(time * 0.3f));
|
||||
float4 scn = Render(ro, rd, prm1, bsMo);
|
||||
float3 col = scn.RGB;
|
||||
|
||||
col = ILerp(col.BGR, col.RGB, Hlsl.Clamp(1.0f - prm1, 0.05f, 1.0f));
|
||||
col = Hlsl.Pow(col, new float3(0.55f, 0.65f, 0.6f)) * new float3(1.0f, 0.97f, 0.9f);
|
||||
col *= (Hlsl.Pow(Hlsl.Abs(16.0f * q.X * q.Y * (1.0f - q.X) * (1.0f - q.Y)), 0.12f) * 0.7f) + 0.3f;
|
||||
|
||||
return new(col, 1.0f);
|
||||
}
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An offset grid of square-based pyramids whose tips have been offset according to an underlying directional noise field.
|
||||
/// The faux lighting is provided via bump mapping. No raymarching was harmed during the making of this example.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/wlscWX"/>.
|
||||
/// <para>Created by Shane.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct PyramidPattern(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
// Standard 2D rotation formula.
|
||||
private static float2x2 Rotate2x2(in float a)
|
||||
{
|
||||
float c = Hlsl.Cos(a);
|
||||
float s = Hlsl.Sin(a);
|
||||
|
||||
return new(c, -s, s, c);
|
||||
}
|
||||
|
||||
// IQ's float2 to float hash.
|
||||
private static float Hash21(float2 p)
|
||||
{
|
||||
return Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(p, new float2(27.619f, 57.583f))) * 43758.5453f);
|
||||
}
|
||||
|
||||
// float2 to float2 hash.
|
||||
private static float2 Hash22B(float2 p)
|
||||
{
|
||||
float n = Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289)));
|
||||
|
||||
return (Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f) - 1.0f;
|
||||
}
|
||||
|
||||
// Based on IQ's gradient noise formula.
|
||||
private static float N2D3G(float2 p)
|
||||
{
|
||||
float2 i = Hlsl.Floor(p);
|
||||
|
||||
p -= i;
|
||||
|
||||
float4 v = default;
|
||||
|
||||
v.X = Hlsl.Dot(Hash22B(i), p);
|
||||
v.Y = Hlsl.Dot(Hash22B(i + float2.UnitX), p - float2.UnitX);
|
||||
v.Z = Hlsl.Dot(Hash22B(i + float2.UnitY), p - float2.UnitY);
|
||||
v.W = Hlsl.Dot(Hash22B(i + 1.0f), p - 1.0f);
|
||||
|
||||
p = p * p * (3.0f - (2.0f * p));
|
||||
|
||||
return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y);
|
||||
}
|
||||
|
||||
// Two layers of noise.
|
||||
private static float FBM(float2 p)
|
||||
{
|
||||
return (N2D3G(p) * 0.66f) + (N2D3G(p * 2.0f) * 0.34f);
|
||||
}
|
||||
|
||||
// HLSL mod from GLSL
|
||||
private static float Mod(float x, float y)
|
||||
{
|
||||
return x - (y * Hlsl.Floor(x / y));
|
||||
}
|
||||
|
||||
private float BMap(float2 p)
|
||||
{
|
||||
p = Hlsl.Mul(p, Rotate2x2(-3.14159f / 5.0f));
|
||||
|
||||
if (Mod(Hlsl.Floor(p.Y), 2.0f) < 0.5f)
|
||||
{
|
||||
p.X += 0.5f;
|
||||
}
|
||||
|
||||
float2 ip = Hlsl.Floor(p);
|
||||
|
||||
p -= ip + 0.5f;
|
||||
|
||||
float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (time / 3.0f)) * 6.2831f * 2.0f);
|
||||
|
||||
float2 offs = new float2(Hlsl.Cos(ang), Hlsl.Sin(ang)) * 0.35f;
|
||||
|
||||
if (p.X < offs.X)
|
||||
{
|
||||
p.X = 1.0f - ((p.X + 0.5f) / Hlsl.Abs(offs.X + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
p.X = (p.X - offs.X) / (0.5f - offs.X);
|
||||
}
|
||||
|
||||
if (p.Y < offs.Y)
|
||||
{
|
||||
p.Y = 1.0f - ((p.Y + 0.5f) / Hlsl.Abs(offs.Y + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Y = (p.Y - offs.Y) / (0.5f - offs.Y);
|
||||
}
|
||||
|
||||
return 1.0f - Hlsl.Max(p.X, p.Y);
|
||||
}
|
||||
|
||||
// Standard function-based bump mapping function, with an edge value included for good measure
|
||||
private float3 DoBumpMap(in float2 p, in float3 n, float bumpfactor, ref float edge)
|
||||
{
|
||||
float2 e = new(0.025f, 0);
|
||||
|
||||
float f = BMap(p);
|
||||
float fx = BMap(p - e.XY);
|
||||
float fy = BMap(p - e.YX);
|
||||
float fx2 = BMap(p + e.XY);
|
||||
float fy2 = BMap(p + e.YX);
|
||||
|
||||
float3 grad = new float3(fx - fx2, fy - fx2, 0) / e.X / 2.0f;
|
||||
|
||||
edge = Hlsl.Length(new float2(fx, fy) + new float2(fx2, fy2) - (f * 2.0f));
|
||||
edge = Hlsl.SmoothStep(0.0f, 1.0f, edge / e.X);
|
||||
|
||||
grad -= n * Hlsl.Dot(n, grad);
|
||||
|
||||
return Hlsl.Normalize(n + (grad * bumpfactor));
|
||||
}
|
||||
|
||||
// A hatch-like algorithm, or a stipple... or some kind of textured pattern
|
||||
private float DoHatch(float2 p, float res)
|
||||
{
|
||||
p *= res / 16.0f;
|
||||
|
||||
float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f);
|
||||
|
||||
float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f);
|
||||
if (hRnd > 0.66f)
|
||||
{
|
||||
hatch = hRnd;
|
||||
}
|
||||
|
||||
return hatch;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
int2 coordinate = new(xy.X, dispatchSize.Y - xy.Y);
|
||||
float iRes = Hlsl.Min(dispatchSize.Y, 800.0f);
|
||||
float2 uv = (coordinate - ((float2)dispatchSize * 0.5f)) / iRes;
|
||||
float3 rd = Hlsl.Normalize(new float3(uv, 0.5f));
|
||||
const float gSc = 10.0f;
|
||||
float2 p = (uv * gSc) + new float2(0, time / 2.0f);
|
||||
float2 oP = p;
|
||||
float m = BMap(p);
|
||||
float3 n = new(0, 0, -1);
|
||||
float edge = 0.0f;
|
||||
float bumpFactor = 0.25f;
|
||||
|
||||
n = DoBumpMap(p, n, bumpFactor, ref edge);
|
||||
|
||||
float3 lp = new float3(-0.0f + (Hlsl.Sin(time) * 0.3f), 0.0f + (Hlsl.Cos(time * 1.3f) * 0.3f), -1) - new float3(uv, 0);
|
||||
float lDist = Hlsl.Max(Hlsl.Length(lp), 0.001f);
|
||||
float3 ld = lp / lDist;
|
||||
float diff = Hlsl.Max(Hlsl.Dot(n, ld), 0.0f);
|
||||
|
||||
diff = Hlsl.Pow(diff, 4.0f);
|
||||
|
||||
float spec = Hlsl.Pow(Hlsl.Max(Hlsl.Dot(Hlsl.Reflect(-ld, n), -rd), 0.0f), 16.0f);
|
||||
float fre = Hlsl.Min(Hlsl.Pow(Hlsl.Max(1.0f + Hlsl.Dot(n, rd), 0.0f), 4.0f), 3.0f);
|
||||
float3 col = 0.15f * (diff + 0.251f + (spec * new float3(1, 0.7f, 0.3f) * 9.0f) + (fre * new float3(0.1f, 0.3f, 1) * 12.0f));
|
||||
float rf = Hlsl.SmoothStep(0.0f, 0.35f, (BMap(Hlsl.Reflect(rd, n).XY * 2.0f) * FBM(Hlsl.Reflect(rd, n).XY * 3.0f)) + 0.1f);
|
||||
|
||||
col += col * col * rf * rf * new float3(1, 0.1f, 0.1f) * 15.0f;
|
||||
|
||||
float shade = (m * 0.83f) + 0.17f;
|
||||
|
||||
col *= shade;
|
||||
col *= 1.0f - (edge * 0.8f);
|
||||
|
||||
float hatch = DoHatch(oP / gSc, iRes);
|
||||
|
||||
col *= (hatch * 0.5f) + 0.7f;
|
||||
|
||||
return new(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An abstract representation of some terraced hills. In essence, just a very basic terrain layout with a small code footprint.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/MtdSRn"/>.
|
||||
/// <para>Created by Shane.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct TerracedHills(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
// 2x2 matrix rotation. Angle vector, courtesy of Fabrice
|
||||
private static float2x2 Rot2(float th)
|
||||
{
|
||||
float2 a = Hlsl.Sin(new float2(1.5707963f, 0) + th);
|
||||
|
||||
return new(a.X, -a.Y, a.Y, a.X);
|
||||
}
|
||||
|
||||
// The triangle function that Shadertoy user Nimitz has used in various triangle noise demonstrations
|
||||
private static float Tri(in float x)
|
||||
{
|
||||
return Hlsl.Abs(x - Hlsl.Floor(x) - 0.5f);
|
||||
}
|
||||
|
||||
// 2D variant of the triangle function
|
||||
private static float2 Tri(in float2 x)
|
||||
{
|
||||
return Hlsl.Abs(x - Hlsl.Floor(x) - 0.5f);
|
||||
}
|
||||
|
||||
// A simple noisey layer made up of a sawtooth combination
|
||||
private static float HLayer(float2 p)
|
||||
{
|
||||
return Hlsl.Dot(Tri((p / 1.5f) + Tri((p.YX / 3.0f) + 0.25f)), 1);
|
||||
}
|
||||
|
||||
// Combine layers to create surfaces to render
|
||||
private static float HMap(float2 p)
|
||||
{
|
||||
float ret = 0, a = 1;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
ret += Hlsl.Abs(a) * HLayer(p / a);
|
||||
p = new float2x2(0.866025f, -0.57735f, 0.57735f, 0.866025f) * p;
|
||||
a *= -0.3f;
|
||||
}
|
||||
|
||||
ret = Hlsl.SmoothStep(-0.2f, 1.0f, ret * ret / 1.39f / 1.39f);
|
||||
|
||||
return (ret * 0.975f) + (Tri(ret * 12.0f) * 0.05f);
|
||||
}
|
||||
|
||||
// Distance function. A flat plane perturbed by a height function of some kind.
|
||||
private static float Map(float3 p)
|
||||
{
|
||||
return (p.Y - (HMap(p.XZ) * 0.35f)) * 0.75f;
|
||||
}
|
||||
|
||||
// Tetrahedral normal - courtesy of IQ
|
||||
private static float3 Normal(in float3 p, ref float edge, float dispatchHeight)
|
||||
{
|
||||
float2 e = new float2(-1.0f, 1.0f) * 0.5f / dispatchHeight;
|
||||
float d1 = Map(p + e.YXX), d2 = Map(p + e.XXY);
|
||||
float d3 = Map(p + e.XYX), d4 = Map(p + e.YYY);
|
||||
float d = Map(p);
|
||||
|
||||
edge = Hlsl.Abs(d1 + d2 + d3 + d4 - (d * 4.0f));
|
||||
edge = Hlsl.SmoothStep(0.0f, 1.0f, Hlsl.Sqrt(edge / e.Y * 2.0f));
|
||||
e = new float2(-1.0f, 1.0f) * 0.001f;
|
||||
d1 = Map(p + e.YXX);
|
||||
d2 = Map(p + e.XXY);
|
||||
d3 = Map(p + e.XYX);
|
||||
d4 = Map(p + e.YYY);
|
||||
|
||||
return Hlsl.Normalize((e.YXX * d1) + (e.XXY * d2) + (e.XYX * d3) + (e.YYY * d4));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
int2 coordinate = new(xy.X, dispatchSize.Y - xy.Y);
|
||||
|
||||
float3 rd = Hlsl.Normalize(new float3((float2)coordinate - (dispatchSize.Y * 0.5f), dispatchSize.Y));
|
||||
|
||||
rd.YZ = Rot2(0.35f) * rd.YZ;
|
||||
|
||||
float3 ro = new(time * 0.4f, 0.5f, time * 0.2f);
|
||||
|
||||
float t = 0, d;
|
||||
for (int i = 0; i < 96; i++)
|
||||
{
|
||||
d = Map(ro + (rd * t));
|
||||
|
||||
if (Hlsl.Abs(d) < 0.001f * ((t * 0.125f) + 1.0f) || t > 20.0f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
t += ((Hlsl.Step(1.0f, t) * 0.3f) + 0.7f) * d;
|
||||
}
|
||||
|
||||
float3 sp = ro + (rd * t);
|
||||
float3 ld = new(-0.676f, 0.408f, 0.613f);
|
||||
float edge = 0;
|
||||
float3 n = Normal(sp, ref edge, dispatchSize.Y);
|
||||
float dif = Hlsl.Max(Hlsl.Dot(ld, n), 0.0f);
|
||||
float spe = Hlsl.Pow(Hlsl.Max(Hlsl.Dot(Hlsl.Reflect(rd, n), ld), 0.0f), 16.0f);
|
||||
float sh = HMap(sp.XZ);
|
||||
float rnd = (Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(Hlsl.Floor(sp.XZ * 512.0f), new float2(41.73f, 289.67f))) * 43758.5453f) * 0.5f) + 0.5f;
|
||||
float3 fog = Hlsl.Lerp(new float3(0.75f, 0.77f, 0.78f), new float3(1.04f, 0.95f, 0.87f), Hlsl.Pow(1.0f + Hlsl.Dot(rd, ld), 3.0f) * 0.35f);
|
||||
float3 c = Hlsl.Lerp(((new float3(1.1f, 1.05f, 1) * rnd * (dif + 0.1f) * sh) + (fog * spe)) * (1.0f - (edge * 0.7f)), fog * fog, Hlsl.Min(1.0f, t * 0.3f));
|
||||
|
||||
return new(c, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// Utilizing a 2D simplex grid to construct the isolines of a noise function.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/WtfGDX"/>.
|
||||
/// <para>Created by Shane.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct TriangleGridContouring(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
// Standard 2D rotation formula.
|
||||
private static float2x2 Rotate2x2(in float a)
|
||||
{
|
||||
float c = Hlsl.Cos(a);
|
||||
float s = Hlsl.Sin(a);
|
||||
|
||||
return new(c, -s, s, c);
|
||||
}
|
||||
|
||||
// float2 to float2 hash.
|
||||
private float2 Hash22(float2 p)
|
||||
{
|
||||
float n = Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289)));
|
||||
|
||||
p = Hlsl.Frac(new float2(262144, 32768) * n);
|
||||
|
||||
return Hlsl.Sin((p * 6.2831853f) + time);
|
||||
}
|
||||
|
||||
// Based on IQ's gradient noise formula.
|
||||
private float N2D3G(float2 p)
|
||||
{
|
||||
float2 i = Hlsl.Floor(p);
|
||||
|
||||
p -= i;
|
||||
|
||||
float4 v = default;
|
||||
|
||||
v.X = Hlsl.Dot(Hash22(i), p);
|
||||
v.Y = Hlsl.Dot(Hash22(i + float2.UnitX), p - float2.UnitX);
|
||||
v.Z = Hlsl.Dot(Hash22(i + float2.UnitY), p - float2.UnitY);
|
||||
v.W = Hlsl.Dot(Hash22(i + 1.0f), p - 1.0f);
|
||||
|
||||
p = p * p * p * ((p * ((p * 6.0f) - 15.0f)) + 10.0f);
|
||||
|
||||
return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y);
|
||||
}
|
||||
|
||||
// The isofunction. Just a Hlsl.Single noise function, but it can be more elaborate.
|
||||
private float IsoFunction(in float2 p)
|
||||
{
|
||||
return N2D3G((p / 4.0f) + 0.07f);
|
||||
}
|
||||
|
||||
// Unsigned distance to the segment joining "a" and "b".
|
||||
private static float DistLine(float2 a, float2 b)
|
||||
{
|
||||
b = a - b;
|
||||
|
||||
float h = Hlsl.Clamp(Hlsl.Dot(a, b) / Hlsl.Dot(b, b), 0.0f, 1.0f);
|
||||
|
||||
return Hlsl.Length(a - (b * h));
|
||||
}
|
||||
|
||||
// Based on IQ's signed distance to the segment joining "a" and "b".
|
||||
private static float DistEdge(float2 a, float2 b)
|
||||
{
|
||||
return Hlsl.Dot((a + b) * 0.5f, Hlsl.Normalize((b - a).YX * new float2(-1, 1)));
|
||||
}
|
||||
|
||||
// Interpolating along the edge connecting vertices v1 and v2 with respect to the isovalue.
|
||||
private static float2 Interpolate(in float2 p1, in float2 p2, float v1, float v2, float isovalue)
|
||||
{
|
||||
return Hlsl.Lerp(p1, p2, ((isovalue - v1) / (v2 - v1) * 0.75f) + (0.25f / 2.0f));
|
||||
}
|
||||
|
||||
// Isoline function.
|
||||
private static int IsoLine(
|
||||
float3 n3,
|
||||
float2 ip0,
|
||||
float2 ip1,
|
||||
float2 ip2,
|
||||
float isovalue,
|
||||
float i,
|
||||
ref float2 p0,
|
||||
ref float2 p1)
|
||||
{
|
||||
p0 = 1e5f;
|
||||
p1 = 1e5f;
|
||||
|
||||
int iTh = 0;
|
||||
|
||||
if (n3.X > isovalue)
|
||||
{
|
||||
iTh += 4;
|
||||
}
|
||||
|
||||
if (n3.Y > isovalue)
|
||||
{
|
||||
iTh += 2;
|
||||
}
|
||||
|
||||
if (n3.Z > isovalue)
|
||||
{
|
||||
iTh += 1;
|
||||
}
|
||||
|
||||
if (iTh == 1 || iTh == 6)
|
||||
{
|
||||
p0 = Interpolate(ip1, ip2, n3.Y, n3.Z, isovalue);
|
||||
p1 = Interpolate(ip2, ip0, n3.Z, n3.X, isovalue);
|
||||
|
||||
}
|
||||
else if (iTh == 2 || iTh == 5)
|
||||
{
|
||||
p0 = Interpolate(ip0, ip1, n3.X, n3.Y, isovalue);
|
||||
p1 = Interpolate(ip1, ip2, n3.Y, n3.Z, isovalue);
|
||||
|
||||
}
|
||||
else if (iTh == 3 || iTh == 4)
|
||||
{
|
||||
p0 = Interpolate(ip0, ip1, n3.X, n3.Y, isovalue);
|
||||
p1 = Interpolate(ip2, ip0, n3.Z, n3.X, isovalue);
|
||||
}
|
||||
|
||||
if (iTh >= 4 && iTh <= 6)
|
||||
{
|
||||
float2 tmp = p0;
|
||||
|
||||
p0 = p1;
|
||||
p1 = tmp;
|
||||
}
|
||||
|
||||
if (i == 0.0f)
|
||||
{
|
||||
float2 tmp = p0;
|
||||
|
||||
p0 = p1;
|
||||
p1 = tmp;
|
||||
}
|
||||
|
||||
return iTh;
|
||||
}
|
||||
|
||||
private float3 SimplexContour(float2 p)
|
||||
{
|
||||
const float gSc = 8.0f;
|
||||
|
||||
p *= gSc;
|
||||
|
||||
float2 oP = p;
|
||||
|
||||
p += new float2(N2D3G(p * 3.5f), N2D3G((p * 3.5f) + 7.3f)) * 0.015f;
|
||||
|
||||
float2 s = Hlsl.Floor(p + ((p.X + p.Y) * 0.36602540378f));
|
||||
|
||||
p -= s - ((s.X + s.Y) * 0.211324865f);
|
||||
|
||||
float i = p.X < p.Y ? 1.0f : 0.0f;
|
||||
float2 ioffs = new(1.0f - i, i);
|
||||
float2 ip0 = 0;
|
||||
float2 ip1 = ioffs - 0.2113248654f;
|
||||
float2 ip2 = 0.577350269f;
|
||||
float2 ctr = (ip0 + ip1 + ip2) / 3.0f;
|
||||
|
||||
ip0 -= ctr;
|
||||
ip1 -= ctr;
|
||||
ip2 -= ctr;
|
||||
p -= ctr;
|
||||
|
||||
float3 n3 = default;
|
||||
|
||||
n3.X = IsoFunction(s);
|
||||
n3.Y = IsoFunction(s + ioffs);
|
||||
n3.Z = IsoFunction(s + 1.0f);
|
||||
|
||||
float d = 1e5f;
|
||||
float d2 = 1e5f;
|
||||
float d3 = 1e5f;
|
||||
float d4 = 1e5f;
|
||||
float d5 = 1e5f;
|
||||
float isovalue = 0;
|
||||
float2 p0 = default;
|
||||
float2 p1 = default;
|
||||
int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
|
||||
|
||||
d = Hlsl.Min(d, DistEdge(p - p0, p - p1));
|
||||
|
||||
if (iTh == 7)
|
||||
{
|
||||
d = 0;
|
||||
}
|
||||
|
||||
d3 = Hlsl.Min(d3, DistLine(p - p0, p - p1));
|
||||
d4 = Hlsl.Min(d4, Hlsl.Min(Hlsl.Length(p - p0), Hlsl.Length(p - p1)));
|
||||
|
||||
float tri = Hlsl.Min(Hlsl.Min(DistLine(p - ip0, p - ip1), DistLine(p - ip1, p - ip2)), DistLine(p - ip2, p - ip0));
|
||||
|
||||
d5 = Hlsl.Min(d5, tri);
|
||||
d5 = Hlsl.Min(d5, Hlsl.Length(p) - 0.02f);
|
||||
isovalue = -0.15f;
|
||||
|
||||
int iTh2 = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
|
||||
|
||||
d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1));
|
||||
|
||||
if (iTh2 == 7)
|
||||
{
|
||||
d2 = 0.0f;
|
||||
}
|
||||
|
||||
if (iTh == 7)
|
||||
{
|
||||
d2 = 1e5f;
|
||||
}
|
||||
|
||||
d2 = Hlsl.Max(d2, -d);
|
||||
d3 = Hlsl.Min(d3, DistLine(p - p0, p - p1));
|
||||
d4 = Hlsl.Min(d4, Hlsl.Min(Hlsl.Length(p - p0), Hlsl.Length(p - p1)));
|
||||
d4 -= 0.075f;
|
||||
d3 -= 0.0125f;
|
||||
d /= gSc;
|
||||
d2 /= gSc;
|
||||
d3 /= gSc;
|
||||
d4 /= gSc;
|
||||
d5 /= gSc;
|
||||
|
||||
float3 col = new(1, 0.85f, 0.6f);
|
||||
float sf = 0.004f;
|
||||
|
||||
if (d > 0.0f && d2 > 0.0f)
|
||||
{
|
||||
col = new float3(1, 1.8f, 3) * 0.45f;
|
||||
}
|
||||
|
||||
if (d > 0.0f)
|
||||
{
|
||||
col = Hlsl.Lerp(col, new float3(1, 1.85f, 3) * 0.3f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d2 - 0.012f));
|
||||
}
|
||||
|
||||
col = Hlsl.Lerp(col, new float3(1.1f, 0.85f, 0.6f), 1.0f - Hlsl.SmoothStep(0.0f, sf, d2));
|
||||
col = Hlsl.Lerp(col, new float3(1.5f, 0.9f, 0.6f) * 0.6f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d - 0.012f));
|
||||
col = Hlsl.Lerp(col, new float3(1, 0.8f, 0.6f) * new float3(0.7f, 1.0f, 0.75f) * 0.95f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d));
|
||||
|
||||
if (d2 > 0.0f)
|
||||
{
|
||||
col *= ((Hlsl.Abs(Hlsl.Dot(n3, float3.One)) * 1.25f) + 1.25f) / 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
col *= Hlsl.Max(2.0f - ((Hlsl.Dot(n3, float3.One) + 1.45f) / 1.25f), 0.0f);
|
||||
}
|
||||
|
||||
float pat = Hlsl.Abs(Hlsl.Frac((tri * 12.5f) + 0.4f) - 0.5f) * 2.0f;
|
||||
|
||||
col *= (pat * 0.425f) + 0.75f;
|
||||
col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sf, d5)) * 0.95f);
|
||||
col = Hlsl.Lerp(col, float3.Zero, 1.0f - Hlsl.SmoothStep(0.0f, sf, d3));
|
||||
col = Hlsl.Lerp(col, float3.Zero, 1.0f - Hlsl.SmoothStep(0.0f, sf, d4));
|
||||
col = Hlsl.Lerp(col, float3.One, 1.0f - Hlsl.SmoothStep(0.0f, sf, d4 + 0.005f));
|
||||
|
||||
float2 q = oP * 1.5f;
|
||||
|
||||
col = Hlsl.Min(col, 1.0f);
|
||||
|
||||
float gr = Hlsl.Sqrt(Hlsl.Dot(col, new float3(0.299f, 0.587f, 0.114f))) * 1.25f;
|
||||
float ns = (((N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f) + (N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f)) * 0.5f) + 0.5f;
|
||||
|
||||
ns = gr - ns;
|
||||
q = Hlsl.Mul(q, Rotate2x2(3.14159f / 3.0f));
|
||||
|
||||
float ns2 = (((N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f) + (N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f)) * 0.5f) + 0.5f;
|
||||
|
||||
ns2 = gr - ns2;
|
||||
ns = Hlsl.SmoothStep(0.0f, 1.0f, Hlsl.Min(ns, ns2));
|
||||
col = Hlsl.Lerp(col, col * (ns + 0.35f), 0.4f);
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
int2 coordinate = new(xy.X, dispatchSize.Y - xy.Y);
|
||||
float2 uv = (coordinate - ((float2)dispatchSize * 0.5f)) / Hlsl.Min(650.0f, dispatchSize.Y);
|
||||
float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * time / 16.0f);
|
||||
float3 col = SimplexContour(p);
|
||||
|
||||
uv = coordinate / (float2)dispatchSize;
|
||||
col *= Hlsl.Pow(Hlsl.Abs(16.0f * uv.X * uv.Y * (1.0f - uv.X) * (1.0f - uv.Y)), 0.0625f) + 0.1f;
|
||||
|
||||
return new(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1);
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
using ComputeSharp.D2D1;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A shader creating an animated two-tiles Truchet arrangement.
|
||||
/// Ported from <see href="https://www.shadertoy.com/view/tsSfWK"/>.
|
||||
/// <para>Created by Shane.</para>
|
||||
/// </summary>
|
||||
/// <param name="time">The current time since the start of the application.</param>
|
||||
/// <param name="dispatchSize">The dispatch size for the current output.</param>
|
||||
[D2DInputCount(0)]
|
||||
[D2DRequiresScenePosition]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
internal readonly partial struct TwoTiledTruchet(float time, int2 dispatchSize) : ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
/// Calculates the Truchet distance field.
|
||||
/// </summary>
|
||||
/// <param name="p">The input value to compute the distance field for.</param>
|
||||
/// <param name="ang">The resulting Truchet angle.</param>
|
||||
/// <returns>The distance field for the input value.</returns>
|
||||
private float2 DistanceField(float2 p, out float2 ang)
|
||||
{
|
||||
// Fast hash for a pair of floats
|
||||
static float Hash21(float2 p)
|
||||
{
|
||||
return Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(p, new float2(27.619f, 57.583f))) * 43758.5453f);
|
||||
}
|
||||
|
||||
// HLSL's port of the GLSL mod intrinsic
|
||||
static float Mod(float x, float y)
|
||||
{
|
||||
return x - (y * Hlsl.Floor(x / y));
|
||||
}
|
||||
|
||||
float2 ip2 = Hlsl.Floor(p / 2.0f);
|
||||
float2 ip = Hlsl.Floor(p);
|
||||
float rnd = Hash21(ip);
|
||||
float rnd3 = Hash21(ip + 0.57f);
|
||||
float2 d = 1e5f;
|
||||
|
||||
p -= ip + 0.5f;
|
||||
|
||||
if (Mod(ip2.X + ip2.Y, 2.0f) < 0.5f)
|
||||
{
|
||||
d = Hlsl.Abs(p);
|
||||
ang = p.YX;
|
||||
|
||||
if (Mod(ip.X + 1.0f, 2.0f) < 0.5f)
|
||||
{
|
||||
ang.X *= -1.0f;
|
||||
|
||||
}
|
||||
|
||||
if (Mod(ip.Y + 1.0f, 2.0f) > 0.5f)
|
||||
{
|
||||
ang.Y *= -1.0f;
|
||||
}
|
||||
|
||||
if (rnd3 < 0.5f)
|
||||
{
|
||||
d = d.YX;
|
||||
ang = ang.YX;
|
||||
}
|
||||
|
||||
ang += 0.5f;
|
||||
ang *= 3.0f;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < 0.5f)
|
||||
{
|
||||
p = p.YX * new float2(1, -1);
|
||||
}
|
||||
|
||||
d.X = Hlsl.Length(p - 0.5f) - 0.5f;
|
||||
d.Y = Hlsl.Length(p + 0.5f) - 0.5f;
|
||||
|
||||
d = Hlsl.Abs(d);
|
||||
|
||||
ang = 0;
|
||||
ang.X = -Hlsl.Atan((p.Y - 0.5f) / (p.X - 0.5f));
|
||||
ang.Y = -Hlsl.Atan((p.Y + 0.5f) / (p.X + 0.5f));
|
||||
|
||||
if (Mod(ip.X + ip.Y, 2.0f) < 0.5f)
|
||||
{
|
||||
ang *= -1.0f;
|
||||
}
|
||||
|
||||
if (rnd < 0.5f)
|
||||
{
|
||||
ang *= -1.0f;
|
||||
}
|
||||
|
||||
if (rnd3 < 0.5f)
|
||||
{
|
||||
d = d.YX;
|
||||
ang = ang.YX;
|
||||
}
|
||||
|
||||
ang *= 4.0f / 6.2831853f;
|
||||
ang *= 2.0f;
|
||||
}
|
||||
|
||||
ang = Hlsl.Frac(ang + (time / 4.0f));
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
float2 uv = (xy - ((float2)dispatchSize * 0.5f)) / dispatchSize.Y;
|
||||
float gSc = 7.0f;
|
||||
float2 p = (uv * gSc) - (new float2(-1, -0.5f) * time / 2.0f);
|
||||
float sf = 2.0f / dispatchSize.Y * gSc;
|
||||
float lSc = 6.0f;
|
||||
float lw = 1.0f / lSc / gSc;
|
||||
float2 d = DistanceField(p, out float2 ang) - (2.5f / lSc);
|
||||
float3 col = new(1.0f, 0.9f, 0.8f);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float di = d[i] - (lw / 4.0f);
|
||||
float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (time * 6.0f)) * 4.0f, 0.0f, 1.0f);
|
||||
float gap = 1.0f + lw;
|
||||
|
||||
col = Hlsl.Lerp(col, 0, (1.0f - Hlsl.SmoothStep(0.0f, sf * 6.0f, di)) * 0.35f);
|
||||
col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di));
|
||||
col = Hlsl.Lerp(col, new(1.0f, 0.9f, 0.8f), 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (lw * 2.0f)));
|
||||
col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (gap / lSc)));
|
||||
col = Hlsl.Lerp(col, 1, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (gap / lSc) + lw));
|
||||
col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (2.0f * gap / lSc)));
|
||||
col = Hlsl.Lerp(col, 1 * tracks, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (2.0f * gap / lSc) + lw));
|
||||
}
|
||||
|
||||
float3 rgb = Hlsl.Sqrt(Hlsl.Max(col, 0.0f));
|
||||
float4 color = new(rgb.X, rgb.Y, rgb.Z, 1.0f);
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
変更前 幅: | 高さ: | サイズ: 3.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 6.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 15 KiB |
|
変更前 幅: | 高さ: | サイズ: 432 B |
|
変更前 幅: | 高さ: | サイズ: 208 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.2 KiB |
|
変更前 幅: | 高さ: | サイズ: 5.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 5.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 8.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 20 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 6.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 508 B |
|
変更前 幅: | 高さ: | サイズ: 796 B |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 711 B |
|
変更前 幅: | 高さ: | サイズ: 826 B |
|
変更前 幅: | 高さ: | サイズ: 508 B |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 711 B |
|
変更前 幅: | 高さ: | サイズ: 826 B |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 508 B |
|
変更前 幅: | 高さ: | サイズ: 796 B |
|
変更前 幅: | 高さ: | サイズ: 796 B |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 711 B |