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 513: |
Line 510: |
| | 0x0012B9F4 | | | 0x0012B9F4 |
| | 0x590 | | | 0x590 |
− | | 0x00A8 ? | + | | 0x00A8 bit0, 0x01C6 (0 = enabled) |
| |- | | |- |
| | 0x33 | | | 0x33 |
Line 520: |
Line 517: |
| | 0x00156744 | | | 0x00156744 |
| | 0xA10 | | | 0xA10 |
− | | ? | + | | 0x01C0? |
| |- | | |- |
| | 0x34 | | | 0x34 |
Line 527: |
Line 524: |
| | 0x00156E1C | | | 0x00156E1C |
| | 0xDE0 | | | 0xDE0 |
− | | ? | + | | 0x01C0? |
| |- | | |- |
| | 0x35 | | | 0x35 |
Line 534: |
Line 531: |
| | 0x0015696C | | | 0x0015696C |
| | 0xDA0 | | | 0xDA0 |
− | | ? | + | | 0x01C0 |
| |- | | |- |
| | 0x36 | | | 0x36 |
Line 1,577: |
Line 1,574: |
| | 0x0012C6E8 | | | 0x0012C6E8 |
| | ? | | | ? |
− | | 0x01D1 bit7-9 | + | | 0x01D1 bit8-10 |
| |- | | |- |
| | 0xCB | | | 0xCB |
Line 1,612: |
Line 1,609: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit0-3 |
| |- | | |- |
| | 0xD0 | | | 0xD0 |
Line 1,619: |
Line 1,616: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit4-7 |
| |- | | |- |
| | 0xD1 | | | 0xD1 |
Line 1,626: |
Line 1,623: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit8-11 |
| |- | | |- |
| | 0xD2 | | | 0xD2 |
Line 1,633: |
Line 1,630: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit12-15 |
| |- | | |- |
| | 0xD3 | | | 0xD3 |
Line 1,640: |
Line 1,637: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | |0x01D2 bit16-19 |
| |- | | |- |
| | 0xD4 | | | 0xD4 |
Line 1,647: |
Line 1,644: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit20-23 |
| |- | | |- |
| | 0xD5 | | | 0xD5 |
Line 1,654: |
Line 1,651: |
| | 0x00155404 | | | 0x00155404 |
| | ? | | | ? |
− | | ? | + | | 0x01D2 bit24-27 |
| |- | | |- |
| | 0xD6 | | | 0xD6 |
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 |
| + | |} |