From 5afd521c5a75da956448df76e415528316ee8a8d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 2 Jul 2022 15:03:35 -0300 Subject: Bindless elimination for constant sampler handle (#3424) * Bindless elimination for constant sampler handle * Shader cache version bump * Update TextureHandle.ReadPackedId for new bindless elimination --- Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image') diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs index 18f5a74a..fcd23441 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs @@ -792,13 +792,23 @@ namespace Ryujinx.Graphics.Gpu.Image // turn that into a regular texture access and produce those special handles with values on the higher 16 bits. if (handleType != TextureHandleType.CombinedSampler) { - ulong samplerBufferAddress = _isCompute - ? _channel.BufferManager.GetComputeUniformBufferAddress(samplerBufferIndex) - : _channel.BufferManager.GetGraphicsUniformBufferAddress(stageIndex, samplerBufferIndex); + int samplerHandle; - int samplerHandle = _channel.MemoryManager.Physical.Read(samplerBufferAddress + (uint)samplerWordOffset * 4); + if (handleType != TextureHandleType.SeparateConstantSamplerHandle) + { + ulong samplerBufferAddress = _isCompute + ? _channel.BufferManager.GetComputeUniformBufferAddress(samplerBufferIndex) + : _channel.BufferManager.GetGraphicsUniformBufferAddress(stageIndex, samplerBufferIndex); + + samplerHandle = _channel.MemoryManager.Physical.Read(samplerBufferAddress + (uint)samplerWordOffset * 4); + } + else + { + samplerHandle = samplerWordOffset; + } - if (handleType == TextureHandleType.SeparateSamplerId) + if (handleType == TextureHandleType.SeparateSamplerId || + handleType == TextureHandleType.SeparateConstantSamplerHandle) { samplerHandle <<= 20; } -- cgit v1.2.3