Merge pull request #34262 from clayjohn/default_point_size

Add a default POINT_SIZE
This commit is contained in:
Rémi Verschelde 2019-12-12 06:45:31 +01:00 committed by GitHub
commit f676d7509e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 4 deletions

View file

@ -911,7 +911,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy"; actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv"; actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize"; actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
@ -986,7 +986,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp"; actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp"; actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp"; actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize"; actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
// gl_InstanceID is not available in OpenGL ES 2.0 // gl_InstanceID is not available in OpenGL ES 2.0
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0"; actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";

View file

@ -149,6 +149,8 @@ void main() {
uv = uv_attrib; uv = uv_attrib;
#endif #endif
float point_size = 1.0;
{ {
vec2 src_vtx = outvec.xy; vec2 src_vtx = outvec.xy;
/* clang-format off */ /* clang-format off */
@ -158,6 +160,8 @@ VERTEX_SHADER_CODE
/* clang-format on */ /* clang-format on */
} }
gl_PointSize = point_size;
#if !defined(SKIP_TRANSFORM_USED) #if !defined(SKIP_TRANSFORM_USED)
outvec = extra_matrix_instance * outvec; outvec = extra_matrix_instance * outvec;
outvec = modelview_matrix * outvec; outvec = modelview_matrix * outvec;

View file

@ -423,6 +423,8 @@ void main() {
#define projection_matrix local_projection_matrix #define projection_matrix local_projection_matrix
#define world_transform world_matrix #define world_transform world_matrix
float point_size = 1.0;
{ {
/* clang-format off */ /* clang-format off */
@ -431,6 +433,7 @@ VERTEX_SHADER_CODE
/* clang-format on */ /* clang-format on */
} }
gl_PointSize = point_size;
vec4 outvec = vertex; vec4 outvec = vertex;
// use local coordinates // use local coordinates

View file

@ -913,7 +913,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy"; actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv"; actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize"; actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix"; actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
@ -970,7 +970,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp"; actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp"; actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp"; actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize"; actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID"; actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID";
//builtins //builtins

View file

@ -150,6 +150,7 @@ void main() {
#define extra_matrix extra_matrix_instance #define extra_matrix extra_matrix_instance
float point_size = 1.0;
//for compatibility with the fragment shader we need to use uv here //for compatibility with the fragment shader we need to use uv here
vec2 uv = uv_interp; vec2 uv = uv_interp;
{ {
@ -160,6 +161,7 @@ VERTEX_SHADER_CODE
/* clang-format on */ /* clang-format on */
} }
gl_PointSize = point_size;
uv_interp = uv; uv_interp = uv;
#ifdef USE_NINEPATCH #ifdef USE_NINEPATCH

View file

@ -432,6 +432,8 @@ void main() {
} }
#endif #endif
float point_size = 1.0;
highp mat4 modelview = camera_inverse_matrix * world_matrix; highp mat4 modelview = camera_inverse_matrix * world_matrix;
{ {
/* clang-format off */ /* clang-format off */
@ -441,6 +443,8 @@ VERTEX_SHADER_CODE
/* clang-format on */ /* clang-format on */
} }
gl_PointSize = point_size;
// using local coordinates (default) // using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED) #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)