Recompiler: Use num_records to check if an inline buffer exists (#4323)

* Change buffer check to use num_records instead

* Fix the address fixup check

Since base_address == 0 is possible, this should specifically check against 1 (which we reserve for null buffers).
Kinda shocked TLOU/Uncharted worked at all without setting this.
This commit is contained in:
Stephen Miller 2026-04-27 00:39:00 -05:00 committed by GitHub
parent a762f70df3
commit e33a185423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -506,7 +506,7 @@ void PatchBufferSharp(IR::Block& block, IR::Inst& inst, Info& info, Descriptors&
// is used to define an inline buffer resource
std::array<u64, 2> raw;
// Keep relative address, we'll do fixup of the address at buffer fetch later
raw[0] = (handle->Arg(0).U32() | u64(handle->Arg(1).U32()) << 32);
raw[0] = handle->Arg(0).U32() | u64(handle->Arg(1).U32()) << 32;
raw[1] = handle->Arg(2).U32() | u64(handle->Arg(3).U32()) << 32;
const auto buffer = std::bit_cast<AmdGpu::Buffer>(raw);
buffer_binding = descriptors.Add(BufferResource{

View File

@ -56,7 +56,7 @@ struct BufferResource {
AmdGpu::Buffer buffer{};
if (inline_cbuf) {
buffer = inline_cbuf;
if (inline_cbuf.base_address > 1) {
if (inline_cbuf.base_address != 1) {
buffer.base_address += info.pgm_base; // address fixup
}
} else {

View File

@ -49,7 +49,7 @@ struct Buffer {
}
operator bool() const noexcept {
return base_address != 0;
return num_records != 0;
}
bool operator==(const Buffer& other) const noexcept {