Reimplement limited bindless textures support

This commit is contained in:
gdkchan
2019-12-27 22:16:14 -03:00
committed by Thog
parent 647d0962df
commit 947e14d3be
6 changed files with 65 additions and 5 deletions

View File

@ -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;