glamor: add gl_PointSize for ES shaders

GLES3.2 spec, page 126:
> The variable gl_PointSize is intended for a shader to write
> the size of the point to be rasterized. It is measured in pixels.
> If gl_PointSize is not written to, its value
> is undefined in subsequent pipe stages.

If glamor shader is use points, we should define gl_PointSize for GLES.
On Desktop GL, it "just work" due to default gl_PointSize is 1.

As @anholt requested, define this only for minimal amount of shaders
(point and glyphbit ones), to make sure than performance will not
affected

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
This commit is contained in:
Konstantin 2022-07-19 11:22:30 +03:00 committed by Emma Anholt
parent baaddf47d5
commit f273c960c1
3 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,7 @@ static const glamor_facet glamor_facet_poly_glyph_blt = {
.name = "poly_glyph_blt",
.vs_vars = "attribute vec2 primitive;\n",
.vs_exec = (" vec2 pos = vec2(0,0);\n"
GLAMOR_DEFAULT_POINT_SIZE
GLAMOR_POS(gl_Position, primitive)),
};

View File

@ -32,7 +32,8 @@
static const glamor_facet glamor_facet_point = {
.name = "poly_point",
.vs_vars = "attribute vec2 primitive;\n",
.vs_exec = GLAMOR_POS(gl_Position, primitive),
.vs_exec = (GLAMOR_DEFAULT_POINT_SIZE
GLAMOR_POS(gl_Position, primitive)),
};
static Bool

View File

@ -49,6 +49,11 @@
"precision mediump float;\n" \
"#endif\n"
#define GLAMOR_DEFAULT_POINT_SIZE \
"#ifdef GL_ES\n" \
" gl_PointSize = 1.0;\n" \
"#endif\n"
#include "glyphstr.h"
#include "glamor_debug.h"