Blender V5.3
select_debug_engine.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "BLT_translation.hh"
12
13#include "DNA_ID.h"
14
15#include "DRW_engine.hh"
16#include "DRW_render.hh"
17
18#include "draw_manager.hh"
19#include "draw_pass.hh"
20
21#include "select_engine.hh"
22
23/* -------------------------------------------------------------------- */
26
28
30 using StaticShader = gpu::StaticShader;
31
32 private:
33 static gpu::StaticShaderCache<ShaderCache> &get_static_cache()
34 {
35 static gpu::StaticShaderCache<ShaderCache> static_cache;
36 return static_cache;
37 }
38
39 public:
40 static ShaderCache &get()
41 {
42 return get_static_cache().get();
43 }
44 static void release()
45 {
46 get_static_cache().release();
47 }
48
49 StaticShader select_debug = {"select_debug_fullscreen"};
50};
51
52class Instance : public DrawEngine {
53 StringRefNull name_get() final
54 {
55 return "Select ID Debug";
56 }
57
58 void init() final {};
59 void begin_sync() final {};
60 void object_sync(draw::ObjectRef & /*ob_ref*/, draw::Manager & /*manager*/) final {};
61 void end_sync() final {};
62
63 void draw(draw::Manager &manager) final
64 {
66 if (texture_u32 == nullptr) {
67 return;
68 }
69 using namespace blender::draw;
70
71 PassSimple pass = {"SelectEngineDebug"};
72 pass.init();
74 pass.shader_set(ShaderCache::get().select_debug.get());
75 pass.bind_texture("image", texture_u32);
76 pass.bind_texture("image", texture_u32);
78
80 manager.submit(pass);
82 }
83};
84
86{
87 return new Instance();
88}
89
94
96
97} // namespace blender::draw::edit_select_debug
ID and Library types, which are fundamental for SDNA.
void submit(PassSimple &pass, View &view)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
Definition draw_pass.hh:976
void shader_set(gpu::Shader *shader)
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void state_set(DRWState state, int clip_plane_count=0)
detail::Pass< command::DrawCommandBuf > PassSimple
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:32
@ DRW_STATE_BLEND_ALPHA
Definition draw_state.hh:57
void DRW_submission_end()
void DRW_submission_start()
gpu::Texture * DRW_engine_select_texture_get()
DrawEngine * create_instance() final
static void free_static()