diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/annotate_draw.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_dopesheet_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/GPU_draw.h | 7 | ||||
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/GPU_state.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.c | 13 |
17 files changed, 43 insertions, 47 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index b1f8e951b3e..7a95120b273 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2822,7 +2822,7 @@ void DRW_framebuffer_select_id_setup(ARegion *ar, const bool clear) glDisable(GL_DITHER); GPU_depth_test(true); - GPU_disable_program_point_size(); + GPU_program_point_size(false); if (clear) { GPU_framebuffer_clear_color_depth( diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 11c19b292f0..ae0239a7e49 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -355,7 +355,7 @@ void DRW_state_reset(void) DRW_state_reset_ex(DRW_STATE_DEFAULT); GPU_point_size(5); - GPU_enable_program_point_size(); + GPU_program_point_size(true); /* Reset blending function */ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 678afef5773..889d27480df 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -815,7 +815,7 @@ static void draw_keylist(View2D *v2d, format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immUniform2f( "ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1); immBegin(GPU_PRIM_POINTS, key_len); @@ -849,7 +849,7 @@ static void draw_keylist(View2D *v2d, } immEnd(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); immUnbindProgram(); } } diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index f325422fec7..a853e2bcc9a 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -561,7 +561,7 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), short lthick, const float color[4]) { - GPU_enable_program_point_size(); + GPU_program_point_size(true); for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { /* check if stroke can be drawn */ @@ -622,7 +622,7 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), } } - GPU_disable_program_point_size(); + GPU_program_point_size(false); } /* Draw selected verts for strokes being edited */ @@ -658,7 +658,7 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, } } - GPU_enable_program_point_size(); + GPU_program_point_size(true); /* draw stroke verts */ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { @@ -751,7 +751,7 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, immUnbindProgram(); } - GPU_disable_program_point_size(); + GPU_program_point_size(false); /* clear depth mask */ if (dflag & GP_DRAWDATA_ONLY3D) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index ef74aa28b63..5f08035a56b 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -180,7 +180,7 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immBegin(GPU_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; @@ -199,7 +199,7 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, immEnd(); immUnbindProgram(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); } /* draw a 3D stroke in "volumetric" style */ @@ -215,7 +215,7 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immBegin(GPU_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; @@ -229,7 +229,7 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, immEnd(); immUnbindProgram(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); } /* --------------- Stroke Fills ----------------- */ @@ -867,7 +867,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw) short sthickness; float ink[4]; - GPU_enable_program_point_size(); + GPU_program_point_size(true); bGPDstroke *gps_init = (tgpw->gps) ? tgpw->gps : tgpw->t_gpf->strokes.first; @@ -1104,7 +1104,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw) } } - GPU_disable_program_point_size(); + GPU_program_point_size(false); } /* ----- General Drawing ------ */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index fa3605269ff..6f1f4dde1ab 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -317,7 +317,7 @@ static void vicon_keytype_draw_wrapper( uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immUniform2f("ViewportSize", -1.0f, -1.0f); immBegin(GPU_PRIM_POINTS, 1); @@ -343,7 +343,7 @@ static void vicon_keytype_draw_wrapper( KEYFRAME_EXTREME_NONE); immEnd(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); immUnbindProgram(); UI_Theme_Restore(&theme_state); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 33e89b1a7c5..d9ca58fa88c 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -600,7 +600,7 @@ static void draw_masklays(const bContext *C, GPU_blend(true); GPU_blend_set_func_separate( GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - GPU_enable_program_point_size(); + GPU_program_point_size(true); MaskLayer *masklay; int i; @@ -635,7 +635,7 @@ static void draw_masklays(const bContext *C, } } - GPU_disable_program_point_size(); + GPU_program_point_size(false); GPU_blend(false); } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 0f6e7947482..599a92ff77f 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -223,7 +223,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immUniform2f( "ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1); immBegin(GPU_PRIM_POINTS, keyframe_len); @@ -282,7 +282,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) } immEnd(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); immUnbindProgram(); } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 062c9f86fab..b16374e0d66 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -292,7 +292,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_blend(true); - GPU_enable_program_point_size(); + GPU_program_point_size(true); /* draw the two handles first (if they're shown, the curve doesn't * have just a single keyframe, and the curve is being edited) */ @@ -303,7 +303,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool /* draw keyframes over the handles */ draw_fcurve_keyframe_vertices(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), pos); - GPU_disable_program_point_size(); + GPU_program_point_size(false); GPU_blend(false); } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 68cbfd76331..5cf9646210e 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -142,7 +142,7 @@ static void nla_action_draw_keyframes( format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immUniform2f("ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1); immBegin(GPU_PRIM_POINTS, key_len); @@ -167,7 +167,7 @@ static void nla_action_draw_keyframes( } immEnd(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); immUnbindProgram(); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 020bdbf60a1..1c3544077c4 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -896,7 +896,7 @@ void node_draw_sockets(View2D *v2d, uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); GPU_blend(true); - GPU_enable_program_point_size(); + GPU_program_point_size(true); immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA); @@ -991,7 +991,7 @@ void node_draw_sockets(View2D *v2d, immUnbindProgram(); - GPU_disable_program_point_size(); + GPU_program_point_size(false); GPU_blend(false); } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 7f9b90f4496..93cef1861d9 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -425,7 +425,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph * float pinned_col[4] = {1.0f, 0.0f, 0.0f, 1.0f}; /* TODO Theme? */ UI_GetThemeColor4fv(TH_VERTEX, col1); GPU_blend(true); - GPU_enable_program_point_size(); + GPU_program_point_size(true); GPU_batch_program_set_builtin(verts, GPU_SHADER_2D_UV_VERTS); GPU_batch_uniform_4f(verts, "vertColor", col1[0], col1[1], col1[2], 1.0f); @@ -450,7 +450,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph * } GPU_blend(false); - GPU_disable_program_point_size(); + GPU_program_point_size(false); } if (facedots) { GPU_point_size(pointsize); diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 8b830aadbba..507baa9531e 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -51,13 +51,6 @@ struct ViewLayer; void GPU_state_init(void); -/* Programmable point size - * - shaders set their own point size when enabled - * - use glPointSize when disabled */ - -void GPU_enable_program_point_size(void); -void GPU_disable_program_point_size(void); - /* Mipmap settings * - these will free textures on changes */ diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 00570bd7ebc..0fe5427019a 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -156,7 +156,6 @@ typedef enum eGPUBuiltinShader { GPU_SHADER_3D_UNIFORM_COLOR, /* Sets Z-depth to 1.0 (draw onto background). */ GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND, - GPU_SHADER_3D_UNIFORM_COLOR_INSTANCE, /** * Take a 3D position and color for each vertex without color interpolation. * diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 48c700adaed..7b970786e5e 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -49,6 +49,7 @@ void GPU_line_smooth(bool enable); void GPU_line_width(float width); void GPU_point_size(float size); void GPU_polygon_smooth(bool enable); +void GPU_program_point_size(bool enable); void GPU_scissor(int x, int y, int width, int height); void GPU_scissor_get_f(float coords[4]); void GPU_scissor_get_i(int coords[4]); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 638729d027c..5f27a0e93cd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1354,7 +1354,7 @@ static void gpu_disable_multisample(void) void GPU_state_init(void) { - GPU_disable_program_point_size(); + GPU_program_point_size(false); glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); @@ -1374,16 +1374,6 @@ void GPU_state_init(void) gpu_disable_multisample(); } -void GPU_enable_program_point_size(void) -{ - glEnable(GL_PROGRAM_POINT_SIZE); -} - -void GPU_disable_program_point_size(void) -{ - glDisable(GL_PROGRAM_POINT_SIZE); -} - /** \name Framebuffer color depth, for selection codes * \{ */ diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c index 176965bb80f..7e8289229f4 100644 --- a/source/blender/gpu/intern/gpu_state.c +++ b/source/blender/gpu/intern/gpu_state.c @@ -126,6 +126,19 @@ void GPU_polygon_smooth(bool enable) } } +/* Programmable point size + * - shaders set their own point size when enabled + * - use glPointSize when disabled */ +void GPU_program_point_size(bool enable) +{ + if (enable) { + glEnable(GL_PROGRAM_POINT_SIZE); + } + else { + glDisable(GL_PROGRAM_POINT_SIZE); + } +} + void GPU_scissor(int x, int y, int width, int height) { glScissor(x, y, width, height); |