aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-27 22:16:14 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit947e14d3be0f7c5e4b6f77df204ec675b8e9e719 (patch)
treebde8c9ecfa0bab5c8dfa9706e6ef2418d2b53a36 /Ryujinx.Graphics.Gpu/Image
parent647d0962df5b54334af965b88f784409afbf6223 (diff)
Reimplement limited bindless textures support
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs21
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs25
2 files changed, 45 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
index 19090ab3..042635ee 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs
@@ -8,10 +8,31 @@ namespace Ryujinx.Graphics.Gpu.Image
public int Handle { get; }
+ public bool IsBindless { get; }
+
+ public int CbufSlot { get; }
+ public int CbufOffset { get; }
+
public TextureBindingInfo(Target target, int handle)
{
Target = target;
Handle = handle;
+
+ IsBindless = false;
+
+ CbufSlot = 0;
+ CbufOffset = 0;
+ }
+
+ public TextureBindingInfo(Target target, int cbufSlot, int cbufOffset)
+ {
+ Target = target;
+ Handle = 0;
+
+ IsBindless = true;
+
+ CbufSlot = cbufSlot;
+ CbufOffset = cbufOffset;
}
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index ce58e5c5..0c09661f 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -2,6 +2,7 @@ using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.State;
using Ryujinx.Graphics.Shader;
using System;
+using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Image
{
@@ -133,7 +134,29 @@ namespace Ryujinx.Graphics.Gpu.Image
{
TextureBindingInfo binding = _textureBindings[stageIndex][index];
- int packedId = ReadPackedId(stageIndex, binding.Handle);
+ int packedId;
+
+ if (binding.IsBindless)
+ {
+ ulong address;
+
+ var bufferManager = _context.Methods.BufferManager;
+
+ if (_isCompute)
+ {
+ address = bufferManager.GetComputeUniformBufferAddress(binding.CbufSlot);
+ }
+ else
+ {
+ address = bufferManager.GetGraphicsUniformBufferAddress(stageIndex, binding.CbufSlot);
+ }
+
+ packedId = MemoryMarshal.Cast<byte, int>(_context.PhysicalMemory.Read(address + (ulong)binding.CbufOffset * 4, 4))[0];
+ }
+ else
+ {
+ packedId = ReadPackedId(stageIndex, binding.Handle);
+ }
int textureId = UnpackTextureId(packedId);
int samplerId;