shader: compare real nested descriptor pointer instructions

This commit is contained in:
nmzik
2026-10-15 00:16:47 +02:00
parent bb2d6dbeb3
commit 65a6f30f51
3 changed files with 38 additions and 4 deletions
@@ -21,6 +21,7 @@ class Value {
public:
Value() = default;
explicit Value(Inst* value);
explicit Value(const Inst* value) = delete;
explicit Value(ScalarReg value);
explicit Value(VectorReg value);
explicit Value(bool value);
@@ -2768,7 +2768,7 @@ private:
IndirectDescriptorPlan& plan) {
if (handle.GetOpcode() != ValueOpcode::GetImageResource &&
handle.GetOpcode() != ValueOpcode::GetSamplerResource) return false;
const Inst* pointer = nullptr;
Inst* pointer = nullptr;
uint32_t descriptor_offset = 0;
for (uint32_t word = 0; word < handle.NumArgs(); ++word) {
const auto* read = descriptor.dwords[word].Resolve().TryInstruction();
@@ -2777,7 +2777,7 @@ private:
if (memory == nullptr || memory->kind != ResourceKind::ScalarAddress ||
memory->offset > INT32_MAX || !ImmediateU32(read->Arg(1), offset) ||
!AvailableBefore(*read, handle)) return false;
const auto* address = read->Arg(0).Resolve().TryInstruction();
auto* address = read->Arg(0).Resolve().TryInstruction();
const uint64_t current_offset = uint64_t {offset & ~3u} + (memory->offset & ~3u);
if (address == nullptr || address->GetOpcode() != ValueOpcode::GetAddressResource ||
address->NumArgs() != 2u || current_offset > UINT32_MAX ||