Simplify logic for bindless texture handling (#1667)

* Simplify logic for bindless texture handling

* Nits
This commit is contained in:
gdkchan 2020-11-09 19:35:04 -03:00 committed by GitHub
parent eda6b78894
commit 934a78005e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 131 additions and 191 deletions

View file

@ -267,30 +267,9 @@ namespace Ryujinx.Graphics.Gpu.Image
{
TextureBindingInfo bindingInfo = _textureBindings[stageIndex][index];
int packedId;
if (bindingInfo.IsBindless)
{
ulong address;
var bufferManager = _context.Methods.BufferManager;
if (_isCompute)
{
address = bufferManager.GetComputeUniformBufferAddress(bindingInfo.CbufSlot);
}
else
{
address = bufferManager.GetGraphicsUniformBufferAddress(stageIndex, bindingInfo.CbufSlot);
}
packedId = _context.PhysicalMemory.Read<int>(address + (ulong)bindingInfo.CbufOffset * 4);
}
else
{
packedId = ReadPackedId(stageIndex, bindingInfo.Handle, _textureBufferIndex);
}
int textureBufferIndex = bindingInfo.CbufSlot < 0 ? _textureBufferIndex : bindingInfo.CbufSlot;
int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, textureBufferIndex);
int textureId = UnpackTextureId(packedId);
int samplerId;
@ -361,7 +340,9 @@ namespace Ryujinx.Graphics.Gpu.Image
{
TextureBindingInfo bindingInfo = _imageBindings[stageIndex][index];
int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, _textureBufferIndex);
int textureBufferIndex = bindingInfo.CbufSlot < 0 ? _textureBufferIndex : bindingInfo.CbufSlot;
int packedId = ReadPackedId(stageIndex, bindingInfo.Handle, textureBufferIndex);
int textureId = UnpackTextureId(packedId);
Texture texture = pool.Get(textureId);