Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .csharpierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# only format our own code
Cafe-Shader-Studio/
ShaderLibrary/
tools/nvpatch/

# Build artifacts
**/bin/
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ on:

jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rid: win-x64
- os: ubuntu-latest
rid: linux-x64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand All @@ -19,20 +28,20 @@ jobs:
dotnet-version: '10.0.x'

- name: Restore
run: dotnet restore PlayerViewer/PlayerViewer.csproj
run: dotnet restore PlayerViewer/PlayerViewer.csproj -r ${{ matrix.rid }}

- name: Publish
run: >
dotnet publish PlayerViewer/PlayerViewer.csproj
-c Release
-r win-x64
-r ${{ matrix.rid }}
--self-contained true
-p:PublishSingleFile=true
-o publish

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PlayerViewer-win-x64
name: PlayerViewer-${{ matrix.rid }}
path: publish
if-no-files-found: error
1 change: 0 additions & 1 deletion Cafe-Shader-Studio/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ bin/
obj/
EffectLibrary/
EffectLibrary.Test/
Toolbox.Core/
CurveEditorLibraryCore/
*Google.FlatBuffers
*NodeEditorWinforms-master
Expand Down
6 changes: 2 additions & 4 deletions Cafe-Shader-Studio/AGraphicsLibrary/AGraphicsLibrary.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Expand Down Expand Up @@ -43,9 +43,7 @@
<Reference Include="Syroot.Maths">
<HintPath>..\CafeShaderStudio\Lib\Syroot.Maths.dll</HintPath>
</Reference>
<Reference Include="Toolbox.Core">
<HintPath>..\CafeShaderStudio\Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
</ItemGroup>

</Project>
9 changes: 5 additions & 4 deletions Cafe-Shader-Studio/BfresEditor/BfresEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Expand Down Expand Up @@ -64,6 +64,9 @@
<Reference Include="Ryujinx.Graphics.Shader">
<HintPath>..\CafeShaderStudio\Lib\Ryujinx.Graphics.Shader.dll</HintPath>
</Reference>
<Reference Include="Spv.Generator">
<HintPath>..\CafeShaderStudio\Lib\Spv.Generator.dll</HintPath>
</Reference>
<Reference Include="Syroot.BinaryData">
<HintPath>..\CafeShaderStudio\Lib\Syroot.BinaryData.dll</HintPath>
</Reference>
Expand All @@ -73,9 +76,7 @@
<Reference Include="Syroot.NintenTools.NSW.Bntx">
<HintPath>Lib\Syroot.NintenTools.NSW.Bntx.dll</HintPath>
</Reference>
<Reference Include="Toolbox.Core">
<HintPath>..\CafeShaderStudio\Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
<Reference Include="TrackStudioLibrary">
<HintPath>..\CafeShaderStudio\Lib\TrackStudioLibrary.dll</HintPath>
</Reference>
Expand Down
Binary file modified Cafe-Shader-Studio/BfresEditor/Lib/BfresLibrary.dll
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TegraShaderDecoder
public static readonly System.Diagnostics.Stopwatch TotalTime = new System.Diagnostics.Stopwatch();
public static int LoadCount = 0;

const int CacheVersion = 3;
const int CacheVersion = 4;
static bool _cacheVersionChecked;

public static string CacheDir = "ShaderCache";
Expand Down Expand Up @@ -124,7 +124,9 @@ internal static string PatchFramebufferSamplers(string fragSource,
if (yFlipSamplers == null || yFlipSamplers.Count == 0) return fragSource;

var sb = new StringBuilder();
foreach (var line in fragSource.Split('\n'))
//Normalize first: the translator emits CRLF, so splitting on '\n' alone leaves a
//trailing '\r' on every line and AppendLine then writes a second line break.
foreach (var line in fragSource.ReplaceLineEndings("\n").Split('\n'))
{
string patched = line;
foreach (var sampler in yFlipSamplers)
Expand Down Expand Up @@ -341,7 +343,9 @@ static string AppendPixelShaderCode(string code)

var builder = new StringBuilder();

var lines = code.Split('\n');
//Normalize first: see the note in PatchSamplerYFlip. These passes chain, so an
//unnormalized split here would stack another line break on top of the previous pass.
var lines = code.ReplaceLineEndings("\n").Split('\n');
int numLines = 0;
foreach (var line in lines) {
if (!writtenExtraUniforms && line.Contains("const int undef = 0;")) {
Expand Down Expand Up @@ -439,7 +443,7 @@ static string DecompileShader(BfshaLibrary.ShaderType shaderType, byte[] Data)

// Strip layout(binding=N) from sampler declarations so glUniform1i can assign texture units.
var sb = new StringBuilder();
foreach (var line in translated.Split('\n'))
foreach (var line in translated.ReplaceLineEndings("\n").Split('\n'))
{
if (line.Contains("uniform sampler") || line.Contains("uniform usampler") ||
line.Contains("uniform isampler"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation;
using System;
using System.IO;
Expand Down Expand Up @@ -33,9 +33,9 @@ public GpuAccessor(byte[] data)
_data = data;
}

public T MemoryRead<T>(ulong address) where T : unmanaged
public ReadOnlySpan<ulong> GetCode(ulong address, int minimumSize)
{
return MemoryMarshal.Cast<byte, T>(new ReadOnlySpan<byte>(_data).Slice((int)address))[0];
return MemoryMarshal.Cast<byte, ulong>(new ReadOnlySpan<byte>(_data).Slice((int)address));
}

public int QueryHostStorageBufferOffsetAlignment() => _storageBufferOffsetAlignment.Value;
Expand Down Expand Up @@ -65,10 +65,10 @@ public static void InitCaps()

public static string Translate(byte[] data)
{
TranslationFlags flags = TranslationFlags.DebugMode;
var options = new TranslationOptions(
TargetLanguage.Glsl, TargetApi.OpenGL, TranslationFlags.DebugMode);

return Translator.CreateContext(0,
new GpuAccessor(data), flags).Translate(out _).Code;
return Translator.CreateContext(0, new GpuAccessor(data), options).Translate().Code;
}

private static int GetLimit(All name)
Expand Down
4 changes: 1 addition & 3 deletions Cafe-Shader-Studio/CafeShaderStudio/CafeShaderStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
<Reference Include="Syroot.Maths">
<HintPath>Lib\Syroot.Maths.dll</HintPath>
</Reference>
<Reference Include="Toolbox.Core">
<HintPath>Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
<Reference Include="TrackStudioLibrary">
<HintPath>Lib\TrackStudioLibrary.dll</HintPath>
</Reference>
Expand Down
Binary file modified Cafe-Shader-Studio/CafeShaderStudio/Lib/Ryujinx.Common.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 2 additions & 4 deletions Cafe-Shader-Studio/CafeStudio.UI/CafeStudio.UI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Expand Down Expand Up @@ -46,9 +46,7 @@
<Reference Include="Syroot.Maths">
<HintPath>..\CafeShaderStudio\Lib\Syroot.Maths.dll</HintPath>
</Reference>
<Reference Include="Toolbox.Core">
<HintPath>..\CafeShaderStudio\Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
<Reference Include="TrackStudioLibrary">
<HintPath>..\CafeShaderStudio\Lib\TrackStudioLibrary.dll</HintPath>
</Reference>
Expand Down
6 changes: 2 additions & 4 deletions Cafe-Shader-Studio/GLFrameworkEngine/GLFrameworkEngine.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Expand Down Expand Up @@ -28,9 +28,7 @@

<ItemGroup>
<PackageReference Include="OpenTK" Version="3.1.0" />
<Reference Include="Toolbox.Core">
<HintPath>..\CafeShaderStudio\Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
</ItemGroup>

</Project>
4 changes: 1 addition & 3 deletions Cafe-Shader-Studio/RedStarLibrary/RedStarLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
<Reference Include="Syroot.Maths">
<HintPath>..\CafeShaderStudio\Lib\Syroot.Maths.dll</HintPath>
</Reference>
<Reference Include="Toolbox.Core">
<HintPath>..\CafeShaderStudio\Lib\Toolbox.Core.dll</HintPath>
</Reference>
<ProjectReference Include="..\Toolbox.Core\Toolbox.Core.csproj" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions Cafe-Shader-Studio/Toolbox.Core/Licenses/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Dan McCarthy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions Cafe-Shader-Studio/Toolbox.Core/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Toolbox.Core

Vendored source, by KillzXGaming. Upstream: https://github.com/KillzXGaming/Toolbox.Core

This is the copy that shipped with the original Cafe Shader Studio, not a checkout of either
public branch. It replaces the prebuilt `CafeShaderStudio/Lib/Toolbox.Core.dll` that used to be committed here.

## Changes made to the original source

### `src/Plugins/PluginManager.cs`, `LoadPlugins`

`LoadPlugins` opened `Runtime.ExecutableDir\Toolbox.Core.dll` from disk, read its `AssemblyName`,
and `Assembly.Load`ed it, to scan the built in formats. That assembly is already loaded, so the
file read bought nothing and cost a loose copy of the DLL beside the exe.

Now the already loaded assembly is used directly:

loadedLibs.Add("Toolbox.Core.dll");
assemblies.Add(typeof(PluginManager).Assembly);

### Texture debug logging removed

4 `Console.WriteLine` calls on the Switch texture path printed per texture and per mip level,
Removed from `TegraX1Swizzle.GetImageData`, `SwitchSwizzle` and `RGBAPixelDecoder`.
14 changes: 14 additions & 0 deletions Cafe-Shader-Studio/Toolbox.Core/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Toolbox.Core
{
/// <summary>
/// Represents a plugin used to interact with this tool.
/// </summary>
public class Plugin : IPlugin
{
public string Name => "Toolbox Core";
}
}
103 changes: 103 additions & 0 deletions Cafe-Shader-Studio/Toolbox.Core/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading