mirror of https://github.com/PCSX2/pcsx2.git
parent
7cc6f635fc
commit
5a414d5711
|
@ -205,10 +205,10 @@ GSLocalMemory::GSLocalMemory()
|
||||||
|
|
||||||
for (psm_t& psm : m_psm)
|
for (psm_t& psm : m_psm)
|
||||||
psm.fmt = 3;
|
psm.fmt = 3;
|
||||||
m_psm[PSMCT32].fmt = m_psm[PSMZ32].fmt = 0;
|
m_psm[PSMCT32].fmt = m_psm[PSMZ32].fmt = PSM_FMT_32;
|
||||||
m_psm[PSMCT24].fmt = m_psm[PSMZ24].fmt = 1;
|
m_psm[PSMCT24].fmt = m_psm[PSMZ24].fmt = PSM_FMT_24;
|
||||||
m_psm[PSMCT16].fmt = m_psm[PSMZ16].fmt = 2;
|
m_psm[PSMCT16].fmt = m_psm[PSMZ16].fmt = PSM_FMT_16;
|
||||||
m_psm[PSMCT16S].fmt = m_psm[PSMZ16S].fmt = 2;
|
m_psm[PSMCT16S].fmt = m_psm[PSMZ16S].fmt = PSM_FMT_16;
|
||||||
|
|
||||||
|
|
||||||
m_psm[PSGPU24].bs = GSVector2i(16, 8);
|
m_psm[PSGPU24].bs = GSVector2i(16, 8);
|
||||||
|
|
|
@ -445,6 +445,13 @@ public:
|
||||||
typedef void (*readTexture)(GSLocalMemory& mem, const GSOffset& off, const GSVector4i& r, u8* dst, int dstpitch, const GIFRegTEXA& TEXA);
|
typedef void (*readTexture)(GSLocalMemory& mem, const GSOffset& off, const GSVector4i& r, u8* dst, int dstpitch, const GIFRegTEXA& TEXA);
|
||||||
typedef void (*readTextureBlock)(const GSLocalMemory& mem, u32 bp, u8* dst, int dstpitch, const GIFRegTEXA& TEXA);
|
typedef void (*readTextureBlock)(const GSLocalMemory& mem, u32 bp, u8* dst, int dstpitch, const GIFRegTEXA& TEXA);
|
||||||
|
|
||||||
|
enum PSM_FMT
|
||||||
|
{
|
||||||
|
PSM_FMT_32,
|
||||||
|
PSM_FMT_24,
|
||||||
|
PSM_FMT_16
|
||||||
|
};
|
||||||
|
|
||||||
struct alignas(128) psm_t
|
struct alignas(128) psm_t
|
||||||
{
|
{
|
||||||
GSSwizzleInfo info;
|
GSSwizzleInfo info;
|
||||||
|
|
|
@ -3123,7 +3123,7 @@ void GSRendererHW::EmulateTextureShuffleAndFbmask(GSTextureCache::Target* rt, GS
|
||||||
if (m_texture_shuffle)
|
if (m_texture_shuffle)
|
||||||
{
|
{
|
||||||
m_conf.ps.shuffle = 1;
|
m_conf.ps.shuffle = 1;
|
||||||
m_conf.ps.dfmt = 0;
|
m_conf.ps.dfmt = GSLocalMemory::PSM_FMT_32;
|
||||||
|
|
||||||
bool write_ba;
|
bool write_ba;
|
||||||
bool read_ba;
|
bool read_ba;
|
||||||
|
@ -3275,14 +3275,14 @@ void GSRendererHW::EmulateTextureShuffleAndFbmask(GSTextureCache::Target* rt, GS
|
||||||
if (!PRIM->ABE || !(~ff_fbmask & ~zero_fbmask & 0x7) || !g_gs_device->Features().texture_barrier)
|
if (!PRIM->ABE || !(~ff_fbmask & ~zero_fbmask & 0x7) || !g_gs_device->Features().texture_barrier)
|
||||||
{
|
{
|
||||||
GL_INS("FBMASK Unsafe SW emulated fb_mask:%x on %d bits format", m_cached_ctx.FRAME.FBMSK,
|
GL_INS("FBMASK Unsafe SW emulated fb_mask:%x on %d bits format", m_cached_ctx.FRAME.FBMSK,
|
||||||
(m_conf.ps.dfmt == 2) ? 16 : 32);
|
(m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_16) ? 16 : 32);
|
||||||
m_conf.require_one_barrier = true;
|
m_conf.require_one_barrier = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The safe and accurate path (but slow)
|
// The safe and accurate path (but slow)
|
||||||
GL_INS("FBMASK SW emulated fb_mask:%x on %d bits format", m_cached_ctx.FRAME.FBMSK,
|
GL_INS("FBMASK SW emulated fb_mask:%x on %d bits format", m_cached_ctx.FRAME.FBMSK,
|
||||||
(m_conf.ps.dfmt == 2) ? 16 : 32);
|
(m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_16) ? 16 : 32);
|
||||||
m_conf.require_full_barrier = true;
|
m_conf.require_full_barrier = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3490,7 +3490,7 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, bool& DAT
|
||||||
// PABE: Check condition early as an optimization.
|
// PABE: Check condition early as an optimization.
|
||||||
const bool PABE = PRIM->ABE && m_draw_env->PABE.PABE && (GetAlphaMinMax().max < 128);
|
const bool PABE = PRIM->ABE && m_draw_env->PABE.PABE && (GetAlphaMinMax().max < 128);
|
||||||
// FBMASK: Color is not written, no need to do blending.
|
// FBMASK: Color is not written, no need to do blending.
|
||||||
const u32 temp_fbmask = m_conf.ps.dfmt == 2 ? 0x00F8F8F8 : 0x00FFFFFF;
|
const u32 temp_fbmask = m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_16 ? 0x00F8F8F8 : 0x00FFFFFF;
|
||||||
const bool FBMASK = (m_cached_ctx.FRAME.FBMSK & temp_fbmask) == temp_fbmask;
|
const bool FBMASK = (m_cached_ctx.FRAME.FBMSK & temp_fbmask) == temp_fbmask;
|
||||||
|
|
||||||
// No blending or coverage anti-aliasing so early exit
|
// No blending or coverage anti-aliasing so early exit
|
||||||
|
@ -3541,7 +3541,7 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, bool& DAT
|
||||||
m_conf.ps.blend_c = 2;
|
m_conf.ps.blend_c = 2;
|
||||||
}
|
}
|
||||||
// 24 bits doesn't have an alpha channel so use 128 (1.0f) fix factor as equivalent.
|
// 24 bits doesn't have an alpha channel so use 128 (1.0f) fix factor as equivalent.
|
||||||
else if (m_conf.ps.dfmt == 1)
|
else if (m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_24)
|
||||||
{
|
{
|
||||||
AFIX = 128;
|
AFIX = 128;
|
||||||
m_conf.ps.blend_c = 2;
|
m_conf.ps.blend_c = 2;
|
||||||
|
@ -5016,9 +5016,9 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before emulateblending, dither will be used
|
// Before emulateblending, dither will be used
|
||||||
m_conf.ps.dither = GSConfig.Dithering > 0 && m_conf.ps.dfmt == 2 && env.DTHE.DTHE;
|
m_conf.ps.dither = GSConfig.Dithering > 0 && m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_16 && env.DTHE.DTHE;
|
||||||
|
|
||||||
if (m_conf.ps.dfmt == 1)
|
if (m_conf.ps.dfmt == GSLocalMemory::PSM_FMT_24)
|
||||||
{
|
{
|
||||||
// Disable writing of the alpha channel
|
// Disable writing of the alpha channel
|
||||||
m_conf.colormask.wa = 0;
|
m_conf.colormask.wa = 0;
|
||||||
|
@ -5986,7 +5986,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
const u32 pixels_per_page = pgs.x * pgs.y;
|
const u32 pixels_per_page = pgs.x * pgs.y;
|
||||||
const int page_aligned_bottom = (bottom & ~(pgs.y - 1));
|
const int page_aligned_bottom = (bottom & ~(pgs.y - 1));
|
||||||
|
|
||||||
if (format == 0)
|
if (format == GSLocalMemory::PSM_FMT_32)
|
||||||
{
|
{
|
||||||
const GSVector4i vcolor = GSVector4i(vert_color);
|
const GSVector4i vcolor = GSVector4i(vert_color);
|
||||||
const u32 iterations_per_page = (pages_wide * pixels_per_page) / 4;
|
const u32 iterations_per_page = (pages_wide * pixels_per_page) / 4;
|
||||||
|
@ -6000,7 +6000,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
*(ptr++) = vcolor;
|
*(ptr++) = vcolor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == 1)
|
else if (format == GSLocalMemory::PSM_FMT_24)
|
||||||
{
|
{
|
||||||
const GSVector4i mask = GSVector4i::xff000000();
|
const GSVector4i mask = GSVector4i::xff000000();
|
||||||
const GSVector4i vcolor = GSVector4i(vert_color & 0x00ffffffu);
|
const GSVector4i vcolor = GSVector4i(vert_color & 0x00ffffffu);
|
||||||
|
@ -6018,7 +6018,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == 2)
|
else if (format == GSLocalMemory::PSM_FMT_16)
|
||||||
{
|
{
|
||||||
const u16 converted_color = ((vert_color >> 16) & 0x8000) | ((vert_color >> 9) & 0x7C00) |
|
const u16 converted_color = ((vert_color >> 16) & 0x8000) | ((vert_color >> 9) & 0x7C00) |
|
||||||
((vert_color >> 6) & 0x7E0) | ((vert_color >> 3) & 0x1F);
|
((vert_color >> 6) & 0x7E0) | ((vert_color >> 3) & 0x1F);
|
||||||
|
@ -6036,7 +6036,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == 0)
|
if (format == GSLocalMemory::PSM_FMT_32)
|
||||||
{
|
{
|
||||||
// Based on WritePixel32
|
// Based on WritePixel32
|
||||||
u32* vm = m_mem.vm32();
|
u32* vm = m_mem.vm32();
|
||||||
|
@ -6048,7 +6048,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
vm[pa.value(x)] = vert_color;
|
vm[pa.value(x)] = vert_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == 1)
|
else if (format == GSLocalMemory::PSM_FMT_24)
|
||||||
{
|
{
|
||||||
// Based on WritePixel24
|
// Based on WritePixel24
|
||||||
u32* vm = m_mem.vm32();
|
u32* vm = m_mem.vm32();
|
||||||
|
@ -6061,7 +6061,7 @@ void GSRendererHW::ClearGSLocalMemory(const GSOffset& off, const GSVector4i& r,
|
||||||
vm[pa.value(x)] = (vm[pa.value(x)] & 0xff000000u) | write_color;
|
vm[pa.value(x)] = (vm[pa.value(x)] & 0xff000000u) | write_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (format == 2)
|
else if (format == GSLocalMemory::PSM_FMT_16)
|
||||||
{
|
{
|
||||||
const u16 converted_color = ((vert_color >> 16) & 0x8000) | ((vert_color >> 9) & 0x7C00) | ((vert_color >> 6) & 0x7E0) | ((vert_color >> 3) & 0x1F);
|
const u16 converted_color = ((vert_color >> 16) & 0x8000) | ((vert_color >> 9) & 0x7C00) | ((vert_color >> 6) & 0x7E0) | ((vert_color >> 3) & 0x1F);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue