diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 51309d8384..894fb0b7c4 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -393,8 +393,8 @@ static const CommandTableEntry commandTable[] = { GPU_DX9::CommandInfo GPU_DX9::cmdInfo_[256]; -GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx) -: gfxCtx_(gfxCtx) { +GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw) +: GPUCommon(gfxCtx, draw) { lastVsync_ = g_Config.bVSync ? 1 : 0; dxstate.SetVSyncInterval(g_Config.bVSync); diff --git a/GPU/Directx9/GPU_DX9.h b/GPU/Directx9/GPU_DX9.h index 9f12b7ebb5..070aebe5e6 100644 --- a/GPU/Directx9/GPU_DX9.h +++ b/GPU/Directx9/GPU_DX9.h @@ -35,7 +35,7 @@ class LinkedShaderDX9; class GPU_DX9 : public GPUCommon { public: - GPU_DX9(GraphicsContext *gfxCtx); + GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw); ~GPU_DX9(); void CheckGPUFeatures(); @@ -85,10 +85,6 @@ public: void Execute_Spline(u32 op, u32 diff); void Execute_VertexType(u32 op, u32 diff); void Execute_VertexTypeSkinning(u32 op, u32 diff); - void Execute_TexScaleU(u32 op, u32 diff); - void Execute_TexScaleV(u32 op, u32 diff); - void Execute_TexOffsetU(u32 op, u32 diff); - void Execute_TexOffsetV(u32 op, u32 diff); void Execute_TexSize0(u32 op, u32 diff); void Execute_LoadClut(u32 op, u32 diff); @@ -126,8 +122,6 @@ private: std::string reportingPrimaryInfo_; std::string reportingFullInfo_; - - GraphicsContext *gfxCtx_; }; } // namespace DX9 diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index ae60c0e12c..b302dbaf57 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -393,8 +393,8 @@ static const CommandTableEntry commandTable[] = { GPU_GLES::CommandInfo GPU_GLES::cmdInfo_[256]; -GPU_GLES::GPU_GLES(GraphicsContext *ctx) -: gfxCtx_(ctx) { +GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) +: GPUCommon(gfxCtx, draw) { UpdateVsyncInterval(true); CheckGPUFeatures(); diff --git a/GPU/GLES/GPU_GLES.h b/GPU/GLES/GPU_GLES.h index 71235fd0c6..033136a7e9 100644 --- a/GPU/GLES/GPU_GLES.h +++ b/GPU/GLES/GPU_GLES.h @@ -30,11 +30,10 @@ class ShaderManagerGLES; class LinkedShader; -class GraphicsContext; class GPU_GLES : public GPUCommon { public: - GPU_GLES(GraphicsContext *gfxCtx); + GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw); ~GPU_GLES(); // This gets called on startup and when we get back from settings. @@ -129,7 +128,5 @@ private: std::string reportingPrimaryInfo_; std::string reportingFullInfo_; - - GraphicsContext *gfxCtx_; std::string shaderCachePath_; }; diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index e650f841f0..96c1ed86f1 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -46,20 +46,20 @@ static void SetGPU(T *obj) { #undef new #endif -bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d) { +bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) { switch (PSP_CoreParameter().gpuCore) { case GPUCORE_NULL: SetGPU(new NullGPU()); break; case GPUCORE_GLES: - SetGPU(new GPU_GLES(ctx)); + SetGPU(new GPU_GLES(ctx, draw)); break; case GPUCORE_SOFTWARE: - SetGPU(new SoftGPU(ctx, thin3d)); + SetGPU(new SoftGPU(ctx, draw)); break; case GPUCORE_DIRECTX9: #if defined(_WIN32) - SetGPU(new DIRECTX9_GPU(ctx)); + SetGPU(new DIRECTX9_GPU(ctx, draw)); #endif break; case GPUCORE_DIRECTX11: @@ -70,7 +70,7 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d) { ERROR_LOG(G3D, "Unable to init Vulkan GPU backend, no context"); break; } - SetGPU(new GPU_Vulkan(ctx)); + SetGPU(new GPU_Vulkan(ctx, draw)); #endif break; } diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 2f00d0fbd0..1058f109b3 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -30,11 +30,13 @@ void GPUCommon::Flush() { drawEngineCommon_->DispatchFlush(); } -GPUCommon::GPUCommon() : +GPUCommon::GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : dumpNextFrame_(false), dumpThisFrame_(false), framebufferManager_(nullptr), - resized_(false) + resized_(false), + gfxCtx_(gfxCtx), + draw_(draw) { // This assert failed on GCC x86 32-bit (but not MSVC 32-bit!) before adding the // "padding" field at the end. This is important for save state compatibility. diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index f648e0f05c..8a2a807642 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -18,6 +18,10 @@ typedef ThreadEventQueue DisplayListQueue; int nextListID; diff --git a/GPU/Null/NullGpu.cpp b/GPU/Null/NullGpu.cpp index 02b0a4efff..45564e7269 100644 --- a/GPU/Null/NullGpu.cpp +++ b/GPU/Null/NullGpu.cpp @@ -25,7 +25,7 @@ #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/sceGe.h" -NullGPU::NullGPU() { } +NullGPU::NullGPU() : GPUCommon(nullptr, nullptr) { } NullGPU::~NullGPU() { } void NullGPU::FastRunLoop(DisplayList &list) { diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 3cced07af0..b8a5862ac8 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -47,8 +47,8 @@ static Draw::SamplerState *samplerLinear = nullptr; static Draw::Buffer *vdata = nullptr; static Draw::Buffer *idata = nullptr; -SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D) - : gfxCtx_(gfxCtx), draw_(_thin3D) +SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw) + : GPUCommon(gfxCtx, draw) { using namespace Draw; TextureDesc desc{}; diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index d0dc9da949..14d73bb0bc 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -103,9 +103,7 @@ private: u32 displayStride_; GEBufferFormat displayFormat_; - GraphicsContext *gfxCtx_; Draw::Texture *fbTex; - Draw::DrawContext *draw_; Draw::Pipeline *texColor; std::vector fbTexBuffer; }; diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index ffbd23bc40..850aced4f3 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -388,10 +388,10 @@ static const CommandTableEntry commandTable[] = { { GE_CMD_UNKNOWN_FF, 0 }, }; -GPU_Vulkan::GPU_Vulkan(GraphicsContext *ctx) - : vulkan_((VulkanContext *)ctx->GetAPIContext()), - drawEngine_(vulkan_), - gfxCtx_(ctx) { +GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw) + : GPUCommon(gfxCtx, draw), + vulkan_((VulkanContext *)gfxCtx->GetAPIContext()), + drawEngine_(vulkan_) { UpdateVsyncInterval(true); CheckGPUFeatures(); diff --git a/GPU/Vulkan/GPU_Vulkan.h b/GPU/Vulkan/GPU_Vulkan.h index 65f64d6259..e60c5ea034 100644 --- a/GPU/Vulkan/GPU_Vulkan.h +++ b/GPU/Vulkan/GPU_Vulkan.h @@ -32,7 +32,7 @@ class LinkedShader; class GPU_Vulkan : public GPUCommon { public: - GPU_Vulkan(GraphicsContext *ctx); + GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw); ~GPU_Vulkan(); // This gets called on startup and when we get back from settings. @@ -108,7 +108,6 @@ private: void UpdateCmdInfo(); static CommandInfo cmdInfo_[256]; - GraphicsContext *gfxCtx_; VulkanContext *vulkan_; FramebufferManagerVulkan *framebufferManagerVulkan_; TextureCacheVulkan *textureCacheVulkan_;