diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 60f484db9a..5024b6f674 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -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 diff --git a/plugins/GSdx/res/glsl/tfx_vgs.glsl b/plugins/GSdx/res/glsl/tfx_vgs.glsl index 6ff064fbd9..1273f5d6cf 100644 --- a/plugins/GSdx/res/glsl/tfx_vgs.glsl +++ b/plugins/GSdx/res/glsl/tfx_vgs.glsl @@ -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 diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index b675e3eb54..9d1778f0d1 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -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"