diff options
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_command.cc | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_command_shared.hh | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_curves.cc | 10 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_hair.cc | 18 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.cc | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.hh | 16 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_pass.hh | 11 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_shader_shared.h | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view.hh | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/shaders/draw_command_generate_comp.glsl | 2 |
11 files changed, 47 insertions, 38 deletions
diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc index 7d5ea5c2048..ff69885b3b6 100644 --- a/source/blender/draw/intern/draw_command.cc +++ b/source/blender/draw/intern/draw_command.cc @@ -437,7 +437,7 @@ std::string DispatchIndirect::serialize() const std::string Barrier::serialize() const { - /* TOOD(fclem): Better serialization... */ + /* TODO(@fclem): Better serialization... */ return std::string(".barrier(") + std::to_string(type) + ")"; } @@ -464,7 +464,7 @@ std::string Clear::serialize() const std::string StateSet::serialize() const { - /* TOOD(fclem): Better serialization... */ + /* TODO(@fclem): Better serialization... */ return std::string(".state_set(") + std::to_string(new_state) + ")"; } @@ -562,7 +562,7 @@ void DrawMultiBuf::bind(RecordingState &state, BLI_assert(batch_inst_len == 1); UNUSED_VARS_NDEBUG(batch_inst_len); - /* Now that we got the batch infos, we can set the counters to 0. */ + /* Now that we got the batch information, we can set the counters to 0. */ group.total_counter = group.front_facing_counter = group.back_facing_counter = 0; } diff --git a/source/blender/draw/intern/draw_command_shared.hh b/source/blender/draw/intern/draw_command_shared.hh index 22d1facfb09..9fbbe23f0ce 100644 --- a/source/blender/draw/intern/draw_command_shared.hh +++ b/source/blender/draw/intern/draw_command_shared.hh @@ -24,7 +24,7 @@ struct RecordingState; * the same render state. */ struct DrawGroup { - /** Index of next DrawGroup from the same header. */ + /** Index of next #DrawGroup from the same header. */ uint next; /** Index of the first instances after sorting. */ @@ -34,7 +34,7 @@ struct DrawGroup { /** Number of non inverted scaling instances in this Group. */ uint front_facing_len; - /** GPUBatch values to be copied to DrawCommand after sorting (if not overriden). */ + /** #GPUBatch values to be copied to #DrawCommand after sorting (if not overridden). */ int vertex_len; int vertex_first; int base_index; diff --git a/source/blender/draw/intern/draw_curves.cc b/source/blender/draw/intern/draw_curves.cc index 9c4181b0161..a61769e7a63 100644 --- a/source/blender/draw/intern/draw_curves.cc +++ b/source/blender/draw/intern/draw_curves.cc @@ -478,9 +478,9 @@ void DRW_curves_update() GPU_framebuffer_free(fb); } else { - /* Note(Metal): If compute is not supported, bind a temporary framebuffer to avoid + /* NOTE(Metal): If compute is not supported, bind a temporary frame-buffer to avoid * side-effects from rendering in the active buffer. - * We also need to guarantee that a Framebuffer is active to perform any rendering work, + * We also need to guarantee that a Frame-buffer is active to perform any rendering work, * even if there is no output */ GPUFrameBuffer *temp_fb = nullptr; GPUFrameBuffer *prev_fb = nullptr; @@ -488,7 +488,7 @@ void DRW_curves_update() if (!GPU_compute_shader_support()) { prev_fb = GPU_framebuffer_active_get(); char errorOut[256]; - /* if the framebuffer is invalid we need a dummy framebuffer to be bound. */ + /* if the frame-buffer is invalid we need a dummy frame-buffer to be bound. */ if (!GPU_framebuffer_check_valid(prev_fb, errorOut)) { int width = 64; int height = 64; @@ -510,11 +510,11 @@ void DRW_curves_update() GPU_memory_barrier(GPU_BARRIER_SHADER_STORAGE); } - /* Release temporary framebuffer. */ + /* Release temporary frame-buffer. */ if (temp_fb != nullptr) { GPU_framebuffer_free(temp_fb); } - /* Rebind existing framebuffer */ + /* Rebind existing frame-buffer */ if (prev_fb != nullptr) { GPU_framebuffer_bind(prev_fb); } diff --git a/source/blender/draw/intern/draw_hair.cc b/source/blender/draw/intern/draw_hair.cc index 69f123b95f3..ceee1c7cb48 100644 --- a/source/blender/draw/intern/draw_hair.cc +++ b/source/blender/draw/intern/draw_hair.cc @@ -59,7 +59,7 @@ static int g_tf_target_height; static GPUVertBuf *g_dummy_vbo = nullptr; static GPUTexture *g_dummy_texture = nullptr; -static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */ +static DRWPass *g_tf_pass; /* XXX can be a problem with multiple #DRWManager in the future */ static blender::draw::UniformBuffer<CurvesInfos> *g_dummy_curves_info = nullptr; static GPUShader *hair_refine_shader_get(ParticleRefineShader refinement) @@ -87,7 +87,7 @@ void DRW_hair_init(void) const float vert[4] = {0.0f, 0.0f, 0.0f, 0.0f}; GPU_vertbuf_data_alloc(g_dummy_vbo, 1); GPU_vertbuf_attr_fill(g_dummy_vbo, dummy_id, vert); - /* Create vbo immediately to bind to texture buffer. */ + /* Create VBO immediately to bind to texture buffer. */ GPU_vertbuf_use(g_dummy_vbo); g_dummy_texture = GPU_texture_create_from_vertbuf("hair_dummy_attr", g_dummy_vbo); @@ -247,7 +247,7 @@ DRWShadingGroup *DRW_shgroup_hair_create_sub(Object *object, DRWShadingGroup *shgrp = DRW_shgroup_create_sub(shgrp_parent); - /* TODO: optimize this. Only bind the ones GPUMaterial needs. */ + /* TODO: optimize this. Only bind the ones #GPUMaterial needs. */ for (int i = 0; i < hair_cache->num_uv_layers; i++) { for (int n = 0; n < MAX_LAYER_NAME_CT && hair_cache->uv_layer_names[i][n][0] != '\0'; n++) { DRW_shgroup_uniform_texture(shgrp, hair_cache->uv_layer_names[i][n], hair_cache->uv_tex[i]); @@ -373,17 +373,17 @@ void DRW_hair_update() GPU_framebuffer_free(fb); } else { - /* Note(Metal): If compute is not supported, bind a temporary framebuffer to avoid + /* NOTE(Metal): If compute is not supported, bind a temporary frame-buffer to avoid * side-effects from rendering in the active buffer. - * We also need to guarantee that a Framebuffer is active to perform any rendering work, - * even if there is no output */ + * We also need to guarantee that a frame-buffer is active to perform any rendering work, + * even if there is no output. */ GPUFrameBuffer *temp_fb = nullptr; GPUFrameBuffer *prev_fb = nullptr; if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_METAL)) { if (!GPU_compute_shader_support()) { prev_fb = GPU_framebuffer_active_get(); char errorOut[256]; - /* if the framebuffer is invalid we need a dummy framebuffer to be bound. */ + /* if the frame-buffer is invalid we need a dummy frame-buffer to be bound. */ if (!GPU_framebuffer_check_valid(prev_fb, errorOut)) { int width = 64; int height = 64; @@ -405,11 +405,11 @@ void DRW_hair_update() GPU_memory_barrier(GPU_BARRIER_SHADER_STORAGE); } - /* Release temporary framebuffer. */ + /* Release temporary frame-buffer. */ if (temp_fb != nullptr) { GPU_framebuffer_free(temp_fb); } - /* Rebind existing framebuffer */ + /* Rebind existing frame-buffer */ if (prev_fb != nullptr) { GPU_framebuffer_bind(prev_fb); } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 799d0544e34..6e05572a20b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2699,7 +2699,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons GPUViewport *viewport = WM_draw_region_get_viewport(region); if (!viewport) { /* Selection engine requires a viewport. - * TODO(germano): This should be done internally in the engine. */ + * TODO(@germano): This should be done internally in the engine. */ sel_ctx->is_dirty = true; sel_ctx->objects_drawn_len = 0; sel_ctx->index_drawn_len = 1; diff --git a/source/blender/draw/intern/draw_manager.cc b/source/blender/draw/intern/draw_manager.cc index 2841abb53e7..41ff974e835 100644 --- a/source/blender/draw/intern/draw_manager.cc +++ b/source/blender/draw/intern/draw_manager.cc @@ -27,8 +27,8 @@ Manager::~Manager() void Manager::begin_sync() { - /* TODO: This means the reference is kept until further redraw or manager teardown. Instead, they - * should be released after each draw loop. But for now, mimics old DRW behavior. */ + /* TODO: This means the reference is kept until further redraw or manager tear-down. Instead, + * they should be released after each draw loop. But for now, mimics old DRW behavior. */ for (GPUTexture *texture : acquired_textures) { /* Decrease refcount and free if 0. */ GPU_texture_free(texture); @@ -37,7 +37,7 @@ void Manager::begin_sync() acquired_textures.clear(); #ifdef DEBUG - /* Detect non-init data. */ + /* Detect uninitialized data. */ memset(matrix_buf.data(), 0xF0, resource_len_ * sizeof(*matrix_buf.data())); memset(bounds_buf.data(), 0xF0, resource_len_ * sizeof(*bounds_buf.data())); memset(infos_buf.data(), 0xF0, resource_len_ * sizeof(*infos_buf.data())); diff --git a/source/blender/draw/intern/draw_manager.hh b/source/blender/draw/intern/draw_manager.hh index 867b376702c..aff56b0307b 100644 --- a/source/blender/draw/intern/draw_manager.hh +++ b/source/blender/draw/intern/draw_manager.hh @@ -44,7 +44,10 @@ class Manager { using ObjectBoundsBuf = StorageArrayBuffer<ObjectBounds, 128>; using ObjectInfosBuf = StorageArrayBuffer<ObjectInfos, 128>; using ObjectAttributeBuf = StorageArrayBuffer<ObjectAttribute, 128>; - /** TODO(fclem): Remove once we get rid of old EEVEE codebase. DRW_RESOURCE_CHUNK_LEN = 512 */ + /** + * TODO(@fclem): Remove once we get rid of old EEVEE code-base. + * `DRW_RESOURCE_CHUNK_LEN = 512`. + */ using ObjectAttributeLegacyBuf = UniformArrayBuffer<float4, 8 * 512>; public: @@ -77,11 +80,16 @@ class Manager { * This is because attribute list is arbitrary. */ ObjectAttributeBuf attributes_buf; - /** TODO(fclem): Remove once we get rid of old EEVEE codebase. Only here to satisfy bindings. */ + /** + * TODO(@fclem): Remove once we get rid of old EEVEE code-base. + * Only here to satisfy bindings. + */ ObjectAttributeLegacyBuf attributes_buf_legacy; - /** List of textures coming from Image data-blocks. They need to be refcounted in order to avoid - * beeing freed in another thread. */ + /** + * List of textures coming from Image data-blocks. + * They need to be reference-counted in order to avoid being freed in another thread. + */ Vector<GPUTexture *> acquired_textures; private: diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh index 65faa9febbc..e4b3a56c414 100644 --- a/source/blender/draw/intern/draw_pass.hh +++ b/source/blender/draw/intern/draw_pass.hh @@ -13,7 +13,7 @@ * submission is optimized for large number of draw calls. But has a significant overhead per * #Pass. Use many #PassSub along with a main #Pass to reduce the overhead and allow groupings of * commands. \note The draw call order inside a batch of multiple draw with the exact same state is - * not guaranteed and is not even deterministic. Use a PassSimple or PassSortable if ordering is + * not guaranteed and is not even deterministic. Use a #PassSimple or #PassSortable if ordering is * needed. \note As of now, it is also quite limited in the type of draw command it can record * (no custom vertex count, no custom first vertex). * @@ -25,7 +25,7 @@ * A lightweight #Pass that lives inside a main #Pass. It can only be created from #Pass.sub() * and is auto managed. This mean it can be created, filled and thrown away. A #PassSub reference * is valid until the next #Pass.init() of the parent pass. Commands recorded inside a #PassSub are - * inserted inside the parent #Pass where the sub have been created durring submission. + * inserted inside the parent #Pass where the sub have been created during submission. * * `PassSortable`: * This is a sort of `PassMain` augmented with a per sub-pass sorting value. They can't directly @@ -35,8 +35,9 @@ * \note A pass can be recorded once and resubmitted any number of time. This can be a good * optimization for passes that are always the same for each frame. The only thing to be aware of * is the life time of external resources. If a pass contains draw-calls with non default - * ResourceHandle (not 0) or a reference to any non static resources (GPUBatch, PushConstant ref, - * ResourceBind ref) it will have to be re-recorded if any of these reference becomes invalid. + * #ResourceHandle (not 0) or a reference to any non static resources + * (#GPUBatch, #PushConstant ref, #ResourceBind ref) it will have to be re-recorded + * if any of these reference becomes invalid. */ #include "BKE_image.h" @@ -362,7 +363,7 @@ template<typename DrawCommandBufType> class Pass : public detail::PassBase<DrawC * \{ */ /** - * Normal pass type. No visibility or draw-call optimisation. + * Normal pass type. No visibility or draw-call optimization. */ // using PassSimple = detail::Pass<DrawCommandBuf>; diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h index d43bfe6b159..bedbedcf438 100644 --- a/source/blender/draw/intern/draw_shader_shared.h +++ b/source/blender/draw/intern/draw_shader_shared.h @@ -131,7 +131,7 @@ struct ObjectInfos { float4 color; float4 infos; #else - /** Uploaded as center + size. Converted to mul+bias to local coord. */ + /** Uploaded as center + size. Converted to mul+bias to local coord. */ float3 orco_add; uint object_attrs_offset; float3 orco_mul; @@ -275,7 +275,7 @@ BLI_STATIC_ASSERT_ALIGN(DRWDebugPrintBuffer, 16) /* Reuse first instance as row index as we don't use instancing. Equivalent to * `DRWDebugPrintBuffer.command.i_first`. */ #define drw_debug_print_row_shared drw_debug_print_buf[3] -/** Offset to the first data. Equal to: sizeof(DrawCommand) / sizeof(uint). +/** Offset to the first data. Equal to: `sizeof(DrawCommand) / sizeof(uint)`. * This is needed because we bind the whole buffer as a `uint` array. */ #define drw_debug_print_offset 8 @@ -308,7 +308,7 @@ BLI_STATIC_ASSERT_ALIGN(DRWDebugPrintBuffer, 16) /* Equivalent to `DRWDebugDrawBuffer.command.v_count`. */ #define drw_debug_draw_v_count drw_debug_verts_buf[0].pos0 -/** Offset to the first data. Equal to: sizeof(DrawCommand) / sizeof(DRWDebugVert). +/** Offset to the first data. Equal to: `sizeof(DrawCommand) / sizeof(DRWDebugVert)`. * This is needed because we bind the whole buffer as a `DRWDebugVert` array. */ #define drw_debug_draw_offset 2 diff --git a/source/blender/draw/intern/draw_view.hh b/source/blender/draw/intern/draw_view.hh index 82e74774a5a..27e7a7a0028 100644 --- a/source/blender/draw/intern/draw_view.hh +++ b/source/blender/draw/intern/draw_view.hh @@ -16,7 +16,7 @@ namespace blender::draw { class Manager; -/* TODO deduplicate. */ +/* TODO: de-duplicate. */ using ObjectBoundsBuf = StorageArrayBuffer<ObjectBounds, 128>; /** \note Using uint4 for declaration but bound as uint. */ using VisibilityBuf = StorageArrayBuffer<uint4, 1, true>; @@ -26,7 +26,7 @@ class View { private: UniformBuffer<ViewInfos> data_; - /** Freezed version of data_ used for debugging culling. */ + /** Frozen version of data_ used for debugging culling. */ UniformBuffer<ViewInfos> data_freeze_; /** Result of the visibility computation. 1 bit per resource ID. */ VisibilityBuf visibility_buf_; diff --git a/source/blender/draw/intern/shaders/draw_command_generate_comp.glsl b/source/blender/draw/intern/shaders/draw_command_generate_comp.glsl index 70842e5bb81..3e640540777 100644 --- a/source/blender/draw/intern/shaders/draw_command_generate_comp.glsl +++ b/source/blender/draw/intern/shaders/draw_command_generate_comp.glsl @@ -28,7 +28,7 @@ void write_draw_call(DrawGroup group, uint group_id) command_buf[group_id * 2 + 1] = cmd; /* Reset the counters for a next command gen dispatch. Avoids resending the whole data just - * for this purpose. Only the last thread will execute this so it is threadsafe. */ + * for this purpose. Only the last thread will execute this so it is thread-safe. */ group_buf[group_id].front_facing_counter = 0u; group_buf[group_id].back_facing_counter = 0u; group_buf[group_id].total_counter = 0u; |