Blender V5.0
overlay_antialiasing.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
42
43#pragma once
44
45#include "overlay_base.hh"
46
47#include "DNA_userdef_types.h"
48
50
52 private:
53 PassSimple anti_aliasing_ps_ = {"AntiAliasing"};
54
55 gpu::FrameBuffer *framebuffer_ref_ = nullptr;
56
57 public:
58 void begin_sync(Resources &res, const State & /*state*/) final
59 {
60 if (res.is_selection()) {
61 anti_aliasing_ps_.init();
62 return;
63 }
64
65 const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0;
66
67 {
68 PassSimple &pass = anti_aliasing_ps_;
69 pass.init();
70 pass.framebuffer_set(&framebuffer_ref_);
72 pass.shader_set(res.shaders->anti_aliasing.get());
73 pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
74 pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
75 pass.bind_texture("depth_tx", &res.depth_tx);
76 pass.bind_texture("color_tx", &res.overlay_tx);
77 pass.bind_texture("line_tx", &res.line_tx);
78 pass.push_constant("do_smooth_lines", do_smooth_lines);
80 }
81 }
82
83 void draw_output(Framebuffer &framebuffer, Manager &manager, View & /*view*/) final
84 {
85 framebuffer_ref_ = framebuffer;
86 manager.submit(anti_aliasing_ps_);
87 }
88};
89
90} // namespace blender::draw::overlay
@ USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE
@ GPU_PRIM_TRIS
#define U
void framebuffer_set(gpu::FrameBuffer **framebuffer)
void shader_set(gpu::Shader *shader)
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
Definition draw_pass.hh:964
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
void push_constant(const char *name, const float &data)
void begin_sync(Resources &res, const State &) final
void draw_output(Framebuffer &framebuffer, Manager &manager, View &) final
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition draw_state.hh:57
detail::Pass< command::DrawCommandBuf > PassSimple