[virglrenderer-devel] [PATCH] shader: Invert y coordonate if we use gles

Elie Tournier tournier.elie at gmail.com
Fri Apr 27 12:48:20 UTC 2018


Hello,

This patch is still unreviewed.
Comments are welcome.

Elie

On Fri, Apr 20, 2018 at 05:17:47PM +0100, Elie Tournier wrote:
> OpenGL ES didn't support GL_POINT_SPRITE_COORD_ORIGIN.
> So when we read from an fbo, the image is upside down.
> This patch invert the y coordonate.
> 
> Fixes: dEQP-GLES2.functional.shaders.builtin_variable.pointcoord
> 
> Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
> ---
>  src/vrend_shader.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/vrend_shader.c b/src/vrend_shader.c
> index bab603e..f7f3b86 100644
> --- a/src/vrend_shader.c
> +++ b/src/vrend_shader.c
> @@ -415,7 +415,10 @@ iter_declaration(struct tgsi_iterate_context *iter,
>        case TGSI_SEMANTIC_GENERIC:
>           if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
>              if (ctx->key->coord_replace & (1 << ctx->inputs[i].sid)) {
> -               name_prefix = "vec4(gl_PointCoord, 0.0, 1.0)";
> +               if (ctx->cfg->use_gles)
> +                  name_prefix = "vec4(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 0.0, 1.0)";
> +               else
> +                  name_prefix = "vec4(gl_PointCoord, 0.0, 1.0)";
>                 ctx->inputs[i].glsl_predefined_no_emit = true;
>                 ctx->inputs[i].glsl_no_index = true;
>                 break;
> -- 
> 2.17.0
> 


More information about the virglrenderer-devel mailing list