GPU: refactor clipped drawing from DRW into GPU
[blender.git] / source / blender / draw / intern / draw_common.c
index f43efa1445191842aaaadb8f6a6f2b6d1a872fbb..0b0510a5ea2e98c751b29d7f118dd00569692bf8 100644 (file)
@@ -32,7 +32,6 @@
 #include "BKE_colorband.h"
 
 #include "draw_common.h"
-#include "draw_builtin_shader.h"
 
 #if 0
 #define UI_COLOR_RGB_FROM_U8(r, g, b, v4) \
@@ -230,7 +229,7 @@ extern char datatoc_armature_stick_frag_glsl[];
 extern char datatoc_armature_dof_vert_glsl[];
 
 extern char datatoc_common_globals_lib_glsl[];
-extern char datatoc_common_world_clip_lib_glsl[];
+extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
 
 extern char datatoc_gpu_shader_flat_color_frag_glsl[];
 extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
@@ -261,7 +260,7 @@ typedef struct COMMON_Shaders {
        struct GPUShader *mball_handles;
 } COMMON_Shaders;
 
-static COMMON_Shaders g_shaders[DRW_SHADER_SLOT_LEN] = {{NULL}};
+static COMMON_Shaders g_shaders[GPU_SHADER_CFG_LEN] = {{NULL}};
 
 static struct {
        struct GPUVertFormat *instance_screenspace;
@@ -292,7 +291,7 @@ void DRW_globals_free(void)
                MEM_SAFE_FREE(*format);
        }
 
-       for (int j = 0; j < DRW_SHADER_SLOT_LEN; j++) {
+       for (int j = 0; j < GPU_SHADER_CFG_LEN; j++) {
                struct GPUShader **shader = &g_shaders[j].shape_outline;
                for (int i = 0; i < sizeof(g_shaders[j]) / sizeof(void *); ++i, ++shader) {
                        DRW_SHADER_FREE_SAFE(*shader);
@@ -338,49 +337,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, eDRW_ShaderSlot shader_slot)
+        DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh = DRW_shader_get_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, shader_slot);
+       GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, shader_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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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], eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_groundlines_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh = DRW_shader_get_builtin_shader(GPU_SHADER_3D_GROUNDLINE, shader_slot);
+       GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDLINE, shader_cfg);
 
        DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass);
        DRW_shgroup_uniform_vec4(grp, "color", color, 1);
-       if (shader_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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], eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh = DRW_shader_get_builtin_shader(GPU_SHADER_3D_GROUNDPOINT, shader_slot);
+       GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDPOINT, shader_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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+        DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh = DRW_shader_get_builtin_shader(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, shader_slot);
+       GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_screenspace, {
                {"world_pos", DRW_ATTR_FLOAT, 3},
@@ -391,7 +390,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_cfg == GPU_SHADER_CFG_CLIPPED) {
                DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
        }
        return grp;
@@ -428,9 +427,9 @@ DRWShadingGroup *shgroup_instance_wire(DRWPass *pass, struct GPUBatch *geom)
 }
 
 DRWShadingGroup *shgroup_instance_screen_aligned(
-        DRWPass *pass, struct GPUBatch *geom, eDRW_ShaderSlot shader_slot)
+        DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh = DRW_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, shader_slot);
+       GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_screen_aligned, {
                {"color",               DRW_ATTR_FLOAT, 3},
@@ -440,15 +439,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_scaled, {
                {"color",               DRW_ATTR_FLOAT, 3},
@@ -457,15 +456,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_sized, {
                {"color",               DRW_ATTR_FLOAT, 4},
@@ -475,15 +474,15 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eDRW_Sha
 
        DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
        DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
-       if (shader_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_sized, {
                {"color",               DRW_ATTR_FLOAT, 4},
@@ -492,19 +491,19 @@ DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eD
        });
 
        DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
-       if (shader_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       COMMON_Shaders *sh_data = &g_shaders[shader_slot];
-       const char *world_clip_lib_or_empty = (shader_slot == DRW_SHADER_SLOT_CLIPPED) ? datatoc_common_world_clip_lib_glsl : "";
-       const char *world_clip_def_or_empty = (shader_slot == DRW_SHADER_SLOT_CLIPPED) ? "#define USE_WORLD_CLIP_PLANES\n" : "";
+       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" : "";
        if (sh_data->empty_axes_sh == NULL) {
-               sh_data->empty_axes_sh = DRW_shader_create_from_arrays({
+               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},
                        .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL},
                        .defs = (const char *[]){world_clip_def_or_empty, NULL},
@@ -519,7 +518,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_cfg == GPU_SHADER_CFG_CLIPPED) {
                DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
        }
        return grp;
@@ -541,9 +540,9 @@ DRWShadingGroup *shgroup_instance_outline(DRWPass *pass, struct GPUBatch *geom,
        return grp;
 }
 
-DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_CAMERA, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_CAMERA, shader_cfg);
 
        DRW_shgroup_instance_format(g_formats.instance_camera, {
                {"color",               DRW_ATTR_FLOAT, 3},
@@ -554,15 +553,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_DISTANCE_LINES, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_DISTANCE_LINES, shader_cfg);
        static float point_size = 4.0f;
 
        DRW_shgroup_instance_format(g_formats.instance_distance_lines, {
@@ -574,15 +573,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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_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, eDRW_ShaderSlot shader_slot)
+DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig shader_cfg)
 {
-       GPUShader *sh_inst = DRW_shader_get_builtin_shader(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, shader_slot);
+       GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, shader_cfg);
        static const int True = true;
        static const int False = false;
 
@@ -595,7 +594,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eDR
        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_slot == DRW_SHADER_SLOT_CLIPPED) {
+       if (shader_cfg == GPU_SHADER_CFG_CLIPPED) {
                DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
        }
        return grp;
@@ -603,7 +602,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eDR
 
 DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_axes == NULL) {
                sh_data->bone_axes = DRW_shader_create(
                        datatoc_armature_axes_vert_glsl, NULL,
@@ -626,7 +625,7 @@ DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass)
 
 DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_envelope_outline == NULL) {
                sh_data->bone_envelope_outline = DRW_shader_create(
                        datatoc_armature_envelope_outline_vert_glsl, NULL,
@@ -651,7 +650,7 @@ DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass)
 
 DRWShadingGroup *shgroup_instance_bone_envelope_distance(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_envelope_distance == NULL) {
                sh_data->bone_envelope_distance = DRW_shader_create(
                        datatoc_armature_envelope_solid_vert_glsl, NULL,
@@ -674,7 +673,7 @@ DRWShadingGroup *shgroup_instance_bone_envelope_distance(DRWPass *pass)
 
 DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, bool transp)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_envelope == NULL) {
                sh_data->bone_envelope = DRW_shader_create(
                        datatoc_armature_envelope_solid_vert_glsl, NULL,
@@ -700,7 +699,7 @@ DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, bool transp
 
 DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->mball_handles == NULL) {
                sh_data->mball_handles = DRW_shader_create(
                        datatoc_object_mball_handles_vert_glsl, NULL,
@@ -725,7 +724,7 @@ DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass)
 /* Only works with batches with adjacency infos. */
 DRWShadingGroup *shgroup_instance_bone_shape_outline(DRWPass *pass, struct GPUBatch *geom)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->shape_outline == NULL) {
                sh_data->shape_outline = DRW_shader_create(
                        datatoc_armature_shape_outline_vert_glsl,
@@ -749,7 +748,7 @@ DRWShadingGroup *shgroup_instance_bone_shape_outline(DRWPass *pass, struct GPUBa
 
 DRWShadingGroup *shgroup_instance_bone_shape_solid(DRWPass *pass, struct GPUBatch *geom, bool transp)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->shape_solid == NULL) {
                sh_data->shape_solid = DRW_shader_create(
                        datatoc_armature_shape_solid_vert_glsl, NULL,
@@ -772,7 +771,7 @@ DRWShadingGroup *shgroup_instance_bone_shape_solid(DRWPass *pass, struct GPUBatc
 
 DRWShadingGroup *shgroup_instance_bone_sphere_solid(DRWPass *pass, bool transp)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_sphere == NULL) {
                sh_data->bone_sphere = DRW_shader_create(
                        datatoc_armature_sphere_solid_vert_glsl, NULL,
@@ -796,7 +795,7 @@ DRWShadingGroup *shgroup_instance_bone_sphere_solid(DRWPass *pass, bool transp)
 
 DRWShadingGroup *shgroup_instance_bone_sphere_outline(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_sphere_outline == NULL) {
                sh_data->bone_sphere_outline = DRW_shader_create(
                        datatoc_armature_sphere_outline_vert_glsl, NULL,
@@ -819,7 +818,7 @@ DRWShadingGroup *shgroup_instance_bone_sphere_outline(DRWPass *pass)
 
 DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_stick == NULL) {
                sh_data->bone_stick = DRW_shader_create(
                        datatoc_armature_stick_vert_glsl, NULL,
@@ -847,7 +846,7 @@ DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass)
 
 struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct GPUBatch *geom)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->bone_dofs == NULL) {
                sh_data->bone_dofs = DRW_shader_create(
                        datatoc_armature_dof_vert_glsl, NULL,
@@ -871,7 +870,7 @@ struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct G
 
 struct GPUShader *mpath_line_shader_get(void)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->mpath_line_sh == NULL) {
                sh_data->mpath_line_sh = DRW_shader_create_with_lib(
                        datatoc_animviz_mpath_lines_vert_glsl,
@@ -886,7 +885,7 @@ struct GPUShader *mpath_line_shader_get(void)
 
 struct GPUShader *mpath_points_shader_get(void)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (sh_data->mpath_points_sh == NULL) {
                sh_data->mpath_points_sh = DRW_shader_create_with_lib(
                        datatoc_animviz_mpath_points_vert_glsl,
@@ -900,7 +899,7 @@ struct GPUShader *mpath_points_shader_get(void)
 
 struct GPUShader *volume_velocity_shader_get(bool use_needle)
 {
-       COMMON_Shaders *sh_data = &g_shaders[DRW_SHADER_SLOT_DEFAULT];
+       COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
        if (use_needle) {
                if (sh_data->volume_velocity_needle_sh == NULL) {
                        sh_data->volume_velocity_needle_sh = DRW_shader_create(