GS: Warning fixes for clang-cl

This commit is contained in:
Stenzek 2022-12-25 15:57:51 +10:00 committed by refractionpcsx2
parent b0e911ad7f
commit a2abe49d3f
23 changed files with 68 additions and 62 deletions

View File

@ -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<std::string> ffx_a_source(Host::ReadResourceFileToString("shaders/common/ffx_a.h"));

View File

@ -16,11 +16,11 @@
#pragma once
#include "common/RedtapeWindows.h"
#include "common/RedtapeWilCom.h"
#include <dxgi1_3.h>
#include <vector>
#include <string>
#include <wil/com.h>
namespace D3D
{

View File

@ -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;

View File

@ -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;

View File

@ -15,9 +15,10 @@
#pragma once
#include "GS.h"
#include "GS/GS.h"
#include "GS/Renderers/Common/GSTexture.h"
#include <wil/com.h>
#include "common/RedtapeWindows.h"
#include "common/RedtapeWilCom.h"
#include <d3d11.h>
class GSTexture11 final : public GSTexture

View File

@ -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()
{

View File

@ -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,

View File

@ -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"

View File

@ -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
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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) {}

View File

@ -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;
}

View File

@ -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; }

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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__) \

View File

@ -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))
{

View File

@ -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>((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;
}

View File

@ -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

View File

@ -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,

View File

@ -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"