Nintendo OpenGL: Difference between revisions

Smea (talk | contribs)
Created page with "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. == Description == T..."
 
Smea (talk | contribs)
No edit summary
Line 4: Line 4:


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 glSetUniform. 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 glSetUniform. See below for the full list.
== Shader program structure ==
When uniform values are set, they are attached to the current shader program and stored into the corresponding shader program structure.
{| class="wikitable" border="1"
! Offset
!  Size
!  Description
|-
| 0x000
| 0x04
| Value 0x0 ?
|-
| 0x004
| 0x04
| Program ID
|-
| 0x008
| 0x04
| Value -1 ?
|-
| 0x01C
| 0x04
| Pointer to program-specific uniform table
|-
| 0x020
| 0x04
| Total number of uniforms for program
|-
| 0x028
| 0x04
| Number of program-specific uniforms
|-
| 0x64C
| 0x04
| Value for GPU register 0x0104
|-
| 0x7C0
| 0x04
| Bitfield containing dmp_FragmentLightSource[n].shadowed values
|-
| 0x7D8
| 0x04
| Bitfield containing dmp_FragmentLightSource[n].geomFactor0 / dmp_FragmentLightSource[n].geomFactor1 / dmp_FragmentLightSource[n].twoSideDiffuse values
|-
| 0xA20
| 0x70*8
| Table of structs for 8 dmp_FragmentLightSource
|}


== Fragment "uniform" list ==
== Fragment "uniform" list ==