From 9dec9eee0d38b32ba4254b624c7a27dc22fc4302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 7 Oct 2022 13:15:22 +0200 Subject: Cleanup: DRW: Rename ViewInfos to ViewMatrices This makes sense now that the struct only contains matrices. --- source/blender/draw/intern/draw_manager.c | 3 +-- source/blender/draw/intern/draw_manager.h | 4 ++-- source/blender/draw/intern/draw_manager_data.cc | 8 ++++---- source/blender/draw/intern/draw_shader_shared.h | 7 +++---- source/blender/draw/intern/draw_view.cc | 2 +- source/blender/draw/intern/draw_view.hh | 4 ++-- source/blender/draw/intern/shaders/draw_view_info.hh | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) (limited to 'source/blender') diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 538fc0bfeb2..7bf6c7f0bb0 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -298,7 +298,6 @@ const float *DRW_viewport_invert_size_get(void) return DST.inv_size; } - const float *DRW_viewport_pixelsize_get(void) { return &DST.pixsize; @@ -599,7 +598,7 @@ static void drw_manager_init(DRWManager *dst, GPUViewport *viewport, const int s } if (G_draw.view_ubo == NULL) { - G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(ViewInfos), NULL, "G_draw.view_ubo"); + G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(ViewMatrices), NULL, "G_draw.view_ubo"); } if (G_draw.clipping_ubo == NULL) { diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 4124e7742b7..6b5a2cc4f6f 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -441,7 +441,7 @@ struct DRWView { /** Parent view if this is a sub view. NULL otherwise. */ struct DRWView *parent; - ViewInfos storage; + ViewMatrices storage; float4 clip_planes[6]; @@ -624,7 +624,7 @@ typedef struct DRWManager { uint primary_view_num; /** TODO(@fclem): Remove this. Only here to support * shaders without common_view_lib.glsl */ - ViewInfos view_storage_cpy; + ViewMatrices view_storage_cpy; #ifdef USE_GPU_SELECT uint select_id; diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc index 1c8d38ba162..06677344132 100644 --- a/source/blender/draw/intern/draw_manager_data.cc +++ b/source/blender/draw/intern/draw_manager_data.cc @@ -695,7 +695,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob) drw_call_calc_orco(ob, ob_infos->orcotexfac); /* Random float value. */ uint random = (DST.dupli_source) ? - DST.dupli_source->random_id : + DST.dupli_source->random_id : /* TODO(fclem): this is rather costly to do at runtime. Maybe we can * put it in ob->runtime and make depsgraph ensure it is up to date. */ BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0); @@ -2145,7 +2145,7 @@ static void draw_view_matrix_state_update(DRWView *view, const float viewmat[4][4], const float winmat[4][4]) { - ViewInfos *storage = &view->storage; + ViewMatrices *storage = &view->storage; copy_m4_m4(storage->viewmat.values, viewmat); invert_m4_m4(storage->viewinv.values, storage->viewmat.values); @@ -2354,14 +2354,14 @@ float DRW_view_far_distance_get(const DRWView *view) void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse) { view = (view) ? view : DST.view_default; - const ViewInfos *storage = &view->storage; + const ViewMatrices *storage = &view->storage; copy_m4_m4(mat, (inverse) ? storage->viewinv.values : storage->viewmat.values); } void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse) { view = (view) ? view : DST.view_default; - const ViewInfos *storage = &view->storage; + const ViewMatrices *storage = &view->storage; copy_m4_m4(mat, (inverse) ? storage->wininv.values : storage->winmat.values); } diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h index bf055daea3d..37899e36d8a 100644 --- a/source/blender/draw/intern/draw_shader_shared.h +++ b/source/blender/draw/intern/draw_shader_shared.h @@ -8,7 +8,7 @@ # include "draw_defines.h" typedef struct ViewCullingData ViewCullingData; -typedef struct ViewInfos ViewInfos; +typedef struct ViewMatrices ViewMatrices; typedef struct ObjectMatrices ObjectMatrices; typedef struct ObjectInfos ObjectInfos; typedef struct ObjectBounds ObjectBounds; @@ -60,14 +60,13 @@ struct ViewCullingData { }; BLI_STATIC_ASSERT_ALIGN(ViewCullingData, 16) -struct ViewInfos { - /* View matrices */ +struct ViewMatrices { float4x4 viewmat; float4x4 viewinv; float4x4 winmat; float4x4 wininv; }; -BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16) +BLI_STATIC_ASSERT_ALIGN(ViewMatrices, 16) /* Do not override old definitions if the shader uses this header but not shader info. */ #ifdef USE_GPU_SHADER_CREATE_INFO diff --git a/source/blender/draw/intern/draw_view.cc b/source/blender/draw/intern/draw_view.cc index 13b03e5a945..cf86558f80f 100644 --- a/source/blender/draw/intern/draw_view.cc +++ b/source/blender/draw/intern/draw_view.cc @@ -218,7 +218,7 @@ void View::bind() void View::compute_visibility(ObjectBoundsBuf &bounds, uint resource_len, bool debug_freeze) { if (debug_freeze && frozen_ == false) { - data_freeze_ = static_cast(data_); + data_freeze_ = static_cast(data_); data_freeze_.push_update(); culling_freeze_ = static_cast(culling_); culling_freeze_.push_update(); diff --git a/source/blender/draw/intern/draw_view.hh b/source/blender/draw/intern/draw_view.hh index d31cfec679e..4fc74e3e890 100644 --- a/source/blender/draw/intern/draw_view.hh +++ b/source/blender/draw/intern/draw_view.hh @@ -25,10 +25,10 @@ class View { friend Manager; private: - UniformBuffer data_; + UniformBuffer data_; UniformBuffer culling_; /** Frozen version of data_ used for debugging culling. */ - UniformBuffer data_freeze_; + UniformBuffer data_freeze_; UniformBuffer culling_freeze_; /** Result of the visibility computation. 1 bit per resource ID. */ VisibilityBuf visibility_buf_; diff --git a/source/blender/draw/intern/shaders/draw_view_info.hh b/source/blender/draw/intern/shaders/draw_view_info.hh index 5ebf3853266..7b500f66a68 100644 --- a/source/blender/draw/intern/shaders/draw_view_info.hh +++ b/source/blender/draw/intern/shaders/draw_view_info.hh @@ -45,7 +45,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle) * \{ */ GPU_SHADER_CREATE_INFO(draw_view) - .uniform_buf(DRW_VIEW_UBO_SLOT, "ViewInfos", "drw_view", Frequency::PASS) + .uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view", Frequency::PASS) .typedef_source("draw_shader_shared.h"); GPU_SHADER_CREATE_INFO(draw_view_culling) -- cgit v1.2.3