Mesh Batch Cache: Port Texture paint wires to new batch request
[blender.git] / source / blender / draw / engines / eevee / eevee_materials.c
index 212f89e72166a2aa2c4b80f5e5d93046dc7ee2e2..f26920c2474d7fc46fb6220cbe713e895ecd99be 100644 (file)
@@ -58,7 +58,6 @@ static struct {
        struct GPUShader *default_hair_prepass_clip_sh;
        struct GPUShader *default_lit[VAR_MAT_MAX];
        struct GPUShader *default_background;
-       struct GPUShader *default_studiolight_background;
        struct GPUShader *update_noise_sh;
 
        /* 64*64 array texture containing all LUTs and other utilitarian arrays.
@@ -407,10 +406,11 @@ static void add_standard_uniforms(
                DRW_shgroup_uniform_texture_ref(shgrp, "probePlanars", &vedata->txl->planar_pool);
                DRW_shgroup_uniform_int(shgrp, "outputSsrId", ssr_id, 1);
        }
-       if (use_refract && use_ssrefraction) {
-               BLI_assert(refract_depth != NULL);
-               DRW_shgroup_uniform_float(shgrp, "refractionDepth", refract_depth, 1);
-               DRW_shgroup_uniform_texture_ref(shgrp, "colorBuffer", &vedata->txl->refract_color);
+       if (use_refract) {
+               DRW_shgroup_uniform_float_copy(shgrp, "refractionDepth", (refract_depth) ? *refract_depth : 0.0 );
+               if (use_ssrefraction) {
+                       DRW_shgroup_uniform_texture_ref(shgrp, "colorBuffer", &vedata->txl->refract_color);
+               }
        }
 
        if ((vedata->stl->effects->enabled_effects & EFFECT_VOLUMETRIC) != 0 &&
@@ -596,10 +596,6 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_StorageList *stl, E
                        datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl,
                        NULL);
 
-               e_data.default_studiolight_background = DRW_shader_create(
-                       datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl,
-                       "#define LOOKDEV\n");
-
                e_data.default_prepass_sh = DRW_shader_create(
                        datatoc_prepass_vert_glsl, NULL, datatoc_prepass_frag_glsl,
                        NULL);
@@ -968,7 +964,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
                float *col = ts.colorBackground;
 
                /* LookDev */
-               EEVEE_lookdev_cache_init(vedata, &grp, e_data.default_studiolight_background, psl->background_pass, wo, NULL);
+               EEVEE_lookdev_cache_init(vedata, &grp, psl->background_pass, wo, NULL);
                /* END */
 
                if (!grp && wo) {
@@ -1391,7 +1387,7 @@ static void material_transparent(
                DRW_shgroup_uniform_float(*shgrp, "roughness", rough_p, 1);
        }
 
-       const bool use_prepass = ((ma->blend_flag & MA_BL_HIDE_BACKSIDE) != 0);
+       const bool use_prepass = ((ma->blend_flag & MA_BL_HIDE_BACKFACE) != 0);
 
        DRWState all_state = (
                DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_CULL_BACK |
@@ -1446,14 +1442,10 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
        const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & V3D_BACKFACE_CULLING));
        const bool is_active = (ob == draw_ctx->obact);
        const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
-#if 0
-       const bool is_sculpt_mode_draw = is_sculpt_mode && (draw_ctx->v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE) == 0;
-#else
        /* For now just force fully shaded with eevee when supported. */
        const bool is_sculpt_mode_draw =
                is_sculpt_mode &&
                ((ob->sculpt && ob->sculpt->pbvh) && (BKE_pbvh_type(ob->sculpt->pbvh) != PBVH_FACES));
-#endif
        const bool is_default_mode_shader = is_sculpt_mode;
 
        /* First get materials for this mesh. */
@@ -1798,7 +1790,6 @@ void EEVEE_materials_free(void)
        DRW_SHADER_FREE_SAFE(e_data.default_prepass_sh);
        DRW_SHADER_FREE_SAFE(e_data.default_prepass_clip_sh);
        DRW_SHADER_FREE_SAFE(e_data.default_background);
-       DRW_SHADER_FREE_SAFE(e_data.default_studiolight_background);
        DRW_SHADER_FREE_SAFE(e_data.update_noise_sh);
        DRW_TEXTURE_FREE_SAFE(e_data.util_tex);
        DRW_TEXTURE_FREE_SAFE(e_data.noise_tex);