Cleanup: Overlay-Next: Deduplicate global UBO binding
No functional changes.
This commit is contained in:
@@ -68,7 +68,7 @@ class AntiAliasing : Overlay {
|
||||
pass.framebuffer_set(&framebuffer_ref_);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL);
|
||||
pass.shader_set(res.shaders.anti_aliasing.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_texture("depthTex", &res.depth_tx);
|
||||
pass.bind_texture("colorTex", &res.overlay_tx);
|
||||
pass.bind_texture("lineTex", &res.line_tx);
|
||||
|
||||
@@ -156,6 +156,7 @@ class Armatures : Overlay {
|
||||
GPUTexture **depth_tex = (state.xray_enabled) ? &res.depth_tx : &res.dummy_depth_tx;
|
||||
|
||||
armature_ps_.init();
|
||||
armature_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(armature_ps_);
|
||||
|
||||
/* Envelope distances and degrees of freedom need to be drawn first as they use additive
|
||||
@@ -188,7 +189,6 @@ class Armatures : Overlay {
|
||||
sub.state_set(transparent_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_degrees_of_freedom.get());
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
opaque_.degrees_of_freedom_fill = ⊂
|
||||
}
|
||||
if (use_wire_alpha) {
|
||||
@@ -196,7 +196,6 @@ class Armatures : Overlay {
|
||||
sub.state_set(transparent_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_degrees_of_freedom.get());
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
transparent_.degrees_of_freedom_fill = ⊂
|
||||
}
|
||||
else {
|
||||
@@ -245,7 +244,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.sphere_outline");
|
||||
sub.state_set(default_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_sphere_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.sphere_outline = ⊂
|
||||
}
|
||||
@@ -253,7 +251,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.sphere_outline");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_sphere_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
transparent_.sphere_outline = ⊂
|
||||
}
|
||||
@@ -265,7 +262,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.shape_outline");
|
||||
sub.state_set(default_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_shape_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.shape_outline = ⊂
|
||||
}
|
||||
@@ -273,7 +269,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.shape_outline");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_shape_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.push_constant("alpha", wire_alpha * 0.6f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
@@ -287,7 +282,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.shape_wire");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_shape_wire.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
opaque_.shape_wire = ⊂
|
||||
@@ -296,7 +290,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.shape_wire");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_shape_wire.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.push_constant("alpha", wire_alpha * 0.6f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
@@ -312,14 +305,12 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.degrees_of_freedom_wire");
|
||||
sub.shader_set(res.shaders.armature_degrees_of_freedom.get());
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
opaque_.degrees_of_freedom_wire = ⊂
|
||||
}
|
||||
if (use_wire_alpha) {
|
||||
auto &sub = armature_ps_.sub("transparent.degrees_of_freedom_wire");
|
||||
sub.shader_set(res.shaders.armature_degrees_of_freedom.get());
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
transparent_.degrees_of_freedom_wire = ⊂
|
||||
}
|
||||
else {
|
||||
@@ -331,7 +322,6 @@ class Armatures : Overlay {
|
||||
{
|
||||
auto &sub = armature_ps_.sub("opaque.stick");
|
||||
sub.shader_set(res.shaders.armature_stick.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.stick = ⊂
|
||||
}
|
||||
@@ -339,7 +329,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.stick");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_stick.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
transparent_.stick = ⊂
|
||||
}
|
||||
@@ -371,7 +360,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.envelope_outline");
|
||||
sub.state_set(default_state | DRW_STATE_CULL_BACK, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_envelope_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.envelope_outline = ⊂
|
||||
}
|
||||
@@ -381,7 +369,6 @@ class Armatures : Overlay {
|
||||
(DRW_STATE_BLEND_ALPHA | DRW_STATE_CULL_BACK),
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_envelope_outline.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
transparent_.envelope_outline = ⊂
|
||||
}
|
||||
@@ -393,7 +380,6 @@ class Armatures : Overlay {
|
||||
{
|
||||
auto &sub = armature_ps_.sub("opaque.wire");
|
||||
sub.shader_set(res.shaders.armature_wire.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.wire = ⊂
|
||||
}
|
||||
@@ -401,7 +387,6 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.wire");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.armature_wire.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
transparent_.wire = ⊂
|
||||
}
|
||||
@@ -413,7 +398,6 @@ class Armatures : Overlay {
|
||||
{
|
||||
auto &sub = armature_ps_.sub("opaque.arrow");
|
||||
sub.shader_set(res.shaders.extra_shape.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
opaque_.arrows = ⊂
|
||||
transparent_.arrows = opaque_.arrows;
|
||||
}
|
||||
@@ -421,7 +405,6 @@ class Armatures : Overlay {
|
||||
{
|
||||
auto &sub = armature_ps_.sub("opaque.relations");
|
||||
sub.shader_set(res.shaders.extra_wire.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
opaque_.relations = ⊂
|
||||
transparent_.relations = opaque_.relations;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class Axes : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.extra_shape.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
axes_buf.end_sync(ps_, shapes.arrows.get());
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class Background : Overlay {
|
||||
|
||||
bg_ps_.state_set(pass_state);
|
||||
bg_ps_.shader_set(res.shaders.background_fill.get());
|
||||
bg_ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
bg_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
bg_ps_.bind_texture("colorBuffer", &res.color_render_tx);
|
||||
bg_ps_.bind_texture("depthBuffer", &res.depth_tx);
|
||||
bg_ps_.push_constant("colorOverride", color_override);
|
||||
|
||||
@@ -202,7 +202,7 @@ class Bounds : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.extra_shape.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
call_buffers_.box.end_sync(ps_, shapes.cube.get());
|
||||
|
||||
@@ -121,7 +121,7 @@ class Cameras : Overlay {
|
||||
pass.init();
|
||||
pass.state_set(draw_state, state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders.image_plane_depth_bias.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("depth_bias_winmat", depth_bias_winmat);
|
||||
res.select_bind(pass);
|
||||
};
|
||||
@@ -162,6 +162,7 @@ class Cameras : Overlay {
|
||||
}
|
||||
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
{
|
||||
@@ -170,7 +171,6 @@ class Cameras : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.volume_buf.end_sync(sub_pass, shapes.camera_volume.get());
|
||||
}
|
||||
{
|
||||
@@ -179,7 +179,6 @@ class Cameras : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.volume_wire_buf.end_sync(sub_pass, shapes.camera_volume_wire.get());
|
||||
}
|
||||
|
||||
@@ -189,7 +188,6 @@ class Cameras : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.distances_buf.end_sync(sub_pass, shapes.camera_distances.get());
|
||||
call_buffers_.frame_buf.end_sync(sub_pass, shapes.camera_frame.get());
|
||||
call_buffers_.tria_buf.end_sync(sub_pass, shapes.camera_tria.get());
|
||||
@@ -203,7 +201,6 @@ class Cameras : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_wire.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.stereo_connect_lines.end_sync(sub_pass);
|
||||
call_buffers_.tracking_path.end_sync(sub_pass);
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ class Curves : Overlay {
|
||||
{
|
||||
auto &pass = edit_curves_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
{
|
||||
auto &sub = pass.sub("Lines");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA |
|
||||
DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.curve_edit_line.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
@@ -78,7 +78,6 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub("Handles");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.curve_edit_handles.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
edit_curves_handles_ = ⊂
|
||||
}
|
||||
@@ -88,7 +87,6 @@ class Curves : Overlay {
|
||||
DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.curve_edit_points.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
@@ -110,7 +108,6 @@ class Curves : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.legacy_curve_edit_wires.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("normalSize", 0.0f);
|
||||
edit_legacy_curve_wires_ = ⊂
|
||||
}
|
||||
@@ -119,7 +116,6 @@ class Curves : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.legacy_curve_edit_normals.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("normalSize", state.overlay.normals_length);
|
||||
sub.push_constant("use_hq_normals", use_hq_normals);
|
||||
edit_legacy_curve_normals_ = ⊂
|
||||
@@ -131,7 +127,6 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub("Handles");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.legacy_curve_edit_handles.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
@@ -142,7 +137,6 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub("Points");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.legacy_curve_edit_points.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
@@ -159,7 +153,6 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub(name);
|
||||
sub.state_set(drw_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.legacy_curve_edit_handles.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("alpha", alpha);
|
||||
|
||||
@@ -60,6 +60,7 @@ class EditText : Overlay {
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State &state) final
|
||||
{
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
{
|
||||
DRWState default_state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
|
||||
@@ -120,7 +121,6 @@ class EditText : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_wire.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
box_line_buf_.end_sync(sub_pass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class Empties : Overlay {
|
||||
pass.state_set(draw_state, state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders.image_plane_depth_bias.get());
|
||||
pass.push_constant("depth_bias_winmat", depth_bias_winmat_);
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(pass);
|
||||
};
|
||||
|
||||
@@ -188,7 +188,7 @@ class Empties : Overlay {
|
||||
ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
ps.shader_set(res.shaders.extra_shape.get());
|
||||
ps.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
|
||||
call_buffers.plain_axes_buf.end_sync(ps, shapes.plain_axes.get());
|
||||
call_buffers.single_arrow_buf.end_sync(ps, shapes.single_arrow.get());
|
||||
@@ -367,7 +367,7 @@ class Empties : Overlay {
|
||||
else {
|
||||
sub.shader_set(res.shaders.image_plane.get());
|
||||
}
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
return sub;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class Facing : Overlay {
|
||||
backface_cull_state,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.facing.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
}
|
||||
|
||||
void object_sync(Manager &manager,
|
||||
|
||||
@@ -236,7 +236,7 @@ class Fluids : Overlay {
|
||||
void end_sync(Resources &res, const ShapeCache &shapes, const State & /*state*/) final
|
||||
{
|
||||
fluid_ps_.shader_set(res.shaders.extra_shape.get());
|
||||
fluid_ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
fluid_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
|
||||
cube_buf_.end_sync(fluid_ps_, shapes.cube.get());
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class ForceFields : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.extra_shape.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
|
||||
call_buffers_.field_force_buf.end_sync(ps_, shapes.field_force.get());
|
||||
call_buffers_.field_wind_buf.end_sync(ps_, shapes.field_wind.get());
|
||||
|
||||
@@ -103,6 +103,7 @@ class GreasePencil : Overlay {
|
||||
{
|
||||
auto &pass = edit_grease_pencil_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
@@ -110,7 +111,6 @@ class GreasePencil : Overlay {
|
||||
if (show_points_) {
|
||||
auto &sub = pass.sub("Points");
|
||||
sub.shader_set(res.shaders.curve_edit_points.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", true);
|
||||
@@ -121,7 +121,6 @@ class GreasePencil : Overlay {
|
||||
if (show_lines_) {
|
||||
auto &sub = pass.sub("Lines");
|
||||
sub.shader_set(res.shaders.curve_edit_line.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", true);
|
||||
@@ -144,7 +143,7 @@ class GreasePencil : Overlay {
|
||||
if (show_grid_) {
|
||||
const float4 col_grid(0.5f, 0.5f, 0.5f, state.overlay.gpencil_grid_opacity);
|
||||
pass.shader_set(res.shaders.grid_grease_pencil.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("color", col_grid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class Grid : Overlay {
|
||||
GPUTexture **depth_infront_tx = &res.depth_target_in_front_tx;
|
||||
|
||||
grid_ps_.init();
|
||||
grid_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
grid_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA);
|
||||
if (state.is_space_image()) {
|
||||
/* Add quad background. */
|
||||
@@ -71,7 +72,6 @@ class Grid : Overlay {
|
||||
auto &sub = grid_ps_.sub("grid");
|
||||
sub.shader_set(res.shaders.grid.get());
|
||||
sub.bind_ubo("grid_buf", &data_);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("depth_tx", depth_tx, GPUSamplerState::default_sampler());
|
||||
sub.bind_texture("depth_infront_tx", depth_infront_tx, GPUSamplerState::default_sampler());
|
||||
if (zneg_flag_ & SHOW_AXIS_Z) {
|
||||
|
||||
@@ -42,7 +42,6 @@ class Lattices : Overlay {
|
||||
PassMain::Sub &sub_pass = ps_.sub(name);
|
||||
sub_pass.state_set(pass_state, state.clipping_plane_count);
|
||||
sub_pass.shader_set(shader);
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
if (add_weight_tex) {
|
||||
sub_pass.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
}
|
||||
@@ -50,6 +49,7 @@ class Lattices : Overlay {
|
||||
};
|
||||
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
edit_lattice_wire_ps_ = create_sub_pass(
|
||||
"edit_lattice_wire", res.shaders.lattice_wire.get(), true);
|
||||
edit_lattice_point_ps_ = create_sub_pass(
|
||||
|
||||
@@ -162,6 +162,7 @@ class Lights : Overlay {
|
||||
const DRWState pass_state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||
DRW_STATE_DEPTH_LESS_EQUAL;
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
{
|
||||
@@ -170,7 +171,6 @@ class Lights : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_FRONT,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.light_spot_cone.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.spot_cone_front_buf.end_sync(sub_pass, shapes.light_spot_volume.get());
|
||||
}
|
||||
{
|
||||
@@ -179,14 +179,12 @@ class Lights : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.light_spot_cone.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.spot_cone_back_buf.end_sync(sub_pass, shapes.light_spot_volume.get());
|
||||
}
|
||||
{
|
||||
PassSimple::Sub &sub_pass = ps_.sub("light_shapes");
|
||||
sub_pass.state_set(pass_state, state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.icon_inner_buf.end_sync(sub_pass, shapes.light_icon_outer_lines.get());
|
||||
call_buffers_.icon_outer_buf.end_sync(sub_pass, shapes.light_icon_inner_lines.get());
|
||||
call_buffers_.icon_sun_rays_buf.end_sync(sub_pass, shapes.light_icon_sun_rays.get());
|
||||
@@ -200,7 +198,6 @@ class Lights : Overlay {
|
||||
PassSimple::Sub &sub_pass = ps_.sub("ground_line");
|
||||
sub_pass.state_set(pass_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_ground_line.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.ground_line_buf.end_sync(sub_pass, shapes.ground_line.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class LightProbes : Overlay {
|
||||
ps_dots_.init();
|
||||
ps_dots_.state_set(DRW_STATE_WRITE_COLOR, state.clipping_plane_count);
|
||||
ps_dots_.shader_set(res.shaders.extra_grid.get());
|
||||
ps_dots_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_dots_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
ps_dots_.bind_texture("depthBuffer", &res.depth_tx);
|
||||
ps_dots_.push_constant("isTransform", (G.moving & G_TRANSFORM_OBJ) != 0);
|
||||
res.select_bind(ps_dots_);
|
||||
@@ -192,6 +192,7 @@ class LightProbes : Overlay {
|
||||
}
|
||||
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
DRWState pass_state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||
@@ -200,7 +201,6 @@ class LightProbes : Overlay {
|
||||
PassSimple::Sub &sub_pass = ps_.sub("empties");
|
||||
sub_pass.state_set(pass_state, state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_shape.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.probe_cube_buf.end_sync(sub_pass, shapes.lightprobe_cube.get());
|
||||
call_buffers_.probe_planar_buf.end_sync(sub_pass, shapes.lightprobe_planar.get());
|
||||
call_buffers_.probe_grid_buf.end_sync(sub_pass, shapes.lightprobe_grid.get());
|
||||
@@ -213,7 +213,6 @@ class LightProbes : Overlay {
|
||||
PassSimple::Sub &sub_pass = ps_.sub("ground_line");
|
||||
sub_pass.state_set(pass_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_ground_line.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
call_buffers_.ground_line_buf.end_sync(sub_pass, shapes.ground_line.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,12 +144,12 @@ class Meshes : Overlay {
|
||||
|
||||
auto &pass = edit_mesh_normals_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(pass_state, state.clipping_plane_count);
|
||||
|
||||
auto shader_pass = [&](GPUShader *shader, const char *name) {
|
||||
auto &sub = pass.sub(name);
|
||||
sub.shader_set(shader);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.push_constant("alpha", backwire_opacity);
|
||||
sub.push_constant("isConstantScreenSizeNormals", use_screen_size);
|
||||
@@ -185,7 +185,7 @@ class Meshes : Overlay {
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(shadeless ? res.shaders.paint_weight.get() :
|
||||
res.shaders.paint_weight_fake_shading.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_texture("colorramp", &res.weight_ramp_tx);
|
||||
pass.push_constant("drawContours", false);
|
||||
pass.push_constant("opacity", state.overlay.weight_paint_mode_opacity);
|
||||
@@ -212,7 +212,7 @@ class Meshes : Overlay {
|
||||
pass.push_constant("alpha", alpha);
|
||||
pass.push_constant("retopologyOffset", retopology_offset);
|
||||
pass.push_constant("dataMask", int4(data_mask));
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
};
|
||||
|
||||
{
|
||||
@@ -270,7 +270,7 @@ class Meshes : Overlay {
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders.mesh_edit_skin_root.get());
|
||||
pass.push_constant("retopologyOffset", retopology_offset);
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ class MeshUVs : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_ALPHA);
|
||||
pass.shader_set(res.shaders.uv_wireframe.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("alpha", space_image->uv_opacity);
|
||||
pass.push_constant("doSmoothWire", do_smooth_wire);
|
||||
}
|
||||
@@ -647,7 +647,7 @@ class MeshUVs : Overlay {
|
||||
GPUShader *sh = res.shaders.uv_edit_edge.get();
|
||||
pass.specialize_constant(sh, "use_edge_select", !show_vert_);
|
||||
pass.shader_set(sh);
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("lineStyle", int(edit_uv_line_style_from_space_image(space_image)));
|
||||
pass.push_constant("alpha", space_image->uv_opacity);
|
||||
pass.push_constant("dashLength", dash_length);
|
||||
@@ -665,7 +665,7 @@ class MeshUVs : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_ALPHA);
|
||||
pass.shader_set(res.shaders.uv_edit_vert.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("pointSize", (point_size + 1.5f) * float(M_SQRT2));
|
||||
pass.push_constant("outlineWidth", 0.75f);
|
||||
pass.push_constant("color", theme_color);
|
||||
@@ -679,7 +679,7 @@ class MeshUVs : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_ALPHA);
|
||||
pass.shader_set(res.shaders.uv_edit_facedot.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("pointSize", point_size);
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ class MeshUVs : Overlay {
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS | DRW_STATE_BLEND_ALPHA);
|
||||
pass.shader_set(res.shaders.uv_edit_face.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("uvOpacity", space_image->uv_opacity);
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ class MeshUVs : Overlay {
|
||||
pass.shader_set(mesh_analysis_type_ == SI_UVDT_STRETCH_ANGLE ?
|
||||
res.shaders.uv_analysis_stretch_angle.get() :
|
||||
res.shaders.uv_analysis_stretch_area.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("aspect", state.image_uv_aspect);
|
||||
pass.push_constant("stretch_opacity", space_image->stretch_opacity);
|
||||
pass.push_constant("totalAreaRatio", &total_area_ratio_);
|
||||
|
||||
@@ -94,7 +94,7 @@ class Metaballs : Overlay {
|
||||
/* NOTE: Use armature sphere outline shader to have perspective correct outline instead of
|
||||
* just a circle facing the camera. */
|
||||
ps_.shader_set(res.shaders.armature_sphere_outline.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
circle_buf_.end_sync(ps_, shapes.metaball_wire_circle.get());
|
||||
|
||||
@@ -49,7 +49,7 @@ class ModeTransfer : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.uniform_color.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
|
||||
any_animated_ = false;
|
||||
}
|
||||
|
||||
@@ -44,17 +44,16 @@ class MotionPath : Overlay {
|
||||
{
|
||||
PassSimple &pass = motion_path_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR, state.clipping_plane_count);
|
||||
{
|
||||
PassSimple::Sub &sub = pass.sub("Lines");
|
||||
sub.shader_set(res.shaders.motion_path_line.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
line_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
PassSimple::Sub &sub = pass.sub("Points");
|
||||
sub.shader_set(res.shaders.motion_path_vert.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
vert_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class Origins : Overlay {
|
||||
ps_.init();
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.extra_point.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
select_buf_.select_bind(ps_);
|
||||
point_buf_.push_update();
|
||||
ps_.bind_ssbo("data_buf", &point_buf_);
|
||||
|
||||
@@ -64,6 +64,7 @@ class Outline : Overlay {
|
||||
{
|
||||
auto &pass = outline_prepass_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.framebuffer_set(&prepass_fb_);
|
||||
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,
|
||||
@@ -72,42 +73,36 @@ class Outline : Overlay {
|
||||
auto &sub = pass.sub("Curves");
|
||||
sub.shader_set(res.shaders.outline_prepass_curves.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_curves_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("PointCloud");
|
||||
sub.shader_set(res.shaders.outline_prepass_pointcloud.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_pointcloud_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("GreasePencil");
|
||||
sub.shader_set(res.shaders.outline_prepass_gpencil.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_gpencil_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Mesh");
|
||||
sub.shader_set(res.shaders.outline_prepass_mesh.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_mesh_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Volume");
|
||||
sub.shader_set(res.shaders.outline_prepass_mesh.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_volume_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Wire");
|
||||
sub.shader_set(res.shaders.outline_prepass_wire.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
prepass_wire_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -124,7 +119,7 @@ class Outline : Overlay {
|
||||
pass.bind_texture("outlineId", &object_id_tx_);
|
||||
pass.bind_texture("sceneDepth", &res.depth_tx);
|
||||
pass.bind_texture("outlineDepth", &tmp_depth_tx_);
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ class Paints : Overlay {
|
||||
|
||||
{
|
||||
auto &pass = paint_region_ps_;
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
{
|
||||
auto &sub = pass.sub("Face");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.paint_region_face.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("ucolor", float4(1.0, 1.0, 1.0, 0.2));
|
||||
paint_region_face_ps_ = ⊂
|
||||
}
|
||||
@@ -77,7 +77,6 @@ class Paints : Overlay {
|
||||
DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.paint_region_edge.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
paint_region_edge_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
@@ -85,7 +84,6 @@ class Paints : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders.paint_region_vert.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
paint_region_vert_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -107,7 +105,7 @@ class Paints : Overlay {
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(shadeless ? res.shaders.paint_weight.get() :
|
||||
res.shaders.paint_weight_fake_shading.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_texture("colorramp", &res.weight_ramp_tx);
|
||||
pass.push_constant("drawContours", draw_contours);
|
||||
pass.push_constant("opacity", state.overlay.weight_paint_mode_opacity);
|
||||
@@ -131,7 +129,7 @@ class Paints : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders.paint_texture.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_texture("maskImage", mask_texture);
|
||||
pass.push_constant("maskPremult", mask_premult);
|
||||
pass.push_constant("maskInvertStencil", mask_inverted);
|
||||
|
||||
@@ -58,27 +58,25 @@ class Particles : Overlay {
|
||||
{
|
||||
auto &pass = particle_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
res.select_bind(pass);
|
||||
{
|
||||
auto &sub = pass.sub("Dots");
|
||||
sub.shader_set(res.shaders.particle_dot.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
dot_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Shapes");
|
||||
sub.shader_set(res.shaders.particle_shape.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
shape_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Hair");
|
||||
sub.shader_set(res.shaders.particle_hair.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("colorType", state.v3d->shading.wire_color_type);
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
hair_ps_ = ⊂
|
||||
@@ -88,13 +86,13 @@ class Particles : Overlay {
|
||||
{
|
||||
auto &pass = edit_particle_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
res.select_bind(pass);
|
||||
{
|
||||
auto &sub = pass.sub("Dots");
|
||||
sub.shader_set(res.shaders.particle_edit_vert.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
@@ -103,7 +101,6 @@ class Particles : Overlay {
|
||||
{
|
||||
auto &sub = pass.sub("Edges");
|
||||
sub.shader_set(res.shaders.particle_edit_edge.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
|
||||
@@ -66,6 +66,7 @@ class Prepass : Overlay {
|
||||
DRWState backface_cull_state = use_cull ? DRW_STATE_CULL_BACK : DRWState(0);
|
||||
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
ps_.state_set(DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | backface_cull_state,
|
||||
state.clipping_plane_count);
|
||||
res.select_bind(ps_);
|
||||
@@ -73,31 +74,26 @@ class Prepass : Overlay {
|
||||
auto &sub = ps_.sub("Mesh");
|
||||
sub.shader_set(res.is_selection() ? res.shaders.depth_mesh_conservative.get() :
|
||||
res.shaders.depth_mesh.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
mesh_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = ps_.sub("Hair");
|
||||
sub.shader_set(res.shaders.depth_mesh.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
hair_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = ps_.sub("Curves");
|
||||
sub.shader_set(res.shaders.depth_curves.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
curves_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = ps_.sub("PointCloud");
|
||||
sub.shader_set(res.shaders.depth_point_cloud.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
point_cloud_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = ps_.sub("GreasePencil");
|
||||
sub.shader_set(res.shaders.depth_grease_pencil.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
grease_pencil_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ class Relations : Overlay {
|
||||
}
|
||||
|
||||
ps_.init();
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
{
|
||||
PassSimple::Sub &sub_pass = ps_.sub("lines");
|
||||
@@ -189,7 +190,6 @@ class Relations : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_wire.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
relations_buf_.end_sync(sub_pass);
|
||||
}
|
||||
{
|
||||
@@ -198,7 +198,6 @@ class Relations : Overlay {
|
||||
DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
sub_pass.shader_set(res.shaders.extra_loose_points.get());
|
||||
sub_pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
points_buf_.end_sync(sub_pass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ class Sculpts : Overlay {
|
||||
|
||||
{
|
||||
sculpt_mask_.init();
|
||||
sculpt_mask_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
sculpt_mask_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||
DRW_STATE_BLEND_MUL,
|
||||
state.clipping_plane_count);
|
||||
{
|
||||
auto &sub = sculpt_mask_.sub("Mesh");
|
||||
sub.shader_set(res.shaders.sculpt_mesh.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("maskOpacity", mask_opacity);
|
||||
sub.push_constant("faceSetsOpacity", face_set_opacity);
|
||||
mesh_ps_ = ⊂
|
||||
@@ -80,7 +80,6 @@ class Sculpts : Overlay {
|
||||
{
|
||||
auto &sub = sculpt_mask_.sub("Curves");
|
||||
sub.shader_set(res.shaders.sculpt_curves.get());
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.push_constant("selection_opacity", mask_opacity);
|
||||
curves_ps_ = ⊂
|
||||
}
|
||||
@@ -91,7 +90,7 @@ class Sculpts : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders.sculpt_curves_cage.get());
|
||||
pass.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.push_constant("opacity", curve_cage_opacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class Speakers : Overlay {
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
ps_.shader_set(res.shaders.extra_shape.get());
|
||||
ps_.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
res.select_bind(ps_);
|
||||
|
||||
speaker_buf_.end_sync(ps_, shapes.speaker.get());
|
||||
|
||||
@@ -71,6 +71,7 @@ class Wireframe : Overlay {
|
||||
{
|
||||
auto &pass = wireframe_ps_;
|
||||
pass.init();
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.state_set(DRW_STATE_FIRST_VERTEX_CONVENTION | DRW_STATE_WRITE_COLOR |
|
||||
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
@@ -83,7 +84,6 @@ class Wireframe : Overlay {
|
||||
sub.specialize_constant(shader, "use_custom_depth_bias", do_smooth_lines);
|
||||
}
|
||||
sub.shader_set(shader);
|
||||
sub.bind_ubo("globalsBlock", &res.globals_buf);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.push_constant("wireOpacity", state.overlay.wireframe_opacity);
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
|
||||
@@ -44,3 +44,6 @@
|
||||
* - The maximum resource index supported for shaders using multi-view (see DRW_VIEW_SHIFT).
|
||||
*/
|
||||
#define DRW_VIEW_MAX 64
|
||||
|
||||
/* TODO(fclem): Move to overlay. */
|
||||
#define OVERLAY_GLOBALS_SLOT 7
|
||||
|
||||
@@ -207,7 +207,7 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_globals)
|
||||
TYPEDEF_SOURCE("draw_common_shader_shared.hh")
|
||||
UNIFORM_BUF_FREQ(7, GlobalsUboStorage, globalsBlock, PASS)
|
||||
UNIFORM_BUF_FREQ(OVERLAY_GLOBALS_SLOT, GlobalsUboStorage, globalsBlock, PASS)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user