Compare commits

...

4 Commits

Author SHA1 Message Date
gdkchan
42750a74f8 Do not add more code after alpha test discard on fragment shader (#5529)
* Do not add more code after alpha test discard on fragment shader

* Shader cache version bump
2023-08-07 12:20:37 -03:00
TSRBerry
3ab0a71c7b Fix PR build concurrency and stop auto assigning reviewers for draft PRs (#5519)
* build: Remove concurrency

It's called by checks anyway.

* Only assign reviewers for PRs that are ready for reviews
2023-08-06 23:25:02 +02:00
riperiperi
6e784e0aca GPU: Don't sync/bind index buffer when it's not in use (#5526)
* GPU: Don't sync/bind index buffer when it's not in use

Sometimes draws don't use an index buffer. It's not necessary to check or upload data for the current index buffer binding as it won't be used.

This fixes Pokemon: Legends Arceus updating a stale index buffer for every draw during its TFB pass, which was all non-indexed draws.

This probably didn't cost much on normal PCs, but it had a large impact on MacOS, which the macos1 release build avoided by mirroring index buffers (the PR currently does not). Needs buffer mirrors still for the rest of the performance.

There are additional cases where index buffers are bound or checked with non-indexed draws on the backend, but this one was straightforward to fix and has the largest impact. Testing is welcome to ensure nothing weird broke.

* Fix case with _rebind
2023-08-06 16:29:20 -03:00
sunshineinabox
5a0aa074b6 Enable VK_EXT_4444_formats (#5525) 2023-08-03 17:46:23 -03:00
8 changed files with 43 additions and 23 deletions

View File

@@ -3,10 +3,6 @@ name: Build job
on: on:
workflow_call: workflow_call:
concurrency:
group: pr-builds-${{ github.event.number }}
cancel-in-progress: true
env: env:
POWERSHELL_TELEMETRY_OPTOUT: 1 POWERSHELL_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1

View File

@@ -28,6 +28,7 @@ jobs:
dot: true dot: true
- name: Assign reviewers - name: Assign reviewers
if: ! github.event.pull_request.draft
run: | run: |
pip3 install PyGithub pip3 install PyGithub
python3 .github/update_reviewers.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.pull_request.number }} .github/reviewers.yml python3 .github/update_reviewers.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.pull_request.number }} .github/reviewers.yml

View File

@@ -331,7 +331,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
UpdateShaderState(); UpdateShaderState();
} }
_channel.BufferManager.CommitGraphicsBindings(); _channel.BufferManager.CommitGraphicsBindings(_drawState.DrawIndexed);
} }
/// <summary> /// <summary>

View File

@@ -515,10 +515,13 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// Ensures that the graphics engine bindings are visible to the host GPU. /// Ensures that the graphics engine bindings are visible to the host GPU.
/// Note: this actually performs the binding using the host graphics API. /// Note: this actually performs the binding using the host graphics API.
/// </summary> /// </summary>
public void CommitGraphicsBindings() /// <param name="indexed">True if the index buffer is in use</param>
public void CommitGraphicsBindings(bool indexed)
{ {
var bufferCache = _channel.MemoryManager.Physical.BufferCache; var bufferCache = _channel.MemoryManager.Physical.BufferCache;
if (indexed)
{
if (_indexBufferDirty || _rebind) if (_indexBufferDirty || _rebind)
{ {
_indexBufferDirty = false; _indexBufferDirty = false;
@@ -534,6 +537,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
{ {
bufferCache.SynchronizeBufferRange(_indexBuffer.Address, _indexBuffer.Size); bufferCache.SynchronizeBufferRange(_indexBuffer.Address, _indexBuffer.Size);
} }
}
else if (_rebind)
{
_indexBufferDirty = true;
}
uint vbEnableMask = _vertexBuffersEnableMask; uint vbEnableMask = _vertexBuffersEnableMask;

View File

@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1; private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2; private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
private const uint CodeGenVersion = 4675; private const uint CodeGenVersion = 5529;
private const string SharedTocFileName = "shared.toc"; private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data"; private const string SharedDataFileName = "shared.data";

View File

@@ -162,9 +162,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.Ccc == Ccc.T) if (op.Ccc == Ccc.T)
{ {
context.PrepareForReturn(); if (context.PrepareForReturn())
{
context.Return(); context.Return();
} }
}
else else
{ {
Operand cond = GetCondition(context, op.Ccc, IrConsts.False); Operand cond = GetCondition(context, op.Ccc, IrConsts.False);
@@ -174,8 +176,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
{ {
Operand lblSkip = Label(); Operand lblSkip = Label();
context.BranchIfFalse(lblSkip, cond); context.BranchIfFalse(lblSkip, cond);
context.PrepareForReturn();
if (context.PrepareForReturn())
{
context.Return(); context.Return();
}
context.MarkLabel(lblSkip); context.MarkLabel(lblSkip);
} }
} }

View File

@@ -304,11 +304,11 @@ namespace Ryujinx.Graphics.Shader.Translation
PrepareForVertexReturn(); PrepareForVertexReturn();
} }
public void PrepareForReturn() public bool PrepareForReturn()
{ {
if (IsNonMain) if (IsNonMain)
{ {
return; return true;
} }
if (Config.LastInVertexPipeline && if (Config.LastInVertexPipeline &&
@@ -383,13 +383,13 @@ namespace Ryujinx.Graphics.Shader.Translation
AlphaTestOp alphaTestOp = Config.GpuAccessor.QueryAlphaTestCompare(); AlphaTestOp alphaTestOp = Config.GpuAccessor.QueryAlphaTestCompare();
if (alphaTestOp != AlphaTestOp.Always && (Config.OmapTargets & 8) != 0) if (alphaTestOp != AlphaTestOp.Always)
{ {
if (alphaTestOp == AlphaTestOp.Never) if (alphaTestOp == AlphaTestOp.Never)
{ {
this.Discard(); this.Discard();
} }
else else if ((Config.OmapTargets & 8) != 0)
{ {
Instruction comparator = alphaTestOp switch Instruction comparator = alphaTestOp switch
{ {
@@ -415,6 +415,12 @@ namespace Ryujinx.Graphics.Shader.Translation
} }
} }
// We don't need to output anything if alpha test always fails.
if (alphaTestOp == AlphaTestOp.Never)
{
return false;
}
int regIndexBase = 0; int regIndexBase = 0;
for (int rtIndex = 0; rtIndex < 8; rtIndex++) for (int rtIndex = 0; rtIndex < 8; rtIndex++)
@@ -462,6 +468,8 @@ namespace Ryujinx.Graphics.Shader.Translation
} }
} }
} }
return true;
} }
private void GenerateAlphaToCoverageDitherDiscard() private void GenerateAlphaToCoverageDitherDiscard()

View File

@@ -42,6 +42,7 @@ namespace Ryujinx.Graphics.Vulkan
"VK_NV_viewport_array2", "VK_NV_viewport_array2",
"VK_EXT_depth_clip_control", "VK_EXT_depth_clip_control",
"VK_KHR_portability_subset", // As per spec, we should enable this if present. "VK_KHR_portability_subset", // As per spec, we should enable this if present.
"VK_EXT_4444_formats",
}; };
private static readonly string[] _requiredExtensions = { private static readonly string[] _requiredExtensions = {