Create the GPUCommonHW class.

This commit is contained in:
Henrik Rydgård 2023-02-25 14:24:59 +01:00
parent c4f4439b8c
commit 18999c3687
20 changed files with 58 additions and 20 deletions

View File

@ -1659,6 +1659,8 @@ set(GPU_SOURCES
GPU/GPU.h
GPU/GPUCommon.cpp
GPU/GPUCommon.h
GPU/GPUCommonHW.cpp
GPU/GPUCommonHW.h
GPU/GPUState.cpp
GPU/GPUState.h
GPU/Math3D.cpp

View File

@ -42,7 +42,7 @@
#include "GPU/D3D11/D3D11Util.h"
GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw), drawEngine_(draw,
: GPUCommonHW(gfxCtx, draw), drawEngine_(draw,
(ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE),
(ID3D11DeviceContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT)) {
device_ = (ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE);

View File

@ -21,17 +21,15 @@
#include <vector>
#include <d3d11.h>
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommonHW.h"
#include "GPU/D3D11/DrawEngineD3D11.h"
#include "GPU/Common/TextureShaderCommon.h"
#include "GPU/Common/VertexDecoderCommon.h"
class FramebufferManagerD3D11;
class ShaderManagerD3D11;
class LinkedShaderD3D11;
class TextureCacheD3D11;
class GPU_D3D11 : public GPUCommon {
class GPU_D3D11 : public GPUCommonHW {
public:
GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
~GPU_D3D11();

View File

@ -44,7 +44,7 @@
#include "GPU/Directx9/TextureCacheDX9.h"
GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw),
: GPUCommonHW(gfxCtx, draw),
drawEngine_(draw) {
device_ = (LPDIRECT3DDEVICE9)draw->GetNativeObject(Draw::NativeObject::DEVICE);
deviceEx_ = (LPDIRECT3DDEVICE9EX)draw->GetNativeObject(Draw::NativeObject::DEVICE_EX);

View File

@ -20,7 +20,7 @@
#include <string>
#include <vector>
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommonHW.h"
#include "GPU/Directx9/FramebufferManagerDX9.h"
#include "GPU/Directx9/DrawEngineDX9.h"
#include "GPU/Common/TextureShaderCommon.h"
@ -30,7 +30,7 @@ class ShaderManagerDX9;
class LinkedShaderDX9;
class TextureCacheDX9;
class GPU_DX9 : public GPUCommon {
class GPU_DX9 : public GPUCommonHW {
public:
GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
~GPU_DX9();

View File

@ -48,7 +48,7 @@
#endif
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
: GPUCommonHW(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
UpdateVsyncInterval(true);
gstate_c.SetUseFlags(CheckGPUFeatures());

View File

@ -22,7 +22,7 @@
#include "Common/File/Path.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommonHW.h"
#include "GPU/Common/TextureShaderCommon.h"
#include "GPU/GLES/FramebufferManagerGLES.h"
#include "GPU/GLES/DrawEngineGLES.h"
@ -32,7 +32,7 @@ class ShaderManagerGLES;
class TextureCacheGLES;
class LinkedShader;
class GPU_GLES : public GPUCommon {
class GPU_GLES : public GPUCommonHW {
public:
GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
~GPU_GLES();

View File

@ -427,6 +427,7 @@
</ClInclude>
<ClInclude Include="GPU.h" />
<ClInclude Include="GPUCommon.h" />
<ClInclude Include="GPUCommonHW.h" />
<ClInclude Include="GPUInterface.h" />
<ClInclude Include="GPUState.h" />
<ClInclude Include="Math3D.h" />
@ -572,6 +573,7 @@
</ClCompile>
<ClCompile Include="GPU.cpp" />
<ClCompile Include="GPUCommon.cpp" />
<ClCompile Include="GPUCommonHW.cpp" />
<ClCompile Include="GPUState.cpp" />
<ClCompile Include="Math3D.cpp" />
<ClCompile Include="Software\BinManager.cpp" />

View File

@ -264,6 +264,9 @@
<ClInclude Include="Common\GeometryShaderGenerator.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="GPUCommonHW.h">
<Filter>Common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Math3D.cpp">
@ -524,6 +527,9 @@
<ClCompile Include="Common\VertexDecoderRiscV.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="GPUCommonHW.cpp">
<Filter>Common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="..\assets\shaders\tex_4xbrz.csh">

View File

@ -1410,10 +1410,6 @@ void GPUCommon::ProcessDLQueue() {
// Since the event is in CoreTiming, we're in sync. Just set 0 now.
}
void GPUCommon::PreExecuteOp(u32 op, u32 diff) {
CheckFlushOp(op >> 24, diff);
}
void GPUCommon::Execute_OffsetAddr(u32 op, u32 diff) {
gstate_c.offsetAddr = op << 8;
}

View File

@ -109,7 +109,7 @@ public:
void DumpNextFrame() override;
void ExecuteOp(u32 op, u32 diff) override;
virtual void PreExecuteOp(u32 op, u32 diff);
virtual void PreExecuteOp(u32 op, u32 diff) {}
bool InterpretList(DisplayList &list);
void ProcessDLQueue();

13
GPU/GPUCommonHW.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "Common/GPU/thin3d.h"
#include "GPU/GPUCommonHW.h"
GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPUCommon(gfxCtx, draw) {
}
GPUCommonHW::~GPUCommonHW() {}
void GPUCommonHW::PreExecuteOp(u32 op, u32 diff) {
CheckFlushOp(op >> 24, diff);
}

16
GPU/GPUCommonHW.h Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include "GPUCommon.h"
// Shared GPUCommon implementation for the HW backends.
// Things that are irrelevant for SoftGPU should live here.
class GPUCommonHW : public GPUCommon {
public:
GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
~GPUCommonHW();
protected:
void PreExecuteOp(u32 op, u32 diff);
};

View File

@ -210,7 +210,6 @@ protected:
void ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, const uint16_t *overrideData = nullptr);
void BuildReportingInfo() override {}
void PreExecuteOp(u32 op, u32 diff) override {}
private:
void MarkDirty(uint32_t addr, uint32_t stride, uint32_t height, GEBufferFormat fmt, SoftGPUVRAMDirty value);

View File

@ -46,7 +46,7 @@
#include "Common/GPU/Vulkan/VulkanQueueRunner.h"
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
: GPUCommonHW(gfxCtx, draw), drawEngine_(draw) {
gstate_c.SetUseFlags(CheckGPUFeatures());
drawEngine_.InitDeviceObjects();

View File

@ -22,7 +22,7 @@
#include "Common/File/Path.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommonHW.h"
#include "GPU/Vulkan/DrawEngineVulkan.h"
#include "GPU/Vulkan/PipelineManagerVulkan.h"
#include "GPU/Common/TextureShaderCommon.h"
@ -32,7 +32,7 @@ class ShaderManagerVulkan;
class LinkedShader;
class TextureCacheVulkan;
class GPU_Vulkan : public GPUCommon {
class GPU_Vulkan : public GPUCommonHW {
public:
GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
~GPU_Vulkan();

View File

@ -423,6 +423,7 @@
<ClInclude Include="..\..\GPU\ge_constants.h" />
<ClInclude Include="..\..\GPU\GPU.h" />
<ClInclude Include="..\..\GPU\GPUCommon.h" />
<ClInclude Include="..\..\GPU\GPUCommonHW.h" />
<ClInclude Include="..\..\GPU\GPUInterface.h" />
<ClInclude Include="..\..\GPU\GPUState.h" />
<ClInclude Include="..\..\GPU\Math3D.h" />
@ -487,6 +488,7 @@
<ClCompile Include="..\..\GPU\GeDisasm.cpp" />
<ClCompile Include="..\..\GPU\GPU.cpp" />
<ClCompile Include="..\..\GPU\GPUCommon.cpp" />
<ClCompile Include="..\..\GPU\GPUCommonHW.cpp" />
<ClCompile Include="..\..\GPU\GPUState.cpp" />
<ClCompile Include="..\..\GPU\Math3D.cpp" />
<ClCompile Include="..\..\GPU\Software\BinManager.cpp" />

View File

@ -61,6 +61,7 @@
<ClCompile Include="..\..\GPU\Common\Draw2D.cpp" />
<ClCompile Include="..\..\GPU\Common\TextureShaderCommon.cpp" />
<ClCompile Include="..\..\GPU\Common\DepthBufferCommon.cpp" />
<ClCompile Include="..\..\GPU\GPUCommonHW.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\GPU\Common\DepalettizeShaderCommon.h" />
@ -123,5 +124,6 @@
<ClInclude Include="..\..\GPU\Common\ReinterpretFramebuffer.h" />
<ClInclude Include="..\..\GPU\Common\Draw2D.h" />
<ClInclude Include="..\..\GPU\Common\TextureShaderCommon.h" />
<ClInclude Include="..\..\GPU\GPUCommonHW.h" />
</ItemGroup>
</Project>

View File

@ -358,6 +358,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/GPU/Math3D.cpp \
$(SRC)/GPU/GPU.cpp \
$(SRC)/GPU/GPUCommon.cpp \
$(SRC)/GPU/GPUCommonHW.cpp \
$(SRC)/GPU/GPUState.cpp \
$(SRC)/GPU/GeConstants.cpp \
$(SRC)/GPU/GeDisasm.cpp \

View File

@ -406,6 +406,7 @@ SOURCES_CXX += \
$(GPUDIR)/GeConstants.cpp \
$(GPUDIR)/GeDisasm.cpp \
$(GPUDIR)/GPUCommon.cpp \
$(GPUDIR)/GPUCommonHW.cpp \
$(GPUDIR)/GPU.cpp \
$(GPUDIR)/GPUState.cpp \
$(GPUDIR)/Math3D.cpp \