gsdx ogl: implement wildhack on the CPU

Speed impact is likely small and the plan is only to keep a single Vertex Shader
This commit is contained in:
Gregory Hainaut 2016-05-31 20:18:40 +02:00
parent 3d192b7f8d
commit 959abe64f8
5 changed files with 10 additions and 8 deletions

View File

@ -769,7 +769,6 @@ void GSDeviceOGL::Barrier(GLbitfield b)
GLuint GSDeviceOGL::CompileVS(VSSelector sel)
{
std::string macro = format("#define VS_BPPZ %d\n", sel.bppz)
+ format("#define VS_WILDHACK %d\n", sel.wildhack)
;
return m_shader->Compile("tfx_vgs.glsl", "vs_main", GL_VERTEX_SHADER, tfx_vgs_glsl, macro);

View File

@ -151,10 +151,9 @@ public:
{
struct
{
uint32 wildhack:1;
uint32 bppz:2;
uint32 _free:29;
uint32 _free:30;
};
uint32 key;
@ -447,7 +446,7 @@ public:
GLuint ps;
} m_shadeboost;
GLuint m_vs[1<<3];
GLuint m_vs[1<<2];
GLuint m_gs[1<<2];
GLuint m_ps_ss[1<<4];
GSDepthStencilOGL* m_om_dss[1<<5];

View File

@ -130,6 +130,12 @@ void GSRendererOGL::SetupIA()
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;
if (UserHacks_WildHack && !isPackedUV_HackFlag && PRIM->TME && PRIM->FST) {
for(unsigned int i = 0; i < m_vertex.next; i++)
m_vertex.buff[i].UV &= 0x3FEF3FEF;
}
if (!GLLoader::found_geometry_shader)
EmulateGS();
@ -973,8 +979,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// vs
vs_sel.wildhack = (UserHacks_WildHack && !isPackedUV_HackFlag) ? 1 : 0;
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
// than the buffer supports seems to be an error condition on the real GS, causing it to crash.
// We are probably receiving bad coordinates from VU1 in these cases.

View File

@ -21,7 +21,7 @@ const float exp_min32 = exp2(-32.0f);
void texture_coord()
{
vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);
vec2 uv = vec2(i_uv);
// Float coordinate
VSout.t_float.xy = i_st;

View File

@ -683,7 +683,7 @@ static const char* const tfx_vgs_glsl =
"\n"
"void texture_coord()\n"
"{\n"
" vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);\n"
" vec2 uv = vec2(i_uv);\n"
"\n"
" // Float coordinate\n"
" VSout.t_float.xy = i_st;\n"