Nintendo OpenGL: Difference between revisions

Luigi2us (talk | contribs)
Neobrain (talk | contribs)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page's goal is to describe parts of Nintendo's OpenGL implementation for the 3DS as we reverse engineer it to better understand how to use the PICA200.
This page's goal is to describe parts of Nintendo's OpenGL implementation for the 3DS as we reverse engineer it to better understand how to use the PICA200.
Some of the information on this page is specific to Steeldiver : Sub Wars. The reason for this is that it's a fairly graphics-heavy game that's available on the eShop for '''free''', so it seems like a good target for a community REing effort.
Some of the information on this page is specific to Steeldiver : Sub Wars. The reason for this is that it's a fairly graphics-heavy game that's available on the eShop for '''free''', so it seems like a good target for a community REing effort.
== Rendering pipeline ==
<!-- [[Image:Renderpipeline.png]] -->


== Description ==
== Description ==


The PICA200 is an opengl ES 1.1 compliant GPU manufactured by DMP. It comes loaded with a number of extensions that make it similar to an openGL ES 2.0 compliant GPU (ability to run programmable vertex/geometry shaders, for instance). Because of this, Nintendo wrapped GPU access into an openGL ES 2.0 implementation with some limitations. As the fragment stage of the pipeline is non-programmable, Nintendo instead gives developers the ability to configure a number of fragment-related values through glGetUniformLocation and glUniformXX. See below for the full list.
The PICA200 is an OpenGL ES 1.1 compliant GPU manufactured by DMP. It comes loaded with a number of extensions that make it similar to an OpenGL ES 2.0 compliant GPU (ability to run programmable vertex/geometry shaders, for instance). Because of this, Nintendo wrapped GPU access into an OpenGL ES 2.0 implementation with some limitations. As the fragment stage of the pipeline is non-programmable, Nintendo instead gives developers the ability to configure a number of fragment-related values through glGetUniformLocation and glUniformXX. See below for the full list.


== Shader program structure ==
== Shader program structure ==
Line 436: Line 433:
| 0x001560EC
| 0x001560EC
| 0xE84
| 0xE84
| ?
| 0x0120 (vec[0] -> bit0-7, vec[1] -> bit8-15, vec[2] -> bit16-23)
|-  
|-  
| 0x28
| 0x28
Line 443: Line 440:
| 0x00156268
| 0x00156268
| 0xE90
| 0xE90
| ?
| 0x0121 (vec[0] -> bit0-7, vec[1] -> bit8-15, vec[2] -> bit16-23), 0x0122 (vec[3] -> bit 0-7)
|-  
|-  
| 0x29
| 0x29
Line 450: Line 447:
| 0x001564D4
| 0x001564D4
| 0xEA0
| 0xEA0
| ?
| 0x0126 bit0-23
|-  
|-  
| 0x2A
| 0x2A
Line 457: Line 454:
| 0x001565C0
| 0x001565C0
| 0xEA4
| 0xEA4
| ?
| 0x00E5
|-  
|-  
| 0x2B
| 0x2B
Line 471: Line 468:
| 0x00156684
| 0x00156684
| 0xEA8
| 0xEA8
| ?
| 0x00E4
|-  
|-  
| 0x2D
| 0x2D
Line 478: Line 475:
| 0x0012B7A4
| 0x0012B7A4
| 0x640
| 0x640
| ?
| 0x0122 bit8 (0x6060/0x6061 -> 0/1)
|-  
|-  
| 0x2E
| 0x2E
Line 485: Line 482:
| 0x0012B854
| 0x0012B854
| 0x624
| 0x624
| ?
| 0x00E0 bit3 (0x605E/0x605F -> 0/1)
|-  
|-  
| 0x2F
| 0x2F
Line 2,214: Line 2,211:
| 0x0012E7F8
| 0x0012E7F8
| ?
| ?
| ?
| 0x00E0 bit0-2 (5 -> fog (0x0B60), 7 -> gas (0x6050))
|-  
|-  
| 0x126
| 0x126
Line 2,228: Line 2,225:
| 0x0012E9DC
| 0x0012E9DC
| ?
| ?
| ?
| 0x00E0 bit16
|-  
|-  
| 0x128
| 0x128
Line 2,239: Line 2,236:


On steeldiver's uniform handlers : R1 is a pointer to the current shader program object, R12 is a pointer to the data the uniform is being set to.
On steeldiver's uniform handlers : R1 is a pointer to the current shader program object, R12 is a pointer to the data the uniform is being set to.
== Other Symbols ==
The list above is not exhaustive. A number of other strings specific to Nintendo's rendering framework have been found. Below is a table listing those strings including the location they were found in.
{| class="wikitable" border="1"
! Name
!  Context
!  Occurrence
|-
| dmp_Point.viewport.xy
| Name of a shader uniform
| CTRAging's romfs:/gpu/GasCessna/shader.shbin
|-
| dmp_Point.distanceAttenuation
| Name of a shader uniform
| CTRAging's romfs:/gpu/GasCessna/shader.shbin
|-
| dmp_Point.Position
| Name of a shader uniform
| CTRAging's romfs:/gpu/GasCessna/shader.shbin
|-
| dmp_Point.PointSize
| Name of a shader uniform
| CTRAging's romfs:/gpu/GasCessna/shader.shbin
|}