Blender V5.0
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 {
54 {
55 return "Select ID Debug";
56 }
57
58 void init() final {};
59 void begin_sync() final {};
60 void object_sync(blender::draw::ObjectRef & /*ob_ref*/,
61 blender::draw::Manager & /*manager*/) final {};
62 void end_sync() final {};
63
64 void draw(blender::draw::Manager &manager) final
65 {
67 if (texture_u32 == nullptr) {
68 return;
69 }
70 using namespace blender::draw;
71
72 PassSimple pass = {"SelectEngineDebug"};
73 pass.init();
75 pass.shader_set(ShaderCache::get().select_debug.get());
76 pass.bind_texture("image", texture_u32);
77 pass.bind_texture("image", texture_u32);
79
81 manager.submit(pass);
83 }
84};
85
87{
88 return new Instance();
89}
90
95
96} // namespace blender::draw::edit_select_debug
ID and Library types, which are fundamental for SDNA.
void DRW_submission_end()
void DRW_submission_start()
@ GPU_PRIM_TRIS
void submit(PassSimple &pass, View &view)
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)
A running instance of the engine.
@ DRW_STATE_BLEND_ALPHA
Definition draw_state.hh:55
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
detail::Pass< command::DrawCommandBuf > PassSimple
blender::gpu::Texture * DRW_engine_select_texture_get()
virtual void begin_sync()=0
virtual void init()=0
virtual blender::StringRefNull name_get()=0
virtual void end_sync()=0
DrawEngine * create_instance() final
static void free_static()