mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-16 15:43:14 +00:00
gnm: Implement sceGnmDrawIndexIndirectMulti (#2889)
This commit is contained in:
parent
8d7cbf9943
commit
a1439b15cf
5 changed files with 86 additions and 20 deletions
|
@ -455,14 +455,14 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
|
|||
case PM4ItOpcode::DrawIndirect: {
|
||||
const auto* draw_indirect = reinterpret_cast<const PM4CmdDrawIndirect*>(header);
|
||||
const auto offset = draw_indirect->data_offset;
|
||||
const auto size = sizeof(DrawIndirectArgs);
|
||||
const auto stride = sizeof(DrawIndirectArgs);
|
||||
if (DebugState.DumpingCurrentReg()) {
|
||||
DebugState.PushRegsDump(base_addr, reinterpret_cast<uintptr_t>(header), regs);
|
||||
}
|
||||
if (rasterizer) {
|
||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||
rasterizer->ScopeMarkerBegin(fmt::format("gfx:{}:DrawIndirect", cmd_address));
|
||||
rasterizer->DrawIndirect(false, indirect_args_addr, offset, size, 1, 0);
|
||||
rasterizer->DrawIndirect(false, indirect_args_addr, offset, stride, 1, 0);
|
||||
rasterizer->ScopeMarkerEnd();
|
||||
}
|
||||
break;
|
||||
|
@ -471,7 +471,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
|
|||
const auto* draw_index_indirect =
|
||||
reinterpret_cast<const PM4CmdDrawIndexIndirect*>(header);
|
||||
const auto offset = draw_index_indirect->data_offset;
|
||||
const auto size = sizeof(DrawIndexedIndirectArgs);
|
||||
const auto stride = sizeof(DrawIndexedIndirectArgs);
|
||||
if (DebugState.DumpingCurrentReg()) {
|
||||
DebugState.PushRegsDump(base_addr, reinterpret_cast<uintptr_t>(header), regs);
|
||||
}
|
||||
|
@ -479,25 +479,46 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
|
|||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||
rasterizer->ScopeMarkerBegin(
|
||||
fmt::format("gfx:{}:DrawIndexIndirect", cmd_address));
|
||||
rasterizer->DrawIndirect(true, indirect_args_addr, offset, size, 1, 0);
|
||||
rasterizer->DrawIndirect(true, indirect_args_addr, offset, stride, 1, 0);
|
||||
rasterizer->ScopeMarkerEnd();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PM4ItOpcode::DrawIndexIndirectCountMulti: {
|
||||
case PM4ItOpcode::DrawIndexIndirectMulti: {
|
||||
const auto* draw_index_indirect =
|
||||
reinterpret_cast<const PM4CmdDrawIndexIndirectMulti*>(header);
|
||||
const auto offset = draw_index_indirect->data_offset;
|
||||
if (DebugState.DumpingCurrentReg()) {
|
||||
DebugState.PushRegsDump(base_addr, reinterpret_cast<uintptr_t>(header), regs);
|
||||
}
|
||||
if (rasterizer) {
|
||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||
rasterizer->ScopeMarkerBegin(
|
||||
fmt::format("gfx:{}:DrawIndexIndirectMulti", cmd_address));
|
||||
rasterizer->DrawIndirect(true, indirect_args_addr, offset,
|
||||
draw_index_indirect->stride,
|
||||
draw_index_indirect->count, 0);
|
||||
rasterizer->ScopeMarkerEnd();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PM4ItOpcode::DrawIndexIndirectCountMulti: {
|
||||
const auto* draw_index_indirect =
|
||||
reinterpret_cast<const PM4CmdDrawIndexIndirectCountMulti*>(header);
|
||||
const auto offset = draw_index_indirect->data_offset;
|
||||
if (DebugState.DumpingCurrentReg()) {
|
||||
DebugState.PushRegsDump(base_addr, reinterpret_cast<uintptr_t>(header), regs);
|
||||
}
|
||||
if (rasterizer) {
|
||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||
rasterizer->ScopeMarkerBegin(
|
||||
fmt::format("gfx:{}:DrawIndexIndirectCountMulti", cmd_address));
|
||||
rasterizer->DrawIndirect(
|
||||
true, indirect_args_addr, offset, draw_index_indirect->stride,
|
||||
draw_index_indirect->count, draw_index_indirect->countAddr);
|
||||
rasterizer->DrawIndirect(true, indirect_args_addr, offset,
|
||||
draw_index_indirect->stride,
|
||||
draw_index_indirect->count,
|
||||
draw_index_indirect->count_indirect_enable.Value()
|
||||
? draw_index_indirect->count_addr
|
||||
: 0);
|
||||
rasterizer->ScopeMarkerEnd();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -860,6 +860,24 @@ struct PM4CmdDrawIndexIndirect {
|
|||
};
|
||||
|
||||
struct PM4CmdDrawIndexIndirectMulti {
|
||||
PM4Type3Header header; ///< header
|
||||
u32 data_offset; ///< Byte aligned offset where the required data structure starts
|
||||
union {
|
||||
u32 dw2;
|
||||
BitField<0, 16, u32> base_vtx_loc; ///< Offset where the CP will write the
|
||||
///< BaseVertexLocation it fetched from memory
|
||||
};
|
||||
union {
|
||||
u32 dw3;
|
||||
BitField<0, 16, u32> start_inst_loc; ///< Offset where the CP will write the
|
||||
///< StartInstanceLocation it fetched from memory
|
||||
};
|
||||
u32 count; ///< Count of data structures to loop through before going to next packet
|
||||
u32 stride; ///< Stride in memory from one data structure to the next
|
||||
u32 draw_initiator; ///< Draw Initiator Register
|
||||
};
|
||||
|
||||
struct PM4CmdDrawIndexIndirectCountMulti {
|
||||
PM4Type3Header header; ///< header
|
||||
u32 data_offset; ///< Byte aligned offset where the required data structure starts
|
||||
union {
|
||||
|
@ -874,14 +892,14 @@ struct PM4CmdDrawIndexIndirectMulti {
|
|||
};
|
||||
union {
|
||||
u32 dw4;
|
||||
BitField<0, 16, u32> drawIndexLoc; ///< register offset to write the Draw Index count
|
||||
BitField<0, 16, u32> draw_index_loc; ///< register offset to write the Draw Index count
|
||||
BitField<30, 1, u32>
|
||||
countIndirectEnable; ///< Indicates the data structure count is in memory
|
||||
count_indirect_enable; ///< Indicates the data structure count is in memory
|
||||
BitField<31, 1, u32>
|
||||
drawIndexEnable; ///< Enables writing of Draw Index count to DRAW_INDEX_LOC
|
||||
draw_index_enable; ///< Enables writing of Draw Index count to DRAW_INDEX_LOC
|
||||
};
|
||||
u32 count; ///< Count of data structures to loop through before going to next packet
|
||||
u64 countAddr; ///< DWord aligned Address[31:2]; Valid if countIndirectEnable is set
|
||||
u64 count_addr; ///< DWord aligned Address[31:2]; Valid if countIndirectEnable is set
|
||||
u32 stride; ///< Stride in memory from one data structure to the next
|
||||
u32 draw_initiator; ///< Draw Initiator Register
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue