Line 17: |
Line 17: |
| | | |
| == Command Structure == | | == Command Structure == |
− | {| class="wikitable" | + | {| class="wikitable" border="1" |
| |- | | |- |
− | ! scope="col"| Bits | + | ! Bits || Description |
− | ! scope="col"| Description
| |
| |- | | |- |
− | |12-0 | + | | 2-12 || Method address |
− | |Method | |
| |- | | |- |
− | |15-13 | + | | 13-15 || Method subchannel |
− | |Subchannel | |
| |- | | |- |
− | |27-16 | + | | 16-28 || Method count, immediate-data or [[#Tertiary opcode|tertiary opcode]] |
− | |Argument count (in 32-bits Words) or inline data (see below) | |
| |- | | |- |
− | |28? | + | | 29-31 || [[#Secondary opcode|Secondary opcode]] |
− | |Hmm?
| |
− | |-
| |
− | |31-29 | |
− | |[[#Submission_mode|Submission mode]] | |
| |} | | |} |
| | | |
− | Note: Methods are treated as 4-byte addressable locations, and hence their numbers are written down multiplied by 4.
| + | 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. |
| | | |
− | Note: The command's arguments, when present, follow the command word immediately.
| + | === Secondary opcode === |
− | | + | {| class="wikitable" border="1" |
− | === Submission mode === | + | |- |
− | {| 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]] |
| |- | | |- |
− | ! scope="col"| Mode
| + | | 5 || [[#ONE_INC|ONE_INC]] |
− | ! scope="col"| Description
| |
− | ! scope="col"| Offical name
| |
| |- | | |- |
− | |0 | + | | 6 || Reserved |
− | |Increasing mode (old) | |
− | | | |
| |- | | |- |
− | |1 | + | | 7 || [[#END_PB_SEGMENT|END_PB_SEGMENT]] |
− | |Increasing mode - Tells PFIFO to read as much arguments as specified by '''argument count''', while automatically incrementing the '''method''' value. This means that each argument will be written to a different method location. | + | |} |
− | |INCR | + | |
| + | ==== 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" |
| |- | | |- |
− | |2 | + | ! Mode || Description |
− | |Non-increasing mode (old)
| |
− | | | |
| |- | | |- |
− | |3 | + | | 1 || GRP0_SET_SUB_DEV_MASK |
− | |Non-increasing mode - Tells PFIFO to read as much arguments as specified by '''argument count'''. However, all arguments will be written to the same method location. | |
− | |NONINCR | |
| |- | | |- |
− | |4 | + | | 2 || GRP0_STORE_SUB_DEV_MASK |
− | |Inline mode - Tells PFIFO to read '''inline data''' from bits 28-16 of the command word, thus eliminating the need to pass additional words for the arguments. | |
− | |IMM | |
| |- | | |- |
− | |5 | + | | 3 || GRP0_USE_SUB_DEV_MASK |
− | |Increase-once mode - Tells PFIFO to read as much arguments as specified by '''argument count''' and automatically increments the '''method''' value once only. | |
− | | | |
| |} | | |} |
| | | |
| == 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-13 of the command word. | + | 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-13 of any subsequent command word will make PFIFO forward the command to the target engine. | + | 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-12 (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. | + | 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 || [[GPU_Texture_Formats#Texture_Formats|Texture Format]] | + | | 0 || 0-6 || [[GPU_Texture_Formats#Texture_Formats|Texture Format]] |
| |- | | |- |
− | | 0 || 9-7 || [[#Channel_Data_Type|R Channel Data Type]] | + | | 0 || 7-9 || [[#Channel_Data_Type|R Channel Data Type]] |
| |- | | |- |
− | | 0 || 12-10 || [[#Channel_Data_Type|G Channel Data Type]] | + | | 0 || 10-12 || [[#Channel_Data_Type|G Channel Data Type]] |
| |- | | |- |
− | | 0 || 15-13 || [[#Channel_Data_Type|B Channel Data Type]] | + | | 0 || 13-15 || [[#Channel_Data_Type|B Channel Data Type]] |
| |- | | |- |
− | | 0 || 18-16 || [[#Channel_Data_Type|A Channel Data Type]] | + | | 0 || 16-18 || [[#Channel_Data_Type|A Channel Data Type]] |
| |- | | |- |
− | | 1 || 31-0 || Lower 32-bits of the Texture GPU Virtual Address | + | | 1 || 0-31 || Lower 32-bits of the Texture GPU Virtual Address |
| |- | | |- |
− | | 2 || 15-0 || Higher 16-bits of the Texture GPU Virtual Address | + | | 2 || 0-15 || Higher 16-bits of the Texture GPU Virtual Address |
| |- | | |- |
− | | 4 || 15-0 || Texture Width minus 1 | + | | 4 || 0-15 || Texture Width minus 1 |
| |- | | |- |
− | | 5 || 15-0 || Texture Height minus 1 | + | | 5 || 0-15 || Texture Height minus 1 |
| |} | | |} |
| | | |