Skip to content

Commit

Permalink
Compute shader renderer (melonDS-emu#2041)
Browse files Browse the repository at this point in the history
* nothing works yet

* don't double buffer 3D framebuffers for the GL Renderer
looks like leftovers from when 3D+2D composition was done in the frontend

* oops

* it works!

* implement display capture for compute renderer
it's actually just all stolen from the regular OpenGL renderer

* fix bad indirect call

* handle cleanup properly

* add hires rendering to the compute shader renderer

* fix UB
also misc changes to use more unsigned multiplication
also fix framebuffer resize

* correct edge filling behaviour when AA is disabled

* fix full color textures

* fix edge marking (polygon id is 6-bit not 5)
also make the code a bit nicer

* take all edge cases into account for XMin/XMax calculation

* use hires coordinate again

* stop using fixed size buffers based on scale factor in shaders
this makes shader compile times tolerable on Wintel
- beginning of the shader cache
- increase size of tile idx in workdesc to 20 bits

* apparently & is not defined on bvec4
why does this even compile on Intel and Nvidia?

* put the texture cache into it's own file

* add compute shader renderer properly to the GUI
also add option to toggle using high resolution vertex coordinates

* unbind sampler object in compute shader renderer

* fix GetRangedBitMask for 64 bit aligned 64 bits
pretty embarassing

* convert NonStupidBitfield.h back to LF only new lines

* actually adapt to latest changes

* fix stupid merge

* actually make compute shader renderer work with newest changes

* show progress on shader compilation

* remove merge leftover
  • Loading branch information
RSDuck authored May 13, 2024
1 parent c85a210 commit 043244a
Show file tree
Hide file tree
Showing 35 changed files with 4,384 additions and 377 deletions.
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ add_library(core STATIC
GPU2D_Soft.cpp
GPU3D.cpp
GPU3D_Soft.cpp
GPU3D_Texcache.cpp
GPU3D_Texcache.h
melonDLDI.h
NDS.cpp
NDSCart.cpp
Expand Down Expand Up @@ -78,6 +80,9 @@ if (ENABLE_OGLRENDERER)
GPU_OpenGL.cpp
GPU_OpenGL_shaders.h
GPU3D_OpenGL.cpp
GPU3D_Compute.cpp
GPU3D_TexcacheOpenGL.cpp
GPU3D_TexcacheOpenGL.h
GPU3D_OpenGL_shaders.h
OpenGLSupport.cpp)

Expand Down
1 change: 1 addition & 0 deletions src/DMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "DSi.h"
#include "DMA.h"
#include "GPU.h"
#include "GPU3D.h"
#include "DMA_Timings.h"
#include "Platform.h"

Expand Down
1 change: 1 addition & 0 deletions src/DSi_NDMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "DSi_NDMA.h"
#include "GPU.h"
#include "DSi_AES.h"
#include "GPU3D.h"

namespace melonDS
{
Expand Down
2 changes: 1 addition & 1 deletion src/GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "ARMJIT.h"

#include "GPU2D_Soft.h"
#include "GPU3D_Soft.h"
#include "GPU3D.h"

namespace melonDS
{
Expand Down
1 change: 1 addition & 0 deletions src/GPU2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>
#include "NDS.h"
#include "GPU.h"
#include "GPU3D.h"

namespace melonDS
{
Expand Down
2 changes: 1 addition & 1 deletion src/GPU2D_Soft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "GPU2D_Soft.h"
#include "GPU.h"
#include "GPU3D_OpenGL.h"
#include "GPU3D.h"

namespace melonDS
{
Expand Down
1 change: 1 addition & 0 deletions src/GPU3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "FIFO.h"
#include "GPU3D_Soft.h"
#include "Platform.h"
#include "GPU3D.h"

namespace melonDS
{
Expand Down
7 changes: 7 additions & 0 deletions src/GPU3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,14 @@ class Renderer3D
virtual void RestartFrame(GPU& gpu) {};
virtual u32* GetLine(int line) = 0;
virtual void Blit(const GPU& gpu) {};

virtual void SetupAccelFrame() {}
virtual void PrepareCaptureFrame() {}
virtual void BindOutputTexture(int buffer) {}

virtual bool NeedsShaderCompile() { return false; }
virtual void ShaderCompileStep(int& current, int& count) {}

protected:
Renderer3D(bool Accelerated);
};
Expand Down
Loading

0 comments on commit 043244a

Please sign in to comment.