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

OpenGL Hardware Renderer

1. Refactor of Rendering Pipeline

  • Restructure rendering system including software rasterizer and OpenGL renderer to be extensible
  • Should be able to easily support new APIs for both hardware rendering and displaying

2. Graphics Backend INI setting

  • New string setting(s) to choose between Software/OpenGL/D3D/... renderers/displayers

3. Core Implementation

  • OpenGL maintains one off-screen framebuffer for rendering
  • Triangles are rendered via 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

4. GLSL Vertex Shader 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

5. 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 for enhanced resolution (HD)

6. GLSL Geometry Shader Translator

  • Analogous to the vertex shader, but for PICA geometry shaders

##Other Changes

1. Divide by Zero Fix

  • Implement epsilon check in software shader interpreter to fix a bunch of graphical issues (in all renderers)