From a2abe49d3f94b97f3df513ec997933be0114d85b Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 25 Dec 2022 15:57:51 +1000 Subject: [PATCH] GS: Warning fixes for clang-cl --- pcsx2/GS/Renderers/Common/GSDevice.cpp | 9 +++++++++ pcsx2/GS/Renderers/DX11/D3D.h | 2 +- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 2 ++ pcsx2/GS/Renderers/DX11/GSDevice11.h | 16 ++++++++-------- pcsx2/GS/Renderers/DX11/GSTexture11.h | 5 +++-- pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp | 4 ++-- pcsx2/GS/Renderers/DX12/GSDevice12.h | 4 ++-- pcsx2/GS/Renderers/DX12/GSTexture12.h | 2 +- pcsx2/GS/Renderers/HW/GSHwHack.cpp | 2 +- pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp | 10 +++++----- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 2 +- pcsx2/GS/Renderers/Null/GSDeviceNull.cpp | 4 ++-- pcsx2/GS/Renderers/Null/GSDeviceNull.h | 2 +- pcsx2/GS/Renderers/Null/GSTextureNull.cpp | 3 ++- pcsx2/GS/Renderers/Null/GSTextureNull.h | 4 ++-- pcsx2/GS/Renderers/SW/GSDrawScanline.cpp | 2 +- .../SW/GSDrawScanlineCodeGenerator.all.cpp | 10 +++++----- pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h | 12 ++++++++++-- pcsx2/GS/Renderers/SW/GSRasterizer.cpp | 6 +++--- pcsx2/GS/Renderers/SW/GSRendererSW.cpp | 14 +++++--------- .../SW/GSSetupPrimCodeGenerator.all.cpp | 2 +- pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 11 ----------- pcsx2/GS/Renderers/Vulkan/GSTextureVK.h | 2 +- 23 files changed, 68 insertions(+), 62 deletions(-) diff --git a/pcsx2/GS/Renderers/Common/GSDevice.cpp b/pcsx2/GS/Renderers/Common/GSDevice.cpp index a29b4b70a3..0094f22e63 100644 --- a/pcsx2/GS/Renderers/Common/GSDevice.cpp +++ b/pcsx2/GS/Renderers/Common/GSDevice.cpp @@ -507,11 +507,20 @@ void GSDevice::SetHWDrawConfigForAlphaPass(GSHWDrawConfig::PSSelector* ps, } } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif + // Kinda grotty, but better than copy/pasting the relevant bits in.. #define A_CPU 1 #include "bin/resources/shaders/common/ffx_a.h" #include "bin/resources/shaders/common/ffx_cas.h" +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + bool GSDevice::GetCASShaderSource(std::string* source) { std::optional ffx_a_source(Host::ReadResourceFileToString("shaders/common/ffx_a.h")); diff --git a/pcsx2/GS/Renderers/DX11/D3D.h b/pcsx2/GS/Renderers/DX11/D3D.h index 69e972b850..3b8bdcff66 100644 --- a/pcsx2/GS/Renderers/DX11/D3D.h +++ b/pcsx2/GS/Renderers/DX11/D3D.h @@ -16,11 +16,11 @@ #pragma once #include "common/RedtapeWindows.h" +#include "common/RedtapeWilCom.h" #include #include #include -#include namespace D3D { diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 76e90c1b05..e062a3c01e 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -505,6 +505,8 @@ GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int width, int height case GSTexture::Type::RWTexture: desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE; break; + default: + break; } GSTexture11* t = nullptr; diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.h b/pcsx2/GS/Renderers/DX11/GSDevice11.h index e155c681bf..31effcc395 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.h +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.h @@ -251,21 +251,21 @@ public: void DrawIndexedPrimitive(); void DrawIndexedPrimitive(int offset, int count); - void ClearRenderTarget(GSTexture* t, const GSVector4& c) final; - void ClearRenderTarget(GSTexture* t, u32 c) final; - void ClearDepth(GSTexture* t) final; - void ClearStencil(GSTexture* t, u8 c) final; + void ClearRenderTarget(GSTexture* t, const GSVector4& c) override; + void ClearRenderTarget(GSTexture* t, u32 c) override; + void ClearDepth(GSTexture* t) override; + void ClearStencil(GSTexture* t, u8 c) override; - bool DownloadTexture(GSTexture* src, const GSVector4i& rect, GSTexture::GSMap& out_map) final; - void DownloadTextureComplete() final; + bool DownloadTexture(GSTexture* src, const GSVector4i& rect, GSTexture::GSMap& out_map) override; + void DownloadTextureComplete() override; void CloneTexture(GSTexture* src, GSTexture** dest, const GSVector4i& rect); void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r, u32 destX, u32 destY) override; - void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ShaderConvert shader = ShaderConvert::COPY, bool linear = true) final; + void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ShaderConvert shader = ShaderConvert::COPY, bool linear = true) override; void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true); - void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha); + void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha) override; void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true); void PresentRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, PresentShader shader, float shaderTime, bool linear) override; diff --git a/pcsx2/GS/Renderers/DX11/GSTexture11.h b/pcsx2/GS/Renderers/DX11/GSTexture11.h index 7f4edf3404..2abb522dfc 100644 --- a/pcsx2/GS/Renderers/DX11/GSTexture11.h +++ b/pcsx2/GS/Renderers/DX11/GSTexture11.h @@ -15,9 +15,10 @@ #pragma once -#include "GS.h" +#include "GS/GS.h" #include "GS/Renderers/Common/GSTexture.h" -#include +#include "common/RedtapeWindows.h" +#include "common/RedtapeWilCom.h" #include class GSTexture11 final : public GSTexture diff --git a/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp b/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp index 55227f20eb..e2ed903b31 100644 --- a/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSTextureFX11.cpp @@ -14,9 +14,9 @@ */ #include "PrecompiledHeader.h" -#include "GSDevice11.h" -#include "GS/resource.h" +#include "GS/Renderers/DX11/GSDevice11.h" #include "GS/GSTables.h" +#include "common/StringUtil.h" bool GSDevice11::CreateTextureFX() { diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.h b/pcsx2/GS/Renderers/DX12/GSDevice12.h index 01e957c070..5a018b1dd5 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.h +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.h @@ -15,9 +15,9 @@ #pragma once -#include "GSTexture12.h" #include "GS/GSVector.h" #include "GS/Renderers/Common/GSDevice.h" +#include "GS/Renderers/DX12/GSTexture12.h" #include "common/D3D12/ShaderCache.h" #include "common/D3D12/StreamBuffer.h" #include "common/HashCombine.h" @@ -266,7 +266,7 @@ public: void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha) override; void PresentRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, - PresentShader shader, float shaderTime, bool linear); + PresentShader shader, float shaderTime, bool linear) override; void BeginRenderPassForStretchRect(GSTexture12* dTex, const GSVector4i& dtex_rc, const GSVector4i& dst_rc); void DoStretchRect(GSTexture12* sTex, const GSVector4& sRect, GSTexture12* dTex, const GSVector4& dRect, diff --git a/pcsx2/GS/Renderers/DX12/GSTexture12.h b/pcsx2/GS/Renderers/DX12/GSTexture12.h index 544ccb5ca8..553ab90935 100644 --- a/pcsx2/GS/Renderers/DX12/GSTexture12.h +++ b/pcsx2/GS/Renderers/DX12/GSTexture12.h @@ -15,7 +15,7 @@ #pragma once -#include "GS.h" +#include "GS/GS.h" #include "GS/Renderers/Common/GSTexture.h" #include "common/D3D12/Context.h" #include "common/D3D12/Texture.h" diff --git a/pcsx2/GS/Renderers/HW/GSHwHack.cpp b/pcsx2/GS/Renderers/HW/GSHwHack.cpp index a84f175782..bdbf8aed8e 100644 --- a/pcsx2/GS/Renderers/HW/GSHwHack.cpp +++ b/pcsx2/GS/Renderers/HW/GSHwHack.cpp @@ -306,7 +306,7 @@ bool GSC_TombRaiderUnderWorld(const GSFrameInfo& fi, int& skip) noexcept { if (skip == 0) { - if (fi.TME && fi.FBP == 0x01000 && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2B60 /*|| fi.TBP0 == 0x2EFF || fi.TBP0 ==0x2F00 || fi.TBP0 == 0x3020*/ || fi.TBP0 >= 0x2C01 && fi.TBP0 != 0x3029 && fi.TBP0 != 0x302d)) + if (fi.TME && fi.FBP == 0x01000 && fi.FPSM == fi.TPSM && fi.TPSM == PSM_PSMCT32 && (fi.TBP0 == 0x2B60 /*|| fi.TBP0 == 0x2EFF || fi.TBP0 ==0x2F00 || fi.TBP0 == 0x3020*/ || (fi.TBP0 >= 0x2C01 && fi.TBP0 != 0x3029 && fi.TBP0 != 0x302d))) { skip = 1; // Garbage TC } diff --git a/pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp b/pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp index c65a51c8cd..b8950e848b 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHWMultiISA.cpp @@ -150,7 +150,7 @@ bool GSRendererHWFunctions::SwPrimRender(GSRendererHW& hw) } const bool fwrite = (fm & fm_mask) != fm_mask; - const bool ftest = gd.sel.atst != ATST_ALWAYS || context->TEST.DATE && context->FRAME.PSM != PSM_PSMCT24; + const bool ftest = gd.sel.atst != ATST_ALWAYS || (context->TEST.DATE && context->FRAME.PSM != PSM_PSMCT24); const bool zwrite = zm != 0xffffffff; const bool ztest = context->TEST.ZTE && context->TEST.ZTST > ZTST_ALWAYS; @@ -340,10 +340,10 @@ bool GSRendererHWFunctions::SwPrimRender(GSRendererHW& hw) const u32 masked_fm = fm & fm_mask; if (gd.sel.date || gd.sel.aba == 1 || gd.sel.abb == 1 || gd.sel.abc == 1 || gd.sel.abd == 1 - || gd.sel.atst != ATST_ALWAYS && gd.sel.afail == AFAIL_RGB_ONLY - || gd.sel.fpsm == 0 && masked_fm != 0 && masked_fm != fm_mask - || gd.sel.fpsm == 1 && masked_fm != 0 && masked_fm != fm_mask - || gd.sel.fpsm == 2 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.atst != ATST_ALWAYS && gd.sel.afail == AFAIL_RGB_ONLY) + || (gd.sel.fpsm == 0 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.fpsm == 1 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.fpsm == 2 && masked_fm != 0 && masked_fm != fm_mask)) { gd.sel.rfb = 1; } diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index ce9e8299e8..9349823bcb 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -3171,7 +3171,7 @@ void GSTextureCache::InjectHashCacheTexture(const HashCacheKey& key, GSTexture* // We must've got evicted before we finished loading. No matter, add it in there anyway; // if it's not used again, it'll get tossed out later. const HashCacheEntry entry{tex, 1u, 0u, true}; - m_hash_cache.emplace(key, entry).first->second; + m_hash_cache.emplace(key, entry); return; } diff --git a/pcsx2/GS/Renderers/Null/GSDeviceNull.cpp b/pcsx2/GS/Renderers/Null/GSDeviceNull.cpp index 4f68658ddd..be2a5f5906 100644 --- a/pcsx2/GS/Renderers/Null/GSDeviceNull.cpp +++ b/pcsx2/GS/Renderers/Null/GSDeviceNull.cpp @@ -16,7 +16,7 @@ #include "PrecompiledHeader.h" #include "GSDeviceNull.h" -GSTexture* GSDeviceNull::CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) +GSTexture* GSDeviceNull::CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format) { - return new GSTextureNull(type, w, h, format); + return new GSTextureNull(type, width, height, levels, format); } diff --git a/pcsx2/GS/Renderers/Null/GSDeviceNull.h b/pcsx2/GS/Renderers/Null/GSDeviceNull.h index b6fe656f85..da35211a20 100644 --- a/pcsx2/GS/Renderers/Null/GSDeviceNull.h +++ b/pcsx2/GS/Renderers/Null/GSDeviceNull.h @@ -21,7 +21,7 @@ class GSDeviceNull : public GSDevice { private: - GSTexture* CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format); + GSTexture* CreateSurface(GSTexture::Type type, int width, int height, int levels, GSTexture::Format format); void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) {} void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0, int bufIdx = 0) {} diff --git a/pcsx2/GS/Renderers/Null/GSTextureNull.cpp b/pcsx2/GS/Renderers/Null/GSTextureNull.cpp index 06f18ea0ce..d813508472 100644 --- a/pcsx2/GS/Renderers/Null/GSTextureNull.cpp +++ b/pcsx2/GS/Renderers/Null/GSTextureNull.cpp @@ -21,11 +21,12 @@ GSTextureNull::GSTextureNull() memset(&m_desc, 0, sizeof(m_desc)); } -GSTextureNull::GSTextureNull(Type type, int w, int h, GSTexture::Format format) +GSTextureNull::GSTextureNull(Type type, int w, int h, int levels, GSTexture::Format format) { m_desc.type = type; m_desc.w = w; m_desc.h = h; + m_desc.levels = levels; m_desc.format = format; } diff --git a/pcsx2/GS/Renderers/Null/GSTextureNull.h b/pcsx2/GS/Renderers/Null/GSTextureNull.h index 255eab935f..fe033d0306 100644 --- a/pcsx2/GS/Renderers/Null/GSTextureNull.h +++ b/pcsx2/GS/Renderers/Null/GSTextureNull.h @@ -23,12 +23,12 @@ class GSTextureNull final : public GSTexture { Type type; Format format; - int w, h; + int w, h, levels; } m_desc; public: GSTextureNull(); - GSTextureNull(Type type, int w, int h, Format format); + GSTextureNull(Type type, int w, int h, int levels, Format format); Type GetType() const { return m_desc.type; } Format GetFormat() const { return m_desc.format; } diff --git a/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp b/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp index c656b8cca1..a34c5d25c7 100644 --- a/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp +++ b/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp @@ -1277,7 +1277,7 @@ void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertex { VectorI rbs = rb, gas = ga, rbd, gad, a, mask; - if (sel.aba != sel.abb && (sel.aba == 1 || sel.abb == 1 || sel.abc == 1) || sel.abd == 1) + if ((sel.aba != sel.abb && (sel.aba == 1 || sel.abb == 1 || sel.abc == 1)) || sel.abd == 1) { switch (sel.fpsm) { diff --git a/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp b/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp index 3f33d3e56e..32e96ee54a 100644 --- a/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp +++ b/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp @@ -686,7 +686,7 @@ void GSDrawScanlineCodeGenerator2::Init() mov(rax, _rip_global(fzbc)); lea(t0, ptr[rax + rbx * 2]); - if (m_sel.prim != GS_SPRITE_CLASS && (m_sel.fwrite && m_sel.fge || m_sel.zb) || m_sel.fb && (m_sel.edge || m_sel.tfx != TFX_NONE || m_sel.iip)) + if ((m_sel.prim != GS_SPRITE_CLASS && ((m_sel.fwrite && m_sel.fge) || m_sel.zb)) || (m_sel.fb && (m_sel.edge || m_sel.tfx != TFX_NONE || m_sel.iip))) { // a1 = &m_local.d[skip] // note a1 was (skip << 4) lea(rax, _rip_local(d)); @@ -705,7 +705,7 @@ void GSDrawScanlineCodeGenerator2::Init() if (m_sel.prim != GS_SPRITE_CLASS) { - if (m_sel.fwrite && m_sel.fge || m_sel.zb) + if ((m_sel.fwrite && m_sel.fge) || m_sel.zb) { if (m_sel.fwrite && m_sel.fge) { @@ -2450,7 +2450,7 @@ void GSDrawScanlineCodeGenerator2::ReadFrame() /// Destroys: xym0, xym1 void GSDrawScanlineCodeGenerator2::TestDestAlpha() { - if (!m_sel.date || m_sel.fpsm != 0 && m_sel.fpsm != 2) + if (!m_sel.date || (m_sel.fpsm != 0 && m_sel.fpsm != 2)) { return; } @@ -2599,7 +2599,7 @@ void GSDrawScanlineCodeGenerator2::AlphaBlend() const XYm& tmp1 = _test; const XYm& tmp2 = xym4; - if ((m_sel.aba != m_sel.abb) && (m_sel.aba == 1 || m_sel.abb == 1 || m_sel.abc == 1) || m_sel.abd == 1) + if (((m_sel.aba != m_sel.abb) && (m_sel.aba == 1 || m_sel.abb == 1 || m_sel.abc == 1)) || m_sel.abd == 1) { switch (m_sel.fpsm) { @@ -2648,7 +2648,7 @@ void GSDrawScanlineCodeGenerator2::AlphaBlend() // xym0, xym1 = dst rb, ga // tmp1, tmp2 = free - if (m_sel.pabe || (m_sel.aba != m_sel.abb) && (m_sel.abb == 0 || m_sel.abd == 0)) + if (m_sel.pabe || ((m_sel.aba != m_sel.abb) && (m_sel.abb == 0 || m_sel.abd == 0))) { movdqa(tmp2, _rb); } diff --git a/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h b/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h index 055aeb1c35..8b01522e21 100644 --- a/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h +++ b/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h @@ -15,6 +15,14 @@ #pragma once +#if defined(_MSC_VER) && defined(__clang__) +#define and and_ +#define or or_ +#define xor xor_ +#define not not_ +#define XBYAK_NO_OP_NAMES +#endif + #include "xbyak/xbyak.h" #include "xbyak/xbyak_util.h" #include "GS/MultiISA.h" @@ -191,7 +199,7 @@ public: ACTUAL_FORWARD_##category(name, a, b, c, d) \ } -#ifdef __GNUC__ +#if defined(__GNUC__) || (defined(_MSC_VER) && defined(__clang__)) #define FORWARD_(argcount, ...) FORWARD##argcount(__VA_ARGS__) // Gets the macro evaluator to evaluate in the right order #define FORWARD(...) FORWARD_(__VA_ARGS__) @@ -219,7 +227,7 @@ public: #define ADD_ONE_2 3 #define ADD_ONE_3 4 -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(_MSC_VER) && defined(__clang__) #define SFORWARD(argcount, name, ...) FORWARD(argcount, SSE, name, __VA_ARGS__) #define AFORWARD_(argcount, name, arg1, ...) \ SFORWARD(argcount, name, arg1, __VA_ARGS__) \ diff --git a/pcsx2/GS/Renderers/SW/GSRasterizer.cpp b/pcsx2/GS/Renderers/SW/GSRasterizer.cpp index 817476f4ab..76bdc5440d 100644 --- a/pcsx2/GS/Renderers/SW/GSRasterizer.cpp +++ b/pcsx2/GS/Renderers/SW/GSRasterizer.cpp @@ -141,7 +141,7 @@ int GSRasterizer::GetPixels(bool reset) void GSRasterizer::Draw(GSRasterizerData* data) { - if (data->vertex != NULL && data->vertex_count == 0 || data->index != NULL && data->index_count == 0) + if ((data->vertex != NULL && data->vertex_count == 0) || (data->index != NULL && data->index_count == 0)) return; m_pixels.actual = 0; @@ -275,7 +275,7 @@ void GSRasterizer::DrawPoint(const GSVertexSW* vertex, int vertex_count, const u GSVector4i p(v.p); - if (!scissor_test || m_scissor.left <= p.x && p.x < m_scissor.right && m_scissor.top <= p.y && p.y < m_scissor.bottom) + if (!scissor_test || (m_scissor.left <= p.x && p.x < m_scissor.right && m_scissor.top <= p.y && p.y < m_scissor.bottom)) { if (IsOneOfMyScanlines(p.y)) { @@ -296,7 +296,7 @@ void GSRasterizer::DrawPoint(const GSVertexSW* vertex, int vertex_count, const u GSVector4i p(v.p); - if (!scissor_test || m_scissor.left <= p.x && p.x < m_scissor.right && m_scissor.top <= p.y && p.y < m_scissor.bottom) + if (!scissor_test || (m_scissor.left <= p.x && p.x < m_scissor.right && m_scissor.top <= p.y && p.y < m_scissor.bottom)) { if (IsOneOfMyScanlines(p.y)) { diff --git a/pcsx2/GS/Renderers/SW/GSRendererSW.cpp b/pcsx2/GS/Renderers/SW/GSRendererSW.cpp index 1dda0ed61f..44152a3815 100644 --- a/pcsx2/GS/Renderers/SW/GSRendererSW.cpp +++ b/pcsx2/GS/Renderers/SW/GSRendererSW.cpp @@ -1025,7 +1025,7 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data) } bool fwrite = (fm & fm_mask) != fm_mask; - bool ftest = gd.sel.atst != ATST_ALWAYS || context->TEST.DATE && context->FRAME.PSM != PSM_PSMCT24; + bool ftest = gd.sel.atst != ATST_ALWAYS || (context->TEST.DATE && context->FRAME.PSM != PSM_PSMCT24); bool zwrite = zm != 0xffffffff; bool ztest = context->TEST.ZTE && context->TEST.ZTST > ZTST_ALWAYS; @@ -1166,8 +1166,6 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data) GSVector4 tmin = m_vt.m_min.t; GSVector4 tmax = m_vt.m_max.t; - static int s_counter = 0; - for (int i = 1, j = std::min((int)context->TEX1.MXL, 6); i <= j; i++) { const GIFRegTEX0& MIP_TEX0 = GetTex0Layer(i); @@ -1193,8 +1191,6 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data) data->SetSource(t, r, i); } - s_counter++; - m_vt.m_min.t = tmin; m_vt.m_max.t = tmax; } @@ -1331,10 +1327,10 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data) const u32 masked_fm = fm & fm_mask; if (gd.sel.date || gd.sel.aba == 1 || gd.sel.abb == 1 || gd.sel.abc == 1 || gd.sel.abd == 1 - || gd.sel.atst != ATST_ALWAYS && gd.sel.afail == AFAIL_RGB_ONLY - || gd.sel.fpsm == 0 && masked_fm != 0 && masked_fm != fm_mask - || gd.sel.fpsm == 1 && masked_fm != 0 && masked_fm != fm_mask - || gd.sel.fpsm == 2 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.atst != ATST_ALWAYS && gd.sel.afail == AFAIL_RGB_ONLY) + || (gd.sel.fpsm == 0 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.fpsm == 1 && masked_fm != 0 && masked_fm != fm_mask) + || (gd.sel.fpsm == 2 && masked_fm != 0 && masked_fm != fm_mask)) { gd.sel.rfb = 1; } diff --git a/pcsx2/GS/Renderers/SW/GSSetupPrimCodeGenerator.all.cpp b/pcsx2/GS/Renderers/SW/GSSetupPrimCodeGenerator.all.cpp index 58c25414a1..0ea5b8e704 100644 --- a/pcsx2/GS/Renderers/SW/GSSetupPrimCodeGenerator.all.cpp +++ b/pcsx2/GS/Renderers/SW/GSSetupPrimCodeGenerator.all.cpp @@ -101,7 +101,7 @@ void GSSetupPrimCodeGenerator2::Generate() // Technically we just need the delta < 2GB m_rip = (size_t)&m_local < 0x80000000 && (size_t)getCurr() < 0x80000000; - bool needs_shift = (m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip; + bool needs_shift = ((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS) || m_en.t || (m_en.c && m_sel.iip); many_regs = isYmm && !m_sel.notest && needs_shift; #ifdef _WIN64 diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index 1270b09611..8c32597226 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -2867,17 +2867,6 @@ void GSDeviceVK::SetPSConstantBuffer(const GSHWDrawConfig::PSConstantBuffer& cb) m_dirty_flags |= DIRTY_FLAG_PS_CONSTANT_BUFFER; } -static void ImageBarrier(GSTextureVK* tex, VkAccessFlags src_mask, VkAccessFlags dst_mask, VkImageLayout src_layout, - VkImageLayout dst_layout, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, bool pixel_local) -{ - const VkImageMemoryBarrier barrier = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, nullptr, src_mask, dst_mask, - src_layout, dst_layout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, tex->GetTexture().GetImage(), - {VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u}}; - - vkCmdPipelineBarrier(g_vulkan_context->GetCurrentCommandBuffer(), src_stage, dst_stage, - pixel_local ? VK_DEPENDENCY_BY_REGION_BIT : 0, 0, nullptr, 0, nullptr, 1, &barrier); -} - static void ColorBufferBarrier(GSTextureVK* rt) { const VkImageMemoryBarrier barrier = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, nullptr, diff --git a/pcsx2/GS/Renderers/Vulkan/GSTextureVK.h b/pcsx2/GS/Renderers/Vulkan/GSTextureVK.h index 795f8b8700..1b270341c7 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSTextureVK.h +++ b/pcsx2/GS/Renderers/Vulkan/GSTextureVK.h @@ -15,7 +15,7 @@ #pragma once -#include "GS.h" +#include "GS/GS.h" #include "GS/Renderers/Common/GSTexture.h" #include "common/Vulkan/Context.h" #include "common/Vulkan/Texture.h"