diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-04-24 00:05:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-04-24 00:07:48 +0300 |
commit | d712f1f83af881be536ec0d183b7d3025c172684 (patch) | |
tree | eabecb450ce2d4697468d2758df28fd990c14ed6 /source/blender/gpu/intern | |
parent | d0ff3434cffa2e056e4f191ead21226f32ea8c15 (diff) |
GPU: Add Polyline shader (wide line emulation)
This new shader is able to emulate smooth wide lines drawing using a
geometry shader.
This shader needs viewportSize and lineWidth uniforms to be set.
There is multiple variants to replace the usage of wide lines for most
shaders.
This patch only fix the gizmo_types files and the navigation gizmo.
Other areas could be fixed afterward, I just limited the patch size.
Fix T57570.
Reviewed By: billreynish
Differential Revision: https://developer.blender.org/D7487
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 3c2266bd65d..8dfc992ae9f 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -88,6 +88,9 @@ extern char datatoc_gpu_shader_image_modulate_alpha_frag_glsl[]; extern char datatoc_gpu_shader_3D_vert_glsl[]; extern char datatoc_gpu_shader_3D_normal_vert_glsl[]; extern char datatoc_gpu_shader_3D_flat_color_vert_glsl[]; +extern char datatoc_gpu_shader_3D_polyline_frag_glsl[]; +extern char datatoc_gpu_shader_3D_polyline_geom_glsl[]; +extern char datatoc_gpu_shader_3D_polyline_vert_glsl[]; extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[]; extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[]; extern char datatoc_gpu_shader_3D_passthrough_vert_glsl[]; @@ -1026,6 +1029,36 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .frag = datatoc_gpu_shader_uniform_color_frag_glsl, }, + [GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR] = + { + .vert = datatoc_gpu_shader_3D_polyline_vert_glsl, + .geom = datatoc_gpu_shader_3D_polyline_geom_glsl, + .frag = datatoc_gpu_shader_3D_polyline_frag_glsl, + .defs = "#define UNIFORM\n", + }, + [GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR] = + { + .vert = datatoc_gpu_shader_3D_polyline_vert_glsl, + .geom = datatoc_gpu_shader_3D_polyline_geom_glsl, + .frag = datatoc_gpu_shader_3D_polyline_frag_glsl, + .defs = "#define UNIFORM\n" + "#define CLIP\n", + }, + [GPU_SHADER_3D_POLYLINE_FLAT_COLOR] = + { + .vert = datatoc_gpu_shader_3D_polyline_vert_glsl, + .geom = datatoc_gpu_shader_3D_polyline_geom_glsl, + .frag = datatoc_gpu_shader_3D_polyline_frag_glsl, + .defs = "#define FLAT\n", + }, + [GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR] = + { + .vert = datatoc_gpu_shader_3D_polyline_vert_glsl, + .geom = datatoc_gpu_shader_3D_polyline_geom_glsl, + .frag = datatoc_gpu_shader_3D_polyline_frag_glsl, + .defs = "#define SMOOTH\n", + }, + [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] = { .vert = datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl, |