Commit: 6d07b459f2981b0d7eae0e89cca80366d3bbbfcb Author: Campbell Barton Date: Mon Jan 16 10:21:32 2023 +1100 Branches: master https://developer.blender.org/rB6d07b459f2981b0d7eae0e89cca80366d3bbbfcb
Cleanup: compare to GPU_SHADER_CFG_CLIPPED when checking configurations Don't assume a non-zero eGPUShaderConfig is clipped, as this would cause unexpected behavior if other configurations are added. =================================================================== M source/blender/draw/engines/overlay/overlay_shader.cc =================================================================== diff --git a/source/blender/draw/engines/overlay/overlay_shader.cc b/source/blender/draw/engines/overlay/overlay_shader.cc index 58d3e92e764..5fd009db715 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.cc +++ b/source/blender/draw/engines/overlay/overlay_shader.cc @@ -146,7 +146,8 @@ GPUShader *OVERLAY_shader_depth_only(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->depth_only) { sh_data->depth_only = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_depth_only_clipped" : "overlay_depth_only"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_depth_only_clipped" : + "overlay_depth_only"); } return sh_data->depth_only; } @@ -157,7 +158,8 @@ GPUShader *OVERLAY_shader_edit_mesh_vert(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->edit_mesh_vert) { sh_data->edit_mesh_vert = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_edit_mesh_vert_clipped" : "overlay_edit_mesh_vert"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_edit_mesh_vert_clipped" : + "overlay_edit_mesh_vert"); } return sh_data->edit_mesh_vert; } @@ -169,7 +171,7 @@ GPUShader *OVERLAY_shader_edit_mesh_edge(bool use_flat_interp) GPUShader **sh = use_flat_interp ? &sh_data->edit_mesh_edge_flat : &sh_data->edit_mesh_edge; if (*sh == nullptr) { *sh = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? (use_flat_interp ? "overlay_edit_mesh_edge_flat_clipped" : "overlay_edit_mesh_edge_clipped") : (use_flat_interp ? "overlay_edit_mesh_edge_flat" : "overlay_edit_mesh_edge")); @@ -183,13 +185,13 @@ GPUShader *OVERLAY_shader_armature_sphere(bool use_outline) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (use_outline && !sh_data->armature_sphere_outline) { sh_data->armature_sphere_outline = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_sphere_outline_clipped" : - "overlay_armature_sphere_outline"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_sphere_outline_clipped" : + "overlay_armature_sphere_outline"); } else if (!sh_data->armature_sphere_solid) { sh_data->armature_sphere_solid = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_sphere_solid_clipped" : - "overlay_armature_sphere_solid"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_sphere_solid_clipped" : + "overlay_armature_sphere_solid"); } return use_outline ? sh_data->armature_sphere_outline : sh_data->armature_sphere_solid; } @@ -200,13 +202,13 @@ GPUShader *OVERLAY_shader_armature_shape(bool use_outline) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (use_outline && !sh_data->armature_shape_outline) { sh_data->armature_shape_outline = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_shape_outline_clipped" : - "overlay_armature_shape_outline"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_shape_outline_clipped" : + "overlay_armature_shape_outline"); } else if (!sh_data->armature_shape_solid) { sh_data->armature_shape_solid = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_shape_solid_clipped" : - "overlay_armature_shape_solid"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_shape_solid_clipped" : + "overlay_armature_shape_solid"); } return use_outline ? sh_data->armature_shape_outline : sh_data->armature_shape_solid; } @@ -217,7 +219,8 @@ GPUShader *OVERLAY_shader_armature_shape_wire(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->armature_shape_wire) { sh_data->armature_shape_wire = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_shape_wire_clipped" : "overlay_armature_shape_wire"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_shape_wire_clipped" : + "overlay_armature_shape_wire"); } return sh_data->armature_shape_wire; } @@ -228,13 +231,14 @@ GPUShader *OVERLAY_shader_armature_envelope(bool use_outline) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (use_outline && !sh_data->armature_envelope_outline) { sh_data->armature_envelope_outline = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_envelope_outline_clipped" : - "overlay_armature_envelope_outline"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? + "overlay_armature_envelope_outline_clipped" : + "overlay_armature_envelope_outline"); } else if (!sh_data->armature_envelope_solid) { sh_data->armature_envelope_solid = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_envelope_solid_clipped" : - "overlay_armature_envelope_solid"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_envelope_solid_clipped" : + "overlay_armature_envelope_solid"); } return use_outline ? sh_data->armature_envelope_outline : sh_data->armature_envelope_solid; } @@ -245,7 +249,8 @@ GPUShader *OVERLAY_shader_armature_stick(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->armature_stick) { sh_data->armature_stick = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_stick_clipped" : "overlay_armature_stick"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_stick_clipped" : + "overlay_armature_stick"); } return sh_data->armature_stick; } @@ -256,7 +261,8 @@ GPUShader *OVERLAY_shader_armature_degrees_of_freedom_wire(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->armature_dof_wire) { sh_data->armature_dof_wire = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_dof_wire_clipped" : "overlay_armature_dof_wire"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_dof_wire_clipped" : + "overlay_armature_dof_wire"); } return sh_data->armature_dof_wire; } @@ -267,7 +273,8 @@ GPUShader *OVERLAY_shader_armature_degrees_of_freedom_solid(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->armature_dof_solid) { sh_data->armature_dof_solid = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_dof_solid_clipped" : "overlay_armature_dof_solid"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_dof_solid_clipped" : + "overlay_armature_dof_solid"); } return sh_data->armature_dof_solid; } @@ -278,7 +285,8 @@ GPUShader *OVERLAY_shader_armature_wire(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->armature_wire) { sh_data->armature_wire = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_armature_wire_clipped" : "overlay_armature_wire"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_armature_wire_clipped" : + "overlay_armature_wire"); } return sh_data->armature_wire; } @@ -289,7 +297,8 @@ GPUShader *OVERLAY_shader_edit_curve_handle(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->edit_curve_handle) { sh_data->edit_curve_handle = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_edit_curve_handle_clipped" : "overlay_edit_curve_handle"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_edit_curve_handle_clipped" : + "overlay_edit_curve_handle"); } return sh_data->edit_curve_handle; } @@ -300,7 +309,8 @@ GPUShader *OVERLAY_shader_edit_curve_point(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->edit_curve_point) { sh_data->edit_curve_point = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_edit_curve_point_clipped" : "overlay_edit_curve_point"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_edit_curve_point_clipped" : + "overlay_edit_curve_point"); } return sh_data->edit_curve_point; } @@ -311,7 +321,8 @@ GPUShader *OVERLAY_shader_edit_curve_wire(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->edit_curve_wire) { sh_data->edit_curve_wire = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_edit_curve_wire_clipped" : "overlay_edit_curve_wire"); + (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_edit_curve_wire_clipped" : + "overlay_edit_curve_wire"); } return sh_data->edit_curve_wire; } @@ -322,8 +333,8 @@ GPUShader *OVERLAY_shader_edit_gpencil_guide_point(void) OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; if (!sh_data->edit_gpencil_guide_point) { sh_data->edit_gpencil_guide_point = GPU_shader_create_from_info_name( - draw_ctx->sh_cfg ? "overlay_edit_gpencil_guide_point_clipped" : - "overlay_edit_gpencil_guide_point"); + (draw_ctx->sh_cfg == GP @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs