When trying multiple formats for texel buffer lookup, use clean address

* We also need to check sign-extending the address we get but we don't want that
  check to affect subsequent formats we try with texel buffers.
This commit is contained in:
baldurk committed 2025-09-03 15:42:26 +01:00
1 parent 08d71592dd
commit ec42e46aa9
1 file changed
+10 -8
@@ -830,12 +830,14 @@ void WrappedVulkan::LookupDescriptor(byte *descriptorBytes, size_t descriptorSiz
if(texelBuffer)
bufinfo.format = m_DescriptorLookup.texelFormats[i];
VkDeviceAddress checkAddress = address;
if(type != DescriptorType::AccelerationStructure)
{
// a couple of formats modify the address or size in non-trivial ways that need to be patched
// here. This also handles converting an element size back into a byte size trivially
GetFinalBufferParameters(descriptorBytes, descriptorSize, type, bufinfo.format,
address, size, bufinfo.address, bufinfo.range);
checkAddress, size, bufinfo.address, bufinfo.range);
}
ObjDisp(m_Device)->GetDescriptorEXT(Unwrap(m_Device), &info, descriptorSize, tempMem);
@@ -843,11 +845,11 @@ void WrappedVulkan::LookupDescriptor(byte *descriptorBytes, size_t descriptorSiz
if(memcmp(tempMem, descriptorBytes, descriptorSize) != 0)
{
// try sign extending if the top bit is set
address |= (0xffffULL << 48);
checkAddress |= (0xffffULL << 48);
if(type == DescriptorType::AccelerationStructure)
info.data.accelerationStructure = address;
info.data.accelerationStructure = checkAddress;
else
bufinfo.address = address;
bufinfo.address = checkAddress;
ObjDisp(m_Device)->GetDescriptorEXT(Unwrap(m_Device), &info, descriptorSize, tempMem);
}
@@ -880,17 +882,17 @@ void WrappedVulkan::LookupDescriptor(byte *descriptorBytes, size_t descriptorSiz
}
else
{
id = m_ASLookupByAddr[address];
id = m_ASLookupByAddr[checkAddress];
if(id == ResourceId() && (address & (1ULL << 47)))
if(id == ResourceId() && (checkAddress & (1ULL << 47)))
{
// try sign extending if the top bit is set
id = m_ASLookupByAddr[address | (0xffffULL << 48)];
id = m_ASLookupByAddr[checkAddress | (0xffffULL << 48)];
}
if(id == ResourceId())
{
RDCWARN("Unknown AS at descriptor address %llx", address);
RDCWARN("Unknown AS at descriptor address %llx", checkAddress);
}
else
{