Skip to content

Commit 91d2945

Browse files
authored
Implement PM4CondExec (#3046)
1 parent fff3bf9 commit 91d2945

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/video_core/amdgpu/liverpool.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,19 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
765765
LOG_WARNING(Render_Vulkan, "Unimplemented IT_GET_LOD_STATS");
766766
break;
767767
}
768+
case PM4ItOpcode::CondExec: {
769+
const auto* cond_exec = reinterpret_cast<const PM4CmdCondExec*>(header);
770+
if (cond_exec->command.Value() != 0) {
771+
LOG_WARNING(Render, "IT_COND_EXEC used a reserved command");
772+
}
773+
const auto skip = *cond_exec->Address() == false;
774+
if (skip) {
775+
dcb = NextPacket(dcb,
776+
header->type3.NumWords() + 1 + cond_exec->exec_count.Value());
777+
continue;
778+
}
779+
break;
780+
}
768781
default:
769782
UNREACHABLE_MSG("Unknown PM4 type 3 opcode {:#x} with count {}",
770783
static_cast<u32>(opcode), count);

src/video_core/amdgpu/pm4_cmds.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,4 +1159,25 @@ struct PM4CmdMemSemaphore {
11591159
}
11601160
};
11611161

1162+
struct PM4CmdCondExec {
1163+
PM4Type3Header header;
1164+
union {
1165+
BitField<2, 30, u32> bool_addr_lo; ///< low 32 address bits for the block in memory from
1166+
///< where the CP will fetch the condition
1167+
};
1168+
union {
1169+
BitField<0, 16, u32> bool_addr_hi; ///< high address bits for the condition
1170+
BitField<28, 4, u32> command;
1171+
};
1172+
union {
1173+
BitField<0, 14, u32> exec_count; ///< Number of DWords that the CP will skip
1174+
///< if bool pointed to is zero
1175+
};
1176+
1177+
bool* Address() const {
1178+
return std::bit_cast<bool*>(u64(bool_addr_hi.Value()) << 32 | u64(bool_addr_lo.Value())
1179+
<< 2);
1180+
}
1181+
};
1182+
11621183
} // namespace AmdGpu

0 commit comments

Comments
 (0)