| 792 | } |
| 793 | |
| 794 | void MTGS::PrepDataPacket(Command cmd, u32 size) |
| 795 | { |
| 796 | s_packet_size = size; |
| 797 | ++size; // takes into account our RingCommand QWC. |
| 798 | GenericStall(size); |
| 799 | |
| 800 | // Command qword: Low word is the command, and the high word is the packet |
| 801 | // length in SIMDs (128 bits). |
| 802 | const unsigned int local_WritePos = s_WritePos.load(std::memory_order_relaxed); |
| 803 | |
| 804 | PacketTagType& tag = (PacketTagType&)RingBuffer[local_WritePos]; |
| 805 | tag.command = static_cast<u32>(cmd); |
| 806 | tag.data[0] = s_packet_size; |
| 807 | s_packet_startpos = local_WritePos; |
| 808 | s_packet_writepos = (local_WritePos + 1) & RingBufferMask; |
| 809 | } |
| 810 | |
| 811 | // Returns the amount of giftag data processed (in simd128 values). |
| 812 | // Return value is used by VU1's XGKICK instruction to wrap the data |