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:
authorClément Foucault <foucault.clem@gmail.com>2022-08-27 21:21:30 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-08-27 21:21:30 +0300
commit7a2becf67eba9b180c815f74e6aac28e43b12dce (patch)
tree9730c6e916fc8d777b036347f71d97a32c8b04d5
parent8ae25c3da21777845ba2fa680ea288b1ff7eb960 (diff)
A few more bugs
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_material.cc7
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_pipeline.cc8
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_velocity.cc9
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_velocity.hh5
-rw-r--r--source/blender/draw/intern/draw_command.cc3
5 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_material.cc b/source/blender/draw/engines/eevee_next/eevee_material.cc
index 5dba1c3eecc..e7a60df15e0 100644
--- a/source/blender/draw/engines/eevee_next/eevee_material.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_material.cc
@@ -215,6 +215,10 @@ MaterialPass MaterialModule::material_pass_get(::Material *blender_mat,
/* First time encountering this shader. Create a shading group. */
return inst_.pipelines.material_add(blender_mat, matpass.gpumat, pipeline_type);
});
+
+ if (matpass.sub_pass != nullptr) {
+ matpass.sub_pass->material_set(*inst_.manager, matpass.gpumat);
+ }
}
return matpass;
@@ -242,8 +246,7 @@ Material &MaterialModule::material_sync(::Material *blender_mat,
auto add_cb = [&]() { return new Material(); };
Material &mat = *material_map_.lookup_or_add_cb(material_key, add_cb);
- /* Forward pipeline needs to use one shgroup per object. */
- if (mat.init == false || (surface_pipe == MAT_PIPE_FORWARD)) {
+ if (mat.init == false) {
mat.init = true;
/* Order is important for transparent. */
mat.prepass = material_pass_get(blender_mat, prepass_pipe, geometry_type);
diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
index 16a7fd0e56b..bedcb9ed40f 100644
--- a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
@@ -140,18 +140,14 @@ PassMain::Sub *ForwardPipeline::prepass_opaque_add(::Material *blender_mat,
prepass_single_sided_static_ps_) :
(has_motion ? prepass_double_sided_moving_ps_ :
prepass_double_sided_static_ps_);
- PassMain::Sub *material_sub = &pass->sub(GPU_material_get_name(gpumat));
- material_sub->material_set(*inst_.manager, gpumat);
- return material_sub;
+ return &pass->sub(GPU_material_get_name(gpumat));
}
PassMain::Sub *ForwardPipeline::material_opaque_add(::Material *blender_mat, GPUMaterial *gpumat)
{
PassMain::Sub *pass = (blender_mat->blend_flag & MA_BL_CULL_BACKFACE) ? opaque_single_sided_ps_ :
opaque_double_sided_ps_;
- PassMain::Sub *material_sub = &pass->sub(GPU_material_get_name(gpumat));
- material_sub->material_set(*inst_.manager, gpumat);
- return material_sub;
+ return &pass->sub(GPU_material_get_name(gpumat));
}
PassMain::Sub *ForwardPipeline::material_transparent_add(::Material *blender_mat,
diff --git a/source/blender/draw/engines/eevee_next/eevee_velocity.cc b/source/blender/draw/engines/eevee_next/eevee_velocity.cc
index dd7e8461694..2fd85a724d2 100644
--- a/source/blender/draw/engines/eevee_next/eevee_velocity.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_velocity.cc
@@ -55,7 +55,9 @@ static void step_object_sync_render(void *velocity,
Depsgraph *UNUSED(depsgraph))
{
ObjectKey object_key(ob);
- reinterpret_cast<VelocityModule *>(velocity)->step_object_sync(ob, object_key);
+ /* NOTE: Dummy resource handle since this will not be used for drawing. */
+ ResourceHandle resource_handle(0);
+ reinterpret_cast<VelocityModule *>(velocity)->step_object_sync(ob, object_key, resource_handle);
}
void VelocityModule::step_sync(eVelocityStep step, float time)
@@ -82,6 +84,7 @@ void VelocityModule::step_camera_sync()
bool VelocityModule::step_object_sync(Object *ob,
ObjectKey &object_key,
+ ResourceHandle resource_handle,
int /*IDRecalcFlag*/ recalc)
{
bool has_motion = object_has_velocity(ob) || (recalc & ID_RECALC_TRANSFORM);
@@ -93,8 +96,6 @@ bool VelocityModule::step_object_sync(Object *ob,
return false;
}
- uint32_t resource_id = DRW_object_resource_id_get(ob);
-
/* Object motion. */
/* FIXME(fclem) As we are using original objects pointers, there is a chance the previous
* object key matches a totally different object if the scene was changed by user or python
@@ -103,7 +104,7 @@ bool VelocityModule::step_object_sync(Object *ob,
* We live with that until we have a correct way of identifying new objects. */
VelocityObjectData &vel = velocity_map.lookup_or_add_default(object_key);
vel.obj.ofs[step_] = object_steps_usage[step_]++;
- vel.obj.resource_id = resource_id;
+ vel.obj.resource_id = resource_handle.resource_index();
vel.id = (ID *)ob->data;
object_steps[step_]->get_or_resize(vel.obj.ofs[step_]) = ob->obmat;
if (step_ == STEP_CURRENT) {
diff --git a/source/blender/draw/engines/eevee_next/eevee_velocity.hh b/source/blender/draw/engines/eevee_next/eevee_velocity.hh
index d142dbeadf7..51f260f8848 100644
--- a/source/blender/draw/engines/eevee_next/eevee_velocity.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_velocity.hh
@@ -105,7 +105,10 @@ class VelocityModule {
void step_sync(eVelocityStep step, float time);
/* Gather motion data. Returns true if the object **can** have motion. */
- bool step_object_sync(Object *ob, ObjectKey &object_key, int recalc = 0);
+ bool step_object_sync(Object *ob,
+ ObjectKey &object_key,
+ ResourceHandle resource_handle,
+ int recalc = 0);
/* Moves next frame data to previous frame data. Nullify next frame data. */
void step_swap();
diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc
index a42416a6f8a..31f7970cee3 100644
--- a/source/blender/draw/intern/draw_command.cc
+++ b/source/blender/draw/intern/draw_command.cc
@@ -557,7 +557,8 @@ void DrawMultiBuf::bind(RecordingState &state,
prototype_buf_.push_update();
/* Allocate enough for the expansion pass. */
resource_id_buf_.get_or_resize(resource_id_count_);
- command_buf_.get_or_resize(group_count_);
+ /* Two command per group. */
+ command_buf_.get_or_resize(group_count_ * 2);
if (prototype_count_ > 0) {
GPUShader *shader = DRW_shader_draw_command_generate_get();