From c7502b092d6a7c58e5d7215abb3f857bdbd76d16 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 26 Jan 2025 20:08:03 +0100 Subject: [PATCH] Cleanup: Various clang-tidy warnings in gpu Pull Request: https://projects.blender.org/blender/blender/pulls/133734 --- source/blender/gpu/GPU_batch.hh | 1 - source/blender/gpu/GPU_batch_presets.hh | 1 - source/blender/gpu/GPU_common.hh | 2 - source/blender/gpu/GPU_common_types.hh | 4 +- source/blender/gpu/GPU_context.hh | 2 - source/blender/gpu/GPU_debug.hh | 2 - source/blender/gpu/GPU_immediate.hh | 4 +- source/blender/gpu/GPU_init_exit.hh | 2 - source/blender/gpu/GPU_material.hh | 2 - source/blender/gpu/GPU_matrix.hh | 2 - source/blender/gpu/GPU_platform.hh | 3 +- source/blender/gpu/GPU_primitive.hh | 2 +- source/blender/gpu/GPU_shader_shared_utils.hh | 1 + source/blender/gpu/GPU_texture.hh | 2 - source/blender/gpu/GPU_vertex_buffer.hh | 1 + source/blender/gpu/GPU_vertex_format.hh | 3 +- source/blender/gpu/dummy/dummy_backend.hh | 1 - source/blender/gpu/dummy/dummy_context.hh | 4 +- .../blender/gpu/dummy/dummy_vertex_buffer.hh | 4 ++ source/blender/gpu/intern/gpu_backend.hh | 20 ++++----- source/blender/gpu/intern/gpu_batch.cc | 24 ++++------- .../blender/gpu/intern/gpu_batch_presets.cc | 1 - source/blender/gpu/intern/gpu_batch_utils.cc | 8 ++-- .../gpu/intern/gpu_capabilities_private.hh | 2 +- source/blender/gpu/intern/gpu_codegen.cc | 2 - source/blender/gpu/intern/gpu_context.cc | 7 +--- .../blender/gpu/intern/gpu_context_private.hh | 2 - source/blender/gpu/intern/gpu_framebuffer.cc | 2 - .../gpu/intern/gpu_framebuffer_private.hh | 42 +++++++++---------- source/blender/gpu/intern/gpu_immediate.cc | 1 + .../blender/gpu/intern/gpu_immediate_util.cc | 1 - source/blender/gpu/intern/gpu_index_buffer.cc | 3 +- source/blender/gpu/intern/gpu_init_exit.cc | 1 - source/blender/gpu/intern/gpu_material.cc | 2 - source/blender/gpu/intern/gpu_matrix.cc | 2 +- source/blender/gpu/intern/gpu_node_graph.hh | 2 - source/blender/gpu/intern/gpu_select.cc | 2 - source/blender/gpu/intern/gpu_select_pick.cc | 2 +- .../gpu/intern/gpu_select_sample_query.cc | 2 - source/blender/gpu/intern/gpu_shader.cc | 3 -- .../blender/gpu/intern/gpu_shader_builtin.cc | 1 - .../gpu/intern/gpu_shader_create_info.cc | 2 - .../gpu/intern/gpu_shader_create_info.hh | 26 ++++++------ .../gpu/intern/gpu_shader_dependency.cc | 6 +-- .../gpu/intern/gpu_shader_interface.hh | 26 ++++++------ source/blender/gpu/intern/gpu_shader_log.cc | 2 - .../blender/gpu/intern/gpu_shader_private.hh | 7 ++-- .../blender/gpu/intern/gpu_storage_buffer.cc | 4 +- .../gpu/intern/gpu_storage_buffer_private.hh | 1 - source/blender/gpu/intern/gpu_texture.cc | 2 +- .../blender/gpu/intern/gpu_texture_private.hh | 3 +- .../blender/gpu/intern/gpu_uniform_buffer.cc | 3 +- source/blender/gpu/intern/gpu_viewport.cc | 2 +- source/blender/gpu/metal/mtl_context.hh | 3 -- .../blender/gpu/metal/mtl_shader_interface.mm | 2 +- source/blender/gpu/opengl/gl_backend.cc | 5 +++ source/blender/gpu/opengl/gl_shader.hh | 1 + .../blender/gpu/tests/buffer_texture_test.cc | 2 +- source/blender/gpu/tests/compute_test.cc | 1 + source/blender/gpu/tests/framebuffer_test.cc | 5 +++ source/blender/gpu/tests/gpu_testing.cc | 1 + source/blender/gpu/tests/immediate_test.cc | 1 + source/blender/gpu/tests/index_buffer_test.cc | 2 - .../blender/gpu/tests/push_constants_test.cc | 1 + source/blender/gpu/tests/shader_test.cc | 3 +- .../tests/specialization_constants_test.cc | 2 + source/blender/gpu/tests/state_blend_test.cc | 2 +- source/blender/gpu/tests/texture_test.cc | 4 +- .../blender/gpu/tests/vertex_buffer_test.cc | 4 +- source/blender/gpu/vulkan/vk_common.hh | 1 + .../blender/gpu/vulkan/vk_shader_compiler.hh | 2 + source/blender/python/gpu/gpu_py_offscreen.cc | 1 + source/blender/python/gpu/gpu_py_texture.cc | 1 + 73 files changed, 132 insertions(+), 171 deletions(-) diff --git a/source/blender/gpu/GPU_batch.hh b/source/blender/gpu/GPU_batch.hh index b0f395cb0dd..0dd03b6d450 100644 --- a/source/blender/gpu/GPU_batch.hh +++ b/source/blender/gpu/GPU_batch.hh @@ -24,7 +24,6 @@ #include "GPU_index_buffer.hh" #include "GPU_shader.hh" #include "GPU_storage_buffer.hh" -#include "GPU_uniform_buffer.hh" #include "GPU_vertex_buffer.hh" struct GPUShader; diff --git a/source/blender/gpu/GPU_batch_presets.hh b/source/blender/gpu/GPU_batch_presets.hh index c393a88c18c..6e4775e9e3a 100644 --- a/source/blender/gpu/GPU_batch_presets.hh +++ b/source/blender/gpu/GPU_batch_presets.hh @@ -12,7 +12,6 @@ #pragma once #include "BLI_compiler_attrs.h" -#include "BLI_sys_types.h" namespace blender::gpu { class Batch; diff --git a/source/blender/gpu/GPU_common.hh b/source/blender/gpu/GPU_common.hh index 391f669ac53..f2fe2149de7 100644 --- a/source/blender/gpu/GPU_common.hh +++ b/source/blender/gpu/GPU_common.hh @@ -11,8 +11,6 @@ #define PROGRAM_NO_OPTI 0 // #define GPU_NO_USE_PY_REFERENCES -#include "BLI_sys_types.h" - /* GPU_INLINE */ #if defined(_MSC_VER) # define GPU_INLINE static __forceinline diff --git a/source/blender/gpu/GPU_common_types.hh b/source/blender/gpu/GPU_common_types.hh index 1a14100448e..004b8287465 100644 --- a/source/blender/gpu/GPU_common_types.hh +++ b/source/blender/gpu/GPU_common_types.hh @@ -181,7 +181,7 @@ struct SpecializationConstant { float f; }; - inline bool operator==(const Value &other) const + bool operator==(const Value &other) const { return u == other.u; } @@ -213,7 +213,7 @@ struct SpecializationConstant { this->value.u = value ? 1 : 0; } - inline bool operator==(const SpecializationConstant &b) const + bool operator==(const SpecializationConstant &b) const { return this->type == b.type && this->name == b.name && this->value == b.value; } diff --git a/source/blender/gpu/GPU_context.hh b/source/blender/gpu/GPU_context.hh index 8529cc87b8e..c7b457a9615 100644 --- a/source/blender/gpu/GPU_context.hh +++ b/source/blender/gpu/GPU_context.hh @@ -10,8 +10,6 @@ #pragma once -#include "GPU_batch.hh" -#include "GPU_common.hh" #include "GPU_platform.hh" /* GPU back-ends abstract the differences between different APIs. #GPU_context_create diff --git a/source/blender/gpu/GPU_debug.hh b/source/blender/gpu/GPU_debug.hh index 67ff48a38be..ff41c88d734 100644 --- a/source/blender/gpu/GPU_debug.hh +++ b/source/blender/gpu/GPU_debug.hh @@ -61,8 +61,6 @@ #pragma once -#include "BLI_sys_types.h" - #define GPU_DEBUG_SHADER_COMPILATION_GROUP "Shader Compilation" void GPU_debug_group_begin(const char *name); diff --git a/source/blender/gpu/GPU_immediate.hh b/source/blender/gpu/GPU_immediate.hh index 10097e4df7e..0745399f54c 100644 --- a/source/blender/gpu/GPU_immediate.hh +++ b/source/blender/gpu/GPU_immediate.hh @@ -11,12 +11,14 @@ #pragma once #include "GPU_batch.hh" -#include "GPU_immediate_util.hh" +#include "GPU_immediate_util.hh" /* IWYU pragma: export */ #include "GPU_primitive.hh" #include "GPU_shader.hh" #include "GPU_texture.hh" #include "GPU_vertex_format.hh" +struct GPUUniformBuf; + /** Returns a cleared vertex format, ready for #add_attr. */ GPUVertFormat *immVertexFormat(); diff --git a/source/blender/gpu/GPU_init_exit.hh b/source/blender/gpu/GPU_init_exit.hh index 9668c25ccc4..39632b5e975 100644 --- a/source/blender/gpu/GPU_init_exit.hh +++ b/source/blender/gpu/GPU_init_exit.hh @@ -8,8 +8,6 @@ #pragma once -#include "BLI_utildefines.h" - void GPU_init(); void GPU_exit(); bool GPU_is_init(); diff --git a/source/blender/gpu/GPU_material.hh b/source/blender/gpu/GPU_material.hh index c4b01ad7db5..ffff5e01249 100644 --- a/source/blender/gpu/GPU_material.hh +++ b/source/blender/gpu/GPU_material.hh @@ -14,8 +14,6 @@ #include "DNA_image_types.h" #include "DNA_listBase.h" -#include "BLI_sys_types.h" /* for bool */ - #include "GPU_shader.hh" /* for GPUShaderCreateInfo */ #include "GPU_texture.hh" /* for GPUSamplerState */ diff --git a/source/blender/gpu/GPU_matrix.hh b/source/blender/gpu/GPU_matrix.hh index 2c23de61033..0eff7e2dfca 100644 --- a/source/blender/gpu/GPU_matrix.hh +++ b/source/blender/gpu/GPU_matrix.hh @@ -8,8 +8,6 @@ #pragma once -#include "BLI_sys_types.h" - struct GPUShader; /** diff --git a/source/blender/gpu/GPU_platform.hh b/source/blender/gpu/GPU_platform.hh index 0b21a220a57..ad4ae4826c2 100644 --- a/source/blender/gpu/GPU_platform.hh +++ b/source/blender/gpu/GPU_platform.hh @@ -11,10 +11,9 @@ #include #include "BLI_span.hh" -#include "BLI_sys_types.h" #include "BLI_utildefines.h" -#include "GPU_platform_backend_enum.h" +#include "GPU_platform_backend_enum.h" // IWYU pragma: export /* GPU platform support */ diff --git a/source/blender/gpu/GPU_primitive.hh b/source/blender/gpu/GPU_primitive.hh index abd6eb63664..5a098bbf5cc 100644 --- a/source/blender/gpu/GPU_primitive.hh +++ b/source/blender/gpu/GPU_primitive.hh @@ -11,7 +11,7 @@ #pragma once #include "BLI_assert.h" -#include "GPU_common.hh" +#include "BLI_sys_types.h" enum GPUPrimType { GPU_PRIM_POINTS, diff --git a/source/blender/gpu/GPU_shader_shared_utils.hh b/source/blender/gpu/GPU_shader_shared_utils.hh index 4f72f75546b..558a363696c 100644 --- a/source/blender/gpu/GPU_shader_shared_utils.hh +++ b/source/blender/gpu/GPU_shader_shared_utils.hh @@ -75,6 +75,7 @@ # pragma once # include "BLI_assert.h" +# include "BLI_sys_types.h" # include "BLI_math_matrix_types.hh" # include "BLI_math_vector_types.hh" diff --git a/source/blender/gpu/GPU_texture.hh b/source/blender/gpu/GPU_texture.hh index ce20d5bce62..426298df269 100644 --- a/source/blender/gpu/GPU_texture.hh +++ b/source/blender/gpu/GPU_texture.hh @@ -17,8 +17,6 @@ #include "BLI_assert.h" #include "BLI_utildefines.h" -#include "GPU_state.hh" - namespace blender::gpu { class VertBuf; } diff --git a/source/blender/gpu/GPU_vertex_buffer.hh b/source/blender/gpu/GPU_vertex_buffer.hh index e8989077514..8a42782ff60 100644 --- a/source/blender/gpu/GPU_vertex_buffer.hh +++ b/source/blender/gpu/GPU_vertex_buffer.hh @@ -13,6 +13,7 @@ #include "BLI_span.hh" #include "BLI_utildefines.h" +#include "GPU_common.hh" #include "GPU_vertex_format.hh" enum GPUVertBufStatus { diff --git a/source/blender/gpu/GPU_vertex_format.hh b/source/blender/gpu/GPU_vertex_format.hh index 42ce1ad04f2..3ee888c4cbc 100644 --- a/source/blender/gpu/GPU_vertex_format.hh +++ b/source/blender/gpu/GPU_vertex_format.hh @@ -12,9 +12,8 @@ #include "BLI_assert.h" #include "BLI_compiler_compat.h" -#include "BLI_math_geom.h" +#include "BLI_math_vector.h" #include "BLI_math_vector_types.hh" -#include "GPU_common.hh" struct GPUShader; diff --git a/source/blender/gpu/dummy/dummy_backend.hh b/source/blender/gpu/dummy/dummy_backend.hh index 472557f3057..523095b3e48 100644 --- a/source/blender/gpu/dummy/dummy_backend.hh +++ b/source/blender/gpu/dummy/dummy_backend.hh @@ -9,7 +9,6 @@ #pragma once #include "gpu_backend.hh" -#include "gpu_capabilities_private.hh" #include "gpu_platform_private.hh" #include "dummy_batch.hh" diff --git a/source/blender/gpu/dummy/dummy_context.hh b/source/blender/gpu/dummy/dummy_context.hh index 43379b5dc2f..f75c1f33514 100644 --- a/source/blender/gpu/dummy/dummy_context.hh +++ b/source/blender/gpu/dummy/dummy_context.hh @@ -20,7 +20,7 @@ class DummyContext : public Context { { back_left = active_fb = new DummyFrameBuffer("DummyFramebuffer"); } - ~DummyContext() + ~DummyContext() override { free_framebuffers(); } @@ -34,7 +34,7 @@ class DummyContext : public Context { void memory_statistics_get(int * /*r_total_mem*/, int * /*r_free_mem*/) override {} - void debug_group_begin(const char *, int) override {} + void debug_group_begin(const char * /*unused*/, int /*unused*/) override {} void debug_group_end() override {} bool debug_capture_begin(const char * /*title*/) override { diff --git a/source/blender/gpu/dummy/dummy_vertex_buffer.hh b/source/blender/gpu/dummy/dummy_vertex_buffer.hh index 0af600e83f7..4093d1c2250 100644 --- a/source/blender/gpu/dummy/dummy_vertex_buffer.hh +++ b/source/blender/gpu/dummy/dummy_vertex_buffer.hh @@ -8,6 +8,10 @@ #pragma once +#include "BLI_sys_types.h" + +#include "GPU_vertex_buffer.hh" + namespace blender::gpu { class DummyVertexBuffer : public VertBuf { diff --git a/source/blender/gpu/intern/gpu_backend.hh b/source/blender/gpu/intern/gpu_backend.hh index 30cd289bd9f..8d63503ff56 100644 --- a/source/blender/gpu/intern/gpu_backend.hh +++ b/source/blender/gpu/intern/gpu_backend.hh @@ -71,33 +71,31 @@ static inline ColorTheme4f get_debug_group_color(StringRefNull name) if (name == "EEVEE") { return ColorTheme4f(1.0, 0.5, 0.0, 1.0); } - else if (name == "External") { + if (name == "External") { return ColorTheme4f(0.0, 0.0, 1.0, 1.0); } - else if (name == "GpencilMode") { + if (name == "GpencilMode") { return ColorTheme4f(1.0, 1.0, 0.0, 1.0); } - else if (name == "UV/Image") { + if (name == "UV/Image") { return ColorTheme4f(0.0, 1.0, 1.0, 1.0); } - else if (name == "Overlay") { + if (name == "Overlay") { return ColorTheme4f(0.0, 1.0, 0.5, 1.0); } - else if (name == "Workbench") { + if (name == "Workbench") { return ColorTheme4f(0.0, 0.7, 1.0, 1.0); } - else if (name == "Cycles") { + if (name == "Cycles") { return ColorTheme4f(0.0, 0.5, 1.0, 1.0); } - else if (name == "BackBuffer.Blit") { + if (name == "BackBuffer.Blit") { return ColorTheme4f(0.5, 0.7, 1.0, 1.0); } - else if (name == "Compositor") { + if (name == "Compositor") { return ColorTheme4f(1.0, 0.5, 0.7, 1.0); } - else { - return GPU_DEBUG_GROUP_COLOR_DEFAULT; - } + return GPU_DEBUG_GROUP_COLOR_DEFAULT; } } // namespace debug diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index 34b69502c41..c92f95c17a8 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -9,14 +9,11 @@ * Contains VAOs + VBOs + Shader representing a drawable entity. */ -#include "MEM_guardedalloc.h" - #include "BLI_math_base.h" #include "BLI_utildefines.h" #include "GPU_batch.hh" #include "GPU_batch_presets.hh" -#include "GPU_platform.hh" #include "GPU_shader.hh" #include "GPU_index_buffer.hh" @@ -328,14 +325,12 @@ void GPU_batch_bind_as_resources(Batch *batch, GPUShader *shader) /** \name Drawing / Drawcall functions * \{ */ -void GPU_batch_draw_parameter_get(Batch *gpu_batch, +void GPU_batch_draw_parameter_get(Batch *batch, int *r_vertex_count, int *r_vertex_first, int *r_base_index, int *r_instance_count) { - Batch *batch = static_cast(gpu_batch); - if (batch->elem) { *r_vertex_count = batch->elem_()->index_len_get(); *r_vertex_first = batch->elem_()->index_start_get(); @@ -393,7 +388,7 @@ static void polyline_draw_workaround( Batch *tri_batch = Context::get()->polyline_batch_get(); GPU_batch_set_shader(tri_batch, batch->shader); - int vert_stride_count[3] = {(batch->prim_type == GPU_PRIM_LINES) ? 2 : 1, int(vertex_count), 0}; + int vert_stride_count[3] = {(batch->prim_type == GPU_PRIM_LINES) ? 2 : 1, vertex_count, 0}; GPU_shader_uniform_3iv(batch->shader, "gpu_vert_stride_count_offset", vert_stride_count); /* Assume GPU_FETCH_FLOAT for now. A bit cumbersome to assert for this or to find the correct * attribute. */ @@ -451,12 +446,11 @@ void GPU_batch_draw_instance_range(Batch *batch, int instance_first, int instanc } void GPU_batch_draw_advanced( - Batch *gpu_batch, int vertex_first, int vertex_count, int instance_first, int instance_count) + Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count) { - BLI_assert(gpu_batch != nullptr); + BLI_assert(batch != nullptr); BLI_assert(Context::get()->shader != nullptr); Context::get()->assert_framebuffer_shader_compatibility(Context::get()->shader); - Batch *batch = static_cast(gpu_batch); if (vertex_count == 0) { if (batch->elem) { @@ -482,25 +476,23 @@ void GPU_batch_draw_advanced( batch->draw(vertex_first, vertex_count, instance_first, instance_count); } -void GPU_batch_draw_indirect(Batch *gpu_batch, GPUStorageBuf *indirect_buf, intptr_t offset) +void GPU_batch_draw_indirect(Batch *batch, GPUStorageBuf *indirect_buf, intptr_t offset) { - BLI_assert(gpu_batch != nullptr); + BLI_assert(batch != nullptr); BLI_assert(indirect_buf != nullptr); BLI_assert(Context::get()->shader != nullptr); Context::get()->assert_framebuffer_shader_compatibility(Context::get()->shader); - Batch *batch = static_cast(gpu_batch); batch->draw_indirect(indirect_buf, offset); } void GPU_batch_multi_draw_indirect( - Batch *gpu_batch, GPUStorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride) + Batch *batch, GPUStorageBuf *indirect_buf, int count, intptr_t offset, intptr_t stride) { - BLI_assert(gpu_batch != nullptr); + BLI_assert(batch != nullptr); BLI_assert(indirect_buf != nullptr); BLI_assert(Context::get()->shader != nullptr); Context::get()->assert_framebuffer_shader_compatibility(Context::get()->shader); - Batch *batch = static_cast(gpu_batch); batch->multi_draw_indirect(indirect_buf, count, offset, stride); } diff --git a/source/blender/gpu/intern/gpu_batch_presets.cc b/source/blender/gpu/intern/gpu_batch_presets.cc index b4b707698e8..056fe7a2ae4 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.cc +++ b/source/blender/gpu/intern/gpu_batch_presets.cc @@ -9,7 +9,6 @@ #include "BLI_listbase.h" #include "BLI_math_vector_types.hh" #include "BLI_threads.h" -#include "BLI_utildefines.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/gpu/intern/gpu_batch_utils.cc b/source/blender/gpu/intern/gpu_batch_utils.cc index c10cdeb7461..1c28cd17ae0 100644 --- a/source/blender/gpu/intern/gpu_batch_utils.cc +++ b/source/blender/gpu/intern/gpu_batch_utils.cc @@ -8,9 +8,9 @@ #include "MEM_guardedalloc.h" -#include "BLI_math_base.h" +#include "DNA_vec_types.h" + #include "BLI_polyfill_2d.h" -#include "BLI_rect.h" #include "BLI_sort_utils.h" #include "BLI_utildefines.h" @@ -25,7 +25,7 @@ blender::gpu::Batch *GPU_batch_tris_from_poly_2d_encoded(const uchar *polys_flat uint polys_flat_len, const rctf *rect) { - const uchar(*polys)[2] = static_cast((const void *)polys_flat); + const uchar(*polys)[2] = reinterpret_cast(polys_flat); const uint polys_len = polys_flat_len / 2; BLI_assert(polys_flat_len == polys_len * 2); @@ -114,7 +114,7 @@ blender::gpu::Batch *GPU_batch_wire_from_poly_2d_encoded(const uchar *polys_flat uint polys_flat_len, const rctf *rect) { - const uchar(*polys)[2] = static_cast((const void *)polys_flat); + const uchar(*polys)[2] = reinterpret_cast(polys_flat); const uint polys_len = polys_flat_len / 2; BLI_assert(polys_flat_len == polys_len * 2); diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index 44d76cbce9d..bee7d403872 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -8,7 +8,7 @@ #pragma once -#include "GPU_platform.hh" +#include "BLI_sys_types.h" namespace blender::gpu { diff --git a/source/blender/gpu/intern/gpu_codegen.cc b/source/blender/gpu/intern/gpu_codegen.cc index a6dd3ae5060..eed77d47455 100644 --- a/source/blender/gpu/intern/gpu_codegen.cc +++ b/source/blender/gpu/intern/gpu_codegen.cc @@ -11,7 +11,6 @@ #include "MEM_guardedalloc.h" #include "DNA_customdata_types.h" -#include "DNA_image_types.h" #include "DNA_material_types.h" #include "BLI_ghash.h" @@ -22,7 +21,6 @@ #include "BLI_string.h" #include "BLI_threads.h" #include "BLI_time.h" -#include "BLI_utildefines.h" #include "BKE_cryptomatte.hh" #include "BKE_material.hh" diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc index 96de0f0da77..11558b2b305 100644 --- a/source/blender/gpu/intern/gpu_context.cc +++ b/source/blender/gpu/intern/gpu_context.cc @@ -13,16 +13,14 @@ * - free can be called from any thread */ -#include "GHOST_C-api.h" - #include "BKE_global.hh" #include "BLI_assert.h" -#include "BLI_utildefines.h" #include "BLI_vector_set.hh" +#include "GHOST_Types.h" + #include "GPU_context.hh" -#include "GPU_framebuffer.hh" #include "GPU_batch.hh" #include "gpu_backend.hh" @@ -44,7 +42,6 @@ #include "dummy_backend.hh" #include -#include using namespace blender::gpu; diff --git a/source/blender/gpu/intern/gpu_context_private.hh b/source/blender/gpu/intern/gpu_context_private.hh index 6df24a07162..42964372b58 100644 --- a/source/blender/gpu/intern/gpu_context_private.hh +++ b/source/blender/gpu/intern/gpu_context_private.hh @@ -10,8 +10,6 @@ #pragma once -#include "MEM_guardedalloc.h" - #include "BKE_global.hh" #include "GPU_batch.hh" diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 0d5d4232491..1c7c5638f2e 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -12,9 +12,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" -#include "GPU_batch.hh" #include "GPU_capabilities.hh" -#include "GPU_shader.hh" #include "GPU_texture.hh" #include "gpu_backend.hh" diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index e42c95eb661..fda01dd69c8 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -13,8 +13,6 @@ #include "BLI_math_vector.h" #include "BLI_span.hh" -#include "MEM_guardedalloc.h" - #include "GPU_framebuffer.hh" struct GPUTexture; @@ -39,12 +37,12 @@ enum GPUAttachmentType : int { #define GPU_FB_MAX_COLOR_ATTACHMENT (GPU_FB_MAX_ATTACHMENT - GPU_FB_COLOR_ATTACHMENT0) -inline constexpr GPUAttachmentType operator-(GPUAttachmentType a, int b) +constexpr GPUAttachmentType operator-(GPUAttachmentType a, int b) { return static_cast(int(a) - b); } -inline constexpr GPUAttachmentType operator+(GPUAttachmentType a, int b) +constexpr GPUAttachmentType operator+(GPUAttachmentType a, int b) { return static_cast(int(a) + b); } @@ -133,7 +131,7 @@ class FrameBuffer { virtual void subpass_transition_impl(const GPUAttachmentState depth_attachment_state, Span color_attachment_states) = 0; - inline void set_color_attachment_bit(GPUAttachmentType type, bool value) + void set_color_attachment_bit(GPUAttachmentType type, bool value) { if (type >= GPU_FB_COLOR_ATTACHMENT0) { int color_index = type - GPU_FB_COLOR_ATTACHMENT0; @@ -156,7 +154,7 @@ class FrameBuffer { uint get_bits_per_pixel(); /* Sets the size after creation. */ - inline void size_set(int width, int height) + void size_set(int width, int height) { width_ = width; height_ = height; @@ -164,7 +162,7 @@ class FrameBuffer { } /* Sets the size for frame-buffer with no attachments. */ - inline void default_size_set(int width, int height) + void default_size_set(int width, int height) { width_ = width; height_ = height; @@ -172,7 +170,7 @@ class FrameBuffer { dirty_state_ = true; } - inline void viewport_set(const int viewport[4]) + void viewport_set(const int viewport[4]) { if (!equals_v4v4_int(viewport_[0], viewport)) { copy_v4_v4_int(viewport_[0], viewport); @@ -181,7 +179,7 @@ class FrameBuffer { multi_viewport_ = false; } - inline void viewport_multi_set(const int viewports[GPU_MAX_VIEWPORTS][4]) + void viewport_multi_set(const int viewports[GPU_MAX_VIEWPORTS][4]) { for (size_t i = 0; i < GPU_MAX_VIEWPORTS; i++) { if (!equals_v4v4_int(viewport_[i], viewports[i])) { @@ -192,7 +190,7 @@ class FrameBuffer { multi_viewport_ = true; } - inline void scissor_set(const int scissor[4]) + void scissor_set(const int scissor[4]) { if (!equals_v4v4_int(scissor_, scissor)) { copy_v4_v4_int(scissor_, scissor); @@ -200,40 +198,40 @@ class FrameBuffer { } } - inline void scissor_test_set(bool test) + void scissor_test_set(bool test) { scissor_test_ = test; dirty_state_ = true; } - inline void viewport_get(int r_viewport[4]) const + void viewport_get(int r_viewport[4]) const { copy_v4_v4_int(r_viewport, viewport_[0]); } - inline void scissor_get(int r_scissor[4]) const + void scissor_get(int r_scissor[4]) const { copy_v4_v4_int(r_scissor, scissor_); } - inline bool scissor_test_get() const + bool scissor_test_get() const { return scissor_test_; } - inline void viewport_reset() + void viewport_reset() { int viewport_rect[4] = {0, 0, width_, height_}; viewport_set(viewport_rect); } - inline void scissor_reset() + void scissor_reset() { int scissor_rect[4] = {0, 0, width_, height_}; scissor_set(scissor_rect); } - inline GPUTexture *depth_tex() const + GPUTexture *depth_tex() const { if (attachments_[GPU_FB_DEPTH_ATTACHMENT].tex) { return attachments_[GPU_FB_DEPTH_ATTACHMENT].tex; @@ -241,27 +239,27 @@ class FrameBuffer { return attachments_[GPU_FB_DEPTH_STENCIL_ATTACHMENT].tex; }; - inline GPUTexture *color_tex(int slot) const + GPUTexture *color_tex(int slot) const { return attachments_[GPU_FB_COLOR_ATTACHMENT0 + slot].tex; }; - inline const char *name_get() const + const char *name_get() const { return name_; }; - inline void set_use_explicit_loadstore(bool use_explicit_loadstore) + void set_use_explicit_loadstore(bool use_explicit_loadstore) { use_explicit_load_store_ = use_explicit_loadstore; } - inline bool get_use_explicit_loadstore() const + bool get_use_explicit_loadstore() const { return use_explicit_load_store_; } - inline uint16_t get_color_attachments_bitset() + uint16_t get_color_attachments_bitset() { return color_attachments_bits_; } diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index 04ea52fe915..53969824670 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -15,6 +15,7 @@ #include "GPU_immediate.hh" #include "GPU_matrix.hh" #include "GPU_texture.hh" +#include "GPU_uniform_buffer.hh" #include "gpu_context_private.hh" #include "gpu_immediate_private.hh" diff --git a/source/blender/gpu/intern/gpu_immediate_util.cc b/source/blender/gpu/intern/gpu_immediate_util.cc index 90845be99a7..e1abcea1f03 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.cc +++ b/source/blender/gpu/intern/gpu_immediate_util.cc @@ -8,7 +8,6 @@ * GPU immediate mode drawing utilities */ -#include #include #include "BLI_math_rotation.h" diff --git a/source/blender/gpu/intern/gpu_index_buffer.cc b/source/blender/gpu/intern/gpu_index_buffer.cc index 7cab56aae5f..c5a3c085088 100644 --- a/source/blender/gpu/intern/gpu_index_buffer.cc +++ b/source/blender/gpu/intern/gpu_index_buffer.cc @@ -21,6 +21,7 @@ #include "GPU_capabilities.hh" #include "GPU_compute.hh" #include "GPU_platform.hh" +#include "GPU_state.hh" #include /* For `min/max`. */ #include @@ -529,7 +530,7 @@ void GPU_indexbuf_create_subrange_in_place(IndexBuf *elem, void GPU_indexbuf_read(IndexBuf *elem, uint32_t *data) { - return elem->read(data); + elem->read(data); } void GPU_indexbuf_discard(IndexBuf *elem) diff --git a/source/blender/gpu/intern/gpu_init_exit.cc b/source/blender/gpu/intern/gpu_init_exit.cc index 71a541cb6e2..8f195bf003b 100644 --- a/source/blender/gpu/intern/gpu_init_exit.cc +++ b/source/blender/gpu/intern/gpu_init_exit.cc @@ -7,7 +7,6 @@ */ #include "GPU_init_exit.hh" /* interface */ -#include "BLI_sys_types.h" #include "GPU_batch.hh" #include "intern/gpu_codegen.hh" diff --git a/source/blender/gpu/intern/gpu_material.cc b/source/blender/gpu/intern/gpu_material.cc index fe32d0f2be1..d4641bc7f04 100644 --- a/source/blender/gpu/intern/gpu_material.cc +++ b/source/blender/gpu/intern/gpu_material.cc @@ -8,8 +8,6 @@ * Manages materials, lights and textures. */ -#include -#include #include #include "MEM_guardedalloc.h" diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc index 4c2326b3a6b..e7c1ff86cce 100644 --- a/source/blender/gpu/intern/gpu_matrix.cc +++ b/source/blender/gpu/intern/gpu_matrix.cc @@ -588,7 +588,7 @@ const float (*GPU_matrix_normal_get(float m[3][3]))[3] m = temp3; } - copy_m3_m4(m, (const float(*)[4])GPU_matrix_model_view_get(nullptr)); + copy_m3_m4(m, GPU_matrix_model_view_get(nullptr)); invert_m3(m); transpose_m3(m); diff --git a/source/blender/gpu/intern/gpu_node_graph.hh b/source/blender/gpu/intern/gpu_node_graph.hh index 095c1fba0c8..e0d998cd96a 100644 --- a/source/blender/gpu/intern/gpu_node_graph.hh +++ b/source/blender/gpu/intern/gpu_node_graph.hh @@ -10,13 +10,11 @@ #pragma once -#include "DNA_customdata_types.h" #include "DNA_listBase.h" #include "BLI_ghash.h" #include "GPU_material.hh" -#include "GPU_shader.hh" struct GPUNode; struct GPUOutput; diff --git a/source/blender/gpu/intern/gpu_select.cc b/source/blender/gpu/intern/gpu_select.cc index 5126677cd21..022cdc4b45c 100644 --- a/source/blender/gpu/intern/gpu_select.cc +++ b/source/blender/gpu/intern/gpu_select.cc @@ -11,8 +11,6 @@ #include #include -#include "DNA_userdef_types.h" - #include "GPU_select.hh" #include "BLI_rect.h" diff --git a/source/blender/gpu/intern/gpu_select_pick.cc b/source/blender/gpu/intern/gpu_select_pick.cc index 4e74b58d9e0..a5f84346a20 100644 --- a/source/blender/gpu/intern/gpu_select_pick.cc +++ b/source/blender/gpu/intern/gpu_select_pick.cc @@ -25,7 +25,7 @@ #include "gpu_select_private.hh" -#include "BLI_strict_flags.h" /* Keep last. */ +#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */ // #define DEBUG_PRINT diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc index f69529d32d6..b45dc3d2258 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.cc +++ b/source/blender/gpu/intern/gpu_select_sample_query.cc @@ -16,8 +16,6 @@ #include "GPU_select.hh" #include "GPU_state.hh" -#include "MEM_guardedalloc.h" - #include "BLI_rect.h" #include "BLI_utildefines.h" diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index cbdfb2853be..b713687492c 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -6,11 +6,8 @@ * \ingroup gpu */ -#include "MEM_guardedalloc.h" - #include "BLI_math_matrix.h" #include "BLI_string.h" -#include "BLI_string_utils.hh" #include "GPU_capabilities.hh" #include "GPU_debug.hh" diff --git a/source/blender/gpu/intern/gpu_shader_builtin.cc b/source/blender/gpu/intern/gpu_shader_builtin.cc index 2657f36546f..158146a41ce 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.cc +++ b/source/blender/gpu/intern/gpu_shader_builtin.cc @@ -8,7 +8,6 @@ #include "BLI_utildefines.h" -#include "GPU_capabilities.hh" #include "GPU_shader.hh" #include "gpu_shader_private.hh" diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc index a5100f9d22b..3ebf840a142 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.cc +++ b/source/blender/gpu/intern/gpu_shader_create_info.cc @@ -11,7 +11,6 @@ #include "BLI_map.hh" #include "BLI_set.hh" #include "BLI_string_ref.hh" -#include "BLI_threads.h" #include "BKE_global.hh" @@ -19,7 +18,6 @@ #include "GPU_context.hh" #include "GPU_platform.hh" #include "GPU_shader.hh" -#include "GPU_texture.hh" #include "gpu_shader_create_info.hh" #include "gpu_shader_create_info_private.hh" diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 9faae673978..fa2bb3b7d83 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -600,7 +600,7 @@ struct StageInterfaceInfo { StageInterfaceInfo(const char *name_, const char *instance_name_ = "") : name(name_), instance_name(instance_name_){}; - ~StageInterfaceInfo(){}; + ~StageInterfaceInfo() = default; using Self = StageInterfaceInfo; @@ -657,11 +657,11 @@ struct ShaderCreateInfo { /** Manually set builtins. */ BuiltinBits builtins_ = BuiltinBits::NONE; /** Manually set generated code. */ - std::string vertex_source_generated = ""; - std::string fragment_source_generated = ""; - std::string compute_source_generated = ""; - std::string geometry_source_generated = ""; - std::string typedef_source_generated = ""; + std::string vertex_source_generated; + std::string fragment_source_generated; + std::string compute_source_generated; + std::string geometry_source_generated; + std::string typedef_source_generated; /** Manually set generated dependencies. */ Vector dependencies_generated; @@ -896,7 +896,7 @@ struct ShaderCreateInfo { public: ShaderCreateInfo(const char *name) : name_(name){}; - ~ShaderCreateInfo(){}; + ~ShaderCreateInfo() = default; using Self = ShaderCreateInfo; @@ -1383,13 +1383,13 @@ struct ShaderCreateInfo { }; /* TODO(@fclem): Order the resources. */ - for (auto &res : info.batch_resources_) { + for (const auto &res : info.batch_resources_) { print_resource(res); } - for (auto &res : info.pass_resources_) { + for (const auto &res : info.pass_resources_) { print_resource(res); } - for (auto &res : info.geometry_resources_) { + for (const auto &res : info.geometry_resources_) { print_resource(res); } return stream; @@ -1397,17 +1397,17 @@ struct ShaderCreateInfo { bool has_resource_type(Resource::BindType bind_type) const { - for (auto &res : batch_resources_) { + for (const auto &res : batch_resources_) { if (res.bind_type == bind_type) { return true; } } - for (auto &res : pass_resources_) { + for (const auto &res : pass_resources_) { if (res.bind_type == bind_type) { return true; } } - for (auto &res : geometry_resources_) { + for (const auto &res : geometry_resources_) { if (res.bind_type == bind_type) { return true; } diff --git a/source/blender/gpu/intern/gpu_shader_dependency.cc b/source/blender/gpu/intern/gpu_shader_dependency.cc index cfdca818644..dfc4adf1419 100644 --- a/source/blender/gpu/intern/gpu_shader_dependency.cc +++ b/source/blender/gpu/intern/gpu_shader_dependency.cc @@ -13,12 +13,10 @@ #include #include #include -#include #include #include "BLI_ghash.h" #include "BLI_map.hh" -#include "BLI_string.h" #include "BLI_string_ref.hh" #include "gpu_material_library.hh" @@ -27,8 +25,6 @@ #include "../glsl_preprocess/glsl_preprocess.hh" -#include "GPU_context.hh" - extern "C" { #define SHADER_SOURCE(datatoc, filename, filepath) extern char datatoc[]; #include "glsl_compositor_source_list.h" @@ -302,7 +298,7 @@ struct GPUSource { name.copy_utf8_truncated(func->name, sizeof(func->name)); func->source = reinterpret_cast(this); func->totparam = 0; - while (1) { + while (true) { StringRef arg_qual = pop_token(line); StringRef arg_type = pop_token(line); if (arg_qual.is_empty()) { diff --git a/source/blender/gpu/intern/gpu_shader_interface.hh b/source/blender/gpu/intern/gpu_shader_interface.hh index 4631734fc54..e5181ff1ff7 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.hh +++ b/source/blender/gpu/intern/gpu_shader_interface.hh @@ -16,7 +16,7 @@ #include /* required for STREQ later on. */ #include "BLI_hash.h" -#include "BLI_utildefines.h" +#include "BLI_sys_types.h" #include "GPU_shader.hh" #include "GPU_vertex_format.hh" /* GPU_VERT_ATTR_MAX_LEN */ @@ -82,63 +82,63 @@ class ShaderInterface { void debug_print() const; - inline const ShaderInput *attr_get(const StringRefNull name) const + const ShaderInput *attr_get(const StringRefNull name) const { return input_lookup(inputs_, attr_len_, name); } - inline const ShaderInput *attr_get(const int binding) const + const ShaderInput *attr_get(const int binding) const { return input_lookup(inputs_, attr_len_, binding); } - inline const ShaderInput *ubo_get(const StringRefNull name) const + const ShaderInput *ubo_get(const StringRefNull name) const { return input_lookup(inputs_ + attr_len_, ubo_len_, name); } - inline const ShaderInput *ubo_get(const int binding) const + const ShaderInput *ubo_get(const int binding) const { return input_lookup(inputs_ + attr_len_, ubo_len_, binding); } - inline const ShaderInput *uniform_get(const StringRefNull name) const + const ShaderInput *uniform_get(const StringRefNull name) const { return input_lookup(inputs_ + attr_len_ + ubo_len_, uniform_len_, name); } - inline const ShaderInput *texture_get(const int binding) const + const ShaderInput *texture_get(const int binding) const { return input_lookup(inputs_ + attr_len_ + ubo_len_, uniform_len_, binding); } - inline const ShaderInput *ssbo_get(const StringRefNull name) const + const ShaderInput *ssbo_get(const StringRefNull name) const { return input_lookup(inputs_ + attr_len_ + ubo_len_ + uniform_len_, ssbo_len_, name); } - inline const ShaderInput *ssbo_get(const int binding) const + const ShaderInput *ssbo_get(const int binding) const { return input_lookup(inputs_ + attr_len_ + ubo_len_ + uniform_len_, ssbo_len_, binding); } - inline const ShaderInput *constant_get(const StringRefNull name) const + const ShaderInput *constant_get(const StringRefNull name) const { return input_lookup( inputs_ + attr_len_ + ubo_len_ + uniform_len_ + ssbo_len_, constant_len_, name); } - inline const char *input_name_get(const ShaderInput *input) const + const char *input_name_get(const ShaderInput *input) const { return name_buffer_ + input->name_offset; } /* Returns uniform location. */ - inline int32_t uniform_builtin(const GPUUniformBuiltin builtin) const + int32_t uniform_builtin(const GPUUniformBuiltin builtin) const { BLI_assert(builtin >= 0 && builtin < GPU_NUM_UNIFORMS); return builtins_[builtin]; } /* Returns binding position. */ - inline int32_t ubo_builtin(const GPUUniformBlockBuiltin builtin) const + int32_t ubo_builtin(const GPUUniformBlockBuiltin builtin) const { BLI_assert(builtin >= 0 && builtin < GPU_NUM_UNIFORM_BLOCKS); return builtin_blocks_[builtin]; diff --git a/source/blender/gpu/intern/gpu_shader_log.cc b/source/blender/gpu/intern/gpu_shader_log.cc index 1e5b24da598..670b5dd3434 100644 --- a/source/blender/gpu/intern/gpu_shader_log.cc +++ b/source/blender/gpu/intern/gpu_shader_log.cc @@ -9,8 +9,6 @@ #include "MEM_guardedalloc.h" #include "BLI_dynstr.h" -#include "BLI_string.h" -#include "BLI_string_utils.hh" #include "BLI_vector.hh" #include "GPU_storage_buffer.hh" diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index 9654b120fb6..c53b61fd84a 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -17,7 +17,6 @@ #include "BLI_map.hh" -#include #include namespace blender::gpu { @@ -124,17 +123,17 @@ class Shader { /* DEPRECATED: Kept only because of BGL API. */ virtual int program_handle_get() const = 0; - inline StringRefNull name_get() const + StringRefNull name_get() const { return name; } - inline void parent_set(Shader *parent) + void parent_set(Shader *parent) { parent_shader_ = parent; } - inline Shader *parent_get() const + Shader *parent_get() const { return parent_shader_; } diff --git a/source/blender/gpu/intern/gpu_storage_buffer.cc b/source/blender/gpu/intern/gpu_storage_buffer.cc index c620bf3a8e1..66613be9d81 100644 --- a/source/blender/gpu/intern/gpu_storage_buffer.cc +++ b/source/blender/gpu/intern/gpu_storage_buffer.cc @@ -9,14 +9,12 @@ #include "MEM_guardedalloc.h" #include -#include "BLI_blenlib.h" -#include "BLI_math_base.h" +#include "BLI_string.h" #include "BKE_global.hh" #include "gpu_backend.hh" -#include "GPU_material.hh" #include "GPU_storage_buffer.hh" #include "GPU_vertex_buffer.hh" /* For GPUUsageType. */ diff --git a/source/blender/gpu/intern/gpu_storage_buffer_private.hh b/source/blender/gpu/intern/gpu_storage_buffer_private.hh index a2cf616bf04..c888b8ad5ae 100644 --- a/source/blender/gpu/intern/gpu_storage_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_storage_buffer_private.hh @@ -8,7 +8,6 @@ #pragma once -#include "BLI_span.hh" #include "BLI_sys_types.h" struct GPUStorageBuf; diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index df14b555e6a..27d8df7ac5c 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -954,7 +954,7 @@ int GPU_texture_opengl_bindcode(const GPUTexture *texture) void GPU_texture_get_mipmap_size(GPUTexture *texture, int mip_level, int *r_size) { - return unwrap(texture)->mip_size_get(mip_level, r_size); + unwrap(texture)->mip_size_get(mip_level, r_size); } /** \} */ diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index c1f6820c002..2c0315b41fd 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -766,8 +766,7 @@ inline size_t to_bytesize(eGPUTextureFormat tex_format, eGPUDataFormat data_form } /* Definitely not complete, edit according to the gl specification. */ -constexpr inline bool validate_data_format(eGPUTextureFormat tex_format, - eGPUDataFormat data_format) +constexpr bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format) { switch (tex_format) { /* Formats texture & render-buffer */ diff --git a/source/blender/gpu/intern/gpu_uniform_buffer.cc b/source/blender/gpu/intern/gpu_uniform_buffer.cc index 121a1aa8e9c..46dd29a7c4d 100644 --- a/source/blender/gpu/intern/gpu_uniform_buffer.cc +++ b/source/blender/gpu/intern/gpu_uniform_buffer.cc @@ -9,8 +9,9 @@ #include "MEM_guardedalloc.h" #include -#include "BLI_blenlib.h" +#include "BLI_listbase.h" #include "BLI_math_base.h" +#include "BLI_string.h" #include "BKE_global.hh" diff --git a/source/blender/gpu/intern/gpu_viewport.cc b/source/blender/gpu/intern/gpu_viewport.cc index bae8b460ccf..d7bf686eebf 100644 --- a/source/blender/gpu/intern/gpu_viewport.cc +++ b/source/blender/gpu/intern/gpu_viewport.cc @@ -24,8 +24,8 @@ #include "GPU_framebuffer.hh" #include "GPU_immediate.hh" #include "GPU_matrix.hh" +#include "GPU_state.hh" #include "GPU_texture.hh" -#include "GPU_uniform_buffer.hh" #include "GPU_viewport.hh" #include "DRW_engine.hh" diff --git a/source/blender/gpu/metal/mtl_context.hh b/source/blender/gpu/metal/mtl_context.hh index 1135d3b0c92..8c676329326 100644 --- a/source/blender/gpu/metal/mtl_context.hh +++ b/source/blender/gpu/metal/mtl_context.hh @@ -7,12 +7,9 @@ */ #pragma once -#include "MEM_guardedalloc.h" - #include "gpu_context_private.hh" #include "GPU_common_types.hh" -#include "GPU_context.hh" /* Don't generate OpenGL deprecation warning. This is a known thing, and is not something easily * solvable in a short term. */ diff --git a/source/blender/gpu/metal/mtl_shader_interface.mm b/source/blender/gpu/metal/mtl_shader_interface.mm index deee132ef79..5b17e383942 100644 --- a/source/blender/gpu/metal/mtl_shader_interface.mm +++ b/source/blender/gpu/metal/mtl_shader_interface.mm @@ -17,8 +17,8 @@ #include "mtl_shader_interface.hh" #include "mtl_shader_interface_type.hh" -#include "BLI_blenlib.h" #include "BLI_math_base.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 682340293a8..6b240303186 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -6,12 +6,17 @@ * \ingroup gpu */ +#include + #include "BKE_global.hh" #if defined(WIN32) # include "BLI_winstuff.h" #endif +#include "BLI_string_ref.hh" #include "BLI_subprocess.hh" #include "BLI_threads.h" +#include "BLI_vector.hh" + #include "DNA_userdef_types.h" #include "gpu_capabilities_private.hh" diff --git a/source/blender/gpu/opengl/gl_shader.hh b/source/blender/gpu/opengl/gl_shader.hh index 7518d421dbd..de19dff3279 100644 --- a/source/blender/gpu/opengl/gl_shader.hh +++ b/source/blender/gpu/opengl/gl_shader.hh @@ -20,6 +20,7 @@ #include "gpu_shader_private.hh" #include +#include namespace blender::gpu { diff --git a/source/blender/gpu/tests/buffer_texture_test.cc b/source/blender/gpu/tests/buffer_texture_test.cc index 64cebacac60..82721d0b308 100644 --- a/source/blender/gpu/tests/buffer_texture_test.cc +++ b/source/blender/gpu/tests/buffer_texture_test.cc @@ -6,10 +6,10 @@ #include "GPU_capabilities.hh" #include "GPU_compute.hh" +#include "GPU_state.hh" #include "GPU_vertex_buffer.hh" #include "GPU_vertex_format.hh" -#include "BLI_index_range.hh" #include "BLI_math_vector_types.hh" #include "gpu_testing.hh" diff --git a/source/blender/gpu/tests/compute_test.cc b/source/blender/gpu/tests/compute_test.cc index 1086414cb7d..2a983967f8c 100644 --- a/source/blender/gpu/tests/compute_test.cc +++ b/source/blender/gpu/tests/compute_test.cc @@ -10,6 +10,7 @@ #include "GPU_capabilities.hh" #include "GPU_compute.hh" +#include "GPU_state.hh" #include "GPU_storage_buffer.hh" #include "GPU_texture.hh" diff --git a/source/blender/gpu/tests/framebuffer_test.cc b/source/blender/gpu/tests/framebuffer_test.cc index c022b0da062..36118d6d6b0 100644 --- a/source/blender/gpu/tests/framebuffer_test.cc +++ b/source/blender/gpu/tests/framebuffer_test.cc @@ -4,9 +4,14 @@ #include "testing/testing.h" +#include "GPU_batch.hh" #include "GPU_context.hh" #include "GPU_framebuffer.hh" #include "GPU_shader.hh" +#include "GPU_state.hh" +#include "GPU_vertex_buffer.hh" +#include "GPU_vertex_format.hh" + #include "gpu_testing.hh" #include "BLI_math_vector.hh" diff --git a/source/blender/gpu/tests/gpu_testing.cc b/source/blender/gpu/tests/gpu_testing.cc index 47a86b50b82..b9f7110a1a6 100644 --- a/source/blender/gpu/tests/gpu_testing.cc +++ b/source/blender/gpu/tests/gpu_testing.cc @@ -11,6 +11,7 @@ #include "GPU_context.hh" #include "GPU_debug.hh" #include "GPU_init_exit.hh" + #include "gpu_testing.hh" #include "GHOST_C-api.h" diff --git a/source/blender/gpu/tests/immediate_test.cc b/source/blender/gpu/tests/immediate_test.cc index aac2c49c179..f0609e8cfa2 100644 --- a/source/blender/gpu/tests/immediate_test.cc +++ b/source/blender/gpu/tests/immediate_test.cc @@ -7,6 +7,7 @@ #include "GPU_framebuffer.hh" #include "GPU_immediate.hh" #include "GPU_shader_builtin.hh" +#include "GPU_state.hh" #include "gpu_testing.hh" #include "BLI_math_vector.hh" diff --git a/source/blender/gpu/tests/index_buffer_test.cc b/source/blender/gpu/tests/index_buffer_test.cc index 82a029dc900..3a247e7f4d4 100644 --- a/source/blender/gpu/tests/index_buffer_test.cc +++ b/source/blender/gpu/tests/index_buffer_test.cc @@ -4,8 +4,6 @@ #include "testing/testing.h" -#include "MEM_guardedalloc.h" - #include "GPU_index_buffer.hh" #include "gpu_testing.hh" diff --git a/source/blender/gpu/tests/push_constants_test.cc b/source/blender/gpu/tests/push_constants_test.cc index 41c9afa6377..72932da2e19 100644 --- a/source/blender/gpu/tests/push_constants_test.cc +++ b/source/blender/gpu/tests/push_constants_test.cc @@ -7,6 +7,7 @@ #include "GPU_capabilities.hh" #include "GPU_compute.hh" #include "GPU_shader.hh" +#include "GPU_state.hh" #include "GPU_storage_buffer.hh" #include "BLI_math_vector.hh" diff --git a/source/blender/gpu/tests/shader_test.cc b/source/blender/gpu/tests/shader_test.cc index c9997239868..89921a6e4cd 100644 --- a/source/blender/gpu/tests/shader_test.cc +++ b/source/blender/gpu/tests/shader_test.cc @@ -14,6 +14,7 @@ #include "GPU_index_buffer.hh" #include "GPU_shader.hh" #include "GPU_shader_shared.hh" +#include "GPU_state.hh" #include "GPU_texture.hh" #include "GPU_vertex_buffer.hh" #include "GPU_vertex_format.hh" @@ -384,7 +385,7 @@ static void gpu_shader_lib_test(const char *test_src_name, const char *additiona if (ELEM(test.status, TEST_STATUS_NONE, TEST_STATUS_PASSED)) { continue; } - else if (test.status == TEST_STATUS_FAILED) { + if (test.status == TEST_STATUS_FAILED) { ADD_FAILURE_AT(test_src_name, test.line) << "Value of: " << print_test_line(test_src, test.line) << "\n" << " Actual: " << print_test_data(test.expect, TestType(test.type)) << "\n" diff --git a/source/blender/gpu/tests/specialization_constants_test.cc b/source/blender/gpu/tests/specialization_constants_test.cc index 049629e6c6b..c484845d565 100644 --- a/source/blender/gpu/tests/specialization_constants_test.cc +++ b/source/blender/gpu/tests/specialization_constants_test.cc @@ -10,7 +10,9 @@ #include "GPU_context.hh" #include "GPU_framebuffer.hh" #include "GPU_shader.hh" +#include "GPU_state.hh" #include "GPU_storage_buffer.hh" +#include "GPU_vertex_format.hh" #include "BLI_math_vector.hh" #include "BLI_utility_mixins.hh" diff --git a/source/blender/gpu/tests/state_blend_test.cc b/source/blender/gpu/tests/state_blend_test.cc index 92ad181f713..f233fee41d2 100644 --- a/source/blender/gpu/tests/state_blend_test.cc +++ b/source/blender/gpu/tests/state_blend_test.cc @@ -9,7 +9,7 @@ #include "GPU_batch.hh" #include "GPU_batch_presets.hh" #include "GPU_framebuffer.hh" -#include "GPU_matrix.hh" +#include "GPU_state.hh" #include "BLI_math_vector.hh" diff --git a/source/blender/gpu/tests/texture_test.cc b/source/blender/gpu/tests/texture_test.cc index 32276df01d1..6ca1ee26059 100644 --- a/source/blender/gpu/tests/texture_test.cc +++ b/source/blender/gpu/tests/texture_test.cc @@ -6,10 +6,10 @@ #include "MEM_guardedalloc.h" -#include "BLI_math_vector.hh" -#include "BLI_vector.hh" +#include "BLI_math_vector_types.hh" #include "GPU_context.hh" +#include "GPU_state.hh" #include "GPU_texture.hh" #include "gpu_texture_private.hh" diff --git a/source/blender/gpu/tests/vertex_buffer_test.cc b/source/blender/gpu/tests/vertex_buffer_test.cc index 0b402aae573..4155f08b15e 100644 --- a/source/blender/gpu/tests/vertex_buffer_test.cc +++ b/source/blender/gpu/tests/vertex_buffer_test.cc @@ -4,10 +4,10 @@ #include "testing/testing.h" -#include "GPU_context.hh" +#include "GPU_batch.hh" #include "GPU_framebuffer.hh" -#include "GPU_immediate.hh" #include "GPU_shader.hh" +#include "GPU_state.hh" #include "GPU_vertex_buffer.hh" #include "GPU_vertex_format.hh" diff --git a/source/blender/gpu/vulkan/vk_common.hh b/source/blender/gpu/vulkan/vk_common.hh index 80dbe0a34e8..0c31e8fab9c 100644 --- a/source/blender/gpu/vulkan/vk_common.hh +++ b/source/blender/gpu/vulkan/vk_common.hh @@ -19,6 +19,7 @@ #include "vk_mem_alloc.h" #include "GPU_index_buffer.hh" +#include "GPU_state.hh" #include "gpu_query.hh" #include "gpu_shader_create_info.hh" #include "gpu_texture_private.hh" diff --git a/source/blender/gpu/vulkan/vk_shader_compiler.hh b/source/blender/gpu/vulkan/vk_shader_compiler.hh index e112b078cad..dcb0202f8da 100644 --- a/source/blender/gpu/vulkan/vk_shader_compiler.hh +++ b/source/blender/gpu/vulkan/vk_shader_compiler.hh @@ -16,6 +16,8 @@ #include "shaderc/shaderc.hpp" +#include + namespace blender::gpu { class VKShader; class VKShaderModule; diff --git a/source/blender/python/gpu/gpu_py_offscreen.cc b/source/blender/python/gpu/gpu_py_offscreen.cc index b9bfe551a69..023135e0ed7 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.cc +++ b/source/blender/python/gpu/gpu_py_offscreen.cc @@ -24,6 +24,7 @@ #include "GPU_context.hh" #include "GPU_framebuffer.hh" +#include "GPU_state.hh" #include "GPU_texture.hh" #include "GPU_viewport.hh" diff --git a/source/blender/python/gpu/gpu_py_texture.cc b/source/blender/python/gpu/gpu_py_texture.cc index 90853a31545..b7de83f9f05 100644 --- a/source/blender/python/gpu/gpu_py_texture.cc +++ b/source/blender/python/gpu/gpu_py_texture.cc @@ -13,6 +13,7 @@ #include +#include "BLI_math_base.h" #include "BLI_string.h" #include "DNA_image_types.h"