GPU/GL Arrays: Difference between revisions

From 3dbrew
< GPU
Jump to navigation Jump to search
Steveice10 (talk | contribs)
mNo edit summary
 
(20 intermediate revisions by 6 users not shown)
Line 1: Line 1:
This page describes the [[GPU_Commands|GPU commands]] used for OpenGL arrays.
Merged into [[GPU/Programming_Guide]].
 
==== Command Sets ====
 
===== glDrawElements() =====
{| class="wikitable" border="1"
!  Command Index
!  CommandID
!  Parameter
!  Description
|-
| 0
| 0x00020229
| u32, val<<8.
| Unknown, val is 0 or 1.
|-
| 1-2
| 0x00020253
| Same as CmdID 0x00020229.
| Unknown
|-
| 3
| 0x0002025E
| u32, val<<8.
| This sets the GL rendering mode.
|-
| 4
| 0x0004025E
| Value 0
| ?
|-
| 5
| 0x000F025F
| Value 1
| ?
|-
| 6
| 0x00010253
| Value 0
| ?
|-
| 7
| 0x000F0227
| u32
| This specifies the indices data-type, and the indices array address.
|-
| 8
| 0x000F0228
| u32
| This specifies the number of elements in the array to use for rendering.
|-
| 9
| 0x00010245
| Value 0
| ?
|-
| 10
| 0x000F022F
| Value 1
| ?
|-
| 11
| 0x00010245
| Value 1
| ?
|-
| 12
| 0x000F0231
| Value 1
| ?
|-
| 13
| 0x000F0111
| Value 1
| ?
|-
| 14
| 0x00020229
| Value 0
| ?
|-
| 15
| 0x00020253
| Value 0
| ?
|-
| 16
| 0x0002025E
| Value 0
| ?
|-
| 17
| 0x000C02BA
| Value 0x7FFF0000
| ?
|}
 
===== CmdID 0x826F0200 =====
{| class="wikitable" border="1"
!  Command Index
!  CommandID
!  Parameter
!  Description
|-
| 0
| 0x826F0200
|
| This sets the addresses for the GL arrays.
|-
| 1
| 0x801F02BB
|
| ?
|-
| 2
| 0x803F0232
|
| Unknown, this command is used multiple times for specifying each parameter-buffer entry.
|}
 
=== GL mode values for CmdID 0x0002025E ===
{| class="wikitable" border="1"
!  Value
!  Description
|-
| 0
| ?
|-
| 1
| GL_TRIANGLE_STRIP
|-
| 2
| GL_TRIANGLE_FAN
|-
| 3
| GL_TRIANGLES
|-
| 4
| Unknown, this seems to have the same effect as value 0.
|}
 
=== Parameter value format for CmdID 0x000F0227 ===
{| class="wikitable" border="1"
!  Bit
!  Description
|-
| 30-0
| Indices array address, relative to VRAM physical address 0x18000000. Thus, when this relative address is 0x08XXXXXX, the array is located in FCRAM.
|-
| 31
| 0 = indices data-type GL_UNSIGNED_BYTE, 1 = GL_UNSIGNED_SHORT.
|}
 
=== Parameter structure for CmdID 0x826F0200 ===
{| class="wikitable" border="1"
!  Index Word
!  Description
|-
| 0x0
| Base physical address >> 3, normally located in VRAM.
|-
| 0x1
| Every 4 bits is used for specifying the array data-type and size for each entry.
|-
| 0x2
| Value is: <nowiki>(0xF0000000 + (val<<28)) | (((0xFF<<totalentries) & 0xFF)<<16)</nowiki>.
|-
| 0x3-0x26
| 12 entries, each entry is 3 words.
|}
 
These parameters and the entries' parameters are set by gl*Pointer().
 
==== Entry structure ====
{| class="wikitable" border="1"
!  Index Word
!  Description
|-
| 0
| Physical address, relative to the base address.
|-
| 1
| Entry index
|-
| 2
| Value is: <nowiki>0x10000000 | (arraytype<<16).</nowiki>
|}
 
When the entry is unused, the entry data is all-zero.
 
===== Entry array types =====
{| class="wikitable" border="1"
!  Type
!  Description
|-
| 0x2
| ?
|-
| 0x3
| Normals array
|-
| 0x4
| Texture coordinates array
|-
| 0xC
| Vertex array
|-
| 0x10
| Color array
|}
 
===== Array data-type/size values =====
{| class="wikitable" border="1"
!  Value
!  GL type
|-
| 0x0 + ((size-1)*4)
| GL_BYTE
|-
| 0x1 + ((size-1)*4)
| GL_UNSIGNED_BYTE
|-
| 0x2 + ((size-1)*4)
| GL_UNSIGNED_SHORT/GL_SHORT
|-
| 0x3 + ((size-1)*4)
| GL_FLOAT
|}
 
Size is 1-4. Using GL_FLOAT with a texture coordinates array causes the GPU to hang?
 
=== Parameter structure for CmdID 0x801F02BB ===
{| class="wikitable" border="1"
!  Index Word
!  Description
|-
| 0-1
| u64, every 4-bits is a value from some array.
|}
 
=== Parameter structure for CmdID 0x803F0232 ===
{| class="wikitable" border="1"
!  Index Word
!  Description
|-
| 0
| Entry index + total CmdID 0x826F0200 parameter-buffer entries.
|-
| 1
| Unknown, usually value 0x3F000000 ( 0.5f ).
|-
| 2
| Unknown, usually value 0.
|-
| 3
| Unknown, usually value 0.
|}
 
Each parameter buffer for CmdID 0x803F0232 is an entry loaded from an array.

Latest revision as of 09:15, 5 December 2015

Merged into GPU/Programming_Guide.