From b0e911ad7f7d1156b6cab2fbb441a6205b43799f Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Sat, 13 Aug 2022 01:11:39 -0500 Subject: [PATCH] GS: Work around clang-cl issues "error: inheritance model does not match definition" really means "Classes with virtual methods need to be compiled differently from those without in ms-abi, and you declared a pointer to member function, which needs to know what type of pointer to use, before clang knew about any virtual methods, so it guessed the wrong type". --- pcsx2/GS/GSClut.h | 4 ++-- pcsx2/GS/GSLocalMemory.h | 4 ++-- pcsx2/GS/GSState.h | 8 +++++--- pcsx2/GS/Renderers/Common/GSVertexTrace.h | 3 +-- pcsx2/GS/Renderers/SW/GSRasterizer.h | 18 +++++++++--------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pcsx2/GS/GSClut.h b/pcsx2/GS/GSClut.h index 54bc72e1eb..ecb8f8d89b 100644 --- a/pcsx2/GS/GSClut.h +++ b/pcsx2/GS/GSClut.h @@ -22,7 +22,7 @@ class GSLocalMemory; -class alignas(32) GSClut : public GSAlignedClass<32> +class alignas(32) GSClut final : public GSAlignedClass<32> { static const GSVector4i m_bm; static const GSVector4i m_gm; @@ -99,7 +99,7 @@ private: public: GSClut(GSLocalMemory* mem); - virtual ~GSClut(); + ~GSClut(); bool InvalidateRange(u32 start_block, u32 end_block, bool is_draw = false); u8 IsInvalid(); diff --git a/pcsx2/GS/GSLocalMemory.h b/pcsx2/GS/GSLocalMemory.h index cc884755f9..64e8e6b517 100644 --- a/pcsx2/GS/GSLocalMemory.h +++ b/pcsx2/GS/GSLocalMemory.h @@ -438,7 +438,7 @@ class GSLocalMemory; MULTI_ISA_DEF(class GSLocalMemoryFunctions;) MULTI_ISA_DEF(void GSLocalMemoryPopulateFunctions(GSLocalMemory& mem);) -class GSLocalMemory : public GSAlignedClass<32> +class GSLocalMemory final : public GSAlignedClass<32> { MULTI_ISA_FRIEND(GSLocalMemoryFunctions) @@ -523,7 +523,7 @@ protected: public: GSLocalMemory(); - virtual ~GSLocalMemory(); + ~GSLocalMemory(); __forceinline u16* vm16() const { return reinterpret_cast(m_vm8); } __forceinline u32* vm32() const { return reinterpret_cast(m_vm8); } diff --git a/pcsx2/GS/GSState.h b/pcsx2/GS/GSState.h index ed3ee7b8d3..261ff633f0 100644 --- a/pcsx2/GS/GSState.h +++ b/pcsx2/GS/GSState.h @@ -44,6 +44,11 @@ typedef bool (*GetSkipCount)(const GSFrameInfo& fi, int& skip); class GSState : public GSAlignedClass<32> { +public: + GSState(); + virtual ~GSState(); + +private: // RESTRICT prevents multiple loads of the same part of the register when accessing its bitfields (the compiler is happy to know that memory writes in-between will not go there) typedef void (GSState::*GIFPackedRegHandler)(const GIFPackedReg* RESTRICT r); @@ -331,9 +336,6 @@ public: }; public: - GSState(); - virtual ~GSState(); - /// Returns the appropriate directory for draw dumping. static std::string GetDrawDumpPath(const char* format, ...); diff --git a/pcsx2/GS/Renderers/Common/GSVertexTrace.h b/pcsx2/GS/Renderers/Common/GSVertexTrace.h index a9c62c773c..b7e7d0b663 100644 --- a/pcsx2/GS/Renderers/Common/GSVertexTrace.h +++ b/pcsx2/GS/Renderers/Common/GSVertexTrace.h @@ -29,7 +29,7 @@ class GSVertexTrace; MULTI_ISA_DEF(class GSVertexTraceFMM;) MULTI_ISA_DEF(void GSVertexTracePopulateFunctions(GSVertexTrace& vt, bool provoking_vertex_first);) -class alignas(32) GSVertexTrace : public GSAlignedClass<32> +class alignas(32) GSVertexTrace final : public GSAlignedClass<32> { MULTI_ISA_FRIEND(GSVertexTraceFMM) @@ -76,7 +76,6 @@ public: public: GSVertexTrace(const GSState* state, bool provoking_vertex_first); - virtual ~GSVertexTrace() {} void Update(const void* vertex, const u32* index, int v_count, int i_count, GS_PRIM_CLASS primclass); diff --git a/pcsx2/GS/Renderers/SW/GSRasterizer.h b/pcsx2/GS/Renderers/SW/GSRasterizer.h index a6e047c588..792900110b 100644 --- a/pcsx2/GS/Renderers/SW/GSRasterizer.h +++ b/pcsx2/GS/Renderers/SW/GSRasterizer.h @@ -71,6 +71,15 @@ public: class IDrawScanline : public GSAlignedClass<32> { public: + IDrawScanline() + : m_sp(NULL) + , m_ds(NULL) + , m_de(NULL) + , m_dr(NULL) + { + } + virtual ~IDrawScanline() {} + typedef void (*SetupPrimPtr)(const GSVertexSW* vertex, const u32* index, const GSVertexSW& dscan); typedef void (*DrawScanlinePtr)(int pixels, int left, int top, const GSVertexSW& scan); typedef void (IDrawScanline::*DrawRectPtr)(const GSVector4i& r, const GSVertexSW& v); // TODO: jit @@ -82,15 +91,6 @@ protected: DrawRectPtr m_dr; public: - IDrawScanline() - : m_sp(NULL) - , m_ds(NULL) - , m_de(NULL) - , m_dr(NULL) - { - } - virtual ~IDrawScanline() {} - virtual void BeginDraw(const GSRasterizerData* data) = 0; virtual void EndDraw(u64 frame, u64 ticks, int actual, int total, int prims) = 0;