Cleanup: GPU: Move program point size to GPU_state
This commit is contained in:
parent
fbe7c848c2
commit
2100dba34b
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 ------ */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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
|
||||
* \{ */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue