Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-08-12 23:57:46 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-08-12 23:57:46 +0300
commit4b93cdc98a5a8df681ea6233f948caf896a54406 (patch)
tree113b2a1b1ee2fd15ad5ff37035609bb15a720360 /source/blender/draw
parent0e2f5614efebde2ee2d24334c08280fffa3ee96c (diff)
parentdb7cfd03b08cbe5a2c986cfebfa4a04d8aa8a40d (diff)
Merge branch 'master' into greasepencil-edit-curve
Conflicts: source/blender/blenkernel/intern/gpencil_curve.c
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_data.c69
-rw-r--r--source/blender/draw/engines/eevee/eevee_effects.c1
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c94
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h42
-rw-r--r--source/blender/draw/engines/eevee/eevee_render.c8
-rw-r--r--source/blender/draw/engines/eevee/eevee_temporal_sampling.c4
-rw-r--r--source/blender/draw/engines/eevee/eevee_volumes.c9
-rw-r--r--source/blender/draw/engines/overlay/overlay_edit_mesh.c16
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h2
9 files changed, 137 insertions, 108 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c
index c475e5287c2..e18c43fc643 100644
--- a/source/blender/draw/engines/eevee/eevee_data.c
+++ b/source/blender/draw/engines/eevee/eevee_data.c
@@ -29,6 +29,7 @@
#include "BKE_duplilist.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "DEG_depsgraph_query.h"
@@ -42,15 +43,20 @@
static void eevee_motion_blur_mesh_data_free(void *val)
{
EEVEE_GeometryMotionData *geom_mb = (EEVEE_GeometryMotionData *)val;
+ EEVEE_HairMotionData *hair_mb = (EEVEE_HairMotionData *)val;
switch (geom_mb->type) {
- case EEVEE_HAIR_GEOM_MOTION_DATA:
- for (int i = 0; i < ARRAY_SIZE(geom_mb->vbo); i++) {
- GPU_VERTBUF_DISCARD_SAFE(geom_mb->hair_pos[i]);
- DRW_TEXTURE_FREE_SAFE(geom_mb->hair_pos_tx[i]);
+ case EEVEE_MOTION_DATA_HAIR:
+ for (int j = 0; j < hair_mb->psys_len; j++) {
+ for (int i = 0; i < ARRAY_SIZE(hair_mb->psys[0].hair_pos); i++) {
+ GPU_VERTBUF_DISCARD_SAFE(hair_mb->psys[j].hair_pos[i]);
+ }
+ for (int i = 0; i < ARRAY_SIZE(hair_mb->psys[0].hair_pos); i++) {
+ DRW_TEXTURE_FREE_SAFE(hair_mb->psys[j].hair_pos_tx[i]);
+ }
}
break;
- case EEVEE_MESH_GEOM_MOTION_DATA:
+ case EEVEE_MOTION_DATA_MESH:
for (int i = 0; i < ARRAY_SIZE(geom_mb->vbo); i++) {
GPU_VERTBUF_DISCARD_SAFE(geom_mb->vbo[i]);
}
@@ -64,7 +70,7 @@ static uint eevee_object_key_hash(const void *key)
EEVEE_ObjectKey *ob_key = (EEVEE_ObjectKey *)key;
uint hash = BLI_ghashutil_ptrhash(ob_key->ob);
hash = BLI_ghashutil_combine_hash(hash, BLI_ghashutil_ptrhash(ob_key->parent));
- for (int i = 0; i < 16; i++) {
+ for (int i = 0; i < MAX_DUPLI_RECUR; i++) {
if (ob_key->id[i] != 0) {
hash = BLI_ghashutil_combine_hash(hash, BLI_ghashutil_inthash(ob_key->id[i]));
}
@@ -148,18 +154,40 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *
return ob_step;
}
-static EEVEE_GeometryMotionData *motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb,
- void *key,
- bool hair)
+static void *motion_blur_deform_data_get(EEVEE_MotionBlurData *mb, Object *ob, bool hair)
{
if (mb->geom == NULL) {
return NULL;
}
+ DupliObject *dup = DRW_object_get_dupli(ob);
+ void *key;
+ if (dup) {
+ key = dup->ob;
+ }
+ else {
+ key = ob;
+ }
+ /* Only use data for object that have no modifiers. */
+ if (!BKE_object_is_modified(DRW_context_state_get()->scene, ob)) {
+ key = ob->data;
+ }
key = (char *)key + (int)hair;
EEVEE_GeometryMotionData *geom_step = BLI_ghash_lookup(mb->geom, key);
if (geom_step == NULL) {
- geom_step = MEM_callocN(sizeof(EEVEE_GeometryMotionData), __func__);
- geom_step->type = hair ? EEVEE_HAIR_GEOM_MOTION_DATA : EEVEE_MESH_GEOM_MOTION_DATA;
+ if (hair) {
+ EEVEE_HairMotionData *hair_step;
+ /* Ugly, we allocate for each modifiers and just fill based on modifier index in the list. */
+ int psys_len = (ob->type != OB_HAIR) ? BLI_listbase_count(&ob->modifiers) : 1;
+ hair_step = MEM_callocN(sizeof(EEVEE_HairMotionData) + sizeof(hair_step->psys[0]) * psys_len,
+ __func__);
+ hair_step->psys_len = psys_len;
+ geom_step = (EEVEE_GeometryMotionData *)hair_step;
+ geom_step->type = EEVEE_MOTION_DATA_HAIR;
+ }
+ else {
+ geom_step = MEM_callocN(sizeof(EEVEE_GeometryMotionData), __func__);
+ geom_step->type = EEVEE_MOTION_DATA_MESH;
+ }
BLI_ghash_insert(mb->geom, key, geom_step);
}
return geom_step;
@@ -167,25 +195,12 @@ static EEVEE_GeometryMotionData *motion_blur_geometry_data_get(EEVEE_MotionBlurD
EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb, Object *ob)
{
- /* Use original data as key to ensure matching accross update. */
- return motion_blur_geometry_data_get(mb, DEG_get_original_object(ob)->data, false);
+ return motion_blur_deform_data_get(mb, ob, false);
}
-EEVEE_GeometryMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb,
- Object *ob,
- ModifierData *md)
+EEVEE_HairMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb, Object *ob)
{
- void *key;
- if (md) {
- /* Particle system. */
- key = BKE_modifier_get_original(md);
- }
- else {
- /* Hair object. */
- key = DEG_get_original_object(ob)->data;
- }
-
- return motion_blur_geometry_data_get(mb, key, true);
+ return motion_blur_deform_data_get(mb, ob, true);
}
/* View Layer data. */
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c
index 365ba0afaac..4a03ef69d45 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -147,6 +147,7 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
if (!stl->effects) {
stl->effects = MEM_callocN(sizeof(EEVEE_EffectsInfo), "EEVEE_EffectsInfo");
+ stl->effects->taa_render_sample = 1;
}
effects = stl->effects;
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index 2a315927015..fa517e2d5c9 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -289,8 +289,14 @@ void EEVEE_motion_blur_hair_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
/* Store transform */
DRW_hair_duplimat_get(ob, psys, md, mb_data->obmat[mb_step]);
- EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_hair_data_get(
- &effects->motion_blur, ob, md);
+ EEVEE_HairMotionData *mb_hair = EEVEE_motion_blur_hair_data_get(&effects->motion_blur, ob);
+ int psys_id = (md != NULL) ? BLI_findindex(&ob->modifiers, md) : 0;
+
+ if (psys_id >= mb_hair->psys_len) {
+ /* This should never happen. It means the modifier list was changed by frame evaluation. */
+ BLI_assert(0);
+ return;
+ }
if (mb_step == MB_CURR) {
/* Fill missing matrices if the object was hidden in previous or next frame. */
@@ -301,18 +307,21 @@ void EEVEE_motion_blur_hair_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
copy_m4_m4(mb_data->obmat[MB_NEXT], mb_data->obmat[MB_CURR]);
}
+ GPUTexture *tex_prev = mb_hair->psys[psys_id].hair_pos_tx[MB_PREV];
+ GPUTexture *tex_next = mb_hair->psys[psys_id].hair_pos_tx[MB_NEXT];
+
grp = DRW_shgroup_hair_create_sub(ob, psys, md, effects->motion_blur.hair_grp);
DRW_shgroup_uniform_mat4(grp, "prevModelMatrix", mb_data->obmat[MB_PREV]);
DRW_shgroup_uniform_mat4(grp, "currModelMatrix", mb_data->obmat[MB_CURR]);
DRW_shgroup_uniform_mat4(grp, "nextModelMatrix", mb_data->obmat[MB_NEXT]);
- DRW_shgroup_uniform_texture(grp, "prvBuffer", mb_geom->hair_pos_tx[MB_PREV]);
- DRW_shgroup_uniform_texture(grp, "nxtBuffer", mb_geom->hair_pos_tx[MB_NEXT]);
- DRW_shgroup_uniform_bool(grp, "useDeform", &mb_geom->use_deform, 1);
+ DRW_shgroup_uniform_texture(grp, "prvBuffer", tex_prev);
+ DRW_shgroup_uniform_texture(grp, "nxtBuffer", tex_next);
+ DRW_shgroup_uniform_bool(grp, "useDeform", &mb_hair->use_deform, 1);
}
else {
/* Store vertex position buffer. */
- mb_geom->hair_pos[mb_step] = DRW_hair_pos_buffer_get(ob, psys, md);
- mb_geom->use_deform = true;
+ mb_hair->psys[psys_id].hair_pos[mb_step] = DRW_hair_pos_buffer_get(ob, psys, md);
+ mb_hair->use_deform = true;
}
}
}
@@ -339,7 +348,8 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
const bool is_dupli = (ob->base_flag & BASE_FROM_DUPLI) != 0;
const bool object_moves = is_dupli || has_rigidbody || BKE_object_moves_in_time(ob, true);
#else
- /* BKE_object_moves_in_time does not work in some cases. Better */
+ /* BKE_object_moves_in_time does not work in some cases.
+ * Better detect non moving object after evaluation. */
const bool object_moves = true;
#endif
const bool is_deform = BKE_object_is_deform_modified(DRW_context_state_get()->scene, ob) ||
@@ -375,17 +385,6 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
}
if (mb_geom->use_deform) {
- EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob);
- if (!oedata->geom_update) {
- /* FIXME(fclem) There can be false positive where the actual mesh is not updated.
- * This avoids a crash but removes the motion blur from some object.
- * Maybe an issue with depsgraph tagging. */
- mb_geom->use_deform = false;
- oedata->geom_update = false;
-
- GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_PREV]);
- GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_NEXT]);
- }
/* Keep to modify later (after init). */
mb_geom->batch = batch;
}
@@ -445,29 +444,36 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata)
BLI_ghashIterator_done(&ghi) == false;
BLI_ghashIterator_step(&ghi)) {
EEVEE_GeometryMotionData *mb_geom = BLI_ghashIterator_getValue(&ghi);
+ EEVEE_HairMotionData *mb_hair = (EEVEE_HairMotionData *)mb_geom;
if (!mb_geom->use_deform) {
continue;
}
switch (mb_geom->type) {
- case EEVEE_HAIR_GEOM_MOTION_DATA:
+ case EEVEE_MOTION_DATA_HAIR:
if (mb_step == MB_CURR) {
/* TODO(fclem) Check if vertex count mismatch. */
- mb_geom->use_deform = true;
+ mb_hair->use_deform = true;
}
else {
- mb_geom->hair_pos[mb_step] = GPU_vertbuf_duplicate(mb_geom->hair_pos[mb_step]);
+ for (int i = 0; i < mb_hair->psys_len; i++) {
+ if (mb_hair->psys[i].hair_pos[mb_step] == NULL) {
+ continue;
+ }
+ mb_hair->psys[i].hair_pos[mb_step] = GPU_vertbuf_duplicate(
+ mb_hair->psys[i].hair_pos[mb_step]);
- /* Create vbo immediately to bind to texture buffer. */
- GPU_vertbuf_use(mb_geom->hair_pos[mb_step]);
+ /* Create vbo immediately to bind to texture buffer. */
+ GPU_vertbuf_use(mb_hair->psys[i].hair_pos[mb_step]);
- mb_geom->hair_pos_tx[mb_step] = GPU_texture_create_from_vertbuf(
- mb_geom->hair_pos[mb_step]);
+ mb_hair->psys[i].hair_pos_tx[mb_step] = GPU_texture_create_from_vertbuf(
+ mb_hair->psys[i].hair_pos[mb_step]);
+ }
}
break;
- case EEVEE_MESH_GEOM_MOTION_DATA:
+ case EEVEE_MOTION_DATA_MESH:
if (mb_step == MB_CURR) {
/* Modify batch to have data from adjacent frames. */
GPUBatch *batch = mb_geom->batch;
@@ -485,15 +491,7 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata)
break;
}
- /* Modify the batch to include the previous & next position. */
- if (i == MB_PREV) {
- GPU_batch_vertbuf_add_ex(batch, vbo, true);
- mb_geom->vbo[i] = NULL;
- }
- else {
- /* This VBO can be reuse by next time step. Don't pass ownership. */
- GPU_batch_vertbuf_add_ex(batch, vbo, false);
- }
+ GPU_batch_vertbuf_add_ex(batch, vbo, false);
}
}
}
@@ -548,16 +546,28 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata)
BLI_ghashIterator_done(&ghi) == false;
BLI_ghashIterator_step(&ghi)) {
EEVEE_GeometryMotionData *mb_geom = BLI_ghashIterator_getValue(&ghi);
+ EEVEE_HairMotionData *mb_hair = (EEVEE_HairMotionData *)mb_geom;
switch (mb_geom->type) {
- case EEVEE_HAIR_GEOM_MOTION_DATA:
- GPU_VERTBUF_DISCARD_SAFE(mb_geom->hair_pos[MB_PREV]);
- DRW_TEXTURE_FREE_SAFE(mb_geom->hair_pos_tx[MB_PREV]);
- mb_geom->hair_pos[MB_PREV] = mb_geom->hair_pos[MB_NEXT];
- mb_geom->hair_pos_tx[MB_PREV] = mb_geom->hair_pos_tx[MB_NEXT];
+ case EEVEE_MOTION_DATA_HAIR:
+ for (int i = 0; i < mb_hair->psys_len; i++) {
+ GPU_VERTBUF_DISCARD_SAFE(mb_hair->psys[i].hair_pos[MB_PREV]);
+ DRW_TEXTURE_FREE_SAFE(mb_hair->psys[i].hair_pos_tx[MB_PREV]);
+ mb_hair->psys[i].hair_pos[MB_PREV] = mb_hair->psys[i].hair_pos[MB_NEXT];
+ mb_hair->psys[i].hair_pos_tx[MB_PREV] = mb_hair->psys[i].hair_pos_tx[MB_NEXT];
+ }
break;
- case EEVEE_MESH_GEOM_MOTION_DATA:
+ case EEVEE_MOTION_DATA_MESH:
+ if (mb_geom->batch != NULL) {
+ for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN; i++) {
+ if (mb_geom->batch->verts[i] == mb_geom->vbo[MB_PREV] ||
+ mb_geom->batch->verts[i] == mb_geom->vbo[MB_NEXT]) {
+ /* Avoid double reference of the VBOs. */
+ mb_geom->batch->verts[i] = NULL;
+ }
+ }
+ }
GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_PREV]);
mb_geom->vbo[MB_PREV] = mb_geom->vbo[MB_NEXT];
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 34cd22ad13c..1e2de521cdf 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -595,25 +595,30 @@ typedef struct EEVEE_ObjectMotionData {
} EEVEE_ObjectMotionData;
typedef enum eEEVEEMotionData {
- EEVEE_MESH_GEOM_MOTION_DATA = 0,
- EEVEE_HAIR_GEOM_MOTION_DATA,
+ EEVEE_MOTION_DATA_MESH = 0,
+ EEVEE_MOTION_DATA_HAIR,
} eEEVEEMotionData;
+typedef struct EEVEE_HairMotionData {
+ /** Needs to be first to ensure casting. */
+ eEEVEEMotionData type;
+ int use_deform;
+ /** Allocator will alloc enough slot for all particle systems. Or 1 if it's a hair object. */
+ int psys_len;
+ struct {
+ struct GPUVertBuf *hair_pos[2]; /* Position buffer for time = t +/- step. */
+ struct GPUTexture *hair_pos_tx[2]; /* Buffer Texture of the corresponding VBO. */
+ } psys[0];
+} EEVEE_HairMotionData;
+
typedef struct EEVEE_GeometryMotionData {
+ /** Needs to be first to ensure casting. */
eEEVEEMotionData type;
- int use_deform; /* To disable deform mb if vertcount mismatch. */
- union {
- struct {
- /* Mesh */
- struct GPUBatch *batch; /* Batch for time = t. */
- struct GPUVertBuf *vbo[2]; /* Vbo for time = t +/- step. */
- };
- struct {
- /* Hair */
- struct GPUVertBuf *hair_pos[2]; /* Position buffer for time = t +/- step. */
- struct GPUTexture *hair_pos_tx[2]; /* Buffer Texture of the corresponding VBO. */
- };
- };
+ /** To disable deform mb if vertcount mismatch. */
+ int use_deform;
+
+ struct GPUBatch *batch; /* Batch for time = t. */
+ struct GPUVertBuf *vbo[2]; /* Vbo for time = t +/- step. */
} EEVEE_GeometryMotionData;
/* ************ EFFECTS DATA ************* */
@@ -914,6 +919,9 @@ typedef struct EEVEE_PrivateData {
float camtexcofac[4];
float size_orig[2];
+ /* Cached original camera when rendering for motion blur (see T79637). */
+ struct Object *cam_original_ob;
+
/* Mist Settings */
float mist_start, mist_inv_dist, mist_falloff;
@@ -971,9 +979,7 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *
bool hair);
EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb,
Object *ob);
-EEVEE_GeometryMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb,
- Object *ob,
- struct ModifierData *md);
+EEVEE_HairMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb, Object *ob);
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob);
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob);
EEVEE_LightEngineData *EEVEE_light_data_get(Object *ob);
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index 62698bc5da3..21a4013e309 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -126,6 +126,9 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph *
GPU_framebuffer_ensure_config(&fbl->main_color_fb,
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)});
+ /* Camera could change because of Motion blur. */
+ g_data->cam_original_ob = RE_GetCamera(engine->re);
+
return true;
}
@@ -135,9 +138,10 @@ void EEVEE_render_modules_init(EEVEE_Data *vedata,
{
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
EEVEE_StorageList *stl = vedata->stl;
+ EEVEE_PrivateData *g_data = vedata->stl->g_data;
EEVEE_FramebufferList *fbl = vedata->fbl;
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
- struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
+ struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob);
EEVEE_render_view_sync(vedata, engine, depsgraph);
/* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`.
@@ -156,7 +160,7 @@ void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Dep
/* Set the pers & view matrix. */
float winmat[4][4], viewmat[4][4], viewinv[4][4];
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
- struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
+ struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob);
RE_GetCameraWindow(engine->re, ob_camera_eval, winmat);
RE_GetCameraWindowWithOverscan(engine->re, g_data->overscan, winmat);
diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
index 12b50030435..5976a9505e8 100644
--- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
+++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
@@ -212,7 +212,9 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data
* Reset for each "redraw". When rendering using ogl render,
* we accumulate the redraw inside the drawing loop in eevee_draw_scene().
**/
- effects->taa_render_sample = 1;
+ if (DRW_state_is_opengl_render()) {
+ effects->taa_render_sample = 1;
+ }
effects->bypass_drawing = false;
EEVEE_temporal_sampling_create_view(vedata);
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c
index e1e65c29b4f..f8c7a6e16db 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -62,6 +62,7 @@ static struct {
GPUTexture *dummy_density;
GPUTexture *dummy_color;
GPUTexture *dummy_flame;
+ GPUTexture *dummy_missing;
GPUTexture *dummy_scatter;
GPUTexture *dummy_transmit;
@@ -141,6 +142,9 @@ static void eevee_create_shader_volumes(void)
const float flame = 0.0f;
e_data.dummy_flame = DRW_texture_create_3d(1, 1, 1, GPU_R8, DRW_TEX_WRAP, &flame);
+
+ const float missing[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ e_data.dummy_missing = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, missing);
}
void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample)
@@ -355,7 +359,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
/* Fix principle volumetric not working with world materials. */
ListBase gpu_grids = GPU_material_volume_grids(mat);
LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, &gpu_grids) {
- DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_density);
+ DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_missing);
}
DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]);
@@ -443,7 +447,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS
NULL;
DRW_shgroup_uniform_texture(
- grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_density);
+ grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_missing);
if (drw_grid && multiple_transforms) {
/* Specify per-volume transform matrix that is applied after the
@@ -830,6 +834,7 @@ void EEVEE_volumes_free(void)
DRW_TEXTURE_FREE_SAFE(e_data.dummy_density);
DRW_TEXTURE_FREE_SAFE(e_data.dummy_flame);
DRW_TEXTURE_FREE_SAFE(e_data.dummy_color);
+ DRW_TEXTURE_FREE_SAFE(e_data.dummy_missing);
DRW_SHADER_FREE_SAFE(e_data.volumetric_clear_sh);
DRW_SHADER_FREE_SAFE(e_data.scatter_sh);
diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
index ebc8a2f97ef..728b3d510fa 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
@@ -75,8 +75,6 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 ||
pd->edit_mesh.do_zbufclip;
- pd->edit_mesh.ghost_ob = 0;
- pd->edit_mesh.edit_ob = 0;
pd->edit_mesh.do_faces = true;
pd->edit_mesh.do_edges = true;
@@ -312,9 +310,6 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
overlay_edit_mesh_add_ob_to_pass(pd, ob, do_in_front);
}
- pd->edit_mesh.ghost_ob += (ob->dtx & OB_DRAW_IN_FRONT) ? 1 : 0;
- pd->edit_mesh.edit_ob += 1;
-
if (DRW_state_show_text() && (pd->edit_mesh.flag & OVERLAY_EDIT_TEXT)) {
const DRWContextState *draw_ctx = DRW_context_state_get();
DRW_text_edit_mesh_measure_stats(draw_ctx->region, draw_ctx->v3d, ob, &draw_ctx->scene->unit);
@@ -375,18 +370,11 @@ void OVERLAY_edit_mesh_draw(OVERLAY_Data *vedata)
DRW_draw_pass(psl->edit_mesh_verts_ps[NOT_IN_FRONT]);
}
else {
- const DRWContextState *draw_ctx = DRW_context_state_get();
- View3D *v3d = draw_ctx->v3d;
-
DRW_draw_pass(psl->edit_mesh_normals_ps);
overlay_edit_mesh_draw_components(psl, pd, false);
- if (!DRW_state_is_depth() && v3d->shading.type == OB_SOLID && pd->edit_mesh.ghost_ob == 1 &&
- pd->edit_mesh.edit_ob == 1) {
- /* In the case of single ghost object edit (common case for retopology):
- * we clear the depth buffer so that only the depth of the retopo mesh
- * is occluding the edit cage. */
- GPU_framebuffer_clear_depth(fbl->overlay_default_fb, 1.0f);
+ if (DRW_state_is_fbo()) {
+ GPU_framebuffer_bind(fbl->overlay_in_front_fb);
}
if (!DRW_pass_is_empty(psl->edit_mesh_depth_ps[IN_FRONT])) {
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index 5e5aba713f0..5cf8cb12aa0 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -309,8 +309,6 @@ typedef struct OVERLAY_PrivateData {
float overlay_color[4];
} edit_text;
struct {
- int ghost_ob;
- int edit_ob;
bool do_zbufclip;
bool do_faces;
bool do_edges;