Revert "Overlay: Skip passes not needed"
This reverts commit c0d6675c84.
The DEG_id_type_any_exists function only takes the original type into
account.
Fix #138548
This commit is contained in:
@@ -146,7 +146,7 @@ class Armatures : Overlay {
|
||||
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.show_bones() && state.has_armature;
|
||||
enabled_ = state.is_space_v3d() && state.show_bones();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -53,24 +53,11 @@ class AttributeViewer : Overlay {
|
||||
return ⊂
|
||||
};
|
||||
|
||||
mesh_sub_ = nullptr;
|
||||
if (state.has_mesh) {
|
||||
mesh_sub_ = create_sub("mesh", res.shaders->attribute_viewer_mesh.get());
|
||||
}
|
||||
pointcloud_sub_ = nullptr;
|
||||
if (state.has_ptcloud) {
|
||||
pointcloud_sub_ = create_sub("pointcloud", res.shaders->attribute_viewer_pointcloud.get());
|
||||
}
|
||||
curve_sub_ = nullptr;
|
||||
curves_sub_ = nullptr;
|
||||
if (state.has_curve) {
|
||||
curve_sub_ = create_sub("curve", res.shaders->attribute_viewer_curve.get());
|
||||
curves_sub_ = create_sub("curves", res.shaders->attribute_viewer_curves.get());
|
||||
}
|
||||
instance_sub_ = nullptr;
|
||||
if (state.has_mesh || state.has_curve) {
|
||||
instance_sub_ = create_sub("instance", res.shaders->uniform_color.get());
|
||||
}
|
||||
mesh_sub_ = create_sub("mesh", res.shaders->attribute_viewer_mesh.get());
|
||||
pointcloud_sub_ = create_sub("pointcloud", res.shaders->attribute_viewer_pointcloud.get());
|
||||
curve_sub_ = create_sub("curve", res.shaders->attribute_viewer_curve.get());
|
||||
curves_sub_ = create_sub("curves", res.shaders->attribute_viewer_curves.get());
|
||||
instance_sub_ = create_sub("instance", res.shaders->uniform_color.get());
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager,
|
||||
|
||||
@@ -54,9 +54,7 @@ class Curves : Overlay {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ =
|
||||
state.is_space_v3d() && state.has_curve &&
|
||||
ELEM(state.ctx_mode, CTX_MODE_EDIT_CURVE, CTX_MODE_EDIT_CURVES, CTX_MODE_EDIT_SURFACE);
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -36,18 +36,11 @@ class Fluids : Overlay {
|
||||
|
||||
int dominant_axis = -1;
|
||||
|
||||
bool enabled_ = false;
|
||||
|
||||
public:
|
||||
Fluids(const SelectionType selection_type) : selection_type_(selection_type){};
|
||||
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.has_volume;
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Against design. Should not sync depending on view. */
|
||||
float3 camera_direction = blender::draw::View::default_get().viewinv().z_axis();
|
||||
dominant_axis = math::dominant_axis(camera_direction);
|
||||
@@ -88,10 +81,6 @@ class Fluids : Overlay {
|
||||
Resources &res,
|
||||
const State &state) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object *ob = ob_ref.object;
|
||||
|
||||
/* Do not show for dupli objects as the fluid is baked for the original object. */
|
||||
@@ -247,10 +236,6 @@ class Fluids : Overlay {
|
||||
|
||||
void end_sync(Resources &res, const State & /*state*/) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
fluid_ps_.shader_set(res.shaders->extra_shape.get());
|
||||
fluid_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
fluid_ps_.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
@@ -260,10 +245,6 @@ class Fluids : Overlay {
|
||||
|
||||
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
|
||||
{
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
GPU_framebuffer_bind(framebuffer);
|
||||
manager.submit(fluid_ps_, view);
|
||||
}
|
||||
|
||||
@@ -122,16 +122,6 @@ void Instance::init()
|
||||
ED_space_image_get_aspect(space_image, &state.image_aspect.x, &state.image_aspect.y);
|
||||
}
|
||||
|
||||
state.has_mesh = DEG_id_type_any_exists(state.depsgraph, ID_ME);
|
||||
state.has_curve = DEG_id_type_any_exists(state.depsgraph, ID_CV) ||
|
||||
DEG_id_type_any_exists(state.depsgraph, ID_CU_LEGACY);
|
||||
state.has_volume = DEG_id_type_any_exists(state.depsgraph, ID_VO);
|
||||
state.has_gpencil = DEG_id_type_any_exists(state.depsgraph, ID_GP);
|
||||
state.has_armature = DEG_id_type_any_exists(state.depsgraph, ID_AR);
|
||||
state.has_particles = DEG_id_type_any_exists(state.depsgraph, ID_PA);
|
||||
state.has_lattice = DEG_id_type_any_exists(state.depsgraph, ID_LT);
|
||||
state.has_ptcloud = DEG_id_type_any_exists(state.depsgraph, ID_PT);
|
||||
|
||||
resources.update_theme_settings(ctx, state);
|
||||
resources.update_clip_planes(state);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class Lattices : Overlay {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.has_lattice;
|
||||
enabled_ = state.is_space_v3d();
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class Meshes : Overlay {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.has_mesh && state.ctx_mode == CTX_MODE_EDIT_MESH;
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -69,43 +69,37 @@ class Outline : Overlay {
|
||||
pass.clear_color_depth_stencil(float4(0.0f), 1.0f, 0x0);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
prepass_curves_ps_ = nullptr;
|
||||
if (state.has_curve) {
|
||||
{
|
||||
auto &sub = pass.sub("Curves");
|
||||
sub.shader_set(res.shaders->outline_prepass_curves.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_curves_ps_ = ⊂
|
||||
}
|
||||
prepass_pointcloud_ps_ = nullptr;
|
||||
if (state.has_ptcloud) {
|
||||
{
|
||||
auto &sub = pass.sub("PointCloud");
|
||||
sub.shader_set(res.shaders->outline_prepass_pointcloud.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_pointcloud_ps_ = ⊂
|
||||
}
|
||||
prepass_gpencil_ps_ = nullptr;
|
||||
if (state.has_gpencil) {
|
||||
{
|
||||
auto &sub = pass.sub("GreasePencil");
|
||||
sub.shader_set(res.shaders->outline_prepass_gpencil.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_gpencil_ps_ = ⊂
|
||||
}
|
||||
prepass_mesh_ps_ = nullptr;
|
||||
if (state.has_mesh) {
|
||||
{
|
||||
auto &sub = pass.sub("Mesh");
|
||||
sub.shader_set(res.shaders->outline_prepass_mesh.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_mesh_ps_ = ⊂
|
||||
}
|
||||
prepass_volume_ps_ = nullptr;
|
||||
if (state.has_volume) {
|
||||
{
|
||||
auto &sub = pass.sub("Volume");
|
||||
sub.shader_set(res.shaders->outline_prepass_mesh.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_volume_ps_ = ⊂
|
||||
}
|
||||
prepass_wire_ps_ = nullptr;
|
||||
if (state.has_mesh) {
|
||||
{
|
||||
auto &sub = pass.sub("Wire");
|
||||
sub.shader_set(res.shaders->outline_prepass_wire.get());
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
|
||||
@@ -43,7 +43,7 @@ class Particles : Overlay {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state) final
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && state.has_particles;
|
||||
enabled_ = state.is_space_v3d();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -78,11 +78,8 @@ class Prepass : Overlay {
|
||||
/* Not used. But release the data. */
|
||||
ps_.init();
|
||||
mesh_ps_ = nullptr;
|
||||
mesh_flat_ps_ = nullptr;
|
||||
hair_ps_ = nullptr;
|
||||
curves_ps_ = nullptr;
|
||||
pointcloud_ps_ = nullptr;
|
||||
grease_pencil_ps_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,39 +94,33 @@ class Prepass : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | backface_cull_state,
|
||||
state.clipping_plane_count);
|
||||
res.select_bind(ps_);
|
||||
mesh_ps_ = nullptr;
|
||||
if (state.has_mesh || state.has_volume) {
|
||||
{
|
||||
auto &sub = ps_.sub("Mesh");
|
||||
sub.shader_set(res.is_selection() ? res.shaders->depth_mesh_conservative.get() :
|
||||
res.shaders->depth_mesh.get());
|
||||
mesh_ps_ = ⊂
|
||||
}
|
||||
mesh_flat_ps_ = nullptr;
|
||||
if (state.has_mesh) {
|
||||
{
|
||||
auto &sub = ps_.sub("MeshFlat");
|
||||
sub.shader_set(res.shaders->depth_mesh.get());
|
||||
mesh_flat_ps_ = ⊂
|
||||
}
|
||||
hair_ps_ = nullptr;
|
||||
if (state.has_particles) {
|
||||
{
|
||||
auto &sub = ps_.sub("Hair");
|
||||
sub.shader_set(res.shaders->depth_mesh.get());
|
||||
hair_ps_ = ⊂
|
||||
}
|
||||
curves_ps_ = nullptr;
|
||||
if (state.has_curve) {
|
||||
{
|
||||
auto &sub = ps_.sub("Curves");
|
||||
sub.shader_set(res.shaders->depth_curves.get());
|
||||
curves_ps_ = ⊂
|
||||
}
|
||||
pointcloud_ps_ = nullptr;
|
||||
if (state.has_ptcloud) {
|
||||
{
|
||||
auto &sub = ps_.sub("PointCloud");
|
||||
sub.shader_set(res.shaders->depth_pointcloud.get());
|
||||
pointcloud_ps_ = ⊂
|
||||
}
|
||||
grease_pencil_ps_ = nullptr;
|
||||
if (state.has_gpencil) {
|
||||
{
|
||||
auto &sub = ps_.sub("GreasePencil");
|
||||
sub.shader_set(res.shaders->depth_grease_pencil.get());
|
||||
grease_pencil_ps_ = ⊂
|
||||
@@ -164,7 +155,7 @@ class Prepass : Overlay {
|
||||
res.select_id(ob_ref);
|
||||
|
||||
gpu::Batch *geom = DRW_cache_particles_get_hair(ob, psys, nullptr);
|
||||
hair_ps_->draw(geom, handle, select_id.get());
|
||||
mesh_ps_->draw(geom, handle, select_id.get());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -169,15 +169,6 @@ struct State {
|
||||
float2 image_uv_aspect = float2(0.0f);
|
||||
float2 image_aspect = float2(0.0f);
|
||||
|
||||
bool has_mesh;
|
||||
bool has_curve;
|
||||
bool has_volume;
|
||||
bool has_gpencil;
|
||||
bool has_armature;
|
||||
bool has_particles;
|
||||
bool has_lattice;
|
||||
bool has_ptcloud;
|
||||
|
||||
View::OffsetData offset_data_get() const
|
||||
{
|
||||
if (rv3d == nullptr) {
|
||||
|
||||
@@ -100,22 +100,10 @@ class Wireframe : Overlay {
|
||||
|
||||
auto coloring_pass = [&](ColoringPass &ps, bool use_color) {
|
||||
overlay::ShaderModule &sh = *res.shaders;
|
||||
ps.mesh_ps_ = nullptr;
|
||||
if (state.has_mesh) {
|
||||
ps.mesh_ps_ = shader_pass(sh.wireframe_mesh.get(), "Mesh", use_color, wire_threshold);
|
||||
}
|
||||
ps.mesh_all_edges_ps_ = nullptr;
|
||||
if (state.has_mesh || state.has_volume) {
|
||||
ps.mesh_all_edges_ps_ = shader_pass(sh.wireframe_mesh.get(), "Wire", use_color, 1.0f);
|
||||
}
|
||||
ps.pointcloud_ps_ = nullptr;
|
||||
if (state.has_ptcloud || state.has_volume || state.has_mesh) {
|
||||
ps.pointcloud_ps_ = shader_pass(sh.wireframe_points.get(), "PtCloud", use_color, 1.0f);
|
||||
}
|
||||
ps.curves_ps_ = nullptr;
|
||||
if (state.has_curve) {
|
||||
ps.curves_ps_ = shader_pass(sh.wireframe_curve.get(), "Curve", use_color, 1.0f);
|
||||
}
|
||||
ps.mesh_ps_ = shader_pass(sh.wireframe_mesh.get(), "Mesh", use_color, wire_threshold);
|
||||
ps.mesh_all_edges_ps_ = shader_pass(sh.wireframe_mesh.get(), "Wire", use_color, 1.0f);
|
||||
ps.pointcloud_ps_ = shader_pass(sh.wireframe_points.get(), "PtCloud", use_color, 1.0f);
|
||||
ps.curves_ps_ = shader_pass(sh.wireframe_curve.get(), "Curve", use_color, 1.0f);
|
||||
};
|
||||
|
||||
coloring_pass(non_colored, false);
|
||||
|
||||
Reference in New Issue
Block a user