diff options
author | clayjohn <claynjohn@gmail.com> | 2019-12-10 23:08:20 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2019-12-10 23:08:20 -0800 |
commit | 676f647c74f155d71a21b07155e529184c7b3d86 (patch) | |
tree | 06ef407a1340c4ae6ddd54c45862e943395f02f5 | |
parent | 269145a346bddae5cbbf00fd17b6c8eac4cd4665 (diff) |
Add a default POINT_SIZE
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 4 | ||||
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 4 | ||||
-rw-r--r-- | drivers/gles2/shaders/scene.glsl | 3 | ||||
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 4 |
6 files changed, 17 insertions, 4 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 7e9b6fdb82..94cb286b0e 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -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"; diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 08548ded17..afce403a9f 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -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; diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 930d3cd9d4..63eee4eb87 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -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 diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 7499962da3..e78ecbae34 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -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 diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 7255b0425c..53f84abf51 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -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 diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index b4ceb7dcfd..549a36817e 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -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) |