Add a default POINT_SIZE

This commit is contained in:
clayjohn 2019-12-10 23:08:20 -08:00
parent 269145a346
commit 676f647c74
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["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["PROJECTION_MATRIX"] = "projection_matrix";
@ -986,7 +986,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_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
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";

View file

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

View file

@ -423,6 +423,8 @@ void main() {
#define projection_matrix local_projection_matrix
#define world_transform world_matrix
float point_size = 1.0;
{
/* clang-format off */
@ -431,6 +433,7 @@ VERTEX_SHADER_CODE
/* clang-format on */
}
gl_PointSize = point_size;
vec4 outvec = vertex;
// 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["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["PROJECTION_MATRIX"] = "projection_matrix";
@ -970,7 +970,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_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";
//builtins

View file

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

View file

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