GPU: Difference between revisions
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
== Command Structure == | == Command Structure == | ||
{| class="wikitable" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Bits || Description | ||
|- | |- | ||
|12 | | 2-12 || Method address | ||
|Method | |||
|- | |- | ||
|15 | | 13-15 || Method subchannel | ||
| | |||
|- | |- | ||
| | | 16-28 || Method count, immediate-data or [[#Tertiary opcode|tertiary opcode]] | ||
| | |||
|- | |- | ||
| | | 29-31 || [[#Secondary opcode|Secondary opcode]] | ||
| | |||
|[[# | |||
|} | |} | ||
Methods are treated as 4-byte addressable locations, and hence their numbers are written down multiplied by 4. The command's arguments, when present, follow the command word immediately. | |||
=== Secondary opcode === | |||
{| class="wikitable" border="1" | |||
=== | |- | ||
{| class="wikitable" | ! Mode || Description | ||
|- | |||
| 0 || [[#GRP0_USE_TERT|GRP0_USE_TERT]] | |||
|- | |||
| 1 || [[#INC_METHOD|INC_METHOD]] | |||
|- | |||
| 2 || Reserved | |||
|- | |||
| 3 || [[#NON_INC_METHOD|NON_INC_METHOD]] | |||
|- | |||
| 4 || [[#IMMD_DATA_METHOD|IMMD_DATA_METHOD]] | |||
|- | |- | ||
| 5 || [[#ONE_INC|ONE_INC]] | |||
|- | |- | ||
| | | 6 || Reserved | ||
| | |||
| | |||
|- | |- | ||
| | | 7 || [[#END_PB_SEGMENT|END_PB_SEGMENT]] | ||
| | |} | ||
| | |||
==== GRP0_USE_TERT ==== | |||
Tells PFIFO to read [[#Tertiary opcode|tertiary opcode]] from bits 16-17 of the command word. | |||
==== INC_METHOD ==== | |||
Tells PFIFO to read as much arguments as specified by '''method count''', while automatically incrementing the '''method address''' value. This means that each argument will be written to a different method location. | |||
==== NON_INC_METHOD ==== | |||
Tells PFIFO to read as much arguments as specified by '''method count'''. However, all arguments will be written to the same method location. | |||
==== IMMD_DATA_METHOD ==== | |||
Tells PFIFO to read '''immediate-data''' from bits 16-28 of the command word, thus eliminating the need to pass additional words for the arguments. | |||
==== ONE_INC ==== | |||
Tells PFIFO to read as much arguments as specified by '''method count''' and automatically increments the '''method address''' value once only. | |||
==== END_PB_SEGMENT ==== | |||
Tells PFIFO to stop processing any further methods. | |||
=== Tertiary opcode === | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Mode || Description | ||
| | |||
|- | |- | ||
| | | 1 || GRP0_SET_SUB_DEV_MASK | ||
| | |||
| | |||
|- | |- | ||
| | | 2 || GRP0_STORE_SUB_DEV_MASK | ||
| | |||
| | |||
|- | |- | ||
| | | 3 || GRP0_USE_SUB_DEV_MASK | ||
| | |||
| | |||
|} | |} | ||
== SetObject == | == SetObject == | ||
In order to bind an engine object to a specific subchannel, method 0 (SetObject) must be used first. The target subchannel is specified in bits 15 | In order to bind an engine object to a specific subchannel, method 0 (SetObject) must be used first. The target subchannel is specified in bits 13-15 of the command word. | ||
After the engine object is bound to the desired subchannel, setting it's value in bits 15 | After the engine object is bound to the desired subchannel, setting it's value in bits 13-15 of any subsequent command word will make PFIFO forward the command to the target engine. | ||
This method only takes one argument, a [[#GPU_Classes|GPU Class ID]]. | This method only takes one argument, a [[#GPU_Classes|GPU Class ID]]. | ||
Line 97: | Line 107: | ||
The above commands are added using the [[#Submission_mode|increasing mode]], since all those 4 registers are sequential. | The above commands are added using the [[#Submission_mode|increasing mode]], since all those 4 registers are sequential. | ||
Official games sets Operation to 0 (Release), bit 4 to 1, bits 15 | Official games sets Operation to 0 (Release), bit 4 to 1, bits 12-15 (Unit) to 0xF, and bit 28 to 1 (OneWord). The ReportSemaphorePayload value is then written by the GPU to the address pointed to by ReportSemaphoreOffset. | ||
On the CPU side, the game code should wait until the value at the address pointed to by ReportSemaphoreOffset is >= to the last written value. Official code waits for this condition to be true on a loop, and won't send any further commands before that. | On the CPU side, the game code should wait until the value at the address pointed to by ReportSemaphoreOffset is >= to the last written value. Official code waits for this condition to be true on a loop, and won't send any further commands before that. | ||
Line 134: | Line 144: | ||
! Word || Bits || Description | ! Word || Bits || Description | ||
|- | |- | ||
| 0 || 6 | | 0 || 0-6 || [[GPU_Texture_Formats#Texture_Formats|Texture Format]] | ||
|- | |- | ||
| 0 || 9 | | 0 || 7-9 || [[#Channel_Data_Type|R Channel Data Type]] | ||
|- | |- | ||
| 0 || 12 | | 0 || 10-12 || [[#Channel_Data_Type|G Channel Data Type]] | ||
|- | |- | ||
| 0 || 15 | | 0 || 13-15 || [[#Channel_Data_Type|B Channel Data Type]] | ||
|- | |- | ||
| 0 || 18 | | 0 || 16-18 || [[#Channel_Data_Type|A Channel Data Type]] | ||
|- | |- | ||
| 1 || 31 | | 1 || 0-31 || Lower 32-bits of the Texture GPU Virtual Address | ||
|- | |- | ||
| 2 || 15 | | 2 || 0-15 || Higher 16-bits of the Texture GPU Virtual Address | ||
|- | |- | ||
| 4 || 15 | | 4 || 0-15 || Texture Width minus 1 | ||
|- | |- | ||
| 5 || 15 | | 5 || 0-15 || Texture Height minus 1 | ||
|} | |} | ||