gsdx-ogl: add some code to fix black netting on some renderings

Code is not yet enabled because it requires extensive test

The idea is to replace point by a 1 pixels sprite with the help of
a geometry shader. In 4x, point will be replaced by a 4x4 sprite.
This commit is contained in:
Gregory Hainaut 2015-07-11 09:32:27 +02:00
parent 5e7ce63ed1
commit 91fbe6f108
3 changed files with 29 additions and 19 deletions

View File

@ -814,8 +814,18 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// GS
#if 0
if (m_vt.m_primclass == GS_POINT_CLASS) {
// Upscaling point will create aliasing because point has a size of 0 pixels.
// This code tries to replace point with sprite. So a point in 4x will be replaced by
// a 4x4 sprite.
gs_sel.point = 1;
// FIXME this formula is potentially wrong
GSVector4 point_size = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y) * 2.0f;
vs_cb.TextureScale = vs_cb.TextureScale.xyxy(point_size);
}
#endif
gs_sel.sprite = m_vt.m_primclass == GS_SPRITE_CLASS;
//gs_sel.point = m_vt.m_primclass == GS_POINT_CLASS;
// WARNING: setup of the program must be done first. So you can setup
// 1/ subroutine uniform

View File

@ -1,5 +1,13 @@
//#version 420 // Keep it for text editor detection
layout(std140, binding = 20) uniform cb20
{
vec2 VertexScale;
vec2 VertexOffset;
vec2 TextureScale;
vec2 PointSize;
};
#ifdef VERTEX_SHADER
layout(location = 0) in vec2 i_st;
layout(location = 2) in vec4 i_c;
@ -28,13 +36,6 @@ out gl_PerVertex {
#endif
};
layout(std140, binding = 20) uniform cb20
{
vec2 VertexScale;
vec2 VertexOffset;
vec2 TextureScale;
};
#ifdef ZERO_TO_ONE_DEPTH
const float exp_min32 = exp2(-32.0f);
#else
@ -226,8 +227,7 @@ void gs_main()
vertex lt = vertex(GSin[0].t, GSin[0].c);
#if GS_POINT == 1
// FIXME need pixel size
vec4 rb_p = gl_in[0].gl_Position + vec4(4.0f/1280.0f, 4.0f/1024.0f, 0.0f, 0.0f);
vec4 rb_p = gl_in[0].gl_Position + vec4(PointSize.x, PointSize.y, 0.0f, 0.0f);
#else
vec4 rb_p = gl_in[1].gl_Position;
#endif

View File

@ -608,6 +608,14 @@ static const char* shadeboost_glsl =
static const char* tfx_vgs_glsl =
"//#version 420 // Keep it for text editor detection\n"
"\n"
"layout(std140, binding = 20) uniform cb20\n"
"{\n"
" vec2 VertexScale;\n"
" vec2 VertexOffset;\n"
" vec2 TextureScale;\n"
" vec2 PointSize;\n"
"};\n"
"\n"
"#ifdef VERTEX_SHADER\n"
"layout(location = 0) in vec2 i_st;\n"
"layout(location = 2) in vec4 i_c;\n"
@ -636,13 +644,6 @@ static const char* tfx_vgs_glsl =
"#endif\n"
"};\n"
"\n"
"layout(std140, binding = 20) uniform cb20\n"
"{\n"
" vec2 VertexScale;\n"
" vec2 VertexOffset;\n"
" vec2 TextureScale;\n"
"};\n"
"\n"
"#ifdef ZERO_TO_ONE_DEPTH\n"
"const float exp_min32 = exp2(-32.0f);\n"
"#else\n"
@ -834,8 +835,7 @@ static const char* tfx_vgs_glsl =
" vertex lt = vertex(GSin[0].t, GSin[0].c);\n"
"\n"
"#if GS_POINT == 1\n"
" // FIXME need pixel size\n"
" vec4 rb_p = gl_in[0].gl_Position + vec4(4.0f/1280.0f, 4.0f/1024.0f, 0.0f, 0.0f);\n"
" vec4 rb_p = gl_in[0].gl_Position + vec4(PointSize.x, PointSize.y, 0.0f, 0.0f);\n"
"#else\n"
" vec4 rb_p = gl_in[1].gl_Position;\n"
"#endif\n"