Skip to content
tfarley edited this page Mar 10, 2015 · 9 revisions

OpenGL Hardware Renderer

1. Graphics Backend INI setting

  • Just a new string setting to choose between Software/OpenGL/D3D/...

2. Core Implementation

  • OpenGL maintains one framebuffer
  • Triangles are sent to either Software or OpenGL renderer
  • OpenGL renders into its framebuffer and commits/reloads color/depth buffers from 3ds memory at critical points (swapbuffers/memfill/copy/...)
  • OpenGL maintains cache of textures, added when new framebuffer texture address is accessed, deleted when dma transfer or flushdata touches it

3. GLSL Translator

  • Translates PICA vertex shaders to GLSL at runtime, and uses them instead of current vertex shader interpreter
  • Provides a -really good- performance boost
  • Could pose integration issues if geometry shaders can't be emulated in hardware since it's dirty to get output of GLSL vertex shader

4. HD Rendering

  • Maintain an OpenGL framebuffer for -each existing- 3ds framebuffer at enhanced resolution
  • For commits/reloads, downscale/upscale the framebuffer to work as normal
  • For commits to a screen framebuffer, also copy texture directly to OpenGL frontend screen texture, and circumvent the normal reload from framebuffer to that screen texture

Related But Non-Critical

1. Divide by zero fix

  • Simple epsilon check for divide by zero in vertex shader interpreter to prevent corrupted colors - not sure if this is root cause though
Clone this wiki locally