Compare commits

..
13 Commits
Author SHA1 Message Date
lightningterror f712b2b63a GSDeviceOGL: Fix Wunused-private-field warnings. 2021-11-04 11:18:26 +01:00
Tyler Wildingandrefractionpcsx2 71923e7cba actions: cleanup discord embed links and add release body 2021-11-03 23:46:45 +00:00
refractionpcsx2 532d14611c GS: Properly loop when reading 32bit CLUT from offset 2021-11-03 18:24:57 +00:00
refractionpcsx2 3a91a07d51 GS: Fix up CLUT offset handling in 32bit I8 mode 2021-11-03 18:24:57 +00:00
refractionpcsx2 6a8287ea9f EE JIT: Backup shift on LDR/L if rs==rt 2021-11-03 18:03:09 +00:00
Tyler Wildingandlightningterror dc051541bd actions: create automatic controller db updating workflow 2021-11-03 16:40:36 +01:00
lightningterror 3265c2a614 GS-ogl: Put GL_ARB_get_texture_sub_image code under a define.
Code is currently disabled, no need to check for the extension.
2021-11-03 16:37:55 +01:00
lightningterror f798401e93 GS-ogl: Remove checks for extensions we don't yet use.
They serve no purpose, no need to check unless we actually use them

GL_ARB_compute_shader,
GL_ARB_shader_storage_buffer_object,
GL_ARB_texture_view,
GL_ARB_vertex_attrib_binding,
GL_ARB_multi_bind
2021-11-03 16:37:55 +01:00
tellowkrinkleandrefractionpcsx2 60791e4c2b GS-OGL: Add comment on m_accurate_stq usage 2021-11-03 01:21:11 +00:00
TellowKrinkleandrefractionpcsx2 bd8fcc8f81 GS: Remove inaccurate stq calculations from GSVertexTrace
They were the same speed or slower than full div on IvyBridge+ and Bulldozer+
2021-11-03 01:21:11 +00:00
TellowKrinkleandrefractionpcsx2 5d33165fa5 GS: Reduce repeated code in GSVertexTrace::FindMinMax
Why repeat things when you can make the compiler repeat them for you
2021-11-03 01:21:11 +00:00
TellowKrinkleandrefractionpcsx2 2e1d147135 GS: Faster accurate_stq calculations 2021-11-03 01:21:11 +00:00
refractionpcsx2 ee8d24a260 GS: Don't propagate 24bit textures on download 2021-11-03 00:54:29 +00:00
17 changed files with 255 additions and 338 deletions
@@ -0,0 +1 @@
*.txt
@@ -0,0 +1,38 @@
import os
relevant_categories = [
"# Mac OS X",
"# Linux"
]
header_lines = []
new_db_contents = []
def is_relevant_category(line):
for category in relevant_categories:
if category in line:
return True
return False
with open("./game_controller_db.txt") as file:
lines = file.readlines()
finished_header = False
processing_section = False
for line in lines:
if finished_header is False:
header_lines.append(line)
if line == "\n":
finished_header = True
if processing_section and line == "\n":
processing_section = False
new_db_contents.append("\n")
if is_relevant_category(line) and processing_section is False:
processing_section = True
new_db_contents.append(line)
elif processing_section:
new_db_contents.append(line)
os.remove("./game_controller_db.txt")
with open("./game_controller_db.txt", "w") as f:
f.writelines(header_lines)
f.writelines(new_db_contents)
@@ -11,9 +11,21 @@ for (var i = 0; i < assets.length; i++) {
continue;
}
if (asset.name.includes("windows")) {
windowsAssetLinks += `- [${asset.name}](${asset.browser_download_url})\n`
let friendlyName = asset.name;
try {
friendlyName = asset.name.split("windows-")[1].split(".7z")[0].replace("-", " ");
} catch (e) {
console.log(e);
}
windowsAssetLinks += `- [${friendlyName}](${asset.browser_download_url})\n`
} else if (asset.name.includes("linux")) {
linuxAssetLinks += `- [${asset.name}](${asset.browser_download_url})\n`
let friendlyName = asset.name;
try {
friendlyName = asset.name.split("linux-")[1].split(".AppImage")[0].replace("-", " ");
} catch (e) {
console.log(e);
}
linuxAssetLinks += `- [${friendlyName}](${asset.browser_download_url})\n`
}
}
@@ -24,7 +36,8 @@ const embed = new MessageEmbed()
.addFields(
{ name: 'Version', value: github.context.payload.release.tag_name, inline: true },
{ name: 'Release Link', value: `[Github Release](${github.context.payload.release.html_url})`, inline: true },
{ name: 'Installation Steps', value: '[See Here](https://github.com/PCSX2/pcsx2/wiki/Nightly-Build-Usage-Guide)', inline: true }
{ name: 'Installation Steps', value: '[See Here](https://github.com/PCSX2/pcsx2/wiki/Nightly-Build-Usage-Guide)', inline: true },
{ name: 'Included Changes', value: github.context.payload.release.body, inline: false }
);
if (windowsAssetLinks != "") {
@@ -0,0 +1,29 @@
name: 🏭 Update Controller Database
on:
schedule:
- cron: "0 16 * * 1" # every monday @ 12pm EST - https://crontab.guru/#0_16_*_*_1
jobs:
update-controller-db:
if: github.repository == 'PCSX2/pcsx2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Latest DB and Prepare DB File
run: |
cd .github/workflows/scripts/controller-db/
wget -O game_controller_db.txt https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
python ./update-db.py
mv ./game_controller_db.txt ${{github.workspace}}/pcsx2/PAD/Linux/res/game_controller_db.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "pad-linux: Update to latest controller database"
commit-message: "pad-linux: Update to latest controller database."
committer: "PCSX2 Bot <PCSX2Bot@users.noreply.github.com>"
author: "PCSX2 Bot <PCSX2Bot@users.noreply.github.com>"
body: "Weekly automatic update of SDL Controller DB for Linux / Mac OS"
reviewers: lightningterror
+3 -6
View File
@@ -1262,22 +1262,19 @@ void GSApp::Init()
m_default_configuration["osd_monitor_enabled"] = "0";
m_default_configuration["osd_max_log_messages"] = "2";
m_default_configuration["override_geometry_shader"] = "-1";
m_default_configuration["override_GL_ARB_compute_shader"] = "-1";
m_default_configuration["override_GL_ARB_copy_image"] = "-1";
m_default_configuration["override_GL_ARB_clear_texture"] = "-1";
m_default_configuration["override_GL_ARB_clip_control"] = "-1";
m_default_configuration["override_GL_ARB_direct_state_access"] = "-1";
m_default_configuration["override_GL_ARB_draw_buffers_blend"] = "-1";
m_default_configuration["override_GL_ARB_get_texture_sub_image"] = "-1";
m_default_configuration["override_GL_ARB_gpu_shader5"] = "-1";
m_default_configuration["override_GL_ARB_multi_bind"] = "-1";
m_default_configuration["override_GL_ARB_shader_image_load_store"] = "-1";
m_default_configuration["override_GL_ARB_shader_storage_buffer_object"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture"] = "-1";
m_default_configuration["override_GL_ARB_sparse_texture2"] = "-1";
m_default_configuration["override_GL_ARB_texture_view"] = "-1";
m_default_configuration["override_GL_ARB_vertex_attrib_binding"] = "-1";
m_default_configuration["override_GL_ARB_texture_barrier"] = "-1";
#ifdef GL_EXT_TEX_SUB_IMAGE
m_default_configuration["override_GL_ARB_get_texture_sub_image"] = "-1";
#endif
m_default_configuration["paltex"] = "0";
m_default_configuration["png_compression_level"] = std::to_string(Z_BEST_SPEED);
m_default_configuration["preload_frame_with_gs_data"] = "0";
+19 -37
View File
@@ -158,36 +158,12 @@ void GSClut::Write(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
m_read.dirty = true;
(this->*m_wc[TEX0.CSM][TEX0.CPSM][TEX0.PSM])(TEX0, TEXCLUT);
// Mirror write to other half of buffer to simulate wrapping memory
int offset = (TEX0.CSA & (TEX0.CPSM < PSM_PSMCT16 ? 15 : 31)) * 16;
if (TEX0.PSM == PSM_PSMT8 || TEX0.PSM == PSM_PSMT8H)
{
int size = TEX0.CPSM < PSM_PSMCT16 ? 512 : 256;
memcpy(m_clut + 512 + offset, m_clut + offset, sizeof(*m_clut) * std::min(size, 512 - offset));
memcpy(m_clut, m_clut + 512, sizeof(*m_clut) * std::max(0, size + offset - 512));
}
else
{
int size = 16;
memcpy(m_clut + 512 + offset, m_clut + offset, sizeof(*m_clut) * size);
if (TEX0.CPSM < PSM_PSMCT16)
{
memcpy(m_clut + 512 + 256 + offset, m_clut + 256 + offset, sizeof(*m_clut) * size);
}
}
}
void GSClut::WriteCLUT32_I8_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
{
ALIGN_STACK(32);
//FIXME: Romance of the Three Kingdoms VIII text doesn't like the offset
WriteCLUT_T32_I8_CSM1((uint32*)m_mem->BlockPtr32(0, 0, TEX0.CBP, 1), m_clut + ((TEX0.CSA & 15) << 4));
WriteCLUT_T32_I8_CSM1((uint32*)m_mem->BlockPtr32(0, 0, TEX0.CBP, 1), m_clut, (TEX0.CSA & 15));
}
void GSClut::WriteCLUT32_I4_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
@@ -339,8 +315,7 @@ void GSClut::Read32(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA)
{
case PSM_PSMT8:
case PSM_PSMT8H:
clut += (TEX0.CSA & 15) << 4; // disney golf title screen
ReadCLUT_T32_I8(clut, m_buff32);
ReadCLUT_T32_I8(clut, m_buff32, (TEX0.CSA & 15) << 4);
break;
case PSM_PSMT4:
case PSM_PSMT4HL:
@@ -443,16 +418,16 @@ void GSClut::GetAlphaMinMax32(int& amin_out, int& amax_out)
//
void GSClut::WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut)
void GSClut::WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut, uint16 offset)
{
// 4 blocks
for (int i = 0; i < 64; i += 16)
// This is required when CSA is offset from the base of the CLUT so we point to the right data
for (int i = offset; i < 16; i ++)
{
WriteCLUT_T32_I4_CSM1(&src[i + 0], &clut[i * 2 + 0]);
WriteCLUT_T32_I4_CSM1(&src[i + 64], &clut[i * 2 + 16]);
WriteCLUT_T32_I4_CSM1(&src[i + 128], &clut[i * 2 + 128]);
WriteCLUT_T32_I4_CSM1(&src[i + 192], &clut[i * 2 + 144]);
const int off = i << 4; // WriteCLUT_T32_I4_CSM1 loads 16 at a time
// Source column
const int s = clutTableT32I8[off & 0x70] | (off & 0x80);
WriteCLUT_T32_I4_CSM1(&src[s], &clut[off]);
}
}
@@ -532,11 +507,18 @@ __forceinline void GSClut::WriteCLUT_T16_I4_CSM1(const uint16* RESTRICT src, uin
}
}
void GSClut::ReadCLUT_T32_I8(const uint16* RESTRICT clut, uint32* RESTRICT dst)
void GSClut::ReadCLUT_T32_I8(const uint16* RESTRICT clut, uint32* RESTRICT dst, int offset)
{
// Okay this deserves a small explanation
// T32 I8 can address up to 256 colors however the offset can be "more than zero" when reading
// Previously I assumed that it would wrap around the end of the buffer to the beginning
// but it turns out this is incorrect, the address doesn't mirror, it clamps to to the last offset,
// probably though some sort of addressing mechanism then picks the color from the lower 0xF of the requested CLUT entry.
// if we don't do this, the dirt on GTA SA goes transparent and actually cleans the car driving through dirt.
for (int i = 0; i < 256; i += 16)
{
ReadCLUT_T32_I4(&clut[i], &dst[i]);
// Min value + offet or Last CSA * 16 (240)
ReadCLUT_T32_I4(&clut[std::min((i + offset), 240)], &dst[i]);
}
}
+2 -2
View File
@@ -74,11 +74,11 @@ class alignas(32) GSClut : public GSAlignedClass<32>
void WriteCLUT_NULL(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
static void WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);
static void WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut, uint16 offset);
static void WriteCLUT_T32_I4_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);
static void WriteCLUT_T16_I8_CSM1(const uint16* RESTRICT src, uint16* RESTRICT clut);
static void WriteCLUT_T16_I4_CSM1(const uint16* RESTRICT src, uint16* RESTRICT clut);
static void ReadCLUT_T32_I8(const uint16* RESTRICT clut, uint32* RESTRICT dst);
static void ReadCLUT_T32_I8(const uint16* RESTRICT clut, uint32* RESTRICT dst, int offset);
static void ReadCLUT_T32_I4(const uint16* RESTRICT clut, uint32* RESTRICT dst);
//static void ReadCLUT_T32_I4(const uint16* RESTRICT clut, uint32* RESTRICT dst32, uint64* RESTRICT dst64);
//static void ReadCLUT_T16_I8(const uint16* RESTRICT clut, uint32* RESTRICT dst);
+11
View File
@@ -205,6 +205,17 @@ public:
return m;
}
/// Makes Clang think that the whole vector is needed, preventing it from changing shuffles around because it thinks we don't need the whole vector
/// Useful for e.g. preventing clang from optimizing shuffles that remove possibly-denormal garbage data from vectors before computing with them
__forceinline GSVector4 noopt()
{
// Note: Clang is currently the only compiler that attempts to optimize vector intrinsics, if that changes in the future the implementation should be updated
#ifdef __clang__
__asm__("":"+x"(m)::);
#endif
return *this;
}
__forceinline uint32 rgba32() const
{
return GSVector4i(*this).rgba32();
+108 -270
View File
@@ -27,8 +27,7 @@ GSVertexTrace::GSVertexTrace(const GSState* state)
memset(&m_alpha, 0, sizeof(m_alpha));
#define InitUpdate3(P, IIP, TME, FST, COLOR) \
m_fmm[0][COLOR][FST][TME][IIP][P] = &GSVertexTrace::FindMinMax<P, IIP, TME, FST, COLOR, 0>; \
m_fmm[1][COLOR][FST][TME][IIP][P] = &GSVertexTrace::FindMinMax<P, IIP, TME, FST, COLOR, 1>; \
m_fmm[COLOR][FST][TME][IIP][P] = &GSVertexTrace::FindMinMax<P, IIP, TME, FST, COLOR>;
#define InitUpdate2(P, IIP, TME) \
InitUpdate3(P, IIP, TME, 0, 0) \
@@ -57,7 +56,7 @@ void GSVertexTrace::Update(const void* vertex, const uint32* index, int v_count,
uint32 fst = m_state->PRIM->FST;
uint32 color = !(m_state->PRIM->TME && m_state->m_context->TEX0.TFX == TFX_DECAL && m_state->m_context->TEX0.TCC);
(this->*m_fmm[m_accurate_stq][color][fst][tme][iip][primclass])(vertex, index, i_count);
(this->*m_fmm[color][fst][tme][iip][primclass])(vertex, index, i_count);
// Potential float overflow detected. Better uses the slower division instead
// Note: If Q is too big, 1/Q will end up as 0. 1e30 is a random number
@@ -66,7 +65,6 @@ void GSVertexTrace::Update(const void* vertex, const uint32* index, int v_count,
{
fprintf(stderr, "Vertex Trace: float overflow detected ! min %e max %e\n", m_min.t.z, m_max.t.z);
m_accurate_stq = true;
(this->*m_fmm[m_accurate_stq][color][fst][tme][iip][primclass])(vertex, index, i_count);
}
m_eq.value = (m_min.c == m_max.c).mask() | ((m_min.p == m_max.p).mask() << 16) | ((m_min.t == m_max.t).mask() << 20);
@@ -150,7 +148,7 @@ void GSVertexTrace::Update(const void* vertex, const uint32* index, int v_count,
}
}
template <GS_PRIM_CLASS primclass, uint32 iip, uint32 tme, uint32 fst, uint32 color, uint32 accurate_stq>
template <GS_PRIM_CLASS primclass, uint32 iip, uint32 tme, uint32 fst, uint32 color>
void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int count)
{
const GSDrawingContext* context = m_state->m_context;
@@ -181,287 +179,123 @@ void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int coun
const GSVertex* RESTRICT v = (GSVertex*)vertex;
for (int i = 0; i < count; i += n)
// Process 2 vertices at a time for increased efficiency
auto processVertices = [&](const GSVertex& v0, const GSVertex& v1, bool finalVertex)
{
if (primclass == GS_POINT_CLASS)
if (color)
{
GSVector4i c(v[index[i]].m[0]);
if (color)
GSVector4i c0 = GSVector4i::load(v0.RGBAQ.u32[0]);
GSVector4i c1 = GSVector4i::load(v1.RGBAQ.u32[0]);
if (iip || finalVertex)
{
cmin = cmin.min_u8(c);
cmax = cmax.max_u8(c);
cmin = cmin.min_u8(c0.min_u8(c1));
cmax = cmax.max_u8(c0.max_u8(c1));
}
if (tme)
else if (n == 2)
{
if (!fst)
{
GSVector4 stq = GSVector4::cast(c);
GSVector4 q = stq.wwww();
if (accurate_stq)
stq = (stq.xyww() / q).xyww(q);
else
stq = (stq.xyww() * q.rcpnr()).xyww(q);
tmin = tmin.min(stq);
tmax = tmax.max(stq);
}
else
{
GSVector4i uv(v[index[i]].m[1]);
GSVector4 st = GSVector4(uv.uph16()).xyxy();
tmin = tmin.min(st);
tmax = tmax.max(st);
}
// For even n, we process v1 and v2 of the same prim
// (For odd n, we process one vertex from each of two prims)
cmin = cmin.min_u8(c1);
cmax = cmax.max_u8(c1);
}
GSVector4i xyzf(v[index[i]].m[1]);
GSVector4i xy = xyzf.upl16();
GSVector4i z = xyzf.yyyy();
GSVector4i p = xy.blend16<0xf0>(z.uph32(xyzf));
pmin = pmin.min_u32(p);
pmax = pmax.max_u32(p);
}
else if (primclass == GS_LINE_CLASS)
if (tme)
{
GSVector4i c0(v[index[i + 0]].m[0]);
GSVector4i c1(v[index[i + 1]].m[0]);
if (color)
if (!fst)
{
if (iip)
{
cmin = cmin.min_u8(c0.min_u8(c1));
cmax = cmax.max_u8(c0.max_u8(c1));
}
else
{
cmin = cmin.min_u8(c1);
cmax = cmax.max_u8(c1);
}
}
GSVector4 stq0 = GSVector4::cast(GSVector4i(v0.m[0]));
GSVector4 stq1 = GSVector4::cast(GSVector4i(v1.m[0]));
if (tme)
GSVector4 q;
// Sprites always have indices == vertices, so we don't have to look at the index table here
if (primclass == GS_SPRITE_CLASS)
q = stq1.wwww();
else
q = stq0.wwww(stq1);
// Note: If in the future this is changed in a way that causes parts of calculations to go unused,
// make sure to remove the z (rgba) field as it's often denormal.
// Then, use GSVector4::noopt() to prevent clang from optimizing out your "useless" shuffle
// e.g. stq = (stq.xyww() / stq.wwww()).noopt().xyww(stq);
GSVector4 st = stq0.xyxy(stq1) / q;
stq0 = st.xyww(primclass == GS_SPRITE_CLASS ? stq1 : stq0);
stq1 = st.zwww(stq1);
tmin = tmin.min(stq0.min(stq1));
tmax = tmax.max(stq0.max(stq1));
}
else
{
if (!fst)
{
GSVector4 stq0 = GSVector4::cast(c0);
GSVector4 stq1 = GSVector4::cast(c1);
GSVector4i uv0(v0.m[1]);
GSVector4i uv1(v1.m[1]);
if (accurate_stq)
{
GSVector4 q = stq0.wwww(stq1);
GSVector4 st0 = GSVector4(uv0.uph16()).xyxy();
GSVector4 st1 = GSVector4(uv1.uph16()).xyxy();
stq0 = (stq0.xyww() / q.xxxx()).xyww(stq0);
stq1 = (stq1.xyww() / q.zzzz()).xyww(stq1);
}
else
{
GSVector4 q = stq0.wwww(stq1).rcpnr();
stq0 = (stq0.xyww() * q.xxxx()).xyww(stq0);
stq1 = (stq1.xyww() * q.zzzz()).xyww(stq1);
}
tmin = tmin.min(stq0.min(stq1));
tmax = tmax.max(stq0.max(stq1));
}
else
{
GSVector4i uv0(v[index[i + 0]].m[1]);
GSVector4i uv1(v[index[i + 1]].m[1]);
GSVector4 st0 = GSVector4(uv0.uph16()).xyxy();
GSVector4 st1 = GSVector4(uv1.uph16()).xyxy();
tmin = tmin.min(st0.min(st1));
tmax = tmax.max(st0.max(st1));
}
tmin = tmin.min(st0.min(st1));
tmax = tmax.max(st0.max(st1));
}
GSVector4i xyzf0(v[index[i + 0]].m[1]);
GSVector4i xyzf1(v[index[i + 1]].m[1]);
GSVector4i xy0 = xyzf0.upl16();
GSVector4i z0 = xyzf0.yyyy();
GSVector4i xy1 = xyzf1.upl16();
GSVector4i z1 = xyzf1.yyyy();
GSVector4i p0 = xy0.blend16<0xf0>(z0.uph32(xyzf0));
GSVector4i p1 = xy1.blend16<0xf0>(z1.uph32(xyzf1));
pmin = pmin.min_u32(p0.min_u32(p1));
pmax = pmax.max_u32(p0.max_u32(p1));
}
else if (primclass == GS_TRIANGLE_CLASS)
GSVector4i xyzf0(v0.m[1]);
GSVector4i xyzf1(v1.m[1]);
GSVector4i xy0 = xyzf0.upl16();
GSVector4i z0 = xyzf0.yyyy();
GSVector4i xy1 = xyzf1.upl16();
GSVector4i z1 = xyzf1.yyyy();
GSVector4i p0 = xy0.blend16<0xf0>(z0.uph32(primclass == GS_SPRITE_CLASS ? xyzf1 : xyzf0));
GSVector4i p1 = xy1.blend16<0xf0>(z1.uph32(xyzf1));
pmin = pmin.min_u32(p0.min_u32(p1));
pmax = pmax.max_u32(p0.max_u32(p1));
};
if (n == 2)
{
for (int i = 0; i < count; i += 2)
{
GSVector4i c0(v[index[i + 0]].m[0]);
GSVector4i c1(v[index[i + 1]].m[0]);
GSVector4i c2(v[index[i + 2]].m[0]);
if (color)
{
if (iip)
{
cmin = cmin.min_u8(c2).min_u8(c0.min_u8(c1));
cmax = cmax.max_u8(c2).max_u8(c0.max_u8(c1));
}
else
{
cmin = cmin.min_u8(c2);
cmax = cmax.max_u8(c2);
}
}
if (tme)
{
if (!fst)
{
GSVector4 stq0 = GSVector4::cast(c0);
GSVector4 stq1 = GSVector4::cast(c1);
GSVector4 stq2 = GSVector4::cast(c2);
if (accurate_stq)
{
GSVector4 q = stq0.wwww(stq1).xzww(stq2);
stq0 = (stq0.xyww() / q.xxxx()).xyww(stq0);
stq1 = (stq1.xyww() / q.yyyy()).xyww(stq1);
stq2 = (stq2.xyww() / q.zzzz()).xyww(stq2);
}
else
{
GSVector4 q = stq0.wwww(stq1).xzww(stq2).rcpnr();
stq0 = (stq0.xyww() * q.xxxx()).xyww(stq0);
stq1 = (stq1.xyww() * q.yyyy()).xyww(stq1);
stq2 = (stq2.xyww() * q.zzzz()).xyww(stq2);
}
tmin = tmin.min(stq2).min(stq0.min(stq1));
tmax = tmax.max(stq2).max(stq0.max(stq1));
}
else
{
GSVector4i uv0(v[index[i + 0]].m[1]);
GSVector4i uv1(v[index[i + 1]].m[1]);
GSVector4i uv2(v[index[i + 2]].m[1]);
GSVector4 st0 = GSVector4(uv0.uph16()).xyxy();
GSVector4 st1 = GSVector4(uv1.uph16()).xyxy();
GSVector4 st2 = GSVector4(uv2.uph16()).xyxy();
tmin = tmin.min(st2).min(st0.min(st1));
tmax = tmax.max(st2).max(st0.max(st1));
}
}
GSVector4i xyzf0(v[index[i + 0]].m[1]);
GSVector4i xyzf1(v[index[i + 1]].m[1]);
GSVector4i xyzf2(v[index[i + 2]].m[1]);
GSVector4i xy0 = xyzf0.upl16();
GSVector4i z0 = xyzf0.yyyy();
GSVector4i xy1 = xyzf1.upl16();
GSVector4i z1 = xyzf1.yyyy();
GSVector4i xy2 = xyzf2.upl16();
GSVector4i z2 = xyzf2.yyyy();
GSVector4i p0 = xy0.blend16<0xf0>(z0.uph32(xyzf0));
GSVector4i p1 = xy1.blend16<0xf0>(z1.uph32(xyzf1));
GSVector4i p2 = xy2.blend16<0xf0>(z2.uph32(xyzf2));
pmin = pmin.min_u32(p2).min_u32(p0.min_u32(p1));
pmax = pmax.max_u32(p2).max_u32(p0.max_u32(p1));
}
else if (primclass == GS_SPRITE_CLASS)
{
GSVector4i c0(v[index[i + 0]].m[0]);
GSVector4i c1(v[index[i + 1]].m[0]);
if (color)
{
if (iip)
{
cmin = cmin.min_u8(c0.min_u8(c1));
cmax = cmax.max_u8(c0.max_u8(c1));
}
else
{
cmin = cmin.min_u8(c1);
cmax = cmax.max_u8(c1);
}
}
if (tme)
{
if (!fst)
{
GSVector4 stq0 = GSVector4::cast(c0);
GSVector4 stq1 = GSVector4::cast(c1);
if (accurate_stq)
{
GSVector4 q = stq1.wwww();
stq0 = (stq0.xyww() / q).xyww(stq1);
stq1 = (stq1.xyww() / q).xyww(stq1);
}
else
{
GSVector4 q = stq1.wwww().rcpnr();
stq0 = (stq0.xyww() * q).xyww(stq1);
stq1 = (stq1.xyww() * q).xyww(stq1);
}
tmin = tmin.min(stq0.min(stq1));
tmax = tmax.max(stq0.max(stq1));
}
else
{
GSVector4i uv0(v[index[i + 0]].m[1]);
GSVector4i uv1(v[index[i + 1]].m[1]);
GSVector4 st0 = GSVector4(uv0.uph16()).xyxy();
GSVector4 st1 = GSVector4(uv1.uph16()).xyxy();
tmin = tmin.min(st0.min(st1));
tmax = tmax.max(st0.max(st1));
}
}
GSVector4i xyzf0(v[index[i + 0]].m[1]);
GSVector4i xyzf1(v[index[i + 1]].m[1]);
GSVector4i xy0 = xyzf0.upl16();
GSVector4i z0 = xyzf0.yyyy();
GSVector4i xy1 = xyzf1.upl16();
GSVector4i z1 = xyzf1.yyyy();
GSVector4i p0 = xy0.blend16<0xf0>(z0.uph32(xyzf1));
GSVector4i p1 = xy1.blend16<0xf0>(z1.uph32(xyzf1));
pmin = pmin.min_u32(p0.min_u32(p1));
pmax = pmax.max_u32(p0.max_u32(p1));
processVertices(v[index[i + 0]], v[index[i + 1]], false);
}
}
// FIXME/WARNING. A division by 2 is done on the depth. I suspect to avoid
// negative value. However it means that we lost the lsb bit. m_eq.z could
// be true if depth isn't constant but close enough. It also imply that
// pmin.z & 1 == 0 and pax.z & 1 == 0
pmin = pmin.blend16<0x30>(pmin.srl32(1));
pmax = pmax.blend16<0x30>(pmax.srl32(1));
else if (iip || n == 1) // iip means final and non-final vertexes are treated the same
{
int i = 0;
for (; i < (count - 1); i += 2) // 2x loop unroll
{
processVertices(v[index[i + 0]], v[index[i + 1]], true);
}
if (count & 1)
{
// Compiler optimizations go!
// (And if they don't, it's only one vertex out of many)
processVertices(v[index[i]], v[index[i]], true);
}
}
else if (n == 3)
{
int i = 0;
for (; i < (count - 3); i += 6)
{
processVertices(v[index[i + 0]], v[index[i + 3]], false);
processVertices(v[index[i + 1]], v[index[i + 4]], false);
processVertices(v[index[i + 2]], v[index[i + 5]], true);
}
if (count & 1)
{
processVertices(v[index[i + 0]], v[index[i + 1]], false);
// Compiler optimizations go!
// (And if they don't, it's only one vertex out of many)
processVertices(v[index[i + 2]], v[index[i + 2]], true);
}
}
else
{
pxAssertRel(0, "Bad n value");
}
GSVector4 o(context->XYOFFSET);
GSVector4 s(1.0f / 16, 1.0f / 16, 2.0f, 1.0f);
@@ -469,6 +303,10 @@ void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int coun
m_min.p = (GSVector4(pmin) - o) * s;
m_max.p = (GSVector4(pmax) - o) * s;
// Fix signed int conversion
m_min.p = m_min.p.insert32<0, 2>(GSVector4::load((float)(uint32)pmin.extract32<2>()));
m_max.p = m_max.p.insert32<0, 2>(GSVector4::load((float)(uint32)pmax.extract32<2>()));
if (tme)
{
if (fst)
@@ -491,8 +329,8 @@ void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int coun
if (color)
{
m_min.c = cmin.zzzz().u8to32();
m_max.c = cmax.zzzz().u8to32();
m_min.c = cmin.u8to32();
m_max.c = cmax.u8to32();
}
else
{
+2 -2
View File
@@ -47,9 +47,9 @@ protected:
typedef void (GSVertexTrace::*FindMinMaxPtr)(const void* vertex, const uint32* index, int count);
FindMinMaxPtr m_fmm[2][2][2][2][2][4];
FindMinMaxPtr m_fmm[2][2][2][2][4];
template <GS_PRIM_CLASS primclass, uint32 iip, uint32 tme, uint32 fst, uint32 color, uint32 accurate_stq>
template <GS_PRIM_CLASS primclass, uint32 iip, uint32 tme, uint32 fst, uint32 color>
void FindMinMax(const void* vertex, const uint32* index, int count);
public:
+2 -1
View File
@@ -1096,7 +1096,8 @@ void GSTextureCache::InvalidateLocalMem(GSOffset* off, const GSVector4i& r)
// the game can then draw using 8H format
// in the case of silent hill blit 8H -> 8P
// this will matter later when the data ends up in GS memory in the wrong format
if (t->m_32_bits_fmt)
// Be careful to avoid 24 bit textures which are technically 32bit, as you could lose alpha (8H) data.
if (t->m_32_bits_fmt && t->m_TEX0.PSM > PSM_PSMCT24)
t->m_TEX0.PSM = PSM_PSMCT32;
if (GSTextureCache::m_disable_partial_invalidation)
+8 -14
View File
@@ -156,22 +156,19 @@ namespace GLLoader
bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default
bool found_GL_ARB_clear_texture = false;
bool found_GL_ARB_get_texture_sub_image = false; // Not yet used
// DX11 GPU
bool found_GL_ARB_gpu_shader5 = false; // Require IvyBridge
bool found_GL_ARB_shader_image_load_store = false; // Intel IB. Nvidia/AMD miss Mesa implementation.
bool found_GL_ARB_shader_storage_buffer_object = false;
bool found_GL_ARB_compute_shader = false;
bool found_GL_ARB_texture_view = false; // maybe older gpu can support it ?
// Mandatory in the future
bool found_GL_ARB_multi_bind = false;
bool found_GL_ARB_vertex_attrib_binding = false;
// In case sparse2 isn't supported
bool found_compatible_GL_ARB_sparse_texture2 = false;
bool found_compatible_sparse_depth = false;
// Not yet used
#ifdef GL_EXT_TEX_SUB_IMAGE
bool found_GL_ARB_get_texture_sub_image = false;
#endif
static void mandatory(const std::string& ext)
{
if (!GLExtension::Has(ext))
@@ -310,20 +307,17 @@ namespace GLLoader
found_GL_ARB_gpu_shader5 = optional("GL_ARB_gpu_shader5");
// GL4.2
found_GL_ARB_shader_image_load_store = optional("GL_ARB_shader_image_load_store");
// GL4.3
found_GL_ARB_compute_shader = optional("GL_ARB_compute_shader");
found_GL_ARB_shader_storage_buffer_object = optional("GL_ARB_shader_storage_buffer_object");
found_GL_ARB_texture_view = optional("GL_ARB_texture_view");
found_GL_ARB_vertex_attrib_binding = optional("GL_ARB_vertex_attrib_binding");
// GL4.4
found_GL_ARB_clear_texture = optional("GL_ARB_clear_texture");
found_GL_ARB_multi_bind = optional("GL_ARB_multi_bind");
// GL4.5
optional("GL_ARB_direct_state_access");
// Mandatory for the advance HW renderer effect. Unfortunately Mesa LLVMPIPE/SWR renderers doesn't support this extension.
// Rendering might be corrupted but it could be good enough for test/virtual machine.
optional("GL_ARB_texture_barrier");
// Not yet used
#ifdef GL_EXT_TEX_SUB_IMAGE
found_GL_ARB_get_texture_sub_image = optional("GL_ARB_get_texture_sub_image");
#endif
}
if (vendor_id_amd)
-2
View File
@@ -485,8 +485,6 @@ private:
std::unique_ptr<GL::StreamBuffer> m_vertex_stream_buffer;
std::unique_ptr<GL::StreamBuffer> m_index_stream_buffer;
GLuint m_vertex_array_object = 0;
u32 m_vertex_buffer_base_vertex = 0;
u32 m_index_buffer_offset = 0;
GLenum m_draw_topology = 0;
std::unique_ptr<GL::StreamBuffer> m_vertex_uniform_stream_buffer;
@@ -82,6 +82,9 @@ void GSRendererOGL::SetupIA(const float& sx, const float& sy)
//
// Note2: Due to MultiThreaded driver, Nvidia suffers less of the previous issue. Still it isn't free
// Shadow Heart is 90 fps (gs) vs 113 fps (no gs)
//
// Note3: Some GPUs (Happens on GT 750m, not on Intel 5200) don't properly divide by large floats (e.g. FLT_MAX/FLT_MAX == 0)
// Lines2Sprites predivides by Q, avoiding this issue, so always use it if m_vt.m_accurate_stq
// If the draw calls contains few primitives. Geometry Shader gain with be rather small versus
// the extra validation cost of the extra stage.
+1 -1
View File
@@ -468,7 +468,7 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r, int layer)
// The fastest way will be to use a PBO to read the data asynchronously. Unfortunately GS
// architecture is waiting the data right now.
#if 0
#ifdef GL_EXT_TEX_SUB_IMAGE
// Maybe it is as good as the code below. I don't know
// With openGL 4.5 you can use glGetTextureSubImage
+2
View File
@@ -28,6 +28,8 @@
//#define DISABLE_DATE
// Not yet used/experimental OpenGL extensions
//#define GL_EXT_TEX_SUB_IMAGE
#if !defined(NDEBUG) || defined(_DEBUG) || defined(_DEVEL)
#define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states.
+10
View File
@@ -538,6 +538,11 @@ void recLDL()
if (GPR_IS_CONST1(_Rs_))
{
u32 srcadr = g_cpuConstRegs[_Rs_].UL[0] + _Imm_;
// If _Rs_ is equal to _Rt_ we need to put the shift in to eax since it won't take the CONST path
if (_Rs_ == _Rt_)
xMOV(calleeSavedReg1d, srcadr);
srcadr &= ~0x07;
t2reg = vtlb_DynGenRead64_Const(64, srcadr, -1);
@@ -609,6 +614,11 @@ void recLDR()
if (GPR_IS_CONST1(_Rs_))
{
u32 srcadr = g_cpuConstRegs[_Rs_].UL[0] + _Imm_;
// If _Rs_ is equal to _Rt_ we need to put the shift in to eax since it won't take the CONST path
if(_Rs_ == _Rt_)
xMOV(calleeSavedReg1d, srcadr);
srcadr &= ~0x07;
t2reg = vtlb_DynGenRead64_Const(64, srcadr, -1);