diff options
20 files changed, 253 insertions, 253 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index b8a449bf176..72ff8de2002 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -78,11 +78,11 @@ typedef struct BASIC_PrivateData { static void basic_engine_init(void *UNUSED(vedata)) { const DRWContextState *draw_ctx = DRW_context_state_get(); - BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; /* Depth prepass */ if (!sh_data->depth) { - sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->shader_cfg); + sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->sh_cfg); } } @@ -92,7 +92,7 @@ static void basic_cache_init(void *vedata) BASIC_StorageList *stl = ((BASIC_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); - BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const RegionView3D *rv3d = draw_ctx->rv3d; const bool is_clip = (rv3d->rflag & RV3D_CLIPPING) != 0; diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index fbd5b4d8f31..6b636bfc018 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -578,7 +578,7 @@ typedef struct DRWContextState { eObjectMode object_mode; - eGPUShaderConfig shader_cfg; + eGPUShaderConfig sh_cfg; /** Last resort (some functions take this as an arg so we can't easily avoid). * May be NULL when used for selection or depth buffer. */ diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index e062948ccec..0210e010c31 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -118,17 +118,17 @@ static struct { static void drw_shgroup_bone_octahedral( const float (*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], - const eGPUShaderConfig shader_cfg) + const eGPUShaderConfig sh_cfg) { if (g_data.bone_octahedral_outline == NULL) { struct GPUBatch *geom = DRW_cache_bone_octahedral_wire_get(); g_data.bone_octahedral_outline = shgroup_instance_bone_shape_outline( - g_data.passes.bone_outline, geom, shader_cfg); + g_data.passes.bone_outline, geom, sh_cfg); } if (g_data.bone_octahedral_solid == NULL) { struct GPUBatch *geom = DRW_cache_bone_octahedral_get(); g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid( - g_data.passes.bone_solid, geom, g_data.transparent, shader_cfg); + g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg); } float final_bonemat[4][4]; mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat); @@ -142,17 +142,17 @@ static void drw_shgroup_bone_octahedral( static void drw_shgroup_bone_box( const float (*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], - const eGPUShaderConfig shader_cfg) + const eGPUShaderConfig sh_cfg) { if (g_data.bone_box_wire == NULL) { struct GPUBatch *geom = DRW_cache_bone_box_wire_get(); g_data.bone_box_outline = shgroup_instance_bone_shape_outline( - g_data.passes.bone_outline, geom, shader_cfg); + g_data.passes.bone_outline, geom, sh_cfg); } if (g_data.bone_box_solid == NULL) { struct GPUBatch *geom = DRW_cache_bone_box_get(); g_data.bone_box_solid = shgroup_instance_bone_shape_solid( - g_data.passes.bone_solid, geom, g_data.transparent, shader_cfg); + g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg); } float final_bonemat[4][4]; mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat); @@ -165,10 +165,10 @@ static void drw_shgroup_bone_box( /* Wire */ static void drw_shgroup_bone_wire( const float (*bone_mat)[4], const float color[4], - const eGPUShaderConfig shader_cfg) + const eGPUShaderConfig sh_cfg) { if (g_data.bone_wire == NULL) { - g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire, shader_cfg); + g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire, sh_cfg); } float head[3], tail[3]; mul_v3_m4v3(head, g_data.ob->obmat, bone_mat[3]); @@ -183,10 +183,10 @@ static void drw_shgroup_bone_wire( static void drw_shgroup_bone_stick( const float (*bone_mat)[4], const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4], - const eGPUShaderConfig shader_cfg) + const eGPUShaderConfig sh_cfg) { if (g_data.bone_stick == NULL) { - g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire, shader_cfg); + g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire, sh_cfg); } float final_bonemat[4][4], tail[4]; mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat); @@ -313,7 +313,7 @@ extern void drw_batch_cache_generate_requested(Object *custom); static void drw_shgroup_bone_custom_solid( const float (*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], - const eGPUShaderConfig shader_cfg, Object *custom) + const eGPUShaderConfig sh_cfg, Object *custom) { /* grr, not re-using instances! */ struct GPUBatch *surf = DRW_cache_object_surface_get(custom); @@ -330,13 +330,13 @@ static void drw_shgroup_bone_custom_solid( if (surf) { DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid( - g_data.passes.bone_solid, surf, g_data.transparent, shader_cfg); + g_data.passes.bone_solid, surf, g_data.transparent, sh_cfg); DRW_shgroup_call_dynamic_add(shgrp_geom_solid, final_bonemat, bone_color, hint_color); } if (edges && outline_color[3] > 0.0f) { DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline( - g_data.passes.bone_outline, edges, shader_cfg); + g_data.passes.bone_outline, edges, sh_cfg); DRW_shgroup_call_dynamic_add(shgrp_geom_wire, final_bonemat, outline_color); } @@ -1257,7 +1257,7 @@ static void draw_points( static void draw_bone_custom_shape( EditBone *eBone, bPoseChannel *pchan, bArmature *arm, const int boneflag, const short constflag, - const eGPUShaderConfig shader_cfg, const int select_id) + const eGPUShaderConfig sh_cfg, const int select_id) { const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); @@ -1269,7 +1269,7 @@ static void draw_bone_custom_shape( } if ((boneflag & BONE_DRAWWIRE) == 0) { - drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, shader_cfg, pchan->custom); + drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, sh_cfg, pchan->custom); } else { drw_shgroup_bone_custom_wire(disp_mat, col_wire, pchan->custom); @@ -1326,7 +1326,7 @@ static void draw_bone_envelope( static void draw_bone_line( EditBone *eBone, bPoseChannel *pchan, bArmature *arm, const int boneflag, const short constflag, - const eGPUShaderConfig shader_cfg, const int select_id) + const eGPUShaderConfig sh_cfg, const int select_id) { const float *col_bone = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); @@ -1364,20 +1364,20 @@ static void draw_bone_line( if (select_id == -1) { /* Not in selection mode, draw everything at once. */ - drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail, shader_cfg); + drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail, sh_cfg); } else { /* In selection mode, draw bone, root and tip separately. */ DRW_select_load_id(select_id | BONESEL_BONE); - drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display, shader_cfg); + drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display, sh_cfg); if (col_head[3] > 0.0f) { DRW_select_load_id(select_id | BONESEL_ROOT); - drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display, shader_cfg); + drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display, sh_cfg); } DRW_select_load_id(select_id | BONESEL_TIP); - drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail, shader_cfg); + drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail, sh_cfg); DRW_select_load_id(-1); } @@ -1386,7 +1386,7 @@ static void draw_bone_line( static void draw_bone_wire( EditBone *eBone, bPoseChannel *pchan, bArmature *arm, const int boneflag, const short constflag, - const eGPUShaderConfig shader_cfg, const int select_id) + const eGPUShaderConfig sh_cfg, const int select_id) { const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); @@ -1399,12 +1399,12 @@ static void draw_bone_wire( BLI_assert(bbones_mat != NULL); for (int i = pchan->bone->segments; i--; bbones_mat++) { - drw_shgroup_bone_wire(bbones_mat->mat, col_wire, shader_cfg); + drw_shgroup_bone_wire(bbones_mat->mat, col_wire, sh_cfg); } } else if (eBone) { for (int i = 0; i < eBone->segments; i++) { - drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire, shader_cfg); + drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire, sh_cfg); } } @@ -1420,7 +1420,7 @@ static void draw_bone_wire( static void draw_bone_box( EditBone *eBone, bPoseChannel *pchan, bArmature *arm, const int boneflag, const short constflag, - const eGPUShaderConfig shader_cfg, const int select_id) + const eGPUShaderConfig sh_cfg, const int select_id) { const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); @@ -1435,12 +1435,12 @@ static void draw_bone_box( BLI_assert(bbones_mat != NULL); for (int i = pchan->bone->segments; i--; bbones_mat++) { - drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire, shader_cfg); + drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire, sh_cfg); } } else if (eBone) { for (int i = 0; i < eBone->segments; i++) { - drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire, shader_cfg); + drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire, sh_cfg); } } @@ -1456,7 +1456,7 @@ static void draw_bone_box( static void draw_bone_octahedral( EditBone *eBone, bPoseChannel *pchan, bArmature *arm, const int boneflag, const short constflag, - const eGPUShaderConfig shader_cfg, const int select_id) + const eGPUShaderConfig sh_cfg, const int select_id) { const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); @@ -1466,7 +1466,7 @@ static void draw_bone_octahedral( DRW_select_load_id(select_id | BONESEL_BONE); } - drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire, shader_cfg); + drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire, sh_cfg); if (select_id != -1) { DRW_select_load_id(-1); @@ -1720,19 +1720,19 @@ static void draw_armature_edit(Object *ob) } else if (arm->drawtype == ARM_LINE) { draw_bone_update_disp_matrix_default(eBone, NULL); - draw_bone_line(eBone, NULL, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_line(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else if (arm->drawtype == ARM_WIRE) { draw_bone_update_disp_matrix_bbone(eBone, NULL); - draw_bone_wire(eBone, NULL, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_wire(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else if (arm->drawtype == ARM_B_BONE) { draw_bone_update_disp_matrix_bbone(eBone, NULL); - draw_bone_box(eBone, NULL, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_box(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else { draw_bone_update_disp_matrix_default(eBone, NULL); - draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } /* Draw names of bone */ @@ -1827,7 +1827,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { draw_bone_update_disp_matrix_custom(pchan); - draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else if (arm->drawtype == ARM_ENVELOPE) { draw_bone_update_disp_matrix_default(NULL, pchan); @@ -1835,19 +1835,19 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) } else if (arm->drawtype == ARM_LINE) { draw_bone_update_disp_matrix_default(NULL, pchan); - draw_bone_line(NULL, pchan, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_line(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else if (arm->drawtype == ARM_WIRE) { draw_bone_update_disp_matrix_bbone(NULL, pchan); - draw_bone_wire(NULL, pchan, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_wire(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else if (arm->drawtype == ARM_B_BONE) { draw_bone_update_disp_matrix_bbone(NULL, pchan); - draw_bone_box(NULL, pchan, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_box(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } else { draw_bone_update_disp_matrix_default(NULL, pchan); - draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, draw_ctx->shader_cfg, select_id); + draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id); } if (!is_pose_select && show_relations && diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 819e895ed21..e222a6bba25 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -305,9 +305,9 @@ void DRW_shgroup_world_clip_planes_from_rv3d(DRWShadingGroup *shgrp, const Regio DRW_shgroup_state_enable(shgrp, DRW_STATE_CLIP_PLANES); } -DRWShadingGroup *shgroup_dynlines_flat_color(DRWPass *pass, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_dynlines_flat_color(DRWPass *pass, eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_FLAT_COLOR, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_FLAT_COLOR, sh_cfg); DRW_shgroup_instance_format(g_formats.dynlines_color, { {"pos", DRW_ATTR_FLOAT, 3}, @@ -315,7 +315,7 @@ DRWShadingGroup *shgroup_dynlines_flat_color(DRWPass *pass, eGPUShaderConfig sha }); DRWShadingGroup *grp = DRW_shgroup_line_batch_create_with_format(sh, pass, g_formats.dynlines_color); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -338,49 +338,49 @@ DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, const floa } DRWShadingGroup *shgroup_dynpoints_uniform_color( - DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig shader_cfg) + DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, sh_cfg); DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", color, 1); DRW_shgroup_uniform_float(grp, "size", size, 1); DRW_shgroup_state_enable(grp, DRW_STATE_POINT); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_groundlines_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_groundlines_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDLINE, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDLINE, sh_cfg); DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", color, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDPOINT, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDPOINT, sh_cfg); DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", color, 1); DRW_shgroup_state_enable(grp, DRW_STATE_POINT); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } DRWShadingGroup *shgroup_instance_screenspace( - DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig shader_cfg) + DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_screenspace, { {"world_pos", DRW_ATTR_FLOAT, 3}, @@ -391,7 +391,7 @@ DRWShadingGroup *shgroup_instance_screenspace( DRW_shgroup_uniform_float(grp, "size", size, 1); DRW_shgroup_uniform_float(grp, "pixel_size", DRW_viewport_pixelsize_get(), 1); DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -428,9 +428,9 @@ DRWShadingGroup *shgroup_instance_wire(DRWPass *pass, struct GPUBatch *geom) } DRWShadingGroup *shgroup_instance_screen_aligned( - DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) + DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, shader_cfg); + GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_screen_aligned, { {"color", DRW_ATTR_FLOAT, 3}, @@ -440,15 +440,15 @@ DRWShadingGroup *shgroup_instance_screen_aligned( DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_screen_aligned); DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_scaled, { {"color", DRW_ATTR_FLOAT, 3}, @@ -457,15 +457,15 @@ DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom, e }); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_scaled); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_sized, { {"color", DRW_ATTR_FLOAT, 4}, @@ -475,15 +475,15 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShad DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized); DRW_shgroup_state_disable(grp, DRW_STATE_BLEND); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_sized, { {"color", DRW_ATTR_FLOAT, 4}, @@ -492,17 +492,17 @@ DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eG }); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[shader_cfg]; - const char *world_clip_lib_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; - const char *world_clip_def_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; + const char *world_clip_lib_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; + const char *world_clip_def_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; if (sh_data->empty_axes_sh == NULL) { sh_data->empty_axes_sh = GPU_shader_create_from_arrays({ .vert = (const char *[]){world_clip_lib_or_empty, datatoc_object_empty_axes_vert_glsl, NULL}, @@ -519,7 +519,7 @@ DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geo DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_data->empty_axes_sh, pass, geom, g_formats.instance_sized); DRW_shgroup_uniform_vec3(grp, "screenVecs[0]", DRW_viewport_screenvecs_get(), 2); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -541,9 +541,9 @@ DRWShadingGroup *shgroup_instance_outline(DRWPass *pass, struct GPUBatch *geom, return grp; } -DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_CAMERA, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_CAMERA, sh_cfg); DRW_shgroup_instance_format(g_formats.instance_camera, { {"color", DRW_ATTR_FLOAT, 3}, @@ -554,15 +554,15 @@ DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, e }); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_camera); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_DISTANCE_LINES, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_DISTANCE_LINES, sh_cfg); static float point_size = 4.0f; DRW_shgroup_instance_format(g_formats.instance_distance_lines, { @@ -574,15 +574,15 @@ DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_distance_lines); DRW_shgroup_uniform_float(grp, "size", &point_size, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } -DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, shader_cfg); + GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, sh_cfg); static const int True = true; static const int False = false; @@ -595,7 +595,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGP DRW_shgroup_uniform_bool(grp, "drawFront", &False, 1); DRW_shgroup_uniform_bool(grp, "drawBack", &False, 1); DRW_shgroup_uniform_bool(grp, "drawSilhouette", &True, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -698,11 +698,11 @@ DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, bool transp return grp; } -DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[shader_cfg]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->mball_handles == NULL) { - bool is_clip = (shader_cfg == GPU_SHADER_CFG_CLIPPED); + bool is_clip = (sh_cfg == GPU_SHADER_CFG_CLIPPED); const char *world_clip_lib_or_empty = is_clip ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; const char *world_clip_def_or_empty = is_clip ? "#define USE_WORLD_CLIP_PLANES\n" : ""; sh_data->mball_handles = GPU_shader_create_from_arrays({ @@ -723,7 +723,7 @@ DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, eGPUShaderConfig DRW_cache_screenspace_circle_get(), g_formats.instance_mball_handles); DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -731,12 +731,12 @@ DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, eGPUShaderConfig /* Only works with batches with adjacency infos. */ DRWShadingGroup *shgroup_instance_bone_shape_outline( - DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg) + DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[shader_cfg]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->shape_outline == NULL) { - const char *world_clip_lib_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; - const char *world_clip_def_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; + const char *world_clip_lib_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; + const char *world_clip_def_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; sh_data->shape_outline = GPU_shader_create_from_arrays({ .vert = (const char *[]){world_clip_lib_or_empty, datatoc_armature_shape_outline_vert_glsl, NULL}, .geom = (const char *[]){world_clip_lib_or_empty, datatoc_armature_shape_outline_geom_glsl, NULL}, @@ -754,19 +754,19 @@ DRWShadingGroup *shgroup_instance_bone_shape_outline( sh_data->shape_outline, pass, geom, g_formats.instance_bone_outline); DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } DRWShadingGroup *shgroup_instance_bone_shape_solid( - DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig shader_cfg) + DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[shader_cfg]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->shape_solid == NULL) { - const char *world_clip_lib_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; - const char *world_clip_def_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; + const char *world_clip_lib_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; + const char *world_clip_def_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; sh_data->shape_solid = GPU_shader_create_from_arrays({ .vert = (const char *[]){world_clip_lib_or_empty, datatoc_armature_shape_solid_vert_glsl, NULL}, .frag = (const char *[]){datatoc_armature_shape_solid_frag_glsl, NULL}, @@ -784,7 +784,7 @@ DRWShadingGroup *shgroup_instance_bone_shape_solid( sh_data->shape_solid, pass, geom, g_formats.instance_bone); DRW_shgroup_uniform_float_copy(grp, "alpha", transp ? 0.6f : 1.0f); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -837,12 +837,12 @@ DRWShadingGroup *shgroup_instance_bone_sphere_outline(DRWPass *pass) return grp; } -DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass, eGPUShaderConfig shader_cfg) +DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[shader_cfg]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->bone_stick == NULL) { - const char *world_clip_lib_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; - const char *world_clip_def_or_empty = (shader_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; + const char *world_clip_lib_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; + const char *world_clip_def_or_empty = (sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : ""; sh_data->bone_stick = GPU_shader_create_from_arrays({ .vert = (const char *[]){world_clip_lib_or_empty, datatoc_armature_stick_vert_glsl, NULL}, .frag = (const char *[]){datatoc_armature_stick_frag_glsl, NULL}, @@ -865,7 +865,7 @@ DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass, eGPUShaderConfig sha g_formats.instance_bone_stick); DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float_copy(grp, "stickSize", 5.0f * U.pixelsize); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index 2caf4974482..426cde52654 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -123,33 +123,33 @@ void DRW_globals_free(void); void DRW_shgroup_world_clip_planes_from_rv3d(struct DRWShadingGroup *shgrp, const RegionView3D *rv3d); -struct DRWShadingGroup *shgroup_dynlines_flat_color(struct DRWPass *pass, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_dynlines_flat_color(struct DRWPass *pass, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(struct DRWPass *pass, const float color[4]); -struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_instance_solid(struct DRWPass *pass, struct GPUBatch *geom); struct DRWShadingGroup *shgroup_instance_wire(struct DRWPass *pass, struct GPUBatch *geom); -struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_empty_axes(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_empty_axes(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_instance_outline(struct DRWPass *pass, struct GPUBatch *geom, int *baseid); -struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_mball_handles(struct DRWPass *pass, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_mball_handles(struct DRWPass *pass, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_instance_bone_axes(struct DRWPass *pass); struct DRWShadingGroup *shgroup_instance_bone_envelope_distance(struct DRWPass *pass); struct DRWShadingGroup *shgroup_instance_bone_envelope_outline(struct DRWPass *pass); struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, bool transp); -struct DRWShadingGroup *shgroup_instance_bone_shape_outline(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg); -struct DRWShadingGroup *shgroup_instance_bone_shape_solid(struct DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_instance_bone_shape_outline(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg); +struct DRWShadingGroup *shgroup_instance_bone_shape_solid(struct DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_instance_bone_sphere_outline(struct DRWPass *pass); struct DRWShadingGroup *shgroup_instance_bone_sphere_solid(struct DRWPass *pass, bool transp); -struct DRWShadingGroup *shgroup_instance_bone_stick(struct DRWPass *pass, eGPUShaderConfig shader_cfg); +struct DRWShadingGroup *shgroup_instance_bone_stick(struct DRWPass *pass, eGPUShaderConfig sh_cfg); struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct GPUBatch *geom); struct GPUShader *mpath_line_shader_get(void); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 29fbe9a862b..bd43a35bd47 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -536,9 +536,9 @@ static void drw_context_state_init(void) DST.draw_ctx.object_pose = NULL; } - DST.draw_ctx.shader_cfg = GPU_SHADER_CFG_DEFAULT; + DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT; if (DST.draw_ctx.rv3d && DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) { - DST.draw_ctx.shader_cfg = GPU_SHADER_CFG_CLIPPED; + DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED; } } diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index 93aab9c0629..2c83316d1fa 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -311,9 +311,9 @@ GPUShader *DRW_shader_create_fullscreen(const char *frag, const char *defines) return GPU_shader_create(datatoc_common_fullscreen_vert_glsl, frag, NULL, NULL, defines, __func__); } -GPUShader *DRW_shader_create_3D_depth_only(eGPUShaderConfig shader_cfg) +GPUShader *DRW_shader_create_3D_depth_only(eGPUShaderConfig sh_cfg) { - return GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_DEPTH_ONLY, shader_cfg); + return GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_DEPTH_ONLY, sh_cfg); } GPUMaterial *DRW_shader_find_from_world(World *wo, const void *engine_type, int options, bool deferred) diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index 4adf31b9b25..0a2a8ede1d9 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -107,7 +107,7 @@ typedef struct EDIT_CURVE_PrivateData { static void EDIT_CURVE_engine_init(void *UNUSED(vedata)) { const DRWContextState *draw_ctx = DRW_context_state_get(); - EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; if (is_clip) { @@ -119,7 +119,7 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata)) if (!sh_data->wire_sh) { sh_data->wire_sh = GPU_shader_get_builtin_shader_with_config( - GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->shader_cfg); + GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->sh_cfg); } if (!sh_data->wire_normals_sh) { @@ -158,7 +158,7 @@ static void EDIT_CURVE_cache_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); View3D *v3d = draw_ctx->v3d; const RegionView3D *rv3d = draw_ctx->rv3d; - EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!stl->g_data) { /* Alloc transient pointers */ diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c index 9096664cdd0..97471ef39e1 100644 --- a/source/blender/draw/modes/edit_lattice_mode.c +++ b/source/blender/draw/modes/edit_lattice_mode.c @@ -136,7 +136,7 @@ static void EDIT_LATTICE_engine_init(void *vedata) */ const DRWContextState *draw_ctx = DRW_context_state_get(); - EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; if (is_clip) { DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d); @@ -145,7 +145,7 @@ static void EDIT_LATTICE_engine_init(void *vedata) const char *world_clip_def_or_empty = is_clip ? "#define USE_WORLD_CLIP_PLANES\n" : ""; if (!sh_data->wire) { - sh_data->wire = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SMOOTH_COLOR, draw_ctx->shader_cfg); + sh_data->wire = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SMOOTH_COLOR, draw_ctx->sh_cfg); } if (!sh_data->overlay_vert) { @@ -174,7 +174,7 @@ static void EDIT_LATTICE_cache_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); RegionView3D *rv3d = draw_ctx->rv3d; - EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!stl->g_data) { /* Alloc transient pointers */ diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 8cb7d93caee..c304e610548 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -158,7 +158,7 @@ static void EDIT_MESH_engine_init(void *vedata) EDIT_MESH_FramebufferList *fbl = ((EDIT_MESH_Data *)vedata)->fbl; const DRWContextState *draw_ctx = DRW_context_state_get(); - EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; const float *viewport_size = DRW_viewport_size_get(); @@ -257,7 +257,7 @@ static void EDIT_MESH_engine_init(void *vedata) .defs = (const char *[]){world_clip_def_or_empty, NULL}, }); - sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->shader_cfg); + sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->sh_cfg); sh_data->ghost_clear_depth = DRW_shader_create_fullscreen(datatoc_gpu_shader_depth_only_frag_glsl, NULL); } @@ -273,7 +273,7 @@ static DRWPass *edit_mesh_create_overlay_pass( RegionView3D *rv3d = draw_ctx->rv3d; Scene *scene = draw_ctx->scene; ToolSettings *tsettings = scene->toolsettings; - EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool select_vert = (tsettings->selectmode & SCE_SELECT_VERTEX) != 0; const bool select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0; const bool select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0; @@ -368,7 +368,7 @@ static void EDIT_MESH_cache_init(void *vedata) RegionView3D *rv3d = draw_ctx->rv3d; Scene *scene = draw_ctx->scene; ToolSettings *tsettings = scene->toolsettings; - EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; static float zero = 0.0f; if (!stl->g_data) { diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c index a61745b09ad..0af1ab9ecd8 100644 --- a/source/blender/draw/modes/edit_metaball_mode.c +++ b/source/blender/draw/modes/edit_metaball_mode.c @@ -121,7 +121,7 @@ static void EDIT_METABALL_cache_init(void *vedata) psl->pass = DRW_pass_create("My Pass", state); /* Create a shadingGroup using a function in draw_common.c or custom one */ - stl->g_data->group = shgroup_instance_mball_handles(psl->pass, draw_ctx->shader_cfg); + stl->g_data->group = shgroup_instance_mball_handles(psl->pass, draw_ctx->sh_cfg); } } diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 7b5b83ca328..67da81b91ff 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -395,7 +395,7 @@ static void OBJECT_engine_init(void *vedata) /* Shaders */ const DRWContextState *draw_ctx = DRW_context_state_get(); - OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; const char *world_clip_lib_or_empty = is_clip ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : ""; @@ -659,37 +659,37 @@ static void OBJECT_engine_free(void) } } -static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, GPUShader *sh, eGPUShaderConfig shader_cfg) +static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, GPUShader *sh, eGPUShaderConfig sh_cfg) { DRWShadingGroup *grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_int(grp, "baseId", ofs, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } /* currently same as 'shgroup_outline', new function to avoid confustion */ -static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig shader_cfg) +static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig sh_cfg) { DRWShadingGroup *grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", col, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; } /* currently same as 'shgroup_outline', new function to avoid confustion */ -static DRWShadingGroup *shgroup_points(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig shader_cfg) +static DRWShadingGroup *shgroup_points(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig sh_cfg) { DRWShadingGroup *grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", col, 1); DRW_shgroup_uniform_vec4(grp, "innerColor", G_draw.block.colorEditMeshMiddle, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } return grp; @@ -912,7 +912,7 @@ static void image_calc_aspect(Image *ima, const int size[2], float r_image_aspec static void DRW_shgroup_empty_image( OBJECT_Shaders *sh_data, OBJECT_ShadingGroupList *sgl, - Object *ob, const float color[3], RegionView3D *rv3d, eGPUShaderConfig shader_cfg) + Object *ob, const float color[3], RegionView3D *rv3d, eGPUShaderConfig sh_cfg) { /* TODO: 'StereoViews', see draw_empty_image. */ @@ -952,7 +952,7 @@ static void DRW_shgroup_empty_image( DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1); DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1); DRW_shgroup_uniform_vec4(grp, "objectColor", ob->col, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } DRW_shgroup_call_add(grp, DRW_cache_image_plane_get(), ob->obmat); @@ -967,7 +967,7 @@ static void DRW_shgroup_empty_image( DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1); DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1); DRW_shgroup_uniform_vec3(grp, "color", color, 1); - if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d); } DRW_shgroup_call_add(grp, DRW_cache_image_plane_wire_get(), ob->obmat); @@ -982,7 +982,7 @@ static void OBJECT_cache_init(void *vedata) DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); OBJECT_PrivateData *g_data; const DRWContextState *draw_ctx = DRW_context_state_get(); - OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const float outline_width = UI_GetThemeValuef(TH_OUTLINE_WIDTH); const bool do_outline_expand = (U.pixelsize > 1.0) || (outline_width > 2.0f); @@ -1006,10 +1006,10 @@ static void OBJECT_cache_init(void *vedata) sh = sh_data->outline_prepass_wire; } - g_data->outlines_select = shgroup_outline(psl->outlines, &g_data->id_ofs_select, sh, draw_ctx->shader_cfg); - g_data->outlines_select_dupli = shgroup_outline(psl->outlines, &g_data->id_ofs_select_dupli, sh, draw_ctx->shader_cfg); - g_data->outlines_transform = shgroup_outline(psl->outlines, &g_data->id_ofs_transform, sh, draw_ctx->shader_cfg); - g_data->outlines_active = shgroup_outline(psl->outlines, &g_data->id_ofs_active, sh, draw_ctx->shader_cfg); + g_data->outlines_select = shgroup_outline(psl->outlines, &g_data->id_ofs_select, sh, draw_ctx->sh_cfg); + g_data->outlines_select_dupli = shgroup_outline(psl->outlines, &g_data->id_ofs_select_dupli, sh, draw_ctx->sh_cfg); + g_data->outlines_transform = shgroup_outline(psl->outlines, &g_data->id_ofs_transform, sh, draw_ctx->sh_cfg); + g_data->outlines_active = shgroup_outline(psl->outlines, &g_data->id_ofs_active, sh, draw_ctx->sh_cfg); g_data->id_ofs_select = 0; g_data->id_ofs_select_dupli = 0; @@ -1167,129 +1167,129 @@ static void OBJECT_cache_init(void *vedata) /* Empties */ geom = DRW_cache_plain_axes_get(); - sgl->plain_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->plain_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_cube_get(); - sgl->cube = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->cube = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_circle_get(); - sgl->circle = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->circle = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_sphere_get(); - sgl->sphere = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->sphere = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_sphere_get(); sgl->sphere_solid = shgroup_instance_solid(sgl->non_meshes, geom); geom = DRW_cache_empty_cylinder_get(); - sgl->cylinder = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->cylinder = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_capsule_cap_get(); - sgl->capsule_cap = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->capsule_cap = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_capsule_body_get(); - sgl->capsule_body = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->capsule_body = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_cone_get(); - sgl->cone = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->cone = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_arrow_get(); - sgl->single_arrow = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->single_arrow = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_line_get(); - sgl->single_arrow_line = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->single_arrow_line = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_bone_arrows_get(); - sgl->empty_axes = shgroup_instance_empty_axes(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->empty_axes = shgroup_instance_empty_axes(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Force Field */ geom = DRW_cache_field_wind_get(); - sgl->field_wind = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_wind = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_field_force_get(); - sgl->field_force = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_force = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_field_vortex_get(); - sgl->field_vortex = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_vortex = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_screenspace_circle_get(); - sgl->field_curve_sta = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_curve_sta = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Grease Pencil */ geom = DRW_cache_gpencil_axes_get(); - sgl->gpencil_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->gpencil_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Speaker */ geom = DRW_cache_speaker_get(); - sgl->speaker = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->speaker = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Probe */ static float probeSize = 14.0f; geom = DRW_cache_lightprobe_cube_get(); - sgl->probe_cube = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->shader_cfg); + sgl->probe_cube = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->sh_cfg); geom = DRW_cache_lightprobe_grid_get(); - sgl->probe_grid = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->shader_cfg); + sgl->probe_grid = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->sh_cfg); static float probePlanarSize = 20.0f; geom = DRW_cache_lightprobe_planar_get(); - sgl->probe_planar = shgroup_instance_screenspace(sgl->non_meshes, geom, &probePlanarSize, draw_ctx->shader_cfg); + sgl->probe_planar = shgroup_instance_screenspace(sgl->non_meshes, geom, &probePlanarSize, draw_ctx->sh_cfg); /* Camera */ geom = DRW_cache_camera_get(); - sgl->camera = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_camera_frame_get(); - sgl->camera_frame = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_frame = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_camera_tria_get(); - sgl->camera_tria = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_tria = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_plain_axes_get(); - sgl->camera_focus = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_focus = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_line_get(); - sgl->camera_clip = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); - sgl->camera_mist = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_clip = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); + sgl->camera_mist = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_line_endpoints_get(); - sgl->camera_clip_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); - sgl->camera_mist_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_clip_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); + sgl->camera_mist_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_quad_get(); - sgl->camera_stereo_plane = shgroup_instance_alpha(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_stereo_plane = shgroup_instance_alpha(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_cube_get(); - sgl->camera_stereo_volume = shgroup_instance_alpha(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_stereo_volume = shgroup_instance_alpha(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_empty_cube_get(); - sgl->camera_stereo_volume_wires = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->camera_stereo_volume_wires = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); BLI_listbase_clear(&sgl->camera_path); /* Texture Space */ geom = DRW_cache_empty_cube_get(); - sgl->texspace = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->texspace = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Wires (for loose edges) */ - sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->shader_cfg); - sgl->wire = shgroup_wire(sgl->non_meshes, gb->colorWire, sh, draw_ctx->shader_cfg); - sgl->wire_select = shgroup_wire(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->shader_cfg); - sgl->wire_transform = shgroup_wire(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->shader_cfg); - sgl->wire_active = shgroup_wire(sgl->non_meshes, gb->colorActive, sh, draw_ctx->shader_cfg); + sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->sh_cfg); + sgl->wire = shgroup_wire(sgl->non_meshes, gb->colorWire, sh, draw_ctx->sh_cfg); + sgl->wire_select = shgroup_wire(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->sh_cfg); + sgl->wire_transform = shgroup_wire(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->sh_cfg); + sgl->wire_active = shgroup_wire(sgl->non_meshes, gb->colorActive, sh, draw_ctx->sh_cfg); /* Wire (duplicator) */ - sgl->wire_dupli = shgroup_wire(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->shader_cfg); - sgl->wire_dupli_select = shgroup_wire(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->shader_cfg); + sgl->wire_dupli = shgroup_wire(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->sh_cfg); + sgl->wire_dupli_select = shgroup_wire(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->sh_cfg); /* Points (loose points) */ sh = sh_data->loose_points; - sgl->points = shgroup_points(sgl->non_meshes, gb->colorWire, sh, draw_ctx->shader_cfg); - sgl->points_select = shgroup_points(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->shader_cfg); - sgl->points_transform = shgroup_points(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->shader_cfg); - sgl->points_active = shgroup_points(sgl->non_meshes, gb->colorActive, sh, draw_ctx->shader_cfg); + sgl->points = shgroup_points(sgl->non_meshes, gb->colorWire, sh, draw_ctx->sh_cfg); + sgl->points_select = shgroup_points(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->sh_cfg); + sgl->points_transform = shgroup_points(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->sh_cfg); + sgl->points_active = shgroup_points(sgl->non_meshes, gb->colorActive, sh, draw_ctx->sh_cfg); /* Points (duplicator) */ - sgl->points_dupli = shgroup_points(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->shader_cfg); - sgl->points_dupli_select = shgroup_points(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->shader_cfg); + sgl->points_dupli = shgroup_points(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->sh_cfg); + sgl->points_dupli_select = shgroup_points(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->sh_cfg); DRW_shgroup_state_disable(sgl->points, DRW_STATE_BLEND); DRW_shgroup_state_disable(sgl->points_select, DRW_STATE_BLEND); DRW_shgroup_state_disable(sgl->points_transform, DRW_STATE_BLEND); @@ -1298,7 +1298,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_state_disable(sgl->points_dupli_select, DRW_STATE_BLEND); /* Metaballs Handles */ - sgl->mball_handle = shgroup_instance_mball_handles(sgl->non_meshes, draw_ctx->shader_cfg); + sgl->mball_handle = shgroup_instance_mball_handles(sgl->non_meshes, draw_ctx->sh_cfg); /* Lamps */ /* TODO @@ -1307,50 +1307,50 @@ static void OBJECT_cache_init(void *vedata) /* start with buflimit because we don't want stipples */ geom = DRW_cache_single_line_get(); - sgl->lamp_buflimit = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_buflimit = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); - sgl->lamp_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, gb->colorLampNoAlpha, &gb->sizeLampCenter, draw_ctx->shader_cfg); + sgl->lamp_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, gb->colorLampNoAlpha, &gb->sizeLampCenter, draw_ctx->sh_cfg); geom = DRW_cache_lamp_get(); - sgl->lamp_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle, draw_ctx->shader_cfg); + sgl->lamp_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle, draw_ctx->sh_cfg); geom = DRW_cache_lamp_shadows_get(); - sgl->lamp_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircleShadow, draw_ctx->shader_cfg); + sgl->lamp_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircleShadow, draw_ctx->sh_cfg); geom = DRW_cache_lamp_sunrays_get(); - sgl->lamp_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle, draw_ctx->shader_cfg); + sgl->lamp_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLampCircle, draw_ctx->sh_cfg); - sgl->lamp_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, gb->colorLamp, draw_ctx->shader_cfg); - sgl->lamp_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, gb->colorLamp, draw_ctx->shader_cfg); + sgl->lamp_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, gb->colorLamp, draw_ctx->sh_cfg); + sgl->lamp_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, gb->colorLamp, draw_ctx->sh_cfg); geom = DRW_cache_screenspace_circle_get(); - sgl->lamp_area_sphere = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_area_sphere = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_area_square_get(); - sgl->lamp_area_square = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_area_square = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_area_disk_get(); - sgl->lamp_area_disk = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_area_disk = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_hemi_get(); - sgl->lamp_hemi = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_hemi = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_line_get(); - sgl->lamp_distance = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_distance = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_single_line_endpoints_get(); - sgl->lamp_buflimit_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_buflimit_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_spot_get(); - sgl->lamp_spot_cone = shgroup_spot_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_cone = shgroup_spot_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_circle_get(); - sgl->lamp_spot_blend = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_blend = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_spot_square_get(); - sgl->lamp_spot_pyramid = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_pyramid = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); geom = DRW_cache_square_get(); - sgl->lamp_spot_blend_rect = shgroup_instance(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_blend_rect = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* -------- STIPPLES ------- */ @@ -1361,34 +1361,34 @@ static void OBJECT_cache_init(void *vedata) /* Force Field Curve Guide End (here because of stipple) */ /* TODO port to shader stipple */ geom = DRW_cache_screenspace_circle_get(); - sgl->field_curve_end = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_curve_end = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Force Field Limits */ /* TODO port to shader stipple */ geom = DRW_cache_field_tube_limit_get(); - sgl->field_tube_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_tube_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* TODO port to shader stipple */ geom = DRW_cache_field_cone_limit_get(); - sgl->field_cone_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->shader_cfg); + sgl->field_cone_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg); /* Spot shapes */ state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND | DRW_STATE_CULL_FRONT; sgl->spot_shapes = psl->spot_shapes[i] = DRW_pass_create("Spot Shape Pass", state); geom = DRW_cache_lamp_spot_volume_get(); - sgl->lamp_spot_volume = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_volume = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_spot_square_volume_get(); - sgl->lamp_spot_volume_rect = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_volume_rect = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->sh_cfg); geom = DRW_cache_lamp_spot_volume_get(); - sgl->lamp_spot_volume_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_volume_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->sh_cfg); DRW_shgroup_state_disable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_FRONT); DRW_shgroup_state_enable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_BACK); geom = DRW_cache_lamp_spot_square_volume_get(); - sgl->lamp_spot_volume_rect_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->shader_cfg); + sgl->lamp_spot_volume_rect_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, draw_ctx->sh_cfg); DRW_shgroup_state_disable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_FRONT); DRW_shgroup_state_enable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_BACK); } @@ -1405,7 +1405,7 @@ static void OBJECT_cache_init(void *vedata) size = U.obcenter_dia * U.pixelsize + outlineWidth; GPUShader *sh = GPU_shader_get_builtin_shader_with_config( - GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, draw_ctx->shader_cfg); + GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, draw_ctx->sh_cfg); /* Active */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); @@ -1413,7 +1413,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_float(grp, "outlineWidth", &outlineWidth, 1); DRW_shgroup_uniform_vec4(grp, "color", gb->colorActive, 1); DRW_shgroup_uniform_vec4(grp, "outlineColor", gb->colorOutline, 1); - if (draw_ctx->shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d); } stl->g_data->center_active = grp; @@ -1421,7 +1421,7 @@ static void OBJECT_cache_init(void *vedata) /* Select */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); DRW_shgroup_uniform_vec4(grp, "color", gb->colorSelect, 1); - if (draw_ctx->shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d); } stl->g_data->center_selected = grp; @@ -1429,7 +1429,7 @@ static void OBJECT_cache_init(void *vedata) /* Deselect */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); DRW_shgroup_uniform_vec4(grp, "color", gb->colorDeselect, 1); - if (draw_ctx->shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d); } stl->g_data->center_deselected = grp; @@ -1437,7 +1437,7 @@ static void OBJECT_cache_init(void *vedata) /* Select (library) */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrarySelect, 1); - if (draw_ctx->shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d); } stl->g_data->center_selected_lib = grp; @@ -1445,7 +1445,7 @@ static void OBJECT_cache_init(void *vedata) /* Deselect (library) */ grp = DRW_shgroup_point_batch_create(sh, psl->ob_center); DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrary, 1); - if (draw_ctx->shader_cfg == GPU_SHADER_CFG_CLIPPED) { + if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d); } stl->g_data->center_deselected_lib = grp; @@ -2118,7 +2118,7 @@ static void DRW_shgroup_empty_ex( static void DRW_shgroup_empty( OBJECT_Shaders *sh_data, OBJECT_ShadingGroupList *sgl, - Object *ob, ViewLayer *view_layer, RegionView3D *rv3d, eGPUShaderConfig shader_cfg) + Object *ob, ViewLayer *view_layer, RegionView3D *rv3d, eGPUShaderConfig sh_cfg) { float *color; DRW_object_wire_theme_get(ob, view_layer, &color); @@ -2134,7 +2134,7 @@ static void DRW_shgroup_empty( DRW_shgroup_empty_ex(sgl, ob->obmat, &ob->empty_drawsize, ob->empty_drawtype, color); break; case OB_EMPTY_IMAGE: - DRW_shgroup_empty_image(sh_data, sgl, ob, color, rv3d, shader_cfg); + DRW_shgroup_empty_image(sh_data, sgl, ob, color, rv3d, sh_cfg); break; } } @@ -2894,7 +2894,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) ModifierData *md = NULL; int theme_id = TH_UNDEFINED; const int ob_visibility = DRW_object_visibility_in_active_context(ob); - OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; /* Handle particles first in case the emitter itself shouldn't be rendered. */ if (ob_visibility & OB_VISIBLE_PARTICLES) { @@ -3052,7 +3052,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) if (hide_object_extra) { break; } - DRW_shgroup_empty(sh_data, sgl, ob, view_layer, rv3d, draw_ctx->shader_cfg); + DRW_shgroup_empty(sh_data, sgl, ob, view_layer, rv3d, draw_ctx->sh_cfg); break; case OB_GPENCIL: if (hide_object_extra) { diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index b026bb5ffd2..a1befa679f0 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -91,7 +91,7 @@ static void overlay_engine_init(void *vedata) OVERLAY_StorageList *stl = data->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; if (is_clip) { @@ -146,7 +146,7 @@ static void overlay_cache_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); RegionView3D *rv3d = draw_ctx->rv3d; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const DRWContextState *DCS = DRW_context_state_get(); diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c index 16c0d3621f2..ced0883b9b6 100644 --- a/source/blender/draw/modes/paint_vertex_mode.c +++ b/source/blender/draw/modes/paint_vertex_mode.c @@ -90,7 +90,7 @@ typedef struct PAINT_VERTEX_PrivateData { static void PAINT_VERTEX_engine_init(void *UNUSED(vedata)) { const DRWContextState *draw_ctx = DRW_context_state_get(); - PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; if (is_clip) { @@ -131,7 +131,7 @@ static void PAINT_VERTEX_cache_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); const View3D *v3d = draw_ctx->v3d; const RegionView3D *rv3d = draw_ctx->rv3d; - PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!stl->g_data) { /* Alloc transient pointers */ diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index 0afcff12613..d52a5540ee6 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -91,7 +91,7 @@ typedef struct PAINT_WEIGHT_PrivateData { static void PAINT_WEIGHT_engine_init(void *UNUSED(vedata)) { const DRWContextState *draw_ctx = DRW_context_state_get(); - PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0; if (is_clip) { @@ -135,7 +135,7 @@ static void PAINT_WEIGHT_cache_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); const View3D *v3d = draw_ctx->v3d; RegionView3D *rv3d = draw_ctx->rv3d; - PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_cfg]; + PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!stl->g_data) { /* Alloc transient pointers */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2ece5358bc0..f48eefdc399 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -193,8 +193,8 @@ static void bbs_mesh_verts(GPUBatch *batch, int offset, const float world_clip_p { GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); - const eGPUShaderConfig shader_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; - GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, shader_cfg); + const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; + GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg); GPU_batch_uniform_1ui(batch, "offset", offset); if (world_clip_planes != NULL) { bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); @@ -207,8 +207,8 @@ static void bbs_mesh_wire(GPUBatch *batch, int offset, const float world_clip_pl GPU_line_width(1.0f); glProvokingVertex(GL_FIRST_VERTEX_CONVENTION); - const eGPUShaderConfig shader_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; - GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, shader_cfg); + const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; + GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg); GPU_batch_uniform_1ui(batch, "offset", offset); if (world_clip_planes != NULL) { bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); @@ -222,8 +222,8 @@ static void bbs_mesh_wire(GPUBatch *batch, int offset, const float world_clip_pl static void bbs_mesh_face(GPUBatch *batch, const bool use_select, const float world_clip_planes[6][4]) { if (use_select) { - const eGPUShaderConfig shader_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; - GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, shader_cfg); + const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; + GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg); GPU_batch_uniform_1ui(batch, "offset", 1); if (world_clip_planes != NULL) { bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); @@ -231,8 +231,8 @@ static void bbs_mesh_face(GPUBatch *batch, const bool use_select, const float wo GPU_batch_draw(batch); } else { - const eGPUShaderConfig shader_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; - GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_UNIFORM_SELECT_ID, shader_cfg); + const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; + GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_UNIFORM_SELECT_ID, sh_cfg); GPU_batch_uniform_1ui(batch, "id", 0); if (world_clip_planes != NULL) { bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); @@ -243,8 +243,8 @@ static void bbs_mesh_face(GPUBatch *batch, const bool use_select, const float wo static void bbs_mesh_face_dot(GPUBatch *batch, const float world_clip_planes[6][4]) { - const eGPUShaderConfig shader_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; - GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, shader_cfg); + const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT; + GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg); GPU_batch_uniform_1ui(batch, "offset", 1); if (world_clip_planes != NULL) { bbs_world_clip_planes_from_rv3d(batch, world_clip_planes); diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index f10202f5642..459a997b4f4 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -125,7 +125,7 @@ void GPU_batch_program_set_shader(GPUBatch *, GPUShader *shader); void GPU_batch_program_set_builtin( GPUBatch *batch, eGPUBuiltinShader shader_id); void GPU_batch_program_set_builtin_with_config( - GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig shader_cfg); + GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg); /* Entire batch draws with one shader program, but can be redrawn later with another program. */ /* Vertex shader's inputs must be compatible with the batch's vertex format. */ diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 38d9b4097a0..bae8c3c7b53 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -376,7 +376,7 @@ typedef enum eGPUInterlaceShader { } eGPUInterlaceShader; GPUShader *GPU_shader_get_builtin_shader_with_config( - eGPUBuiltinShader shader, eGPUShaderConfig shader_cfg); + eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg); GPUShader *GPU_shader_get_builtin_shader( eGPUBuiltinShader shader); diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index bd4fa25c306..9738b303700 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -669,9 +669,9 @@ void GPU_batch_program_set_shader(GPUBatch *batch, GPUShader *shader) } void GPU_batch_program_set_builtin_with_config( - GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig shader_cfg) + GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg) { - GPUShader *shader = GPU_shader_get_builtin_shader_with_config(shader_id, shader_cfg); + GPUShader *shader = GPU_shader_get_builtin_shader_with_config(shader_id, sh_cfg); GPU_batch_program_set(batch, shader->program, shader->interface); } diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 8bc53a71b5a..4245adbde5f 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -1170,11 +1170,11 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { }; GPUShader *GPU_shader_get_builtin_shader_with_config( - eGPUBuiltinShader shader, eGPUShaderConfig shader_cfg) + eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg) { BLI_assert(shader < GPU_SHADER_BUILTIN_LEN); - BLI_assert(shader_cfg < GPU_SHADER_CFG_LEN); - GPUShader **sh_p = &builtin_shaders[shader_cfg][shader]; + BLI_assert(sh_cfg < GPU_SHADER_CFG_LEN); + GPUShader **sh_p = &builtin_shaders[sh_cfg][shader]; if (*sh_p == NULL) { GPUShaderStages stages_legacy = {NULL}; @@ -1199,10 +1199,10 @@ GPUShader *GPU_shader_get_builtin_shader_with_config( } /* common case */ - if (shader_cfg == GPU_SHADER_CFG_DEFAULT) { + if (sh_cfg == GPU_SHADER_CFG_DEFAULT) { *sh_p = GPU_shader_create(stages->vert, stages->frag, stages->geom, NULL, stages->defs, __func__); } - else if (shader_cfg == GPU_SHADER_CFG_CLIPPED) { + else if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { /* Remove eventually, for now ensure support for each shader has been added. */ BLI_assert(ELEM(shader, GPU_SHADER_3D_UNIFORM_COLOR, |