Skip to content

Commit

Permalink
Shader cache version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
gdkchan committed Apr 6, 2023
1 parent 6ddb9a7 commit 8c0a065
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DiskCacheHostStorage
private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
private const uint CodeGenVersion = 4565;
private const uint CodeGenVersion = 4646;

private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data";
Expand Down
19 changes: 18 additions & 1 deletion Ryujinx.Graphics.Gpu/Shader/GpuAccessorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Ryujinx.Graphics.Gpu.Image;
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation;
using System;

namespace Ryujinx.Graphics.Gpu.Shader
{
Expand All @@ -16,6 +17,8 @@ class GpuAccessorBase
private readonly ResourceCounts _resourceCounts;
private readonly int _stageIndex;

private readonly int[] _constantBufferBindings;

/// <summary>
/// Creates a new GPU accessor.
/// </summary>
Expand All @@ -25,6 +28,12 @@ public GpuAccessorBase(GpuContext context, ResourceCounts resourceCounts, int st
_context = context;
_resourceCounts = resourceCounts;
_stageIndex = stageIndex;

if (context.Capabilities.Api != TargetApi.Vulkan)
{
_constantBufferBindings = new int[Constants.TotalGpUniformBuffers];
_constantBufferBindings.AsSpan().Fill(-1);
}
}

public int QueryBindingConstantBuffer(int index)
Expand All @@ -36,7 +45,15 @@ public int QueryBindingConstantBuffer(int index)
}
else
{
return _resourceCounts.UniformBuffersCount++;
int binding = _constantBufferBindings[index];

if (binding < 0)
{
binding = _resourceCounts.UniformBuffersCount++;
_constantBufferBindings[index] = binding;
}

return binding;
}
}

Expand Down

0 comments on commit 8c0a065

Please sign in to comment.