From 680fec144c6a792ac38381e1bc618a12c84aa8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 15 Sep 2025 15:11:02 +0200 Subject: [PATCH] Cleanup: GPU: Remove prefix 'e' from enum types _No response_ Pull Request: https://projects.blender.org/blender/blender/pulls/146034 --- .../blender/compositor/intern/shader_node.cc | 2 +- .../draw/engines/select/select_engine.cc | 12 ++-- .../blender/draw/intern/draw_cache_inline.hh | 2 +- source/blender/draw/intern/draw_command.cc | 12 ++-- source/blender/draw/intern/draw_command.hh | 4 +- source/blender/draw/intern/draw_context.cc | 2 +- source/blender/draw/intern/draw_pass.hh | 8 +-- source/blender/draw/intern/draw_state.hh | 16 ++--- source/blender/draw/intern/draw_volume.cc | 2 +- .../editors/interface/interface_icons.cc | 2 +- source/blender/editors/screen/glutil.cc | 4 +- .../editors/sculpt_paint/paint_cursor.cc | 6 +- .../editors/space_view3d/view3d_placement.cc | 2 +- .../editors/space_view3d/view3d_view.cc | 4 +- .../transform/transform_constraints.cc | 4 +- source/blender/gpu/GPU_batch.hh | 22 +++---- source/blender/gpu/GPU_common_types.hh | 6 +- source/blender/gpu/GPU_context.hh | 10 +-- source/blender/gpu/GPU_framebuffer.hh | 16 ++--- source/blender/gpu/GPU_immediate.hh | 2 +- source/blender/gpu/GPU_material.hh | 18 +++--- source/blender/gpu/GPU_pass.hh | 4 +- source/blender/gpu/GPU_platform.hh | 22 +++---- .../blender/gpu/GPU_platform_backend_enum.h | 2 +- source/blender/gpu/GPU_select.hh | 9 +-- source/blender/gpu/GPU_shader_builtin.hh | 10 +-- source/blender/gpu/GPU_shader_shared.hh | 6 +- source/blender/gpu/GPU_shader_shared_utils.hh | 2 +- source/blender/gpu/GPU_state.hh | 62 +++++++++---------- source/blender/gpu/dummy/dummy_framebuffer.hh | 6 +- .../gpu/glsl_preprocess/glsl_preprocess.hh | 4 +- source/blender/gpu/intern/gpu_batch.cc | 14 ++--- source/blender/gpu/intern/gpu_codegen.cc | 14 ++--- source/blender/gpu/intern/gpu_codegen.hh | 4 +- source/blender/gpu/intern/gpu_context.cc | 16 ++--- .../blender/gpu/intern/gpu_context_private.hh | 2 +- source/blender/gpu/intern/gpu_framebuffer.cc | 6 +- .../gpu/intern/gpu_framebuffer_private.hh | 6 +- source/blender/gpu/intern/gpu_immediate.cc | 4 +- .../gpu/intern/gpu_immediate_private.hh | 4 +- source/blender/gpu/intern/gpu_material.cc | 4 +- .../gpu/intern/gpu_material_library.hh | 2 +- source/blender/gpu/intern/gpu_node_graph.cc | 8 +-- source/blender/gpu/intern/gpu_node_graph.hh | 18 +++--- source/blender/gpu/intern/gpu_pass.cc | 4 +- source/blender/gpu/intern/gpu_platform.cc | 24 +++---- .../gpu/intern/gpu_platform_private.hh | 20 +++--- source/blender/gpu/intern/gpu_select.cc | 12 ++-- source/blender/gpu/intern/gpu_select_next.cc | 18 +++--- source/blender/gpu/intern/gpu_select_pick.cc | 8 +-- .../blender/gpu/intern/gpu_select_private.hh | 8 +-- .../gpu/intern/gpu_select_sample_query.cc | 8 +-- source/blender/gpu/intern/gpu_shader.cc | 2 +- .../blender/gpu/intern/gpu_shader_builtin.cc | 12 ++-- .../gpu/intern/gpu_shader_create_info.hh | 6 +- .../gpu/intern/gpu_shader_dependency.cc | 2 +- source/blender/gpu/intern/gpu_state.cc | 48 +++++++------- .../blender/gpu/intern/gpu_state_private.hh | 16 ++--- source/blender/gpu/intern/gpu_texture.cc | 8 +-- .../blender/gpu/intern/gpu_texture_private.hh | 26 ++++---- .../blender/gpu/intern/gpu_uniform_buffer.cc | 8 +-- .../metal/kernels/compute_texture_read.msl | 2 +- .../metal/kernels/compute_texture_update.msl | 2 +- source/blender/gpu/metal/mtl_backend.mm | 8 +-- .../blender/gpu/metal/mtl_command_buffer.mm | 6 +- source/blender/gpu/metal/mtl_context.hh | 12 ++-- source/blender/gpu/metal/mtl_context.mm | 4 +- source/blender/gpu/metal/mtl_framebuffer.hh | 18 +++--- source/blender/gpu/metal/mtl_framebuffer.mm | 44 ++++++------- .../blender/gpu/metal/mtl_shader_generator.hh | 6 +- .../blender/gpu/metal/mtl_shader_generator.mm | 10 +-- .../blender/gpu/metal/mtl_shader_interface.hh | 14 ++--- .../blender/gpu/metal/mtl_shader_interface.mm | 10 +-- .../gpu/metal/mtl_shader_interface_type.hh | 8 +-- source/blender/gpu/metal/mtl_state.hh | 18 +++--- source/blender/gpu/metal/mtl_state.mm | 54 ++++++++-------- source/blender/gpu/metal/mtl_texture.hh | 8 +-- source/blender/gpu/metal/mtl_texture.mm | 10 +-- source/blender/gpu/metal/mtl_texture_util.mm | 8 +-- source/blender/gpu/opengl/gl_backend.cc | 8 +-- source/blender/gpu/opengl/gl_framebuffer.cc | 14 ++--- source/blender/gpu/opengl/gl_framebuffer.hh | 8 +-- source/blender/gpu/opengl/gl_shader.hh | 4 +- source/blender/gpu/opengl/gl_state.cc | 32 +++++----- source/blender/gpu/opengl/gl_state.hh | 18 +++--- source/blender/gpu/opengl/gl_texture.hh | 4 +- source/blender/gpu/tests/gpu_testing.cc | 2 +- source/blender/gpu/tests/gpu_testing.hh | 2 +- source/blender/gpu/tests/state_blend_test.cc | 2 +- source/blender/gpu/vulkan/vk_backend.cc | 10 +-- source/blender/gpu/vulkan/vk_common.cc | 8 +-- source/blender/gpu/vulkan/vk_common.hh | 8 +-- source/blender/gpu/vulkan/vk_device.cc | 4 +- source/blender/gpu/vulkan/vk_device.hh | 4 +- source/blender/gpu/vulkan/vk_framebuffer.cc | 14 ++--- source/blender/gpu/vulkan/vk_framebuffer.hh | 8 +-- source/blender/gpu/vulkan/vk_pipeline_pool.cc | 2 +- source/blender/gpu/vulkan/vk_state_manager.cc | 2 +- source/blender/gpu/vulkan/vk_state_manager.hh | 2 +- source/blender/gpu/vulkan/vk_texture.cc | 8 +-- source/blender/gpu/vulkan/vk_texture.hh | 2 +- source/blender/makesdna/DNA_userdef_types.h | 4 +- .../blender/python/gpu/gpu_py_framebuffer.cc | 2 +- source/blender/python/gpu/gpu_py_shader.cc | 3 +- source/blender/python/gpu/gpu_py_state.cc | 10 +-- .../blender/windowmanager/intern/wm_files.cc | 2 +- .../intern/wm_platform_support.cc | 2 +- .../windowmanager/intern/wm_playanim.cc | 2 +- .../blender/windowmanager/intern/wm_window.cc | 6 +- .../windowmanager/intern/wm_window_private.hh | 2 +- source/creator/creator_args.cc | 2 +- 111 files changed, 528 insertions(+), 530 deletions(-) diff --git a/source/blender/compositor/intern/shader_node.cc b/source/blender/compositor/intern/shader_node.cc index 3ed995b284a..f0348be7870 100644 --- a/source/blender/compositor/intern/shader_node.cc +++ b/source/blender/compositor/intern/shader_node.cc @@ -41,7 +41,7 @@ GPUNodeStack &ShaderNode::get_output(const StringRef identifier) return get_shader_node_output(*node_, outputs_.data(), identifier); } -static eGPUType gpu_type_from_socket(DSocket socket) +static GPUType gpu_type_from_socket(DSocket socket) { switch (eNodeSocketDatatype(socket->type)) { case SOCK_FLOAT: diff --git a/source/blender/draw/engines/select/select_engine.cc b/source/blender/draw/engines/select/select_engine.cc index b6f6b55a2e9..d2bf8cff53e 100644 --- a/source/blender/draw/engines/select/select_engine.cc +++ b/source/blender/draw/engines/select/select_engine.cc @@ -91,9 +91,9 @@ struct Instance : public DrawEngine { { this->draw_ctx = DRW_context_get(); StaticData &e_data = StaticData::get(); - eGPUShaderConfig sh_cfg = (RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) ? - GPU_SHADER_CFG_CLIPPED : - GPU_SHADER_CFG_DEFAULT; + GPUShaderConfig sh_cfg = (RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) ? + GPU_SHADER_CFG_CLIPPED : + GPU_SHADER_CFG_DEFAULT; StaticData::Shaders *sh_data = &e_data.sh_data[sh_cfg]; @@ -111,9 +111,9 @@ struct Instance : public DrawEngine { void begin_sync() final { StaticData &e_data = StaticData::get(); - eGPUShaderConfig sh_cfg = (RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) ? - GPU_SHADER_CFG_CLIPPED : - GPU_SHADER_CFG_DEFAULT; + GPUShaderConfig sh_cfg = (RV3D_CLIPPING_ENABLED(draw_ctx->v3d, draw_ctx->rv3d)) ? + GPU_SHADER_CFG_CLIPPED : + GPU_SHADER_CFG_DEFAULT; StaticData::Shaders *sh = &e_data.sh_data[sh_cfg]; diff --git a/source/blender/draw/intern/draw_cache_inline.hh b/source/blender/draw/intern/draw_cache_inline.hh index 20c89953942..c8a34d6a457 100644 --- a/source/blender/draw/intern/draw_cache_inline.hh +++ b/source/blender/draw/intern/draw_cache_inline.hh @@ -40,7 +40,7 @@ inline bool DRW_batch_requested(blender::gpu::Batch *batch, GPUPrimType prim_typ if (batch != nullptr && batch->verts[0] == nullptr) { /* HACK. We init without a valid VBO and let the first vbo binding * fill verts[0]. */ - GPU_batch_init_ex(batch, prim_type, (blender::gpu::VertBuf *)1, nullptr, (eGPUBatchFlag)0); + GPU_batch_init_ex(batch, prim_type, (blender::gpu::VertBuf *)1, nullptr, (GPUBatchFlag)0); batch->verts[0] = nullptr; return true; } diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc index 5eb34060950..ff9e859b49c 100644 --- a/source/blender/draw/intern/draw_command.cc +++ b/source/blender/draw/intern/draw_command.cc @@ -285,7 +285,7 @@ void Barrier::execute() const void Clear::execute() const { GPUFrameBuffer *fb = GPU_framebuffer_active_get(); - GPU_framebuffer_clear(fb, (eGPUFrameBufferBits)clear_channels, color, depth, stencil); + GPU_framebuffer_clear(fb, (GPUFrameBufferBits)clear_channels, color, depth, stencil); } void ClearMulti::execute() const @@ -669,19 +669,19 @@ std::string Barrier::serialize() const std::string Clear::serialize() const { std::stringstream ss; - if (eGPUFrameBufferBits(clear_channels) & GPU_COLOR_BIT) { + if (GPUFrameBufferBits(clear_channels) & GPU_COLOR_BIT) { ss << "color=" << color; - if (eGPUFrameBufferBits(clear_channels) & (GPU_DEPTH_BIT | GPU_STENCIL_BIT)) { + if (GPUFrameBufferBits(clear_channels) & (GPU_DEPTH_BIT | GPU_STENCIL_BIT)) { ss << ", "; } } - if (eGPUFrameBufferBits(clear_channels) & GPU_DEPTH_BIT) { + if (GPUFrameBufferBits(clear_channels) & GPU_DEPTH_BIT) { ss << "depth=" << depth; - if (eGPUFrameBufferBits(clear_channels) & GPU_STENCIL_BIT) { + if (GPUFrameBufferBits(clear_channels) & GPU_STENCIL_BIT) { ss << ", "; } } - if (eGPUFrameBufferBits(clear_channels) & GPU_STENCIL_BIT) { + if (GPUFrameBufferBits(clear_channels) & GPU_STENCIL_BIT) { ss << "stencil=0b" << std::bitset<8>(stencil) << ")"; } return std::string(".clear(") + ss.str() + ")"; diff --git a/source/blender/draw/intern/draw_command.hh b/source/blender/draw/intern/draw_command.hh index b461e5e4af6..be03c302a7c 100644 --- a/source/blender/draw/intern/draw_command.hh +++ b/source/blender/draw/intern/draw_command.hh @@ -441,14 +441,14 @@ struct DispatchIndirect { }; struct Barrier { - eGPUBarrier type; + GPUBarrier type; void execute() const; std::string serialize() const; }; struct Clear { - uint8_t clear_channels; /* #eGPUFrameBufferBits. But want to save some bits. */ + uint8_t clear_channels; /* #GPUFrameBufferBits. But want to save some bits. */ uint8_t stencil; float depth; float4 color; diff --git a/source/blender/draw/intern/draw_context.cc b/source/blender/draw/intern/draw_context.cc index e7fc2794b09..d117f647572 100644 --- a/source/blender/draw/intern/draw_context.cc +++ b/source/blender/draw/intern/draw_context.cc @@ -1770,7 +1770,7 @@ void DRW_custom_pipeline_end(DRWContext &draw_ctx) * resources as the main thread (viewport) may lead to data * races and undefined behavior on certain drivers. Using * GPU_finish to sync seems to fix the issue. (see #62997) */ - eGPUBackendType type = GPU_backend_get_type(); + GPUBackendType type = GPU_backend_get_type(); if (type == GPU_BACKEND_OPENGL) { GPU_finish(); } diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh index 6c224f05eb6..56264d88b79 100644 --- a/source/blender/draw/intern/draw_pass.hh +++ b/source/blender/draw/intern/draw_pass.hh @@ -335,7 +335,7 @@ class PassBase { /** * Record a barrier call to synchronize arbitrary load/store operation between draw calls. */ - void barrier(eGPUBarrier type); + void barrier(GPUBarrier type); /** * Bind a shader resource. @@ -468,7 +468,7 @@ class PassBase { int push_constant_offset(const char *name); - void clear(eGPUFrameBufferBits planes, float4 color, float depth, uint8_t stencil); + void clear(GPUFrameBufferBits planes, float4 color, float depth, uint8_t stencil); gpu::Batch *procedural_batch_get(GPUPrimType primitive); @@ -655,7 +655,7 @@ template inline command::Undetermined &PassBase::create_command(comm } template -inline void PassBase::clear(eGPUFrameBufferBits planes, +inline void PassBase::clear(GPUFrameBufferBits planes, float4 color, float depth, uint8_t stencil) @@ -1075,7 +1075,7 @@ inline void PassBase::clear_color_depth_stencil(float4 color, float depth, ui /** \name Barrier Implementation * \{ */ -template inline void PassBase::barrier(eGPUBarrier type) +template inline void PassBase::barrier(GPUBarrier type) { create_command(Type::Barrier).barrier = {type}; } diff --git a/source/blender/draw/intern/draw_state.hh b/source/blender/draw/intern/draw_state.hh index b95a618d90a..54b69616717 100644 --- a/source/blender/draw/intern/draw_state.hh +++ b/source/blender/draw/intern/draw_state.hh @@ -100,9 +100,9 @@ namespace blender::draw { /** \name DRWState to GPU state conversion * \{ */ -static inline eGPUWriteMask to_write_mask(DRWState state) +static inline GPUWriteMask to_write_mask(DRWState state) { - eGPUWriteMask write_mask = GPU_WRITE_NONE; + GPUWriteMask write_mask = GPU_WRITE_NONE; if (state & DRW_STATE_WRITE_DEPTH) { write_mask |= GPU_WRITE_DEPTH; } @@ -115,7 +115,7 @@ static inline eGPUWriteMask to_write_mask(DRWState state) return write_mask; } -static inline eGPUFaceCullTest to_face_cull_test(DRWState state) +static inline GPUFaceCullTest to_face_cull_test(DRWState state) { switch (state & (DRW_STATE_CULL_BACK | DRW_STATE_CULL_FRONT)) { case DRW_STATE_CULL_BACK: @@ -127,7 +127,7 @@ static inline eGPUFaceCullTest to_face_cull_test(DRWState state) } } -static inline eGPUDepthTest to_depth_test(DRWState state) +static inline GPUDepthTest to_depth_test(DRWState state) { switch (state & DRW_STATE_DEPTH_TEST_ENABLED) { case DRW_STATE_DEPTH_LESS: @@ -147,7 +147,7 @@ static inline eGPUDepthTest to_depth_test(DRWState state) } } -static inline eGPUStencilOp to_stencil_op(DRWState state) +static inline GPUStencilOp to_stencil_op(DRWState state) { switch (state & DRW_STATE_WRITE_STENCIL_ENABLED) { case DRW_STATE_WRITE_STENCIL: @@ -161,7 +161,7 @@ static inline eGPUStencilOp to_stencil_op(DRWState state) } } -static inline eGPUStencilTest to_stencil_test(DRWState state) +static inline GPUStencilTest to_stencil_test(DRWState state) { switch (state & DRW_STATE_STENCIL_TEST_ENABLED) { case DRW_STATE_STENCIL_ALWAYS: @@ -175,7 +175,7 @@ static inline eGPUStencilTest to_stencil_test(DRWState state) } } -static inline eGPUBlend to_blend(DRWState state) +static inline GPUBlend to_blend(DRWState state) { switch (state & DRW_STATE_BLEND_ENABLED) { case DRW_STATE_BLEND_ADD: @@ -205,7 +205,7 @@ static inline eGPUBlend to_blend(DRWState state) } } -static inline eGPUProvokingVertex to_provoking_vertex(DRWState state) +static inline GPUProvokingVertex to_provoking_vertex(DRWState state) { switch (state & DRW_STATE_FIRST_VERTEX_CONVENTION) { case DRW_STATE_FIRST_VERTEX_CONVENTION: diff --git a/source/blender/draw/intern/draw_volume.cc b/source/blender/draw/intern/draw_volume.cc index 75803076fac..eb3941e018a 100644 --- a/source/blender/draw/intern/draw_volume.cc +++ b/source/blender/draw/intern/draw_volume.cc @@ -77,7 +77,7 @@ struct VolumeModule { GPU_texture_extend_mode(dummy_one, GPU_SAMPLER_EXTEND_MODE_REPEAT); } - gpu::Texture *grid_default_texture(eGPUDefaultValue default_value) + gpu::Texture *grid_default_texture(GPUDefaultValue default_value) { switch (default_value) { case GPU_DEFAULT_0: diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index 2f0d4f560fb..b15e88dd139 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -1456,7 +1456,7 @@ static void icon_draw_rect(float x, } /* draw */ - eGPUBuiltinShader shader; + GPUBuiltinShader shader; if (desaturate != 0.0f) { shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR; } diff --git a/source/blender/editors/screen/glutil.cc b/source/blender/editors/screen/glutil.cc index 23c44fc5b62..ffeb81215e0 100644 --- a/source/blender/editors/screen/glutil.cc +++ b/source/blender/editors/screen/glutil.cc @@ -39,10 +39,10 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin) IMMDrawPixelsTexState state; immDrawPixelsTexSetupAttributes(&state); - state.shader = GPU_shader_get_builtin_shader(eGPUBuiltinShader(builtin)); + state.shader = GPU_shader_get_builtin_shader(GPUBuiltinShader(builtin)); /* Shader will be unbind by immUnbindProgram in a `immDrawPixelsTex` function. */ - immBindBuiltinProgram(eGPUBuiltinShader(builtin)); + immBindBuiltinProgram(GPUBuiltinShader(builtin)); state.do_shader_unbind = true; return state; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.cc b/source/blender/editors/sculpt_paint/paint_cursor.cc index 01ccf50138f..c91d68a94b9 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.cc +++ b/source/blender/editors/sculpt_paint/paint_cursor.cc @@ -831,8 +831,8 @@ static bool paint_draw_alpha_overlay( bool alpha_overlay_active = false; ePaintOverlayControlFlags flags = BKE_paint_get_overlay_flags(); - eGPUBlend blend_state = GPU_blend_get(); - eGPUDepthTest depth_test = GPU_depth_test_get(); + GPUBlend blend_state = GPU_blend_get(); + GPUDepthTest depth_test = GPU_depth_test_get(); /* Translate to region. */ GPU_matrix_push(); @@ -1209,7 +1209,7 @@ static void sculpt_geometry_preview_lines_draw(const Depsgraph &depsgraph, immUniformColor4f(1.0f, 1.0f, 1.0f, 0.6f); /* Cursor normally draws on top, but for this part we need depth tests. */ - const eGPUDepthTest depth_test = GPU_depth_test_get(); + const GPUDepthTest depth_test = GPU_depth_test_get(); if (!depth_test) { GPU_depth_test(GPU_DEPTH_LESS_EQUAL); } diff --git a/source/blender/editors/space_view3d/view3d_placement.cc b/source/blender/editors/space_view3d/view3d_placement.cc index 893f8330924..8b8e1f5973e 100644 --- a/source/blender/editors/space_view3d/view3d_placement.cc +++ b/source/blender/editors/space_view3d/view3d_placement.cc @@ -647,7 +647,7 @@ static void draw_primitive_view(const bContext *C, ARegion * /*region*/, void *a UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, color); const bool use_depth = !XRAY_ENABLED(ipd->v3d); - const eGPUDepthTest depth_test_enabled = GPU_depth_test_get(); + const GPUDepthTest depth_test_enabled = GPU_depth_test_get(); if (use_depth) { GPU_depth_test(GPU_DEPTH_NONE); diff --git a/source/blender/editors/space_view3d/view3d_view.cc b/source/blender/editors/space_view3d/view3d_view.cc index f32133f1185..b73fab6deb1 100644 --- a/source/blender/editors/space_view3d/view3d_view.cc +++ b/source/blender/editors/space_view3d/view3d_view.cc @@ -491,7 +491,7 @@ struct DrawSelectLoopUserData { uint hits; GPUSelectBuffer *buffer; const rcti *rect; - eGPUSelectMode gpu_select_mode; + GPUSelectMode gpu_select_mode; }; static bool drw_select_loop_pass(eDRWSelectStage stage, void *user_data) @@ -568,7 +568,7 @@ int view3d_gpu_select_ex(const ViewContext *vc, const bool use_nearest = select_mode == VIEW3D_SELECT_PICK_NEAREST; bool draw_surface = true; - eGPUSelectMode gpu_select_mode = GPU_SELECT_INVALID; + GPUSelectMode gpu_select_mode = GPU_SELECT_INVALID; /* case not a box select */ if (input->xmin == input->xmax) { diff --git a/source/blender/editors/transform/transform_constraints.cc b/source/blender/editors/transform/transform_constraints.cc index d3a72282346..e56ce29a422 100644 --- a/source/blender/editors/transform/transform_constraints.cc +++ b/source/blender/editors/transform/transform_constraints.cc @@ -803,7 +803,7 @@ void drawConstraint(TransInfo *t) drawLine(t, t->center_global, t->spacemtx[1], 'Y', 0); drawLine(t, t->center_global, t->spacemtx[2], 'Z', 0); - eGPUDepthTest depth_test_enabled = GPU_depth_test_get(); + GPUDepthTest depth_test_enabled = GPU_depth_test_get(); if (depth_test_enabled) { GPU_depth_test(GPU_DEPTH_NONE); } @@ -876,7 +876,7 @@ void drawPropCircle(TransInfo *t) GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]); } - eGPUDepthTest depth_test_enabled = GPU_depth_test_get(); + GPUDepthTest depth_test_enabled = GPU_depth_test_get(); if (depth_test_enabled) { GPU_depth_test(GPU_DEPTH_NONE); } diff --git a/source/blender/gpu/GPU_batch.hh b/source/blender/gpu/GPU_batch.hh index 90108cf8f77..3faa4978f21 100644 --- a/source/blender/gpu/GPU_batch.hh +++ b/source/blender/gpu/GPU_batch.hh @@ -34,7 +34,7 @@ constexpr static int GPU_BATCH_VBO_MAX_LEN = 16; constexpr static int GPU_BATCH_VAO_STATIC_LEN = 3; constexpr static int GPU_BATCH_VAO_DYN_ALLOC_COUNT = 16; -enum eGPUBatchFlag { +enum GPUBatchFlag { /** Invalid default state. */ GPU_BATCH_INVALID = 0, @@ -56,9 +56,9 @@ enum eGPUBatchFlag { #define GPU_BATCH_OWNS_NONE GPU_BATCH_INVALID BLI_STATIC_ASSERT(GPU_BATCH_OWNS_INDEX < GPU_BATCH_INIT, - "eGPUBatchFlag: Error: status flags are shadowed by the ownership bits!") + "GPUBatchFlag: Error: status flags are shadowed by the ownership bits!") -ENUM_OPERATORS(eGPUBatchFlag, GPU_BATCH_DIRTY) +ENUM_OPERATORS(GPUBatchFlag, GPU_BATCH_DIRTY) namespace blender::gpu { @@ -79,7 +79,7 @@ class Batch { /** Number of vertices to draw for procedural drawcalls. -1 otherwise. */ int32_t procedural_vertices; /** Bookkeeping. */ - eGPUBatchFlag flag; + GPUBatchFlag flag; /** Type of geometry to draw. */ GPUPrimType prim_type; /** Current assigned shader. DEPRECATED. Here only for uniform binding. */ @@ -131,7 +131,7 @@ blender::gpu::Batch *GPU_batch_calloc(); blender::gpu::Batch *GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, - eGPUBatchFlag owns_flag); + GPUBatchFlag owns_flag); blender::gpu::Batch *GPU_batch_create_procedural(GPUPrimType primitive_type, int32_t vertex_count); @@ -139,7 +139,7 @@ blender::gpu::Batch *GPU_batch_create_procedural(GPUPrimType primitive_type, int * Creates a #blender::gpu::Batch without buffer ownership. */ #define GPU_batch_create(primitive_type, vertex_buf, index_buf) \ - GPU_batch_create_ex(primitive_type, vertex_buf, index_buf, (eGPUBatchFlag)0) + GPU_batch_create_ex(primitive_type, vertex_buf, index_buf, (GPUBatchFlag)0) /** * Initialize a cleared #blender::gpu::Batch with explicit buffer ownership. @@ -150,14 +150,14 @@ void GPU_batch_init_ex(blender::gpu::Batch *batch, GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, - eGPUBatchFlag owns_flag); + GPUBatchFlag owns_flag); /** * Initialize a cleared #blender::gpu::Batch without buffer ownership. * A #blender::gpu::Batch is in cleared state if it was just allocated using `GPU_batch_calloc()` * or cleared using `GPU_batch_clear()`. */ #define GPU_batch_init(batch, primitive_type, vertex_buf, index_buf) \ - GPU_batch_init_ex(batch, primitive_type, vertex_buf, index_buf, (eGPUBatchFlag)0) + GPU_batch_init_ex(batch, primitive_type, vertex_buf, index_buf, (GPUBatchFlag)0) /** * DEPRECATED: It is easy to loose ownership with this. To be removed. @@ -250,10 +250,10 @@ void GPU_batch_set_shader( blender::gpu::Batch *batch, blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state = nullptr); -void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, eGPUBuiltinShader shader_id); +void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, GPUBuiltinShader shader_id); void GPU_batch_program_set_builtin_with_config(blender::gpu::Batch *batch, - eGPUBuiltinShader shader_id, - eGPUShaderConfig sh_cfg); + GPUBuiltinShader shader_id, + GPUShaderConfig sh_cfg); /** * Bind program bound to IMM (immediate mode) to the #blender::gpu::Batch. * diff --git a/source/blender/gpu/GPU_common_types.hh b/source/blender/gpu/GPU_common_types.hh index 88e31d31ba4..516796d7de4 100644 --- a/source/blender/gpu/GPU_common_types.hh +++ b/source/blender/gpu/GPU_common_types.hh @@ -14,7 +14,7 @@ /** * Describes the load operation of a frame-buffer attachment at the start of a render pass. */ -enum eGPULoadOp { +enum GPULoadOp { /** * Clear the frame-buffer attachment using the clear value. */ @@ -36,7 +36,7 @@ enum eGPULoadOp { /** * Describes the store operation of a frame-buffer attachment at the end of a render pass. */ -enum eGPUStoreOp { +enum GPUStoreOp { /** * Do not care about the content of the attachment when the render pass ends. * Useful if only the values being written are important. @@ -69,7 +69,7 @@ enum GPUAttachmentState { GPU_ATTACHMENT_READ, }; -enum eGPUFrontFace { +enum GPUFrontFace { GPU_CLOCKWISE, GPU_COUNTERCLOCKWISE, }; diff --git a/source/blender/gpu/GPU_context.hh b/source/blender/gpu/GPU_context.hh index 7366ad0efd6..df8e084ffd4 100644 --- a/source/blender/gpu/GPU_context.hh +++ b/source/blender/gpu/GPU_context.hh @@ -17,13 +17,13 @@ * are no more contexts. */ bool GPU_backend_supported(); -void GPU_backend_type_selection_set(const eGPUBackendType backend); -eGPUBackendType GPU_backend_type_selection_get(); -eGPUBackendType GPU_backend_get_type(); +void GPU_backend_type_selection_set(const GPUBackendType backend); +GPUBackendType GPU_backend_type_selection_get(); +GPUBackendType GPU_backend_get_type(); const char *GPU_backend_get_name(); /** - * Detect the most suited eGPUBackendType. + * Detect the most suited GPUBackendType. * * - The detected backend will be set in `GPU_backend_type_selection_set`. * - When GPU_backend_type_selection_is_overridden it checks the overridden backend. @@ -39,7 +39,7 @@ bool GPU_backend_type_selection_detect(); /** * Alter the GPU_backend_type_selection_detect to only test a specific backend */ -void GPU_backend_type_selection_set_override(eGPUBackendType backend_type); +void GPU_backend_type_selection_set_override(GPUBackendType backend_type); /** * Check if the GPU_backend_type_selection_detect is overridden to only test a specific backend. diff --git a/source/blender/gpu/GPU_framebuffer.hh b/source/blender/gpu/GPU_framebuffer.hh index 08a9bff71ae..cd52952b24b 100644 --- a/source/blender/gpu/GPU_framebuffer.hh +++ b/source/blender/gpu/GPU_framebuffer.hh @@ -31,13 +31,13 @@ namespace blender::gpu { class Texture; } -enum eGPUFrameBufferBits { +enum GPUFrameBufferBits { GPU_COLOR_BIT = (1 << 0), GPU_DEPTH_BIT = (1 << 1), GPU_STENCIL_BIT = (1 << 2), }; -ENUM_OPERATORS(eGPUFrameBufferBits, GPU_STENCIL_BIT) +ENUM_OPERATORS(GPUFrameBufferBits, GPU_STENCIL_BIT) /* Guaranteed by the spec and is never greater than 16 on any hardware or implementation. */ constexpr static int GPU_MAX_VIEWPORTS = 16; @@ -98,7 +98,7 @@ void GPU_framebuffer_free(GPUFrameBuffer *fb); /** \name Binding * \{ */ -enum eGPUBackBuffer { +enum GPUBackBuffer { /** Default framebuffer of a window. Always available. */ GPU_BACKBUFFER_LEFT = 0, /** Right buffer of a window. Only available if window was created using stereo-view. */ @@ -109,7 +109,7 @@ enum eGPUBackBuffer { * Binds the active context's window frame-buffer. * Note that `GPU_BACKBUFFER_RIGHT` is only available if the window was created using stereo-view. */ -void GPU_backbuffer_bind(eGPUBackBuffer back_buffer_type); +void GPU_backbuffer_bind(GPUBackBuffer back_buffer_type); /** * Binds a #GPUFrameBuffer making it the active framebuffer for all geometry rendering. @@ -134,8 +134,8 @@ void GPU_framebuffer_restore(); * \{ */ struct GPULoadStore { - eGPULoadOp load_action; - eGPUStoreOp store_action; + GPULoadOp load_action; + GPUStoreOp store_action; float clear_value[4]; }; @@ -432,7 +432,7 @@ void GPU_framebuffer_viewport_reset(GPUFrameBuffer *fb); * \note Viewport and scissor regions affect this command but are not efficient nor recommended. */ void GPU_framebuffer_clear(GPUFrameBuffer *fb, - eGPUFrameBufferBits buffers, + GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, unsigned int clear_stencil); @@ -613,7 +613,7 @@ void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, int read_slot, GPUFrameBuffer *fb_write, int write_slot, - eGPUFrameBufferBits blit_buffers); + GPUFrameBufferBits blit_buffers); /** \} */ diff --git a/source/blender/gpu/GPU_immediate.hh b/source/blender/gpu/GPU_immediate.hh index a24b929e3c4..6a11313e435 100644 --- a/source/blender/gpu/GPU_immediate.hh +++ b/source/blender/gpu/GPU_immediate.hh @@ -132,7 +132,7 @@ void immUniformColor4ubv(const unsigned char rgba[4]); * Extend #immBindShader to use Blender's library of built-in shader programs. * Use #immUnbindProgram() when done. */ -void immBindBuiltinProgram(eGPUBuiltinShader shader_id); +void immBindBuiltinProgram(GPUBuiltinShader shader_id); /** Extend #immUniformColor to take Blender's themes. */ void immUniformThemeColor(int color_id); diff --git a/source/blender/gpu/GPU_material.hh b/source/blender/gpu/GPU_material.hh index 33bb5a21dc6..039f9bde8ef 100644 --- a/source/blender/gpu/GPU_material.hh +++ b/source/blender/gpu/GPU_material.hh @@ -45,7 +45,7 @@ enum eGPUMaterialEngine { GPU_MAT_ENGINE_MAX, }; -enum eGPUMaterialStatus { +enum GPUMaterialStatus { GPU_MAT_FAILED = 0, GPU_MAT_QUEUED, GPU_MAT_SUCCESS, @@ -147,7 +147,7 @@ Material *GPU_material_get_material(GPUMaterial *material); /** * Return true if the material compilation has not yet begin or begin. */ -eGPUMaterialStatus GPU_material_status(GPUMaterial *mat); +GPUMaterialStatus GPU_material_status(GPUMaterial *mat); /** * Return status for asynchronous optimization jobs. @@ -188,7 +188,7 @@ const ListBase *GPU_material_layer_attributes(const GPUMaterial *material); /* Requested Material Attributes and Textures */ -enum eGPUType { +enum GPUType { /* Keep in sync with GPU_DATATYPE_STR */ /* The value indicates the number of elements in each type */ GPU_NONE = 0, @@ -213,7 +213,7 @@ enum eGPUType { GPU_ATTR = 3001, }; -enum eGPUDefaultValue { +enum GPUDefaultValue { GPU_DEFAULT_0 = 0, GPU_DEFAULT_1, }; @@ -223,8 +223,8 @@ struct GPUMaterialAttribute { int type; /* eCustomDataType */ char name[/*MAX_CUSTOMDATA_LAYER_NAME*/ 68]; char input_name[/*GPU_MAX_SAFE_ATTR_NAME + 1*/ 12 + 1]; - eGPUType gputype; - eGPUDefaultValue default_value; /* Only for volumes attributes. */ + GPUType gputype; + GPUDefaultValue default_value; /* Only for volumes attributes. */ int id; int users; /** @@ -286,7 +286,7 @@ const GPUUniformAttrList *GPU_material_uniform_attributes(const GPUMaterial *mat /* TODO: Move to its own header. */ struct GPUNodeStack { - eGPUType type; + GPUType type; float vec[4]; GPUNodeLink *link; bool hasinput; @@ -324,7 +324,7 @@ GPUNodeLink *GPU_attribute_hair_intercept(GPUMaterial *mat); GPUNodeLink *GPU_attribute_with_default(GPUMaterial *mat, eCustomDataType type, const char *name, - eGPUDefaultValue default_value); + GPUDefaultValue default_value); GPUNodeLink *GPU_uniform_attribute(GPUMaterial *mat, const char *name, bool use_dupli, @@ -381,7 +381,7 @@ void GPU_material_add_output_link_composite(GPUMaterial *material, GPUNodeLink * * \return the name of the generated function. */ char *GPU_material_split_sub_function(GPUMaterial *material, - eGPUType return_type, + GPUType return_type, GPUNodeLink **link); void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag); diff --git a/source/blender/gpu/GPU_pass.hh b/source/blender/gpu/GPU_pass.hh index 648dd3c346d..d80f16bc054 100644 --- a/source/blender/gpu/GPU_pass.hh +++ b/source/blender/gpu/GPU_pass.hh @@ -17,7 +17,7 @@ struct GPUNodeGraph; struct GPUPass; -enum eGPUPassStatus { +enum GPUPassStatus { GPU_PASS_FAILED = 0, GPU_PASS_QUEUED, GPU_PASS_SUCCESS, @@ -32,7 +32,7 @@ GPUPass *GPU_generate_pass(GPUMaterial *material, void *thunk, bool optimize_graph); -eGPUPassStatus GPU_pass_status(GPUPass *pass); +GPUPassStatus GPU_pass_status(GPUPass *pass); bool GPU_pass_should_optimize(GPUPass *pass); void GPU_pass_ensure_its_ready(GPUPass *pass); blender::gpu::Shader *GPU_pass_shader_get(GPUPass *pass); diff --git a/source/blender/gpu/GPU_platform.hh b/source/blender/gpu/GPU_platform.hh index d597a27b58b..4fb25697d34 100644 --- a/source/blender/gpu/GPU_platform.hh +++ b/source/blender/gpu/GPU_platform.hh @@ -20,7 +20,7 @@ /* GPU platform support */ /* GPU Types */ -enum eGPUDeviceType { +enum GPUDeviceType { GPU_DEVICE_NVIDIA = (1 << 0), GPU_DEVICE_ATI = (1 << 1), GPU_DEVICE_INTEL = (1 << 2), @@ -32,23 +32,23 @@ enum eGPUDeviceType { GPU_DEVICE_ANY = (0xff), }; -ENUM_OPERATORS(eGPUDeviceType, GPU_DEVICE_ANY) +ENUM_OPERATORS(GPUDeviceType, GPU_DEVICE_ANY) -enum eGPUOSType { +enum GPUOSType { GPU_OS_WIN = (1 << 8), GPU_OS_MAC = (1 << 9), GPU_OS_UNIX = (1 << 10), GPU_OS_ANY = (0xff00), }; -enum eGPUDriverType { +enum GPUDriverType { GPU_DRIVER_OFFICIAL = (1 << 16), GPU_DRIVER_OPENSOURCE = (1 << 17), GPU_DRIVER_SOFTWARE = (1 << 18), GPU_DRIVER_ANY = (0xff0000), }; -enum eGPUSupportLevel { +enum GPUSupportLevel { GPU_SUPPORT_LEVEL_SUPPORTED, GPU_SUPPORT_LEVEL_LIMITED, GPU_SUPPORT_LEVEL_UNSUPPORTED, @@ -78,13 +78,13 @@ struct GPUDevice { /* GPU Types */ /* TODO: Verify all use-cases of GPU_type_matches to determine which graphics API it should apply * to, and replace with `GPU_type_matches_ex` where appropriate. */ -bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver); -bool GPU_type_matches_ex(eGPUDeviceType device, - eGPUOSType os, - eGPUDriverType driver, - eGPUBackendType backend); +bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver); +bool GPU_type_matches_ex(GPUDeviceType device, + GPUOSType os, + GPUDriverType driver, + GPUBackendType backend); -eGPUSupportLevel GPU_platform_support_level(); +GPUSupportLevel GPU_platform_support_level(); const char *GPU_platform_vendor(); const char *GPU_platform_renderer(); const char *GPU_platform_version(); diff --git a/source/blender/gpu/GPU_platform_backend_enum.h b/source/blender/gpu/GPU_platform_backend_enum.h index 2f9ce9757b7..f9824d5f72e 100644 --- a/source/blender/gpu/GPU_platform_backend_enum.h +++ b/source/blender/gpu/GPU_platform_backend_enum.h @@ -9,7 +9,7 @@ #pragma once /** NOTE: Keep in sync with eUserPref_GPUBackendType. */ -enum eGPUBackendType { +enum GPUBackendType { GPU_BACKEND_NONE = 0, GPU_BACKEND_OPENGL = 1 << 0, GPU_BACKEND_METAL = 1 << 1, diff --git a/source/blender/gpu/GPU_select.hh b/source/blender/gpu/GPU_select.hh index 5a77c3d9af1..f29cc675126 100644 --- a/source/blender/gpu/GPU_select.hh +++ b/source/blender/gpu/GPU_select.hh @@ -15,7 +15,7 @@ struct rcti; /** Flags for mode of operation. */ -enum eGPUSelectMode { +enum GPUSelectMode { GPU_SELECT_INVALID = 0, GPU_SELECT_ALL = 1, /* gpu_select_query */ @@ -50,17 +50,14 @@ struct GPUSelectBuffer { /** * Initialize and provide buffer for results. */ -void GPU_select_begin(GPUSelectBuffer *buffer, - const rcti *input, - eGPUSelectMode mode, - int oldhits); +void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits); /** * Initialize and provide buffer for results. * Uses the new Select-Next engine if enabled. */ void GPU_select_begin_next(GPUSelectBuffer *buffer, const rcti *input, - eGPUSelectMode mode, + GPUSelectMode mode, int oldhits); /** * Loads a new selection id and ends previous query, if any. diff --git a/source/blender/gpu/GPU_shader_builtin.hh b/source/blender/gpu/GPU_shader_builtin.hh index eba15a18f5e..e68e5dd5868 100644 --- a/source/blender/gpu/GPU_shader_builtin.hh +++ b/source/blender/gpu/GPU_shader_builtin.hh @@ -24,7 +24,7 @@ namespace blender::gpu { class Shader; } // namespace blender::gpu -enum eGPUBuiltinShader { +enum GPUBuiltinShader { /** Glyph drawing shader used by the BLF module. */ GPU_SHADER_TEXT = 0, /** Draws keyframe markers. All markers shapes are supported through a single shader. */ @@ -153,15 +153,15 @@ enum eGPUBuiltinShader { #define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_IMAGE_COLOR + 1) /** Support multiple configurations. */ -enum eGPUShaderConfig { +enum GPUShaderConfig { GPU_SHADER_CFG_DEFAULT = 0, GPU_SHADER_CFG_CLIPPED = 1, }; #define GPU_SHADER_CFG_LEN (GPU_SHADER_CFG_CLIPPED + 1) -blender::gpu::Shader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, - eGPUShaderConfig sh_cfg); -blender::gpu::Shader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader); +blender::gpu::Shader *GPU_shader_get_builtin_shader_with_config(GPUBuiltinShader shader, + GPUShaderConfig sh_cfg); +blender::gpu::Shader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader); void GPU_shader_builtin_warm_up(); diff --git a/source/blender/gpu/GPU_shader_shared.hh b/source/blender/gpu/GPU_shader_shared.hh index 6b2c8e6cfc7..4156a0c0e75 100644 --- a/source/blender/gpu/GPU_shader_shared.hh +++ b/source/blender/gpu/GPU_shader_shared.hh @@ -20,7 +20,7 @@ struct TestOutputRawData; * required in the common use-case where a float3 and an int/float are paired together for optimal * data transfer. */ -enum eGPUKeyframeShapes : uint32_t { +enum GPUKeyframeShapes : uint32_t { GPU_KEYFRAME_SHAPE_DIAMOND = (1u << 0u), GPU_KEYFRAME_SHAPE_CIRCLE = (1u << 1u), GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL = (1u << 2u), @@ -116,7 +116,7 @@ BLI_STATIC_ASSERT_ALIGN(MultiIconCallData, 16) #define GPU_SEQ_STRIP_DRAW_DATA_LEN 256 -enum eGPUSeqFlags : uint32_t { +enum GPUSeqFlags : uint32_t { GPU_SEQ_FLAG_BACKGROUND = (1u << 0u), GPU_SEQ_FLAG_SINGLE_IMAGE = (1u << 1u), GPU_SEQ_FLAG_COLOR_BAND = (1u << 2u), @@ -157,7 +157,7 @@ struct SeqStripDrawData { float bottom; float top; float strip_content_top; /* Content coordinate, i.e. below title bar if there is one. */ - uint flags; /* eGPUSeqFlags bitmask. */ + uint flags; /* GPUSeqFlags bitmask. */ /* Strip colors, each is uchar4 packed with equivalent of packUnorm4x8. */ uint col_background; uint col_outline; diff --git a/source/blender/gpu/GPU_shader_shared_utils.hh b/source/blender/gpu/GPU_shader_shared_utils.hh index d15e2a7fff1..f29739afaa5 100644 --- a/source/blender/gpu/GPU_shader_shared_utils.hh +++ b/source/blender/gpu/GPU_shader_shared_utils.hh @@ -14,7 +14,7 @@ * IMPORTANT: * - Always use `u` suffix for enum values. GLSL do not support implicit cast. * - Define all values. This is in order to simplify custom pre-processor code. - * - (C++ only) Always use `uint32_t` as underlying type (`enum eMyEnum : uint32_t`). + * - (C++ only) Always use `uint32_t` as underlying type (`enum MyEnum : uint32_t`). * - (C only) do NOT use the enum type inside UBO/SSBO structs and use `uint` instead. * - Use float suffix by default for float literals to avoid double promotion in C++. * - Pack one float or int after a vec3/ivec3 to fulfill alignment rules. diff --git a/source/blender/gpu/GPU_state.hh b/source/blender/gpu/GPU_state.hh index 787a3a7f00c..6a67a307e33 100644 --- a/source/blender/gpu/GPU_state.hh +++ b/source/blender/gpu/GPU_state.hh @@ -13,7 +13,7 @@ /** Opaque type hiding blender::gpu::Fence. */ struct GPUFence; -enum eGPUWriteMask { +enum GPUWriteMask { GPU_WRITE_NONE = 0, GPU_WRITE_RED = (1 << 0), GPU_WRITE_GREEN = (1 << 1), @@ -24,9 +24,9 @@ enum eGPUWriteMask { GPU_WRITE_COLOR = (GPU_WRITE_RED | GPU_WRITE_GREEN | GPU_WRITE_BLUE | GPU_WRITE_ALPHA), }; -ENUM_OPERATORS(eGPUWriteMask, GPU_WRITE_COLOR) +ENUM_OPERATORS(GPUWriteMask, GPU_WRITE_COLOR) -enum eGPUBarrier { +enum GPUBarrier { /* Texture Barrier. */ /** All written texture prior to this barrier can be bound as frame-buffer attachment. */ @@ -58,11 +58,11 @@ enum eGPUBarrier { // GPU_BARRIER_CLIENT_MAPPED_BUFFER = (1 << 15), /* Not implemented yet. */ }; -ENUM_OPERATORS(eGPUBarrier, GPU_BARRIER_BUFFER_UPDATE) +ENUM_OPERATORS(GPUBarrier, GPU_BARRIER_BUFFER_UPDATE) /* NOTE: For Metal and Vulkan only. * TODO(Metal): Update barrier calls to use stage flags. */ -enum eGPUStageBarrierBits { +enum GPUStageBarrierBits { GPU_BARRIER_STAGE_VERTEX = (1 << 0), GPU_BARRIER_STAGE_FRAGMENT = (1 << 1), GPU_BARRIER_STAGE_COMPUTE = (1 << 2), @@ -71,7 +71,7 @@ enum eGPUStageBarrierBits { GPU_BARRIER_STAGE_COMPUTE), }; -ENUM_OPERATORS(eGPUStageBarrierBits, GPU_BARRIER_STAGE_COMPUTE) +ENUM_OPERATORS(GPUStageBarrierBits, GPU_BARRIER_STAGE_COMPUTE) /** * Defines the fixed pipeline blending equation. @@ -81,7 +81,7 @@ ENUM_OPERATORS(eGPUStageBarrierBits, GPU_BARRIER_STAGE_COMPUTE) * `(SRC * A) + (DST * B)`. * The blend mode will modify the A and B parameters. */ -enum eGPUBlend { +enum GPUBlend { GPU_BLEND_NONE = 0, /** Pre-multiply variants will _NOT_ multiply rgb output by alpha. */ GPU_BLEND_ALPHA, @@ -107,7 +107,7 @@ enum eGPUBlend { GPU_BLEND_OVERLAY_MASK_FROM_ALPHA, }; -enum eGPUDepthTest { +enum GPUDepthTest { GPU_DEPTH_NONE = 0, GPU_DEPTH_ALWAYS, /* Used to draw to the depth buffer without really testing. */ GPU_DEPTH_LESS, @@ -117,14 +117,14 @@ enum eGPUDepthTest { GPU_DEPTH_GREATER_EQUAL, }; -enum eGPUStencilTest { +enum GPUStencilTest { GPU_STENCIL_NONE = 0, GPU_STENCIL_ALWAYS, GPU_STENCIL_EQUAL, GPU_STENCIL_NEQUAL, }; -enum eGPUStencilOp { +enum GPUStencilOp { GPU_STENCIL_OP_NONE = 0, GPU_STENCIL_OP_REPLACE, /** Special values for stencil shadows. */ @@ -132,22 +132,22 @@ enum eGPUStencilOp { GPU_STENCIL_OP_COUNT_DEPTH_FAIL, }; -enum eGPUFaceCullTest { +enum GPUFaceCullTest { GPU_CULL_NONE = 0, /* Culling disabled. */ GPU_CULL_FRONT, GPU_CULL_BACK, }; -enum eGPUProvokingVertex { +enum GPUProvokingVertex { GPU_VERTEX_LAST = 0, /* Default. */ GPU_VERTEX_FIRST = 1, /* Follow Blender loop order. */ }; -void GPU_blend(eGPUBlend blend); -void GPU_face_culling(eGPUFaceCullTest culling); -void GPU_depth_test(eGPUDepthTest test); -void GPU_stencil_test(eGPUStencilTest test); -void GPU_provoking_vertex(eGPUProvokingVertex vert); +void GPU_blend(GPUBlend blend); +void GPU_face_culling(GPUFaceCullTest culling); +void GPU_depth_test(GPUDepthTest test); +void GPU_stencil_test(GPUStencilTest test); +void GPU_provoking_vertex(GPUProvokingVertex vert); void GPU_front_facing(bool invert); void GPU_depth_range(float near, float far); void GPU_scissor_test(bool enable); @@ -175,20 +175,20 @@ void GPU_scissor_get(int coords[4]); void GPU_viewport(int x, int y, int width, int height); void GPU_viewport_size_get_f(float coords[4]); void GPU_viewport_size_get_i(int coords[4]); -void GPU_write_mask(eGPUWriteMask mask); +void GPU_write_mask(GPUWriteMask mask); void GPU_color_mask(bool r, bool g, bool b, bool a); void GPU_depth_mask(bool depth); bool GPU_depth_mask_get(); void GPU_shadow_offset(bool enable); void GPU_clip_distances(int distances_enabled); bool GPU_mipmap_enabled(); -void GPU_state_set(eGPUWriteMask write_mask, - eGPUBlend blend, - eGPUFaceCullTest culling_test, - eGPUDepthTest depth_test, - eGPUStencilTest stencil_test, - eGPUStencilOp stencil_op, - eGPUProvokingVertex provoking_vert); +void GPU_state_set(GPUWriteMask write_mask, + GPUBlend blend, + GPUFaceCullTest culling_test, + GPUDepthTest depth_test, + GPUStencilTest stencil_test, + GPUStencilOp stencil_op, + GPUProvokingVertex provoking_vert); void GPU_stencil_reference_set(uint reference); void GPU_stencil_write_mask_set(uint write_mask); @@ -199,12 +199,12 @@ void GPU_stencil_compare_mask_set(uint compare_mask); * BuiltinBits::CLIP_CONTROL for their vertex shader to be patched. */ void GPU_clip_control_unit_range(bool enable); -eGPUFaceCullTest GPU_face_culling_get(); -eGPUBlend GPU_blend_get(); -eGPUDepthTest GPU_depth_test_get(); -eGPUWriteMask GPU_write_mask_get(); +GPUFaceCullTest GPU_face_culling_get(); +GPUBlend GPU_blend_get(); +GPUDepthTest GPU_depth_test_get(); +GPUWriteMask GPU_write_mask_get(); uint GPU_stencil_mask_get(); -eGPUStencilTest GPU_stencil_test_get(); +GPUStencilTest GPU_stencil_test_get(); /** * \note Already pre-multiplied by `U.pixelsize`. */ @@ -223,7 +223,7 @@ void GPU_apply_state(); * The type of barrier must be chosen depending on the _future_ use of the memory that was written * by the shader. */ -void GPU_memory_barrier(eGPUBarrier barrier); +void GPU_memory_barrier(GPUBarrier barrier); GPUFence *GPU_fence_create(); void GPU_fence_free(GPUFence *fence); diff --git a/source/blender/gpu/dummy/dummy_framebuffer.hh b/source/blender/gpu/dummy/dummy_framebuffer.hh index ac715987f98..ba954beb2d2 100644 --- a/source/blender/gpu/dummy/dummy_framebuffer.hh +++ b/source/blender/gpu/dummy/dummy_framebuffer.hh @@ -20,7 +20,7 @@ class DummyFrameBuffer : public FrameBuffer { { return true; } - void clear(eGPUFrameBufferBits /*buffers*/, + void clear(GPUFrameBufferBits /*buffers*/, const float /*clear_color*/[4], float /*clear_depth*/, uint /*clear_stencil*/) override @@ -38,7 +38,7 @@ class DummyFrameBuffer : public FrameBuffer { void subpass_transition_impl(const GPUAttachmentState /*depth_attachment_state*/, Span /*color_attachment_states*/) override{}; - void read(eGPUFrameBufferBits /*planes*/, + void read(GPUFrameBufferBits /*planes*/, eGPUDataFormat /*format*/, const int /*area*/[4], int /*channel_len*/, @@ -47,7 +47,7 @@ class DummyFrameBuffer : public FrameBuffer { { } - void blit_to(eGPUFrameBufferBits /*planes*/, + void blit_to(GPUFrameBufferBits /*planes*/, int /*src_slot*/, FrameBuffer * /*dst*/, int /*dst_slot*/, diff --git a/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh b/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh index 57c511b44d4..1b8bd252b20 100644 --- a/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh +++ b/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh @@ -1850,7 +1850,7 @@ class Preprocessor { * Transform C,C++ enum declaration into GLSL compatible defines and constants: * * \code{.cpp} - * enum eMyEnum : uint { + * enum MyEnum : uint { * ENUM_1 = 0u, * ENUM_2 = 1u, * ENUM_3 = 2u, @@ -1860,7 +1860,7 @@ class Preprocessor { * becomes * * \code{.glsl} - * #define eMyEnum uint + * #define MyEnum uint * constant static constexpr uint ENUM_1 = 0u; * constant static constexpr uint ENUM_2 = 1u; * constant static constexpr uint ENUM_3 = 2u; diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index e17655230cf..a32e4f833b0 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -35,7 +35,7 @@ void GPU_batch_zero(Batch *batch) { std::fill_n(batch->verts, ARRAY_SIZE(batch->verts), nullptr); batch->elem = nullptr; - batch->flag = eGPUBatchFlag(0); + batch->flag = GPUBatchFlag(0); batch->prim_type = GPUPrimType(0); batch->shader = nullptr; batch->procedural_vertices = -1; @@ -51,7 +51,7 @@ Batch *GPU_batch_calloc() Batch *GPU_batch_create_ex(GPUPrimType primitive_type, VertBuf *vertex_buf, IndexBuf *index_buf, - eGPUBatchFlag owns_flag) + GPUBatchFlag owns_flag) { Batch *batch = GPU_batch_calloc(); GPU_batch_init_ex(batch, primitive_type, vertex_buf, index_buf, owns_flag); @@ -62,7 +62,7 @@ void GPU_batch_init_ex(Batch *batch, GPUPrimType primitive_type, VertBuf *vertex_buf, IndexBuf *index_buf, - eGPUBatchFlag owns_flag) + GPUBatchFlag owns_flag) { /* Do not pass any other flag */ BLI_assert((owns_flag & ~(GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX)) == 0); @@ -161,7 +161,7 @@ int GPU_batch_vertbuf_add(Batch *batch, VertBuf *vertex_buf, bool own_vbo) // BLI_assert(verts->vertex_len == batch->verts[0]->vertex_len); } batch->verts[v] = vertex_buf; - SET_FLAG_FROM_TEST(batch->flag, own_vbo, (eGPUBatchFlag)(GPU_BATCH_OWNS_VBO << v)); + SET_FLAG_FROM_TEST(batch->flag, own_vbo, (GPUBatchFlag)(GPU_BATCH_OWNS_VBO << v)); return v; } } @@ -489,14 +489,14 @@ void GPU_batch_multi_draw_indirect(Batch *batch, * \{ */ void GPU_batch_program_set_builtin_with_config(Batch *batch, - eGPUBuiltinShader shader_id, - eGPUShaderConfig sh_cfg) + GPUBuiltinShader shader_id, + GPUShaderConfig sh_cfg) { blender::gpu::Shader *shader = GPU_shader_get_builtin_shader_with_config(shader_id, sh_cfg); GPU_batch_set_shader(batch, shader); } -void GPU_batch_program_set_builtin(Batch *batch, eGPUBuiltinShader shader_id) +void GPU_batch_program_set_builtin(Batch *batch, GPUBuiltinShader shader_id) { GPU_batch_program_set_builtin_with_config(batch, shader_id, GPU_SHADER_CFG_DEFAULT); } diff --git a/source/blender/gpu/intern/gpu_codegen.cc b/source/blender/gpu/intern/gpu_codegen.cc index 5231c9bf71a..9d241174356 100644 --- a/source/blender/gpu/intern/gpu_codegen.cc +++ b/source/blender/gpu/intern/gpu_codegen.cc @@ -82,7 +82,7 @@ static std::ostream &operator<<(std::ostream &stream, const GPUOutput *output) /* Print data constructor (i.e: vec2(1.0f, 1.0f)). */ static std::ostream &operator<<(std::ostream &stream, const Span &span) { - stream << (eGPUType)span.size() << "("; + stream << (GPUType)span.size() << "("; /* Use uint representation to allow exact same bit pattern even if NaN. This is * because we can pass UINTs as floats for constants. */ const Span uint_span = span.cast(); @@ -184,7 +184,7 @@ void GPUCodegen::generate_attribs() StringRefNull attr_name = info.name_buffer.attr_names[slot]; StringRefNull var_name = info.name_buffer.var_names[slot]; - eGPUType input_type, iface_type; + GPUType input_type, iface_type; load_ss << "var_attrs." << var_name; if (attr->is_hair_length || attr->is_hair_intercept) { @@ -346,9 +346,9 @@ void GPUCodegen::node_serialize(std::stringstream &eval_ss, const GPUNode *node) case GPU_SOURCE_OUTPUT: case GPU_SOURCE_ATTR: { /* These inputs can have non matching types. Do conversion. */ - eGPUType to = input->type; - eGPUType from = (input->source == GPU_SOURCE_ATTR) ? input->attr->gputype : - input->link->output->type; + GPUType to = input->type; + GPUType from = (input->source == GPU_SOURCE_ATTR) ? input->attr->gputype : + input->link->output->type; if (from != to) { /* Use defines declared inside codegen_lib (i.e: vec4_from_float). */ eval_ss << to << "_from_" << from << "("; @@ -392,7 +392,7 @@ void GPUCodegen::node_serialize(std::stringstream &eval_ss, const GPUNode *node) nodes_total_++; } -std::string GPUCodegen::graph_serialize(eGPUNodeTag tree_tag, +std::string GPUCodegen::graph_serialize(GPUNodeTag tree_tag, GPUNodeLink *output_link, const char *output_default) { @@ -429,7 +429,7 @@ std::string GPUCodegen::graph_serialize(eGPUNodeTag tree_tag, return str; } -std::string GPUCodegen::graph_serialize(eGPUNodeTag tree_tag) +std::string GPUCodegen::graph_serialize(GPUNodeTag tree_tag) { std::stringstream eval_ss; LISTBASE_FOREACH (GPUNode *, node, &graph.nodes) { diff --git a/source/blender/gpu/intern/gpu_codegen.hh b/source/blender/gpu/intern/gpu_codegen.hh index f107da1ca4a..0ab390aa95b 100644 --- a/source/blender/gpu/intern/gpu_codegen.hh +++ b/source/blender/gpu/intern/gpu_codegen.hh @@ -97,10 +97,10 @@ class GPUCodegen { void set_unique_ids(); void node_serialize(std::stringstream &eval_ss, const GPUNode *node); - std::string graph_serialize(eGPUNodeTag tree_tag, + std::string graph_serialize(GPUNodeTag tree_tag, GPUNodeLink *output_link, const char *output_default = nullptr); - std::string graph_serialize(eGPUNodeTag tree_tag); + std::string graph_serialize(GPUNodeTag tree_tag); }; } // namespace blender::gpu::shader diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc index e848e7bfbab..873ba072db7 100644 --- a/source/blender/gpu/intern/gpu_context.cc +++ b/source/blender/gpu/intern/gpu_context.cc @@ -344,8 +344,8 @@ void GPU_render_step(bool force_resource_release) /** \name Backend selection * \{ */ -static eGPUBackendType g_backend_type = GPU_BACKEND_OPENGL; -static std::optional g_backend_type_override = std::nullopt; +static GPUBackendType g_backend_type = GPU_BACKEND_OPENGL; +static std::optional g_backend_type_override = std::nullopt; static std::optional g_backend_type_supported = std::nullopt; static std::optional g_vsync_override = std::nullopt; static GPUBackend *g_backend = nullptr; @@ -361,7 +361,7 @@ void *GPU_backend_ghost_system_get() return g_ghost_system; } -void GPU_backend_type_selection_set(const eGPUBackendType backend) +void GPU_backend_type_selection_set(const GPUBackendType backend) { g_backend_type = backend; g_backend_type_supported = std::nullopt; @@ -382,12 +382,12 @@ bool GPU_backend_vsync_is_overridden() return g_vsync_override.has_value(); } -eGPUBackendType GPU_backend_type_selection_get() +GPUBackendType GPU_backend_type_selection_get() { return g_backend_type; } -void GPU_backend_type_selection_set_override(const eGPUBackendType backend_type) +void GPU_backend_type_selection_set_override(const GPUBackendType backend_type) { g_backend_type_override = backend_type; } @@ -399,7 +399,7 @@ bool GPU_backend_type_selection_is_overridden() bool GPU_backend_type_selection_detect() { - blender::VectorSet backends_to_check; + blender::VectorSet backends_to_check; if (g_backend_type_override.has_value()) { backends_to_check.add(*g_backend_type_override); } @@ -413,7 +413,7 @@ bool GPU_backend_type_selection_detect() backends_to_check.add(GPU_BACKEND_VULKAN); #endif - for (const eGPUBackendType backend_type : backends_to_check) { + for (const GPUBackendType backend_type : backends_to_check) { GPU_backend_type_selection_set(backend_type); if (GPU_backend_supported()) { return true; @@ -511,7 +511,7 @@ void gpu_backend_discard() g_backend = nullptr; } -eGPUBackendType GPU_backend_get_type() +GPUBackendType GPU_backend_get_type() { #ifdef WITH_OPENGL_BACKEND diff --git a/source/blender/gpu/intern/gpu_context_private.hh b/source/blender/gpu/intern/gpu_context_private.hh index d43b58ed859..c68038378ed 100644 --- a/source/blender/gpu/intern/gpu_context_private.hh +++ b/source/blender/gpu/intern/gpu_context_private.hh @@ -134,7 +134,7 @@ class Context { return; } - if (!(state_manager->state.write_mask & eGPUWriteMask::GPU_WRITE_COLOR)) { + if (!(state_manager->state.write_mask & GPUWriteMask::GPU_WRITE_COLOR)) { return; } diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index adf3b1e6cac..bf2b703cf1e 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -271,7 +271,7 @@ void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb) unwrap(fb)->bind(enable_srgb); } -void GPU_backbuffer_bind(eGPUBackBuffer back_buffer_type) +void GPU_backbuffer_bind(GPUBackBuffer back_buffer_type) { Context *ctx = Context::get(); @@ -412,7 +412,7 @@ void GPU_framebuffer_viewport_reset(GPUFrameBuffer *gpu_fb) /* ---------- Frame-buffer Operations ----------- */ void GPU_framebuffer_clear(GPUFrameBuffer *gpu_fb, - eGPUFrameBufferBits buffers, + GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) @@ -518,7 +518,7 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpu_fb_read, int read_slot, GPUFrameBuffer *gpu_fb_write, int write_slot, - eGPUFrameBufferBits blit_buffers) + GPUFrameBufferBits blit_buffers) { FrameBuffer *fb_read = unwrap(gpu_fb_read); FrameBuffer *fb_write = unwrap(gpu_fb_write); diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 0711428a30a..b163a05a087 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -104,7 +104,7 @@ class FrameBuffer { virtual void bind(bool enabled_srgb) = 0; virtual bool check(char err_out[256]) = 0; - virtual void clear(eGPUFrameBufferBits buffers, + virtual void clear(GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) = 0; @@ -115,14 +115,14 @@ class FrameBuffer { virtual void attachment_set_loadstore_op(GPUAttachmentType type, GPULoadStore ls) = 0; - virtual void read(eGPUFrameBufferBits planes, + virtual void read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) = 0; - virtual void blit_to(eGPUFrameBufferBits planes, + virtual void blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index 150ca128bc7..b5df424a906 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -58,7 +58,7 @@ void immBindShader(blender::gpu::Shader *shader) GPU_matrix_bind(shader); } -void immBindBuiltinProgram(eGPUBuiltinShader shader_id) +void immBindBuiltinProgram(GPUBuiltinShader shader_id) { blender::gpu::Shader *shader = GPU_shader_get_builtin_shader(shader_id); immBindShader(shader); @@ -135,7 +135,7 @@ static void wide_line_workaround_start(GPUPrimType prim_type) return; } - eGPUBuiltinShader polyline_sh; + GPUBuiltinShader polyline_sh; switch (*imm->builtin_shader_bound) { case GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR: polyline_sh = GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR; diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh b/source/blender/gpu/intern/gpu_immediate_private.hh index 07f86e97ff6..27c4263a52f 100644 --- a/source/blender/gpu/intern/gpu_immediate_private.hh +++ b/source/blender/gpu/intern/gpu_immediate_private.hh @@ -45,9 +45,9 @@ class Immediate { /** Wide Line workaround. */ /** Previously bound shader to restore after drawing. */ - std::optional prev_builtin_shader; + std::optional prev_builtin_shader; /** Builtin shader index. Used to test if the line width workaround can be done. */ - std::optional builtin_shader_bound; + std::optional builtin_shader_bound; /** Uniform color: Kept here to update the wide-line shader just before #immBegin. */ float uniform_color[4]; diff --git a/source/blender/gpu/intern/gpu_material.cc b/source/blender/gpu/intern/gpu_material.cc index 20a33176e28..5c3539d6c55 100644 --- a/source/blender/gpu/intern/gpu_material.cc +++ b/source/blender/gpu/intern/gpu_material.cc @@ -318,7 +318,7 @@ blender::gpu::Shader *GPU_material_get_shader(GPUMaterial *material) return GPU_pass_shader_get(GPU_material_get_pass(material)); } -eGPUMaterialStatus GPU_material_status(GPUMaterial *mat) +GPUMaterialStatus GPU_material_status(GPUMaterial *mat) { switch (GPU_pass_status(mat->pass)) { case GPU_PASS_SUCCESS: @@ -572,7 +572,7 @@ void GPU_material_add_output_link_composite(GPUMaterial *material, GPUNodeLink * } char *GPU_material_split_sub_function(GPUMaterial *material, - eGPUType return_type, + GPUType return_type, GPUNodeLink **link) { /* Force cast to return type. */ diff --git a/source/blender/gpu/intern/gpu_material_library.hh b/source/blender/gpu/intern/gpu_material_library.hh index 7ac0610460d..af92c344cbf 100644 --- a/source/blender/gpu/intern/gpu_material_library.hh +++ b/source/blender/gpu/intern/gpu_material_library.hh @@ -24,7 +24,7 @@ enum GPUFunctionQual { struct GPUFunction { char name[MAX_FUNCTION_NAME]; - eGPUType paramtype[MAX_PARAMETER]; + GPUType paramtype[MAX_PARAMETER]; GPUFunctionQual paramqual[MAX_PARAMETER]; int totparam; /* TODO(@fclem): Clean that void pointer. */ diff --git a/source/blender/gpu/intern/gpu_node_graph.cc b/source/blender/gpu/intern/gpu_node_graph.cc index 59079711dc5..a5f81c60461 100644 --- a/source/blender/gpu/intern/gpu_node_graph.cc +++ b/source/blender/gpu/intern/gpu_node_graph.cc @@ -63,7 +63,7 @@ static GPUNode *gpu_node_create(const char *name) return node; } -static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type) +static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType type) { GPUInput *input; GPUNode *outnode; @@ -246,7 +246,7 @@ static void gpu_node_input_socket( } } -static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link) +static void gpu_node_output(GPUNode *node, const GPUType type, GPUNodeLink **link) { GPUOutput *output = MEM_callocN("GPUOutput"); @@ -605,7 +605,7 @@ GPUNodeLink *GPU_attribute_hair_intercept(GPUMaterial *mat) GPUNodeLink *GPU_attribute_with_default(GPUMaterial *mat, const eCustomDataType type, const char *name, - eGPUDefaultValue default_value) + GPUDefaultValue default_value) { GPUNodeLink *link = GPU_attribute(mat, type, name); if (link->link_type == GPU_NODE_LINK_ATTR) { @@ -939,7 +939,7 @@ void gpu_node_graph_free(GPUNodeGraph *graph) /* Prune Unused Nodes */ -void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag) +void gpu_nodes_tag(GPUNodeLink *link, GPUNodeTag tag) { GPUNode *node; diff --git a/source/blender/gpu/intern/gpu_node_graph.hh b/source/blender/gpu/intern/gpu_node_graph.hh index 9d3921028d0..4589e3bacd1 100644 --- a/source/blender/gpu/intern/gpu_node_graph.hh +++ b/source/blender/gpu/intern/gpu_node_graph.hh @@ -20,7 +20,7 @@ struct GPUNode; struct GPUOutput; struct ListBase; -enum eGPUDataSource { +enum GPUDataSource { GPU_SOURCE_OUTPUT, GPU_SOURCE_CONSTANT, GPU_SOURCE_UNIFORM, @@ -50,7 +50,7 @@ enum GPUNodeLinkType { GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN, }; -enum eGPUNodeTag { +enum GPUNodeTag { GPU_NODE_TAG_NONE = 0, GPU_NODE_TAG_SURFACE = (1 << 0), GPU_NODE_TAG_VOLUME = (1 << 1), @@ -61,7 +61,7 @@ enum eGPUNodeTag { GPU_NODE_TAG_COMPOSITOR = (1 << 6), }; -ENUM_OPERATORS(eGPUNodeTag, GPU_NODE_TAG_COMPOSITOR) +ENUM_OPERATORS(GPUNodeTag, GPU_NODE_TAG_COMPOSITOR) struct GPUNode { GPUNode *next, *prev; @@ -69,7 +69,7 @@ struct GPUNode { const char *name; /* Internal flag to mark nodes during pruning */ - eGPUNodeTag tag; + GPUNodeTag tag; ListBase inputs; ListBase outputs; @@ -108,7 +108,7 @@ struct GPUOutput { GPUOutput *next, *prev; GPUNode *node; - eGPUType type; /* data type = length of vector/matrix */ + GPUType type; /* data type = length of vector/matrix */ GPUNodeLink *link; /* output link */ int id; /* unique id as created by code generator */ }; @@ -117,13 +117,13 @@ struct GPUInput { GPUInput *next, *prev; GPUNode *node; - eGPUType type; /* data-type. */ + GPUType type; /* data-type. */ GPUNodeLink *link; int id; /* unique id as created by code generator */ - eGPUDataSource source; /* data source */ + GPUDataSource source; /* data source */ - /* Content based on eGPUDataSource */ + /* Content based on GPUDataSource */ union { /* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */ float vec[16]; /* vector data */ @@ -184,7 +184,7 @@ struct GPUNodeGraph { /* Node Graph */ -void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag); +void gpu_nodes_tag(GPUNodeLink *link, GPUNodeTag tag); void gpu_node_graph_prune_unused(GPUNodeGraph *graph); void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph); diff --git a/source/blender/gpu/intern/gpu_pass.cc b/source/blender/gpu/intern/gpu_pass.cc index 170cbd731a5..7419293b1e4 100644 --- a/source/blender/gpu/intern/gpu_pass.cc +++ b/source/blender/gpu/intern/gpu_pass.cc @@ -39,7 +39,7 @@ struct GPUPass { GPUCodegenCreateInfo *create_info = nullptr; BatchHandle compilation_handle = 0; std::atomic shader = nullptr; - std::atomic status = GPU_PASS_QUEUED; + std::atomic status = GPU_PASS_QUEUED; /* Orphaned GPUPasses gets freed by the garbage collector. */ std::atomic refcount = 1; double creation_timestamp = 0.0f; @@ -158,7 +158,7 @@ struct GPUPass { } }; -eGPUPassStatus GPU_pass_status(GPUPass *pass) +GPUPassStatus GPU_pass_status(GPUPass *pass) { return pass->status; } diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc index 899504afb05..ee8468ff62c 100644 --- a/source/blender/gpu/intern/gpu_platform.cc +++ b/source/blender/gpu/intern/gpu_platform.cc @@ -30,7 +30,7 @@ namespace blender::gpu { GPUPlatformGlobal GPG; -static char *create_key(eGPUSupportLevel support_level, +static char *create_key(GPUSupportLevel support_level, const char *vendor, const char *renderer, const char *version) @@ -66,11 +66,11 @@ static char *create_gpu_name(const char *vendor, const char *renderer, const cha return gpu_name; } -void GPUPlatformGlobal::init(eGPUDeviceType gpu_device, - eGPUOSType os_type, - eGPUDriverType driver_type, - eGPUSupportLevel gpu_support_level, - eGPUBackendType backend, +void GPUPlatformGlobal::init(GPUDeviceType gpu_device, + GPUOSType os_type, + GPUDriverType driver_type, + GPUSupportLevel gpu_support_level, + GPUBackendType backend, const char *vendor_str, const char *renderer_str, const char *version_str, @@ -122,7 +122,7 @@ void GPUPlatformGlobal::clear() using namespace blender::gpu; -eGPUSupportLevel GPU_platform_support_level() +GPUSupportLevel GPU_platform_support_level() { BLI_assert(GPG.initialized); return GPG.support_level; @@ -164,15 +164,15 @@ GPUArchitectureType GPU_platform_architecture() return GPG.architecture_type; } -bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver) +bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver) { return GPU_type_matches_ex(device, os, driver, GPU_BACKEND_ANY); } -bool GPU_type_matches_ex(eGPUDeviceType device, - eGPUOSType os, - eGPUDriverType driver, - eGPUBackendType backend) +bool GPU_type_matches_ex(GPUDeviceType device, + GPUOSType os, + GPUDriverType driver, + GPUBackendType backend) { BLI_assert(GPG.initialized); return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver) && diff --git a/source/blender/gpu/intern/gpu_platform_private.hh b/source/blender/gpu/intern/gpu_platform_private.hh index 7f0a206bd35..7b6447921af 100644 --- a/source/blender/gpu/intern/gpu_platform_private.hh +++ b/source/blender/gpu/intern/gpu_platform_private.hh @@ -20,16 +20,16 @@ namespace blender::gpu { class GPUPlatformGlobal { public: bool initialized = false; - eGPUDeviceType device; - eGPUOSType os; - eGPUDriverType driver; - eGPUSupportLevel support_level; + GPUDeviceType device; + GPUOSType os; + GPUDriverType driver; + GPUSupportLevel support_level; char *vendor = nullptr; char *renderer = nullptr; char *version = nullptr; char *support_key = nullptr; char *gpu_name = nullptr; - eGPUBackendType backend = GPU_BACKEND_NONE; + GPUBackendType backend = GPU_BACKEND_NONE; GPUArchitectureType architecture_type = GPU_ARCHITECTURE_IMR; Vector devices; @@ -41,11 +41,11 @@ class GPUPlatformGlobal { * matters if device_luid is defined. */ uint32_t device_luid_node_mask; - void init(eGPUDeviceType gpu_device, - eGPUOSType os_type, - eGPUDriverType driver_type, - eGPUSupportLevel gpu_support_level, - eGPUBackendType backend, + void init(GPUDeviceType gpu_device, + GPUOSType os_type, + GPUDriverType driver_type, + GPUSupportLevel gpu_support_level, + GPUBackendType backend, const char *vendor_str, const char *renderer_str, const char *version_str, diff --git a/source/blender/gpu/intern/gpu_select.cc b/source/blender/gpu/intern/gpu_select.cc index 2f9ab635505..749923220f2 100644 --- a/source/blender/gpu/intern/gpu_select.cc +++ b/source/blender/gpu/intern/gpu_select.cc @@ -24,7 +24,7 @@ * \{ */ /* Internal algorithm used */ -enum eGPUSelectAlgo { +enum GPUSelectAlgo { /** * `glBegin/EndQuery(GL_SAMPLES_PASSED... )`, `gpu_select_query.c` * Only sets 4th component (ID) correctly. @@ -43,9 +43,9 @@ struct GPUSelectState { /* To ignore selection id calls when not initialized */ bool select_is_active; /* mode of operation */ - eGPUSelectMode mode; + GPUSelectMode mode; /* internal algorithm for selection */ - eGPUSelectAlgo algorithm; + GPUSelectAlgo algorithm; /* allow GPU_select_begin/end without drawing */ bool use_cache; /** @@ -69,7 +69,7 @@ static GPUSelectState g_select_state = {false}; static void gpu_select_begin_ex(GPUSelectBuffer *buffer, const rcti *input, - eGPUSelectMode mode, + GPUSelectMode mode, int oldhits, bool use_select_next) { @@ -131,13 +131,13 @@ static void gpu_select_begin_ex(GPUSelectBuffer *buffer, void GPU_select_begin_next(GPUSelectBuffer *buffer, const rcti *input, - eGPUSelectMode mode, + GPUSelectMode mode, int oldhits) { gpu_select_begin_ex(buffer, input, mode, oldhits, true); } -void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode, int oldhits) +void GPU_select_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits) { gpu_select_begin_ex(buffer, input, mode, oldhits, false); } diff --git a/source/blender/gpu/intern/gpu_select_next.cc b/source/blender/gpu/intern/gpu_select_next.cc index 91826b8a5ee..b45a4c62cdb 100644 --- a/source/blender/gpu/intern/gpu_select_next.cc +++ b/source/blender/gpu/intern/gpu_select_next.cc @@ -22,12 +22,12 @@ struct GPUSelectNextState { /** Number of hits. Set to -1 if it overflows buffer_len. */ uint hits = -1; /** Mode of operation. */ - eGPUSelectMode mode = eGPUSelectMode::GPU_SELECT_INVALID; + GPUSelectMode mode = GPUSelectMode::GPU_SELECT_INVALID; }; static GPUSelectNextState g_state = {}; -void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode) +void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode) { g_state.buffer = buffer; @@ -41,7 +41,7 @@ int gpu_select_next_get_pick_area_center() return BLI_rcti_size_x(&g_state.rect) / 2; } -eGPUSelectMode gpu_select_next_get_mode() +GPUSelectMode gpu_select_next_get_mode() { return g_state.mode; } @@ -56,18 +56,18 @@ void gpu_select_next_set_result(GPUSelectResult *hit_buf, uint hit_len) /* TODO(fclem): There might be some conversion to do to align to the other APIs output. */ switch (g_state.mode) { - case eGPUSelectMode::GPU_SELECT_ALL: + case GPUSelectMode::GPU_SELECT_ALL: hit_results.copy_from(hits); break; - case eGPUSelectMode::GPU_SELECT_PICK_ALL: + case GPUSelectMode::GPU_SELECT_PICK_ALL: hit_results.copy_from(hits); break; - case eGPUSelectMode::GPU_SELECT_PICK_NEAREST: + case GPUSelectMode::GPU_SELECT_PICK_NEAREST: hit_results.copy_from(hits); break; - case eGPUSelectMode::GPU_SELECT_NEAREST_FIRST_PASS: - case eGPUSelectMode::GPU_SELECT_NEAREST_SECOND_PASS: - case eGPUSelectMode::GPU_SELECT_INVALID: + case GPUSelectMode::GPU_SELECT_NEAREST_FIRST_PASS: + case GPUSelectMode::GPU_SELECT_NEAREST_SECOND_PASS: + case GPUSelectMode::GPU_SELECT_INVALID: BLI_assert_unreachable(); break; } diff --git a/source/blender/gpu/intern/gpu_select_pick.cc b/source/blender/gpu/intern/gpu_select_pick.cc index 722a0be930f..421fe5448a0 100644 --- a/source/blender/gpu/intern/gpu_select_pick.cc +++ b/source/blender/gpu/intern/gpu_select_pick.cc @@ -229,7 +229,7 @@ struct GPUPickState { /** Cache on initialization. */ GPUSelectBuffer *buffer; /** Mode of this operation. */ - eGPUSelectMode mode; + GPUSelectMode mode; /** GPU drawing, never use when `is_cached == true`. */ struct { @@ -287,13 +287,13 @@ struct GPUPickState { /** Previous state to restore after drawing. */ int viewport[4]; int scissor[4]; - eGPUWriteMask write_mask; - eGPUDepthTest depth_test; + GPUWriteMask write_mask; + GPUDepthTest depth_test; }; static GPUPickState g_pick_state{}; -void gpu_select_pick_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode) +void gpu_select_pick_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode) { GPUPickState *ps = &g_pick_state; diff --git a/source/blender/gpu/intern/gpu_select_private.hh b/source/blender/gpu/intern/gpu_select_private.hh index 4125f7e398e..64705792af2 100644 --- a/source/blender/gpu/intern/gpu_select_private.hh +++ b/source/blender/gpu/intern/gpu_select_private.hh @@ -14,7 +14,7 @@ /* gpu_select_pick */ -void gpu_select_pick_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode); +void gpu_select_pick_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode); bool gpu_select_pick_load_id(uint id, bool end); uint gpu_select_pick_end(); @@ -30,19 +30,19 @@ void gpu_select_pick_cache_load_id(); void gpu_select_query_begin(GPUSelectBuffer *buffer, const rcti *input, - eGPUSelectMode mode, + GPUSelectMode mode, int oldhits); bool gpu_select_query_load_id(uint id); uint gpu_select_query_end(); /* gpu_select_next */ -void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode); +void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode); uint gpu_select_next_end(); /* Return a single offset since picking uses squared viewport. */ int gpu_select_next_get_pick_area_center(); -eGPUSelectMode gpu_select_next_get_mode(); +GPUSelectMode gpu_select_next_get_mode(); void gpu_select_next_set_result(GPUSelectResult *hit_buf, uint hit_len); #define SELECT_ID_NONE ((uint)0xffffffff) diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc index b45dc3d2258..ebd71d2f29d 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.cc +++ b/source/blender/gpu/intern/gpu_select_sample_query.cc @@ -39,22 +39,22 @@ struct GPUSelectQueryState { /** Cache on initialization. */ GPUSelectBuffer *buffer; /** Mode of operation. */ - eGPUSelectMode mode; + GPUSelectMode mode; uint index; int oldhits; /** Previous state to restore after drawing. */ int viewport[4]; int scissor[4]; - eGPUWriteMask write_mask; - eGPUDepthTest depth_test; + GPUWriteMask write_mask; + GPUDepthTest depth_test; }; static GPUSelectQueryState g_query_state = {false}; void gpu_select_query_begin(GPUSelectBuffer *buffer, const rcti *input, - const eGPUSelectMode mode, + const GPUSelectMode mode, int oldhits) { GPU_debug_group_begin("Selection Queries"); diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 61a2f1c28b0..d585828d40a 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -98,7 +98,7 @@ static void standard_defines(Vector &sources) sources.append("#define OS_UNIX\n"); } /* API Definition */ - eGPUBackendType backend = GPU_backend_get_type(); + GPUBackendType backend = GPU_backend_get_type(); switch (backend) { case GPU_BACKEND_OPENGL: sources.append("#define GPU_OPENGL\n"); diff --git a/source/blender/gpu/intern/gpu_shader_builtin.cc b/source/blender/gpu/intern/gpu_shader_builtin.cc index efc64929108..5af0826d686 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.cc +++ b/source/blender/gpu/intern/gpu_shader_builtin.cc @@ -24,7 +24,7 @@ struct BuiltinShader : blender::gpu::StaticShader { /* Cache of built-in shaders (each is created on first use). */ static BuiltinShader *builtin_shaders[GPU_SHADER_CFG_LEN][GPU_SHADER_BUILTIN_LEN] = {{nullptr}}; -static const char *builtin_shader_create_info_name(eGPUBuiltinShader shader) +static const char *builtin_shader_create_info_name(GPUBuiltinShader shader) { switch (shader) { case GPU_SHADER_TEXT: @@ -125,7 +125,7 @@ static const char *builtin_shader_create_info_name(eGPUBuiltinShader shader) } } -static const char *builtin_shader_create_info_name_clipped(eGPUBuiltinShader shader) +static const char *builtin_shader_create_info_name_clipped(GPUBuiltinShader shader) { switch (shader) { case GPU_SHADER_3D_UNIFORM_COLOR: @@ -148,8 +148,8 @@ static const char *builtin_shader_create_info_name_clipped(eGPUBuiltinShader sha } } -blender::gpu::Shader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, - eGPUShaderConfig sh_cfg) +blender::gpu::Shader *GPU_shader_get_builtin_shader_with_config(GPUBuiltinShader shader, + GPUShaderConfig sh_cfg) { BLI_assert(shader < GPU_SHADER_BUILTIN_LEN); @@ -201,7 +201,7 @@ blender::gpu::Shader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShade return (*sh_p)->get(); } -static void gpu_shader_warm_builtin_shader_async(eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg) +static void gpu_shader_warm_builtin_shader_async(GPUBuiltinShader shader, GPUShaderConfig sh_cfg) { BLI_assert(shader < GPU_SHADER_BUILTIN_LEN); @@ -234,7 +234,7 @@ static void gpu_shader_warm_builtin_shader_async(eGPUBuiltinShader shader, eGPUS (*sh_p)->ensure_compile_async(); } -blender::gpu::Shader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader) +blender::gpu::Shader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) { return GPU_shader_get_builtin_shader_with_config(shader, GPU_SHADER_CFG_DEFAULT); } diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index b29e0e2a1a2..1a29e0c4f2f 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -335,7 +335,7 @@ struct GPUSource; namespace blender::gpu::shader { /* All of these functions is a bit out of place */ -static inline Type to_type(const eGPUType type) +static inline Type to_type(const GPUType type) { switch (type) { case GPU_FLOAT: @@ -351,7 +351,7 @@ static inline Type to_type(const eGPUType type) case GPU_MAT4: return Type::float4x4_t; default: - BLI_assert_msg(0, "Error: Cannot convert eGPUType to shader::Type."); + BLI_assert_msg(0, "Error: Cannot convert GPUType to shader::Type."); return Type::float_t; } } @@ -429,7 +429,7 @@ static inline std::ostream &operator<<(std::ostream &stream, const Type type) } } -static inline std::ostream &operator<<(std::ostream &stream, const eGPUType type) +static inline std::ostream &operator<<(std::ostream &stream, const GPUType type) { switch (type) { case GPU_CLOSURE: diff --git a/source/blender/gpu/intern/gpu_shader_dependency.cc b/source/blender/gpu/intern/gpu_shader_dependency.cc index 2ca4be99613..ba79425fcd8 100644 --- a/source/blender/gpu/intern/gpu_shader_dependency.cc +++ b/source/blender/gpu/intern/gpu_shader_dependency.cc @@ -132,7 +132,7 @@ struct GPUSource { return FUNCTION_QUAL_IN; } - eGPUType convert_type(shader::metadata::Type type) + GPUType convert_type(shader::metadata::Type type) { using namespace blender::gpu::shader; switch (type) { diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 35cafbf8091..8b75d38821e 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -39,20 +39,20 @@ using namespace blender::gpu; /** \name Immutable state Setters * \{ */ -void GPU_blend(eGPUBlend blend) +void GPU_blend(GPUBlend blend) { SET_IMMUTABLE_STATE(blend, blend); } -void GPU_face_culling(eGPUFaceCullTest culling) +void GPU_face_culling(GPUFaceCullTest culling) { SET_IMMUTABLE_STATE(culling_test, culling); } -eGPUFaceCullTest GPU_face_culling_get() +GPUFaceCullTest GPU_face_culling_get() { GPUState &state = Context::get()->state_manager->state; - return (eGPUFaceCullTest)state.culling_test; + return (GPUFaceCullTest)state.culling_test; } void GPU_front_facing(bool invert) @@ -60,17 +60,17 @@ void GPU_front_facing(bool invert) SET_IMMUTABLE_STATE(invert_facing, invert); } -void GPU_provoking_vertex(eGPUProvokingVertex vert) +void GPU_provoking_vertex(GPUProvokingVertex vert) { SET_IMMUTABLE_STATE(provoking_vert, vert); } -void GPU_depth_test(eGPUDepthTest test) +void GPU_depth_test(GPUDepthTest test) { SET_IMMUTABLE_STATE(depth_test, test); } -void GPU_stencil_test(eGPUStencilTest test) +void GPU_stencil_test(GPUStencilTest test) { SET_IMMUTABLE_STATE(stencil_test, test); } @@ -90,7 +90,7 @@ void GPU_logic_op_xor_set(bool enable) SET_IMMUTABLE_STATE(logic_op_xor, enable); } -void GPU_write_mask(eGPUWriteMask mask) +void GPU_write_mask(GPUWriteMask mask) { SET_IMMUTABLE_STATE(write_mask, mask); } @@ -126,13 +126,13 @@ void GPU_clip_distances(int distances_enabled) SET_IMMUTABLE_STATE(clip_distances, distances_enabled); } -void GPU_state_set(eGPUWriteMask write_mask, - eGPUBlend blend, - eGPUFaceCullTest culling_test, - eGPUDepthTest depth_test, - eGPUStencilTest stencil_test, - eGPUStencilOp stencil_op, - eGPUProvokingVertex provoking_vert) +void GPU_state_set(GPUWriteMask write_mask, + GPUBlend blend, + GPUFaceCullTest culling_test, + GPUDepthTest depth_test, + GPUStencilTest stencil_test, + GPUStencilOp stencil_op, + GPUProvokingVertex provoking_vert) { StateManager *stack = Context::get()->state_manager; auto &state = stack->state; @@ -223,16 +223,16 @@ void GPU_stencil_compare_mask_set(uint compare_mask) /** \name State Getters * \{ */ -eGPUBlend GPU_blend_get() +GPUBlend GPU_blend_get() { GPUState &state = Context::get()->state_manager->state; - return (eGPUBlend)state.blend; + return (GPUBlend)state.blend; } -eGPUWriteMask GPU_write_mask_get() +GPUWriteMask GPU_write_mask_get() { GPUState &state = Context::get()->state_manager->state; - return (eGPUWriteMask)state.write_mask; + return (GPUWriteMask)state.write_mask; } uint GPU_stencil_mask_get() @@ -241,16 +241,16 @@ uint GPU_stencil_mask_get() return state.stencil_write_mask; } -eGPUDepthTest GPU_depth_test_get() +GPUDepthTest GPU_depth_test_get() { GPUState &state = Context::get()->state_manager->state; - return (eGPUDepthTest)state.depth_test; + return (GPUDepthTest)state.depth_test; } -eGPUStencilTest GPU_stencil_test_get() +GPUStencilTest GPU_stencil_test_get() { GPUState &state = Context::get()->state_manager->state; - return (eGPUStencilTest)state.stencil_test; + return (GPUStencilTest)state.stencil_test; } float GPU_line_width_get() @@ -323,7 +323,7 @@ void GPU_apply_state() /** \name Synchronization Utils * \{ */ -void GPU_memory_barrier(eGPUBarrier barrier) +void GPU_memory_barrier(GPUBarrier barrier) { Context::get()->state_manager->issue_barrier(barrier); } diff --git a/source/blender/gpu/intern/gpu_state_private.hh b/source/blender/gpu/intern/gpu_state_private.hh index 57a06ec414c..942f3c22cec 100644 --- a/source/blender/gpu/intern/gpu_state_private.hh +++ b/source/blender/gpu/intern/gpu_state_private.hh @@ -22,19 +22,19 @@ namespace blender::gpu { * Try to keep small to reduce validation time. */ union GPUState { struct { - /** eGPUWriteMask */ + /** GPUWriteMask */ uint32_t write_mask : 13; - /** eGPUBlend */ + /** GPUBlend */ uint32_t blend : 4; - /** eGPUFaceCullTest */ + /** GPUFaceCullTest */ uint32_t culling_test : 2; - /** eGPUDepthTest */ + /** GPUDepthTest */ uint32_t depth_test : 3; - /** eGPUStencilTest */ + /** GPUStencilTest */ uint32_t stencil_test : 3; - /** eGPUStencilOp */ + /** GPUStencilOp */ uint32_t stencil_op : 3; - /** eGPUProvokingVertex */ + /** GPUProvokingVertex */ uint32_t provoking_vert : 1; /** Enable bits. */ uint32_t logic_op_xor : 1; @@ -150,7 +150,7 @@ class StateManager { virtual void apply_state() = 0; virtual void force_state() = 0; - virtual void issue_barrier(eGPUBarrier barrier_bits) = 0; + virtual void issue_barrier(GPUBarrier barrier_bits) = 0; virtual void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) = 0; virtual void texture_unbind(Texture *tex) = 0; diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index bb8925d0206..1814399c726 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -132,7 +132,7 @@ bool Texture::init_buffer(VertBuf *vbo, TextureFormat format) bool Texture::init_view(Texture *src, TextureFormat format, - eGPUTextureType type, + GPUTextureType type, int mip_start, int mip_len, int layer_start, @@ -253,7 +253,7 @@ static inline gpu::Texture *gpu_texture_create(const char *name, const int w, const int h, const int d, - const eGPUTextureType type, + const GPUTextureType type, int mip_len, TextureFormat tex_format, eGPUTextureUsage usage, @@ -435,7 +435,7 @@ gpu::Texture *GPU_texture_create_error(int dimension, bool is_array) int h = (dimension < 2 && !is_array) ? 0 : 1; int d = (dimension < 3 && !is_array) ? 0 : 1; - eGPUTextureType type = GPU_TEXTURE_3D; + GPUTextureType type = GPU_TEXTURE_3D; type = (dimension == 2) ? (is_array ? GPU_TEXTURE_2D_ARRAY : GPU_TEXTURE_2D) : type; type = (dimension == 1) ? (is_array ? GPU_TEXTURE_1D_ARRAY : GPU_TEXTURE_1D) : type; @@ -691,7 +691,7 @@ void GPU_texture_ref(gpu::Texture *texture) int GPU_texture_dimensions(const gpu::Texture *texture) { - eGPUTextureType type = texture->type_get(); + GPUTextureType type = texture->type_get(); if (type & GPU_TEXTURE_1D) { return 1; } diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index ed0b0f761ba..1110cd978ab 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -16,7 +16,7 @@ namespace blender::gpu { -enum eGPUTextureFormatFlag { +enum GPUTextureFormatFlag { /* The format has a depth component and can be used as depth attachment. */ GPU_FORMAT_DEPTH = (1 << 0), /* The format has a stencil component and can be used as stencil attachment. */ @@ -37,9 +37,9 @@ enum eGPUTextureFormatFlag { GPU_FORMAT_DEPTH_STENCIL = (GPU_FORMAT_DEPTH | GPU_FORMAT_STENCIL), }; -ENUM_OPERATORS(eGPUTextureFormatFlag, GPU_FORMAT_SIGNED) +ENUM_OPERATORS(GPUTextureFormatFlag, GPU_FORMAT_SIGNED) -enum eGPUTextureType { +enum GPUTextureType { GPU_TEXTURE_1D = (1 << 0), GPU_TEXTURE_2D = (1 << 1), GPU_TEXTURE_3D = (1 << 2), @@ -52,11 +52,11 @@ enum eGPUTextureType { GPU_TEXTURE_CUBE_ARRAY = (GPU_TEXTURE_CUBE | GPU_TEXTURE_ARRAY), }; -ENUM_OPERATORS(eGPUTextureType, GPU_TEXTURE_BUFFER) +ENUM_OPERATORS(GPUTextureType, GPU_TEXTURE_BUFFER) /* Format types for samplers within the shader. * This covers the sampler format type permutations within GLSL/MSL. */ -enum eGPUSamplerFormat { +enum GPUSamplerFormat { GPU_SAMPLER_TYPE_FLOAT = 0, GPU_SAMPLER_TYPE_INT = 1, GPU_SAMPLER_TYPE_UINT = 2, @@ -65,7 +65,7 @@ enum eGPUSamplerFormat { GPU_SAMPLER_TYPE_MAX = 4 }; -ENUM_OPERATORS(eGPUSamplerFormat, GPU_SAMPLER_TYPE_UINT) +ENUM_OPERATORS(GPUSamplerFormat, GPU_SAMPLER_TYPE_UINT) #ifndef NDEBUG # define DEBUG_NAME_LEN 64 @@ -106,9 +106,9 @@ class Texture { /** Internal data format. */ TextureFormat format_; /** Format characteristics. */ - eGPUTextureFormatFlag format_flag_; + GPUTextureFormatFlag format_flag_; /** Texture type. */ - eGPUTextureType type_; + GPUTextureType type_; /** Texture usage flags. */ eGPUTextureUsage gpu_image_usage_flags_; @@ -137,7 +137,7 @@ class Texture { bool init_buffer(VertBuf *vbo, TextureFormat format); bool init_view(Texture *src, TextureFormat format, - eGPUTextureType type, + GPUTextureType type, int mip_start, int mip_len, int layer_start, @@ -258,11 +258,11 @@ class Texture { { return format_; } - eGPUTextureFormatFlag format_flag_get() const + GPUTextureFormatFlag format_flag_get() const { return format_flag_; } - eGPUTextureType type_get() const + GPUTextureType type_get() const { return type_; } @@ -373,7 +373,7 @@ inline size_t to_block_size(TextureFormat data_type) } } -inline eGPUTextureFormatFlag to_format_flag(TextureFormat format) +inline GPUTextureFormatFlag to_format_flag(TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ @@ -775,7 +775,7 @@ inline eGPUDataFormat to_texture_data_format(TextureFormat tex_format) return GPU_DATA_FLOAT; } -inline eGPUFrameBufferBits to_framebuffer_bits(TextureFormat tex_format) +inline GPUFrameBufferBits to_framebuffer_bits(TextureFormat tex_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 3c717dc3c4f..61d67e3a858 100644 --- a/source/blender/gpu/intern/gpu_uniform_buffer.cc +++ b/source/blender/gpu/intern/gpu_uniform_buffer.cc @@ -58,10 +58,10 @@ UniformBuf::~UniformBuf() * We need to pad some data types (vec3) on the C side * To match the GPU expected memory block alignment. */ -static eGPUType get_padded_gpu_type(LinkData *link) +static GPUType get_padded_gpu_type(LinkData *link) { GPUInput *input = (GPUInput *)link->data; - eGPUType gputype = input->type; + GPUType gputype = input->type; /* Metal cannot pack floats after vec3. */ if (GPU_backend_get_type() == GPU_BACKEND_METAL) { return (gputype == GPU_VEC3) ? GPU_VEC4 : gputype; @@ -107,7 +107,7 @@ static void buffer_from_list_inputs_sort(ListBase *inputs) /* Creates a lookup table for the different types. */ LinkData *inputs_lookup[MAX_UBO_GPU_TYPE + 1] = {nullptr}; - eGPUType cur_type = static_cast(MAX_UBO_GPU_TYPE + 1); + GPUType cur_type = static_cast(MAX_UBO_GPU_TYPE + 1); LISTBASE_FOREACH (LinkData *, link, inputs) { GPUInput *input = (GPUInput *)link->data; @@ -162,7 +162,7 @@ static inline size_t buffer_size_from_list(ListBase *inputs) { size_t buffer_size = 0; LISTBASE_FOREACH (LinkData *, link, inputs) { - const eGPUType gputype = get_padded_gpu_type(link); + const GPUType gputype = get_padded_gpu_type(link); buffer_size += gputype * sizeof(float); } /* Round up to size of vec4. (Opengl Requirement) */ diff --git a/source/blender/gpu/metal/kernels/compute_texture_read.msl b/source/blender/gpu/metal/kernels/compute_texture_read.msl index c1afbc4d19a..dac83267915 100644 --- a/source/blender/gpu/metal/kernels/compute_texture_read.msl +++ b/source/blender/gpu/metal/kernels/compute_texture_read.msl @@ -2,7 +2,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -/* MATCHING eGPUTextureType. */ +/* MATCHING GPUTextureType. */ #define GPU_TEXTURE_1D (1 << 0) #define GPU_TEXTURE_2D (1 << 1) #define GPU_TEXTURE_3D (1 << 2) diff --git a/source/blender/gpu/metal/kernels/compute_texture_update.msl b/source/blender/gpu/metal/kernels/compute_texture_update.msl index 3893d900858..218a2520215 100644 --- a/source/blender/gpu/metal/kernels/compute_texture_update.msl +++ b/source/blender/gpu/metal/kernels/compute_texture_update.msl @@ -4,7 +4,7 @@ using namespace metal; -/* MATCHING eGPUTextureType. */ +/* MATCHING GPUTextureType. */ #define GPU_TEXTURE_1D (1 << 0) #define GPU_TEXTURE_2D (1 << 1) #define GPU_TEXTURE_3D (1 << 2) diff --git a/source/blender/gpu/metal/mtl_backend.mm b/source/blender/gpu/metal/mtl_backend.mm index 23741c91306..10b3e520119 100644 --- a/source/blender/gpu/metal/mtl_backend.mm +++ b/source/blender/gpu/metal/mtl_backend.mm @@ -188,10 +188,10 @@ void MTLBackend::platform_init(MTLContext *ctx) return; } - eGPUDeviceType device = GPU_DEVICE_UNKNOWN; - eGPUOSType os = GPU_OS_MAC; - eGPUDriverType driver = GPU_DRIVER_ANY; - eGPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; + GPUDeviceType device = GPU_DEVICE_UNKNOWN; + GPUOSType os = GPU_OS_MAC; + GPUDriverType driver = GPU_DRIVER_ANY; + GPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; BLI_assert(ctx); id mtl_device = ctx->device; diff --git a/source/blender/gpu/metal/mtl_command_buffer.mm b/source/blender/gpu/metal/mtl_command_buffer.mm index b736cc34617..35012af7966 100644 --- a/source/blender/gpu/metal/mtl_command_buffer.mm +++ b/source/blender/gpu/metal/mtl_command_buffer.mm @@ -576,9 +576,9 @@ void MTLCommandBufferManager::unfold_pending_debug_groups() } /* Workload Synchronization. */ -bool MTLCommandBufferManager::insert_memory_barrier(eGPUBarrier barrier_bits, - eGPUStageBarrierBits before_stages, - eGPUStageBarrierBits after_stages) +bool MTLCommandBufferManager::insert_memory_barrier(GPUBarrier barrier_bits, + GPUStageBarrierBits before_stages, + GPUStageBarrierBits after_stages) { /* Apple Silicon does not support memory barriers for RenderCommandEncoder's. * We do not currently need these due to implicit API guarantees. However, render->render diff --git a/source/blender/gpu/metal/mtl_context.hh b/source/blender/gpu/metal/mtl_context.hh index e6ef64bce2d..57a521d619d 100644 --- a/source/blender/gpu/metal/mtl_context.hh +++ b/source/blender/gpu/metal/mtl_context.hh @@ -500,8 +500,8 @@ struct MTLContextGlobalShaderPipelineState { /* Culling State. */ bool culling_enabled; - eGPUFaceCullTest cull_mode; - eGPUFrontFace front_face; + GPUFaceCullTest cull_mode; + GPUFrontFace front_face; /* Depth State. */ MTLContextDepthStencilState depth_stencil_state; @@ -641,9 +641,9 @@ class MTLCommandBufferManager { id ensure_begin_compute_encoder(); /* Workload Synchronization. */ - bool insert_memory_barrier(eGPUBarrier barrier_bits, - eGPUStageBarrierBits before_stages, - eGPUStageBarrierBits after_stages); + bool insert_memory_barrier(GPUBarrier barrier_bits, + GPUStageBarrierBits before_stages, + GPUStageBarrierBits after_stages); void encode_signal_event(id event, uint64_t value); void encode_wait_for_event(id event, uint64_t value); /* TODO(Metal): Support fences in command buffer class. */ @@ -896,7 +896,7 @@ class MTLContext : public Context { id get_null_buffer(); id get_null_attribute_buffer(); - gpu::MTLTexture *get_dummy_texture(eGPUTextureType type, eGPUSamplerFormat sampler_format); + gpu::MTLTexture *get_dummy_texture(GPUTextureType type, GPUSamplerFormat sampler_format); void free_dummy_resources(); /* Compute. */ diff --git a/source/blender/gpu/metal/mtl_context.mm b/source/blender/gpu/metal/mtl_context.mm index e18f724b3c5..056d559456a 100644 --- a/source/blender/gpu/metal/mtl_context.mm +++ b/source/blender/gpu/metal/mtl_context.mm @@ -609,8 +609,8 @@ id MTLContext::get_null_attribute_buffer() return null_attribute_buffer_; } -gpu::MTLTexture *MTLContext::get_dummy_texture(eGPUTextureType type, - eGPUSamplerFormat sampler_format) +gpu::MTLTexture *MTLContext::get_dummy_texture(GPUTextureType type, + GPUSamplerFormat sampler_format) { /* Decrement 1 from texture type as they start from 1 and go to 32 (inclusive). Remap to 0..31 */ gpu::MTLTexture *dummy_tex = dummy_textures_[sampler_format][type - 1]; diff --git a/source/blender/gpu/metal/mtl_framebuffer.hh b/source/blender/gpu/metal/mtl_framebuffer.hh index 15dd06bffa0..bd04b931791 100644 --- a/source/blender/gpu/metal/mtl_framebuffer.hh +++ b/source/blender/gpu/metal/mtl_framebuffer.hh @@ -31,8 +31,8 @@ struct MTLAttachment { uint stencil; } clear_value; - eGPULoadOp load_action = GPU_LOADACTION_DONT_CARE; - eGPUStoreOp store_action = GPU_STOREACTION_DONT_CARE; + GPULoadOp load_action = GPU_LOADACTION_DONT_CARE; + GPUStoreOp store_action = GPU_STOREACTION_DONT_CARE; uint mip = 0; uint slice = 0; uint depth_plane = 0; @@ -130,7 +130,7 @@ class MTLFrameBuffer : public FrameBuffer { bool check(char err_out[256]) override; - void clear(eGPUFrameBufferBits buffers, + void clear(GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) override; @@ -141,14 +141,14 @@ class MTLFrameBuffer : public FrameBuffer { void attachment_set_loadstore_op(GPUAttachmentType type, GPULoadStore ls) override; - void read(eGPUFrameBufferBits planes, + void read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override; - void blit_to(eGPUFrameBufferBits planes, + void blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, @@ -189,9 +189,9 @@ class MTLFrameBuffer : public FrameBuffer { bool set_color_attachment_clear_color(uint slot, const float clear_color[4]); bool set_depth_attachment_clear_value(float depth_clear); bool set_stencil_attachment_clear_value(uint stencil_clear); - bool set_color_loadstore_op(uint slot, eGPULoadOp load_action, eGPUStoreOp store_action); - bool set_depth_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action); - bool set_stencil_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action); + bool set_color_loadstore_op(uint slot, GPULoadOp load_action, GPUStoreOp store_action); + bool set_depth_loadstore_op(GPULoadOp load_action, GPUStoreOp store_action); + bool set_stencil_loadstore_op(GPULoadOp load_action, GPUStoreOp store_action); /* Remove any pending clears - Ensure "load" configuration is used. */ bool reset_clear_state(); @@ -225,7 +225,7 @@ class MTLFrameBuffer : public FrameBuffer { uint dst_y_offset, uint width, uint height, - eGPUFrameBufferBits blit_buffers); + GPUFrameBufferBits blit_buffers); int get_width(); int get_height(); diff --git a/source/blender/gpu/metal/mtl_framebuffer.mm b/source/blender/gpu/metal/mtl_framebuffer.mm index d9acd51ef86..02ec3e049bd 100644 --- a/source/blender/gpu/metal/mtl_framebuffer.mm +++ b/source/blender/gpu/metal/mtl_framebuffer.mm @@ -308,7 +308,7 @@ void MTLFrameBuffer::force_clear() } } -void MTLFrameBuffer::clear(eGPUFrameBufferBits buffers, +void MTLFrameBuffer::clear(GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) @@ -494,7 +494,7 @@ void MTLFrameBuffer::subpass_transition_impl(const GPUAttachmentState /*depth_at } } -void MTLFrameBuffer::read(eGPUFrameBufferBits planes, +void MTLFrameBuffer::read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, @@ -571,7 +571,7 @@ void MTLFrameBuffer::read(eGPUFrameBufferBits planes, } } -void MTLFrameBuffer::blit_to(eGPUFrameBufferBits planes, +void MTLFrameBuffer::blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, @@ -1355,12 +1355,12 @@ bool MTLFrameBuffer::set_stencil_attachment_clear_value(uint stencil_clear) } bool MTLFrameBuffer::set_color_loadstore_op(uint slot, - eGPULoadOp load_action, - eGPUStoreOp store_action) + GPULoadOp load_action, + GPUStoreOp store_action) { BLI_assert(this); - eGPULoadOp prev_load_action = mtl_color_attachments_[slot].load_action; - eGPUStoreOp prev_store_action = mtl_color_attachments_[slot].store_action; + GPULoadOp prev_load_action = mtl_color_attachments_[slot].load_action; + GPUStoreOp prev_store_action = mtl_color_attachments_[slot].store_action; mtl_color_attachments_[slot].load_action = load_action; mtl_color_attachments_[slot].store_action = store_action; @@ -1373,11 +1373,11 @@ bool MTLFrameBuffer::set_color_loadstore_op(uint slot, return changed; } -bool MTLFrameBuffer::set_depth_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action) +bool MTLFrameBuffer::set_depth_loadstore_op(GPULoadOp load_action, GPUStoreOp store_action) { BLI_assert(this); - eGPULoadOp prev_load_action = mtl_depth_attachment_.load_action; - eGPUStoreOp prev_store_action = mtl_depth_attachment_.store_action; + GPULoadOp prev_load_action = mtl_depth_attachment_.load_action; + GPUStoreOp prev_store_action = mtl_depth_attachment_.store_action; mtl_depth_attachment_.load_action = load_action; mtl_depth_attachment_.store_action = store_action; @@ -1390,11 +1390,11 @@ bool MTLFrameBuffer::set_depth_loadstore_op(eGPULoadOp load_action, eGPUStoreOp return changed; } -bool MTLFrameBuffer::set_stencil_loadstore_op(eGPULoadOp load_action, eGPUStoreOp store_action) +bool MTLFrameBuffer::set_stencil_loadstore_op(GPULoadOp load_action, GPUStoreOp store_action) { BLI_assert(this); - eGPULoadOp prev_load_action = mtl_stencil_attachment_.load_action; - eGPUStoreOp prev_store_action = mtl_stencil_attachment_.store_action; + GPULoadOp prev_load_action = mtl_stencil_attachment_.load_action; + GPUStoreOp prev_store_action = mtl_stencil_attachment_.store_action; mtl_stencil_attachment_.load_action = load_action; mtl_stencil_attachment_.store_action = store_action; @@ -1522,14 +1522,14 @@ bool MTLFrameBuffer::validate_render_pass() return true; } -MTLLoadAction mtl_load_action_from_gpu(eGPULoadOp action) +MTLLoadAction mtl_load_action_from_gpu(GPULoadOp action) { return (action == GPU_LOADACTION_LOAD) ? MTLLoadActionLoad : ((action == GPU_LOADACTION_CLEAR) ? MTLLoadActionClear : MTLLoadActionDontCare); } -MTLStoreAction mtl_store_action_from_gpu(eGPUStoreOp action) +MTLStoreAction mtl_store_action_from_gpu(GPUStoreOp action) { return (action == GPU_STOREACTION_STORE) ? MTLStoreActionStore : MTLStoreActionDontCare; } @@ -1658,7 +1658,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c /* Resolve appropriate load action -- IF force load, perform load. * If clear but framebuffer has no pending clear, also load. */ - eGPULoadOp load_action = attachment_config.load_action; + GPULoadOp load_action = attachment_config.load_action; if (descriptor_config == MTL_FB_CONFIG_LOAD) { /* MTL_FB_CONFIG_LOAD must always load. */ load_action = GPU_LOADACTION_LOAD; @@ -1675,7 +1675,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c } /* Ensure memoryless attachment cannot load or store results. */ - eGPUStoreOp store_action = attachment_config.store_action; + GPUStoreOp store_action = attachment_config.store_action; if (texture_is_memoryless && load_action == GPU_LOADACTION_LOAD) { load_action = GPU_LOADACTION_DONT_CARE; } @@ -1723,7 +1723,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c /* Resolve appropriate load action -- IF force load, perform load. * If clear but framebuffer has no pending clear, also load. */ - eGPULoadOp load_action = mtl_depth_attachment_.load_action; + GPULoadOp load_action = mtl_depth_attachment_.load_action; if (descriptor_config == MTL_FB_CONFIG_LOAD) { /* MTL_FB_CONFIG_LOAD must always load. */ load_action = GPU_LOADACTION_LOAD; @@ -1738,7 +1738,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c } /* Ensure memoryless attachment cannot load or store results. */ - eGPUStoreOp store_action = mtl_depth_attachment_.store_action; + GPUStoreOp store_action = mtl_depth_attachment_.store_action; if (texture_is_memoryless && load_action == GPU_LOADACTION_LOAD) { load_action = GPU_LOADACTION_DONT_CARE; } @@ -1772,7 +1772,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c /* Resolve appropriate load action -- IF force load, perform load. * If clear but framebuffer has no pending clear, also load. */ - eGPULoadOp load_action = mtl_stencil_attachment_.load_action; + GPULoadOp load_action = mtl_stencil_attachment_.load_action; if (descriptor_config == MTL_FB_CONFIG_LOAD) { /* MTL_FB_CONFIG_LOAD must always load. */ load_action = GPU_LOADACTION_LOAD; @@ -1787,7 +1787,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c } /* Ensure memoryless attachment cannot load or store results. */ - eGPUStoreOp store_action = mtl_stencil_attachment_.store_action; + GPUStoreOp store_action = mtl_stencil_attachment_.store_action; if (texture_is_memoryless && load_action == GPU_LOADACTION_LOAD) { load_action = GPU_LOADACTION_DONT_CARE; } @@ -1849,7 +1849,7 @@ void MTLFrameBuffer::blit(uint read_slot, uint dst_y_offset, uint width, uint height, - eGPUFrameBufferBits blit_buffers) + GPUFrameBufferBits blit_buffers) { BLI_assert(metal_fb_write); if (!metal_fb_write) { diff --git a/source/blender/gpu/metal/mtl_shader_generator.hh b/source/blender/gpu/metal/mtl_shader_generator.hh index 224a922976f..2cac7779792 100644 --- a/source/blender/gpu/metal/mtl_shader_generator.hh +++ b/source/blender/gpu/metal/mtl_shader_generator.hh @@ -199,8 +199,8 @@ struct MSLTextureResource { /* Atomic fallback buffer information. */ int atomic_fallback_buffer_ssbo_id = -1; - eGPUTextureType get_texture_binding_type() const; - eGPUSamplerFormat get_sampler_format() const; + GPUTextureType get_texture_binding_type() const; + GPUSamplerFormat get_sampler_format() const; void resolve_binding_indices(); @@ -502,7 +502,7 @@ inline bool is_builtin_type(std::string type) * Though most efficient and maintainable approach to be determined. * NOTE: Some duplicate types exit for Metal and GLSL representations, as generated type-names * from #shader::ShaderCreateInfo may use GLSL signature. */ - static std::map glsl_builtin_types = { + static std::map glsl_builtin_types = { {"float", MTL_DATATYPE_FLOAT}, {"vec2", MTL_DATATYPE_FLOAT2}, {"vec3", MTL_DATATYPE_FLOAT3}, diff --git a/source/blender/gpu/metal/mtl_shader_generator.mm b/source/blender/gpu/metal/mtl_shader_generator.mm index 91da87d6b39..4290a42b5a5 100644 --- a/source/blender/gpu/metal/mtl_shader_generator.mm +++ b/source/blender/gpu/metal/mtl_shader_generator.mm @@ -70,7 +70,7 @@ static void split_array(StringRefNull input, std::string &r_name, std::string &r } } -static eMTLDataType to_mtl_type(Type type) +static MTLInterfaceDataType to_mtl_type(Type type) { switch (type) { case Type::float_t: @@ -2855,7 +2855,7 @@ MTLShaderInterface *MSLGeneratorInterface::bake_shader_interface( * components. */ if (is_matrix_type(this->vertex_input_attributes[attribute].type)) { - eMTLDataType mtl_type = to_mtl_type( + MTLInterfaceDataType mtl_type = to_mtl_type( get_matrix_subtype(this->vertex_input_attributes[attribute].type)); int size = mtl_get_data_type_size(mtl_type); for (int elem = 0; @@ -2894,7 +2894,7 @@ MTLShaderInterface *MSLGeneratorInterface::bake_shader_interface( else { /* Normal attribute types. */ - eMTLDataType mtl_type = to_mtl_type(this->vertex_input_attributes[attribute].type); + MTLInterfaceDataType mtl_type = to_mtl_type(this->vertex_input_attributes[attribute].type); int size = mtl_get_data_type_size(mtl_type); interface->add_input_attribute( name_buffer_copystr(&interface->name_buffer_, @@ -3333,7 +3333,7 @@ std::string MSLTextureResource::get_msl_return_type_str() const }; } -eGPUTextureType MSLTextureResource::get_texture_binding_type() const +GPUTextureType MSLTextureResource::get_texture_binding_type() const { /* Add Types as needed */ switch (this->type) { @@ -3446,7 +3446,7 @@ eGPUTextureType MSLTextureResource::get_texture_binding_type() const }; } -eGPUSamplerFormat MSLTextureResource::get_sampler_format() const +GPUSamplerFormat MSLTextureResource::get_sampler_format() const { switch (this->type) { case ImageType::FloatBuffer: diff --git a/source/blender/gpu/metal/mtl_shader_interface.hh b/source/blender/gpu/metal/mtl_shader_interface.hh index 884c155e38c..0c177b85d7e 100644 --- a/source/blender/gpu/metal/mtl_shader_interface.hh +++ b/source/blender/gpu/metal/mtl_shader_interface.hh @@ -126,7 +126,7 @@ struct MTLShaderUniform { /* Index of `MTLShaderBufferBlock` this uniform belongs to. */ uint32_t size_in_bytes; uint32_t byte_offset; - eMTLDataType type; + MTLInterfaceDataType type; uint32_t array_len; }; @@ -141,8 +141,8 @@ struct MTLShaderTexture { int slot_index; /* Explicit bind location for texture. */ int location; - eGPUTextureType type; - eGPUSamplerFormat sampler_format; + GPUTextureType type; + GPUSamplerFormat sampler_format; ShaderStage stage_mask; /* Whether texture resource is expected to be image or sampler. */ bool is_texture_sampler; @@ -159,7 +159,7 @@ struct MTLShaderSampler { }; /* Utility Functions. */ -MTLVertexFormat mtl_datatype_to_vertex_type(eMTLDataType type); +MTLVertexFormat mtl_datatype_to_vertex_type(MTLInterfaceDataType type); /** * Implementation of Shader interface for Metal Back-end. @@ -239,12 +239,12 @@ class MTLShaderInterface : public ShaderInterface { uint32_t location, uint32_t size, ShaderStage stage_mask = ShaderStage::ANY); - void add_uniform(uint32_t name_offset, eMTLDataType type, int array_len = 1); + void add_uniform(uint32_t name_offset, MTLInterfaceDataType type, int array_len = 1); void add_texture(uint32_t name_offset, uint32_t texture_slot, uint32_t location, - eGPUTextureType tex_binding_type, - eGPUSamplerFormat sampler_format, + GPUTextureType tex_binding_type, + GPUSamplerFormat sampler_format, bool is_texture_sampler, ShaderStage stage_mask = ShaderStage::FRAGMENT, int tex_buffer_ssbo_location = -1); diff --git a/source/blender/gpu/metal/mtl_shader_interface.mm b/source/blender/gpu/metal/mtl_shader_interface.mm index 1992b413404..4a62b81e87d 100644 --- a/source/blender/gpu/metal/mtl_shader_interface.mm +++ b/source/blender/gpu/metal/mtl_shader_interface.mm @@ -172,7 +172,9 @@ void MTLShaderInterface::add_push_constant_block(uint32_t name_offset) push_constant_block_.stage_mask = ShaderStage::ANY; } -void MTLShaderInterface::add_uniform(uint32_t name_offset, eMTLDataType type, int array_len) +void MTLShaderInterface::add_uniform(uint32_t name_offset, + MTLInterfaceDataType type, + int array_len) { BLI_assert(array_len > 0); BLI_assert(total_uniforms_ < MTL_MAX_UNIFORMS_PER_BLOCK); @@ -223,8 +225,8 @@ void MTLShaderInterface::add_uniform(uint32_t name_offset, eMTLDataType type, in void MTLShaderInterface::add_texture(uint32_t name_offset, uint32_t texture_slot, uint32_t location, - eGPUTextureType tex_binding_type, - eGPUSamplerFormat sampler_format, + GPUTextureType tex_binding_type, + GPUSamplerFormat sampler_format, bool is_texture_sampler, ShaderStage stage_mask, int tex_buffer_ssbo_location) @@ -629,7 +631,7 @@ void MTLShaderInterface::insert_argument_encoder(int buffer_index, id encoder) MTL_LOG_WARNING("could not insert encoder into cache!"); } -MTLVertexFormat mtl_datatype_to_vertex_type(eMTLDataType type) +MTLVertexFormat mtl_datatype_to_vertex_type(MTLInterfaceDataType type) { switch (type) { case MTL_DATATYPE_CHAR: diff --git a/source/blender/gpu/metal/mtl_shader_interface_type.hh b/source/blender/gpu/metal/mtl_shader_interface_type.hh index b7d05548d49..ae0e6bbf0c0 100644 --- a/source/blender/gpu/metal/mtl_shader_interface_type.hh +++ b/source/blender/gpu/metal/mtl_shader_interface_type.hh @@ -10,7 +10,7 @@ #include "BLI_assert.h" #include "GPU_material.hh" -enum eMTLDataType { +enum MTLInterfaceDataType { MTL_DATATYPE_CHAR, MTL_DATATYPE_CHAR2, MTL_DATATYPE_CHAR3, @@ -87,7 +87,7 @@ enum eMTLDataType { MTL_DATATYPE_INT1010102_NORM }; -inline uint mtl_get_data_type_size(eMTLDataType type) +inline uint mtl_get_data_type_size(MTLInterfaceDataType type) { switch (type) { case MTL_DATATYPE_CHAR: @@ -176,7 +176,7 @@ inline uint mtl_get_data_type_size(eMTLDataType type) }; } -inline uint mtl_get_data_type_alignment(eMTLDataType type) +inline uint mtl_get_data_type_alignment(MTLInterfaceDataType type) { switch (type) { case MTL_DATATYPE_CHAR: @@ -258,7 +258,7 @@ inline uint mtl_get_data_type_alignment(eMTLDataType type) }; } -inline eMTLDataType gpu_type_to_mtl_type(eGPUType type) +inline MTLInterfaceDataType gpu_type_to_mtl_type(GPUType type) { switch (type) { case GPU_FLOAT: diff --git a/source/blender/gpu/metal/mtl_state.hh b/source/blender/gpu/metal/mtl_state.hh index e6b3b2a05ae..5853effb621 100644 --- a/source/blender/gpu/metal/mtl_state.hh +++ b/source/blender/gpu/metal/mtl_state.hh @@ -43,7 +43,7 @@ class MTLStateManager : public StateManager { void apply_state() override; void force_state() override; - void issue_barrier(eGPUBarrier barrier_bits) override; + void issue_barrier(GPUBarrier barrier_bits) override; void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) override; void texture_unbind(Texture *tex) override; @@ -62,17 +62,17 @@ class MTLStateManager : public StateManager { } private: - void set_write_mask(const eGPUWriteMask value); - void set_depth_test(const eGPUDepthTest value); - void set_stencil_test(const eGPUStencilTest test, const eGPUStencilOp operation); - void set_stencil_mask(const eGPUStencilTest test, const GPUStateMutable &state); + void set_write_mask(const GPUWriteMask value); + void set_depth_test(const GPUDepthTest value); + void set_stencil_test(const GPUStencilTest test, const GPUStencilOp operation); + void set_stencil_mask(const GPUStencilTest test, const GPUStateMutable &state); void set_clip_distances(const int new_dist_len, const int old_dist_len); void set_logic_op(const bool enable); void set_facing(const bool invert); - void set_backface_culling(const eGPUFaceCullTest test); - void set_provoking_vert(const eGPUProvokingVertex vert); + void set_backface_culling(const GPUFaceCullTest test); + void set_provoking_vert(const GPUProvokingVertex vert); void set_shadow_bias(const bool enable); - void set_blend(const eGPUBlend value); + void set_blend(const GPUBlend value); void set_state(const GPUState &state); void set_mutable_state(const GPUStateMutable &state); @@ -81,7 +81,7 @@ class MTLStateManager : public StateManager { void mtl_state_init(); void mtl_depth_range(float near, float far); void mtl_stencil_mask(uint mask); - void mtl_stencil_set_func(eGPUStencilTest stencil_func, int ref, uint mask); + void mtl_stencil_set_func(GPUStencilTest stencil_func, int ref, uint mask); void mtl_clip_plane_enable(uint i); void mtl_clip_plane_disable(uint i); diff --git a/source/blender/gpu/metal/mtl_state.mm b/source/blender/gpu/metal/mtl_state.mm index f3cd2831786..08a4308a3de 100644 --- a/source/blender/gpu/metal/mtl_state.mm +++ b/source/blender/gpu/metal/mtl_state.mm @@ -73,23 +73,23 @@ void MTLStateManager::set_state(const GPUState &state) GPUState changed = state ^ current_; if (changed.blend != 0) { - set_blend((eGPUBlend)state.blend); + set_blend((GPUBlend)state.blend); } if (changed.write_mask != 0) { - set_write_mask((eGPUWriteMask)state.write_mask); + set_write_mask((GPUWriteMask)state.write_mask); } if (changed.depth_test != 0) { - set_depth_test((eGPUDepthTest)state.depth_test); + set_depth_test((GPUDepthTest)state.depth_test); } if (changed.stencil_test != 0 || changed.stencil_op != 0) { - set_stencil_test((eGPUStencilTest)state.stencil_test, (eGPUStencilOp)state.stencil_op); - set_stencil_mask((eGPUStencilTest)state.stencil_test, mutable_state); + set_stencil_test((GPUStencilTest)state.stencil_test, (GPUStencilOp)state.stencil_op); + set_stencil_mask((GPUStencilTest)state.stencil_test, mutable_state); } if (changed.clip_distances != 0) { set_clip_distances(state.clip_distances, current_.clip_distances); } if (changed.culling_test != 0) { - set_backface_culling((eGPUFaceCullTest)state.culling_test); + set_backface_culling((GPUFaceCullTest)state.culling_test); } if (changed.logic_op_xor != 0) { set_logic_op(state.logic_op_xor); @@ -98,7 +98,7 @@ void MTLStateManager::set_state(const GPUState &state) set_facing(state.invert_facing); } if (changed.provoking_vert != 0) { - set_provoking_vert((eGPUProvokingVertex)state.provoking_vert); + set_provoking_vert((GPUProvokingVertex)state.provoking_vert); } if (changed.shadow_bias != 0) { set_shadow_bias(state.shadow_bias); @@ -151,7 +151,7 @@ void MTLStateManager::set_mutable_state(const GPUStateMutable &state) if (changed.stencil_compare_mask != 0 || changed.stencil_reference != 0 || changed.stencil_write_mask != 0) { - set_stencil_mask((eGPUStencilTest)current_.stencil_test, state); + set_stencil_mask((GPUStencilTest)current_.stencil_test, state); } current_mutable_ = state; @@ -163,7 +163,7 @@ void MTLStateManager::set_mutable_state(const GPUStateMutable &state) /** \name State setting functions * \{ */ -void MTLStateManager::set_write_mask(const eGPUWriteMask value) +void MTLStateManager::set_write_mask(const GPUWriteMask value) { BLI_assert(context_); MTLContextGlobalShaderPipelineState &pipeline_state = context_->pipeline_state; @@ -176,7 +176,7 @@ void MTLStateManager::set_write_mask(const eGPUWriteMask value) pipeline_state.dirty_flags |= MTL_PIPELINE_STATE_PSO_FLAG; } -static MTLCompareFunction gpu_depth_function_to_metal(eGPUDepthTest depth_func) +static MTLCompareFunction gpu_depth_function_to_metal(GPUDepthTest depth_func) { switch (depth_func) { case GPU_DEPTH_NONE: @@ -194,13 +194,13 @@ static MTLCompareFunction gpu_depth_function_to_metal(eGPUDepthTest depth_func) case GPU_DEPTH_ALWAYS: return MTLCompareFunctionAlways; default: - BLI_assert(false && "Invalid eGPUDepthTest"); + BLI_assert(false && "Invalid GPUDepthTest"); break; } return MTLCompareFunctionAlways; } -static MTLCompareFunction gpu_stencil_func_to_metal(eGPUStencilTest stencil_func) +static MTLCompareFunction gpu_stencil_func_to_metal(GPUStencilTest stencil_func) { switch (stencil_func) { case GPU_STENCIL_NONE: @@ -212,13 +212,13 @@ static MTLCompareFunction gpu_stencil_func_to_metal(eGPUStencilTest stencil_func case GPU_STENCIL_ALWAYS: return MTLCompareFunctionAlways; default: - BLI_assert(false && "Unrecognized eGPUStencilTest function"); + BLI_assert(false && "Unrecognized GPUStencilTest function"); break; } return MTLCompareFunctionAlways; } -void MTLStateManager::set_depth_test(const eGPUDepthTest value) +void MTLStateManager::set_depth_test(const GPUDepthTest value) { BLI_assert(context_); MTLContextGlobalShaderPipelineState &pipeline_state = context_->pipeline_state; @@ -237,7 +237,7 @@ void MTLStateManager::mtl_stencil_mask(uint mask) pipeline_state.dirty_flags |= MTL_PIPELINE_STATE_DEPTHSTENCIL_FLAG; } -void MTLStateManager::mtl_stencil_set_func(eGPUStencilTest stencil_func, int ref, uint mask) +void MTLStateManager::mtl_stencil_set_func(GPUStencilTest stencil_func, int ref, uint mask) { BLI_assert(context_); MTLContextGlobalShaderPipelineState &pipeline_state = context_->pipeline_state; @@ -250,7 +250,7 @@ void MTLStateManager::mtl_stencil_set_func(eGPUStencilTest stencil_func, int ref } static void mtl_stencil_set_op_separate(MTLContext *context, - eGPUFaceCullTest face, + GPUFaceCullTest face, MTLStencilOperation stencil_fail, MTLStencilOperation depth_test_fail, MTLStencilOperation depthstencil_pass) @@ -284,7 +284,7 @@ static void mtl_stencil_set_op(MTLContext *context, context, GPU_CULL_BACK, stencil_fail, depth_test_fail, depthstencil_pass); } -void MTLStateManager::set_stencil_test(const eGPUStencilTest test, const eGPUStencilOp operation) +void MTLStateManager::set_stencil_test(const GPUStencilTest test, const GPUStencilOp operation) { switch (operation) { case GPU_STENCIL_OP_REPLACE: @@ -327,7 +327,7 @@ void MTLStateManager::set_stencil_test(const eGPUStencilTest test, const eGPUSte pipeline_state.dirty_flags |= MTL_PIPELINE_STATE_DEPTHSTENCIL_FLAG; } -void MTLStateManager::set_stencil_mask(const eGPUStencilTest test, const GPUStateMutable &state) +void MTLStateManager::set_stencil_mask(const GPUStencilTest test, const GPUStateMutable &state) { if (test == GPU_STENCIL_NONE) { mtl_stencil_mask(0x00); @@ -387,7 +387,7 @@ void MTLStateManager::set_facing(const bool invert) pipeline_state.dirty = true; } -void MTLStateManager::set_backface_culling(const eGPUFaceCullTest test) +void MTLStateManager::set_backface_culling(const GPUFaceCullTest test) { /* Check Current Context. */ BLI_assert(context_); @@ -402,7 +402,7 @@ void MTLStateManager::set_backface_culling(const eGPUFaceCullTest test) pipeline_state.dirty = true; } -void MTLStateManager::set_provoking_vert(const eGPUProvokingVertex /*vert*/) +void MTLStateManager::set_provoking_vert(const GPUProvokingVertex /*vert*/) { /* NOTE(Metal): Provoking vertex is not a feature in the Metal API. * Shaders are handled on a case-by-case basis using a modified vertex shader. @@ -437,7 +437,7 @@ void MTLStateManager::set_shadow_bias(const bool enable) pipeline_state.dirty = true; } -void MTLStateManager::set_blend(const eGPUBlend value) +void MTLStateManager::set_blend(const GPUBlend value) { /** * Factors to the equation. @@ -568,19 +568,19 @@ void MTLStateManager::set_blend(const eGPUBlend value) /* NOTE(Metal): Granular option for specifying before/after stages for a barrier * Would be a useful feature. */ #if 0 -void MTLStateManager::issue_barrier(eGPUBarrier barrier_bits, - eGPUStageBarrierBits before_stages, - eGPUStageBarrierBits after_stages) +void MTLStateManager::issue_barrier(GPUBarrier barrier_bits, + GPUStageBarrierBits before_stages, + GPUStageBarrierBits after_stages) #endif -void MTLStateManager::issue_barrier(eGPUBarrier barrier_bits) +void MTLStateManager::issue_barrier(GPUBarrier barrier_bits) { /* NOTE(Metal): The Metal API implicitly tracks dependencies between resources. * Memory barriers and execution barriers (Fences/Events) can be used to coordinate * this explicitly, however, in most cases, the driver will be able to * resolve these dependencies automatically. * For untracked resources, such as MTLHeap's, explicit barriers are necessary. */ - eGPUStageBarrierBits before_stages = GPU_BARRIER_STAGE_ANY; - eGPUStageBarrierBits after_stages = GPU_BARRIER_STAGE_ANY; + GPUStageBarrierBits before_stages = GPU_BARRIER_STAGE_ANY; + GPUStageBarrierBits after_stages = GPU_BARRIER_STAGE_ANY; MTLContext *ctx = MTLContext::get(); BLI_assert(ctx); diff --git a/source/blender/gpu/metal/mtl_texture.hh b/source/blender/gpu/metal/mtl_texture.hh index 9e052644058..a2e8745f00b 100644 --- a/source/blender/gpu/metal/mtl_texture.hh +++ b/source/blender/gpu/metal/mtl_texture.hh @@ -268,7 +268,7 @@ class MTLTexture : public Texture { MTLTexture(const char *name); MTLTexture(const char *name, TextureFormat format, - eGPUTextureType type, + GPUTextureType type, id metal_texture); ~MTLTexture() override; @@ -439,7 +439,7 @@ class MTLTexture : public Texture { TextureUpdateRoutineSpecialisation specialization_params, blender::Map> &specialization_cache, - eGPUTextureType texture_type); + GPUTextureType texture_type); /* Depth Update Utilities */ /* Depth texture updates are not directly supported with Blit operations, similarly, we cannot @@ -473,7 +473,7 @@ class MTLTexture : public Texture { TextureReadRoutineSpecialisation specialization_params, blender::Map> &specialization_cache, - eGPUTextureType texture_type); + GPUTextureType texture_type); /* fullscreen blit utilities. */ gpu::Shader *fullscreen_blit_sh_get(); @@ -558,7 +558,7 @@ inline std::string tex_data_format_to_msl_texture_template_type(eGPUDataFormat t } /* Fetch Metal texture type from GPU texture type. */ -inline MTLTextureType to_metal_type(eGPUTextureType type) +inline MTLTextureType to_metal_type(GPUTextureType type) { switch (type) { case GPU_TEXTURE_1D: diff --git a/source/blender/gpu/metal/mtl_texture.mm b/source/blender/gpu/metal/mtl_texture.mm index c6b8d0da8eb..16cef43704b 100644 --- a/source/blender/gpu/metal/mtl_texture.mm +++ b/source/blender/gpu/metal/mtl_texture.mm @@ -72,7 +72,7 @@ gpu::MTLTexture::MTLTexture(const char *name) : Texture(name) gpu::MTLTexture::MTLTexture(const char *name, TextureFormat format, - eGPUTextureType type, + GPUTextureType type, id metal_texture) : Texture(name) { @@ -402,10 +402,10 @@ void gpu::MTLTexture::blit(gpu::MTLTexture *dst, /* Caching previous pipeline state. */ bool depth_write_prev = GPU_depth_mask_get(); uint stencil_mask_prev = GPU_stencil_mask_get(); - eGPUStencilTest stencil_test_prev = GPU_stencil_test_get(); - eGPUFaceCullTest culling_test_prev = GPU_face_culling_get(); - eGPUBlend blend_prev = GPU_blend_get(); - eGPUDepthTest depth_test_prev = GPU_depth_test_get(); + GPUStencilTest stencil_test_prev = GPU_stencil_test_get(); + GPUFaceCullTest culling_test_prev = GPU_face_culling_get(); + GPUBlend blend_prev = GPU_blend_get(); + GPUDepthTest depth_test_prev = GPU_depth_test_get(); GPU_scissor_test(false); /* Apply state for blit draw call. */ diff --git a/source/blender/gpu/metal/mtl_texture_util.mm b/source/blender/gpu/metal/mtl_texture_util.mm index e13a59ee7bb..126d1a2228c 100644 --- a/source/blender/gpu/metal/mtl_texture_util.mm +++ b/source/blender/gpu/metal/mtl_texture_util.mm @@ -258,7 +258,7 @@ id gpu::MTLTexture::mtl_texture_update_impl( TextureUpdateRoutineSpecialisation specialization_params, blender::Map> &specialization_cache, - eGPUTextureType texture_type) + GPUTextureType texture_type) { /* Check whether the Kernel exists. */ id *result = specialization_cache.lookup_ptr(specialization_params); @@ -509,8 +509,8 @@ void gpu::MTLTexture::update_sub_depth_2d( bool depth_write_prev = GPU_depth_mask_get(); uint stencil_mask_prev = GPU_stencil_mask_get(); - eGPUDepthTest depth_test_prev = GPU_depth_test_get(); - eGPUStencilTest stencil_test_prev = GPU_stencil_test_get(); + GPUDepthTest depth_test_prev = GPU_depth_test_get(); + GPUStencilTest stencil_test_prev = GPU_stencil_test_get(); GPU_scissor_test(true); GPU_scissor(offset[0], offset[1], extent[0], extent[1]); @@ -546,7 +546,7 @@ id gpu::MTLTexture::mtl_texture_read_impl( TextureReadRoutineSpecialisation specialization_params, blender::Map> &specialization_cache, - eGPUTextureType texture_type) + GPUTextureType texture_type) { /* Check whether the Kernel exists. */ id *result = specialization_cache.lookup_ptr(specialization_params); diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index c6a98ac8879..711e1b6f117 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -124,10 +124,10 @@ void GLBackend::platform_init() const char *vendor = (const char *)glGetString(GL_VENDOR); const char *renderer = (const char *)glGetString(GL_RENDERER); const char *version = (const char *)glGetString(GL_VERSION); - eGPUDeviceType device = GPU_DEVICE_ANY; - eGPUOSType os = GPU_OS_ANY; - eGPUDriverType driver = GPU_DRIVER_ANY; - eGPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; + GPUDeviceType device = GPU_DEVICE_ANY; + GPUOSType os = GPU_OS_ANY; + GPUDriverType driver = GPU_DRIVER_ANY; + GPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; #ifdef _WIN32 os = GPU_OS_WIN; diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 9d49a8c19e1..a3dec02b3e5 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -302,7 +302,7 @@ void GLFrameBuffer::attachment_set_loadstore_op(GPUAttachmentType type, GPULoadS BLI_assert(context_->active_fb == this); /* TODO(fclem): Add support for other ops. */ - if (ls.load_action == eGPULoadOp::GPU_LOADACTION_CLEAR) { + if (ls.load_action == GPULoadOp::GPU_LOADACTION_CLEAR) { if (tmp_detached_[type].tex != nullptr) { /* #GPULoadStore is used to define the frame-buffer before it is used for rendering. * Binding back unattached attachment makes its state undefined. This is described by the @@ -421,7 +421,7 @@ void GLFrameBuffer::bind(bool enabled_srgb) /** \name Operations. * \{ */ -void GLFrameBuffer::clear(eGPUFrameBufferBits buffers, +void GLFrameBuffer::clear(GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) @@ -430,9 +430,9 @@ void GLFrameBuffer::clear(eGPUFrameBufferBits buffers, BLI_assert(context_->active_fb == this); /* Save and restore the state. */ - eGPUWriteMask write_mask = GPU_write_mask_get(); + GPUWriteMask write_mask = GPU_write_mask_get(); uint stencil_mask = GPU_stencil_mask_get(); - eGPUStencilTest stencil_test = GPU_stencil_test_get(); + GPUStencilTest stencil_test = GPU_stencil_test_get(); if (buffers & GPU_COLOR_BIT) { GPU_color_mask(true, true, true, true); @@ -470,7 +470,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type, BLI_assert(context_->active_fb == this); /* Save and restore the state. */ - eGPUWriteMask write_mask = GPU_write_mask_get(); + GPUWriteMask write_mask = GPU_write_mask_get(); GPU_color_mask(true, true, true, true); bool depth_mask = GPU_depth_mask_get(); GPU_depth_mask(true); @@ -530,7 +530,7 @@ void GLFrameBuffer::clear_multi(const float (*clear_cols)[4]) } } -void GLFrameBuffer::read(eGPUFrameBufferBits plane, +void GLFrameBuffer::read(GPUFrameBufferBits plane, eGPUDataFormat data_format, const int area[4], int channel_len, @@ -573,7 +573,7 @@ void GLFrameBuffer::read(eGPUFrameBufferBits plane, } void GLFrameBuffer::blit_to( - eGPUFrameBufferBits planes, int src_slot, FrameBuffer *dst_, int dst_slot, int x, int y) + GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst_, int dst_slot, int x, int y) { GLFrameBuffer *src = this; GLFrameBuffer *dst = static_cast(dst_); diff --git a/source/blender/gpu/opengl/gl_framebuffer.hh b/source/blender/gpu/opengl/gl_framebuffer.hh index e839367ea04..bebdf3e4171 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.hh +++ b/source/blender/gpu/opengl/gl_framebuffer.hh @@ -70,7 +70,7 @@ class GLFrameBuffer : public FrameBuffer { */ bool check(char err_out[256]) override; - void clear(eGPUFrameBufferBits buffers, + void clear(GPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil) override; @@ -87,7 +87,7 @@ class GLFrameBuffer : public FrameBuffer { Span color_attachment_states) override; public: - void read(eGPUFrameBufferBits planes, + void read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, @@ -97,7 +97,7 @@ class GLFrameBuffer : public FrameBuffer { /** * Copy \a src at the give offset inside \a dst. */ - void blit_to(eGPUFrameBufferBits planes, + void blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, @@ -144,7 +144,7 @@ static inline GLenum to_gl(const GPUAttachmentType type) #undef ATTACHMENT } -static inline GLbitfield to_gl(const eGPUFrameBufferBits bits) +static inline GLbitfield to_gl(const GPUFrameBufferBits bits) { GLbitfield mask = 0; mask |= (bits & GPU_DEPTH_BIT) ? GL_DEPTH_BUFFER_BIT : 0; diff --git a/source/blender/gpu/opengl/gl_shader.hh b/source/blender/gpu/opengl/gl_shader.hh index d5b365b2d4e..b9a6f09edda 100644 --- a/source/blender/gpu/opengl/gl_shader.hh +++ b/source/blender/gpu/opengl/gl_shader.hh @@ -214,7 +214,7 @@ class GLCompilerWorker { std::unique_ptr start_semaphore_; std::unique_ptr end_semaphore_; std::unique_ptr close_semaphore_; - enum eState { + enum State { /* The worker has been acquired and the compilation has been requested. */ COMPILATION_REQUESTED, /* The shader binary result is ready to be read. */ @@ -224,7 +224,7 @@ class GLCompilerWorker { /* The worker is not currently in use and can be acquired. */ AVAILABLE }; - std::atomic state_ = AVAILABLE; + std::atomic state_ = AVAILABLE; double compilation_start = 0; GLCompilerWorker(); diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index acab5c1135b..e15e64dfb67 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -78,23 +78,23 @@ void GLStateManager::set_state(const GPUState &state) GPUState changed = state ^ current_; if (changed.blend != 0) { - set_blend((eGPUBlend)state.blend); + set_blend((GPUBlend)state.blend); } if (changed.write_mask != 0) { - set_write_mask((eGPUWriteMask)state.write_mask); + set_write_mask((GPUWriteMask)state.write_mask); } if (changed.depth_test != 0) { - set_depth_test((eGPUDepthTest)state.depth_test); + set_depth_test((GPUDepthTest)state.depth_test); } if (changed.stencil_test != 0 || changed.stencil_op != 0) { - set_stencil_test((eGPUStencilTest)state.stencil_test, (eGPUStencilOp)state.stencil_op); - set_stencil_mask((eGPUStencilTest)state.stencil_test, mutable_state); + set_stencil_test((GPUStencilTest)state.stencil_test, (GPUStencilOp)state.stencil_op); + set_stencil_mask((GPUStencilTest)state.stencil_test, mutable_state); } if (changed.clip_distances != 0) { set_clip_distances(state.clip_distances, current_.clip_distances); } if (changed.culling_test != 0) { - set_backface_culling((eGPUFaceCullTest)state.culling_test); + set_backface_culling((GPUFaceCullTest)state.culling_test); } if (changed.logic_op_xor != 0) { set_logic_op(state.logic_op_xor); @@ -103,7 +103,7 @@ void GLStateManager::set_state(const GPUState &state) set_facing(state.invert_facing); } if (changed.provoking_vert != 0) { - set_provoking_vert((eGPUProvokingVertex)state.provoking_vert); + set_provoking_vert((GPUProvokingVertex)state.provoking_vert); } if (changed.shadow_bias != 0) { set_shadow_bias(state.shadow_bias); @@ -161,7 +161,7 @@ void GLStateManager::set_mutable_state(const GPUStateMutable &state) if (changed.stencil_compare_mask != 0 || changed.stencil_reference != 0 || changed.stencil_write_mask != 0) { - set_stencil_mask((eGPUStencilTest)current_.stencil_test, state); + set_stencil_mask((GPUStencilTest)current_.stencil_test, state); } current_mutable_ = state; @@ -173,7 +173,7 @@ void GLStateManager::set_mutable_state(const GPUStateMutable &state) /** \name State set functions * \{ */ -void GLStateManager::set_write_mask(const eGPUWriteMask value) +void GLStateManager::set_write_mask(const GPUWriteMask value) { glDepthMask((value & GPU_WRITE_DEPTH) != 0); glColorMask((value & GPU_WRITE_RED) != 0, @@ -189,7 +189,7 @@ void GLStateManager::set_write_mask(const eGPUWriteMask value) } } -void GLStateManager::set_depth_test(const eGPUDepthTest value) +void GLStateManager::set_depth_test(const GPUDepthTest value) { GLenum func; switch (value) { @@ -223,7 +223,7 @@ void GLStateManager::set_depth_test(const eGPUDepthTest value) } } -void GLStateManager::set_stencil_test(const eGPUStencilTest test, const eGPUStencilOp operation) +void GLStateManager::set_stencil_test(const GPUStencilTest test, const GPUStencilOp operation) { switch (operation) { case GPU_STENCIL_OP_REPLACE: @@ -250,7 +250,7 @@ void GLStateManager::set_stencil_test(const eGPUStencilTest test, const eGPUSten } } -void GLStateManager::set_stencil_mask(const eGPUStencilTest test, const GPUStateMutable &state) +void GLStateManager::set_stencil_mask(const GPUStencilTest test, const GPUStateMutable &state) { GLenum func; switch (test) { @@ -300,7 +300,7 @@ void GLStateManager::set_facing(const bool invert) glFrontFace((invert) ? GL_CW : GL_CCW); } -void GLStateManager::set_backface_culling(const eGPUFaceCullTest test) +void GLStateManager::set_backface_culling(const GPUFaceCullTest test) { if (test != GPU_CULL_NONE) { glEnable(GL_CULL_FACE); @@ -311,7 +311,7 @@ void GLStateManager::set_backface_culling(const eGPUFaceCullTest test) } } -void GLStateManager::set_provoking_vert(const eGPUProvokingVertex vert) +void GLStateManager::set_provoking_vert(const GPUProvokingVertex vert) { GLenum value = (vert == GPU_VERTEX_FIRST) ? GL_FIRST_VERTEX_CONVENTION : GL_LAST_VERTEX_CONVENTION; @@ -343,7 +343,7 @@ void GLStateManager::set_clip_control(const bool enable) } } -void GLStateManager::set_blend(const eGPUBlend value) +void GLStateManager::set_blend(const GPUBlend value) { /** * Factors to the equation. @@ -658,7 +658,7 @@ uint8_t GLStateManager::bound_image_slots() /** \name Memory barrier * \{ */ -void GLStateManager::issue_barrier(eGPUBarrier barrier_bits) +void GLStateManager::issue_barrier(GPUBarrier barrier_bits) { glMemoryBarrier(to_gl(barrier_bits)); } diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index 8d44acbb42d..f3e2ebf0810 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -64,7 +64,7 @@ class GLStateManager : public StateManager { */ void force_state() override; - void issue_barrier(eGPUBarrier barrier_bits) override; + void issue_barrier(GPUBarrier barrier_bits) override; void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) override; /** @@ -84,18 +84,18 @@ class GLStateManager : public StateManager { uint8_t bound_image_slots(); private: - static void set_write_mask(eGPUWriteMask value); - static void set_depth_test(eGPUDepthTest value); - static void set_stencil_test(eGPUStencilTest test, eGPUStencilOp operation); - static void set_stencil_mask(eGPUStencilTest test, const GPUStateMutable &state); + static void set_write_mask(GPUWriteMask value); + static void set_depth_test(GPUDepthTest value); + static void set_stencil_test(GPUStencilTest test, GPUStencilOp operation); + static void set_stencil_mask(GPUStencilTest test, const GPUStateMutable &state); static void set_clip_distances(int new_dist_len, int old_dist_len); static void set_logic_op(bool enable); static void set_facing(bool invert); - static void set_backface_culling(eGPUFaceCullTest test); - static void set_provoking_vert(eGPUProvokingVertex vert); + static void set_backface_culling(GPUFaceCullTest test); + static void set_provoking_vert(GPUProvokingVertex vert); static void set_shadow_bias(bool enable); static void set_clip_control(bool enable); - static void set_blend(eGPUBlend value); + static void set_blend(GPUBlend value); void set_state(const GPUState &state); void set_mutable_state(const GPUStateMutable &state); @@ -121,7 +121,7 @@ class GLFence : public Fence { MEM_CXX_CLASS_ALLOC_FUNCS("GLFence") }; -static inline GLbitfield to_gl(eGPUBarrier barrier_bits) +static inline GLbitfield to_gl(GPUBarrier barrier_bits) { GLbitfield barrier = 0; if (barrier_bits & GPU_BARRIER_SHADER_IMAGE_ACCESS) { diff --git a/source/blender/gpu/opengl/gl_texture.hh b/source/blender/gpu/opengl/gl_texture.hh index 9d3b6c2859f..5b9c1868821 100644 --- a/source/blender/gpu/opengl/gl_texture.hh +++ b/source/blender/gpu/opengl/gl_texture.hh @@ -162,7 +162,7 @@ inline GLenum to_gl_internal_format(TextureFormat format) return 0; } -inline GLenum to_gl_target(eGPUTextureType type) +inline GLenum to_gl_target(GPUTextureType type) { switch (type) { case GPU_TEXTURE_1D: @@ -187,7 +187,7 @@ inline GLenum to_gl_target(eGPUTextureType type) } } -inline GLenum to_gl_proxy(eGPUTextureType type) +inline GLenum to_gl_proxy(GPUTextureType type) { switch (type) { case GPU_TEXTURE_1D: diff --git a/source/blender/gpu/tests/gpu_testing.cc b/source/blender/gpu/tests/gpu_testing.cc index c8657672a83..f9fd13e34dd 100644 --- a/source/blender/gpu/tests/gpu_testing.cc +++ b/source/blender/gpu/tests/gpu_testing.cc @@ -27,7 +27,7 @@ GPUContext *GPUTest::context_; int32_t GPUTest::prev_g_debug_; void GPUTest::SetUpTestSuite(GHOST_TDrawingContextType draw_context_type, - eGPUBackendType gpu_backend_type, + GPUBackendType gpu_backend_type, int32_t g_debug_flags) { prev_g_debug_ = G.debug; diff --git a/source/blender/gpu/tests/gpu_testing.hh b/source/blender/gpu/tests/gpu_testing.hh index e2bf6279e5e..37382d4d7c9 100644 --- a/source/blender/gpu/tests/gpu_testing.hh +++ b/source/blender/gpu/tests/gpu_testing.hh @@ -27,7 +27,7 @@ class GPUTest : public ::testing::Test { protected: static void SetUpTestSuite(GHOST_TDrawingContextType draw_context_type, - eGPUBackendType gpu_backend_type, + GPUBackendType gpu_backend_type, int32_t g_debug_flags); static void TearDownTestSuite(); }; diff --git a/source/blender/gpu/tests/state_blend_test.cc b/source/blender/gpu/tests/state_blend_test.cc index cfd5bbc70c7..a3d4df57f12 100644 --- a/source/blender/gpu/tests/state_blend_test.cc +++ b/source/blender/gpu/tests/state_blend_test.cc @@ -18,7 +18,7 @@ namespace blender::gpu::tests { -template +template void blend_test(float4 source_a, float4 source_b, float4 expected_result) { GPUOffScreen *offscreen = GPU_offscreen_create(1, diff --git a/source/blender/gpu/vulkan/vk_backend.cc b/source/blender/gpu/vulkan/vk_backend.cc index 11d0e6ca9da..a3abc3509b7 100644 --- a/source/blender/gpu/vulkan/vk_backend.cc +++ b/source/blender/gpu/vulkan/vk_backend.cc @@ -299,7 +299,7 @@ bool VKBackend::is_supported() return false; } -static eGPUOSType determine_os_type() +static GPUOSType determine_os_type() { #ifdef _WIN32 return GPU_OS_WIN; @@ -364,10 +364,10 @@ void VKBackend::platform_init(const VKDevice &device) { const VkPhysicalDeviceProperties &properties = device.physical_device_properties_get(); - eGPUDeviceType device_type = device.device_type(); - eGPUDriverType driver = device.driver_type(); - eGPUOSType os = determine_os_type(); - eGPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; + GPUDeviceType device_type = device.device_type(); + GPUDriverType driver = device.driver_type(); + GPUOSType os = determine_os_type(); + GPUSupportLevel support_level = GPU_SUPPORT_LEVEL_SUPPORTED; std::string vendor_name = device.vendor_name(); std::string driver_version = device.driver_version(); diff --git a/source/blender/gpu/vulkan/vk_common.cc b/source/blender/gpu/vulkan/vk_common.cc index 057732ef446..fdc2d8e08a2 100644 --- a/source/blender/gpu/vulkan/vk_common.cc +++ b/source/blender/gpu/vulkan/vk_common.cc @@ -102,7 +102,7 @@ VkImageAspectFlags to_vk_image_aspect_flag_bits(const TextureFormat format) return 0; } -VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUFrameBufferBits buffers) +VkImageAspectFlags to_vk_image_aspect_flag_bits(const GPUFrameBufferBits buffers) { VkImageAspectFlags result = 0; if (buffers & GPU_COLOR_BIT) { @@ -472,7 +472,7 @@ VkQueryType to_vk_query_type(const GPUQueryType query_type) return VK_QUERY_TYPE_OCCLUSION; } -VkImageType to_vk_image_type(const eGPUTextureType type) +VkImageType to_vk_image_type(const GPUTextureType type) { /* See * https://vulkan.lunarg.com/doc/view/1.3.243.0/linux/1.3-extensions/vkspec.html#resources-image-views-compatibility @@ -501,7 +501,7 @@ VkImageType to_vk_image_type(const eGPUTextureType type) return VK_IMAGE_TYPE_1D; } -VkImageViewType to_vk_image_view_type(const eGPUTextureType type, +VkImageViewType to_vk_image_view_type(const GPUTextureType type, const eImageViewUsage view_type, VKImageViewArrayed arrayed) { @@ -676,7 +676,7 @@ VkPrimitiveTopology to_vk_primitive_topology(const GPUPrimType prim_type) return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; } -VkCullModeFlags to_vk_cull_mode_flags(const eGPUFaceCullTest cull_test) +VkCullModeFlags to_vk_cull_mode_flags(const GPUFaceCullTest cull_test) { switch (cull_test) { case GPU_CULL_FRONT: diff --git a/source/blender/gpu/vulkan/vk_common.hh b/source/blender/gpu/vulkan/vk_common.hh index a8e87e8c69e..c1da02d3390 100644 --- a/source/blender/gpu/vulkan/vk_common.hh +++ b/source/blender/gpu/vulkan/vk_common.hh @@ -56,7 +56,7 @@ enum class VKImageViewArrayed { }; VkImageAspectFlags to_vk_image_aspect_flag_bits(const TextureFormat format); -VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUFrameBufferBits buffers); +VkImageAspectFlags to_vk_image_aspect_flag_bits(const GPUFrameBufferBits buffers); VkFormat to_vk_format(const TextureFormat format); TextureFormat to_gpu_format(const VkFormat format); VkFormat to_vk_format(const GPUVertCompType type, @@ -66,14 +66,14 @@ VkFormat to_vk_format(const shader::Type type); VkQueryType to_vk_query_type(const GPUQueryType query_type); VkComponentSwizzle to_vk_component_swizzle(const char swizzle); -VkImageViewType to_vk_image_view_type(const eGPUTextureType type, +VkImageViewType to_vk_image_view_type(const GPUTextureType type, eImageViewUsage view_type, VKImageViewArrayed arrayed); -VkImageType to_vk_image_type(const eGPUTextureType type); +VkImageType to_vk_image_type(const GPUTextureType type); VkClearColorValue to_vk_clear_color_value(const eGPUDataFormat format, const void *data); VkIndexType to_vk_index_type(const GPUIndexBufType index_type); VkPrimitiveTopology to_vk_primitive_topology(const GPUPrimType prim_type); -VkCullModeFlags to_vk_cull_mode_flags(const eGPUFaceCullTest cull_test); +VkCullModeFlags to_vk_cull_mode_flags(const GPUFaceCullTest cull_test); VkSamplerAddressMode to_vk_sampler_address_mode(const GPUSamplerExtendMode extend_mode); VkDescriptorType to_vk_descriptor_type(const shader::ShaderCreateInfo::Resource &resource); diff --git a/source/blender/gpu/vulkan/vk_device.cc b/source/blender/gpu/vulkan/vk_device.cc index 1ac0758d744..fdca8bae365 100644 --- a/source/blender/gpu/vulkan/vk_device.cc +++ b/source/blender/gpu/vulkan/vk_device.cc @@ -374,7 +374,7 @@ constexpr int32_t PCI_ID_AMD = 0x1002; constexpr int32_t PCI_ID_ATI = 0x1022; constexpr int32_t PCI_ID_APPLE = 0x106b; -eGPUDeviceType VKDevice::device_type() const +GPUDeviceType VKDevice::device_type() const { switch (vk_physical_device_driver_properties_.driverID) { case VK_DRIVER_ID_AMD_PROPRIETARY: @@ -406,7 +406,7 @@ eGPUDeviceType VKDevice::device_type() const return GPU_DEVICE_UNKNOWN; } -eGPUDriverType VKDevice::driver_type() const +GPUDriverType VKDevice::driver_type() const { switch (vk_physical_device_driver_properties_.driverID) { case VK_DRIVER_ID_AMD_PROPRIETARY: diff --git a/source/blender/gpu/vulkan/vk_device.hh b/source/blender/gpu/vulkan/vk_device.hh index 58fccfcc861..1757c84c8ac 100644 --- a/source/blender/gpu/vulkan/vk_device.hh +++ b/source/blender/gpu/vulkan/vk_device.hh @@ -345,8 +345,8 @@ class VKDevice : public NonCopyable { return is_initialized_; } - eGPUDeviceType device_type() const; - eGPUDriverType driver_type() const; + GPUDeviceType device_type() const; + GPUDriverType driver_type() const; std::string vendor_name() const; std::string driver_version() const; diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc index 13239cc2eda..2e320833d09 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.cc +++ b/source/blender/gpu/vulkan/vk_framebuffer.cc @@ -124,7 +124,7 @@ bool VKFrameBuffer::check(char /*err_out*/[256]) } void VKFrameBuffer::build_clear_attachments_depth_stencil( - const eGPUFrameBufferBits buffers, + const GPUFrameBufferBits buffers, float clear_depth, uint32_t clear_stencil, render_graph::VKClearAttachmentsNode::CreateInfo &clear_attachments) const @@ -174,7 +174,7 @@ void VKFrameBuffer::clear(render_graph::VKClearAttachmentsNode::CreateInfo &clea context.render_graph().add_node(clear_attachments); } -void VKFrameBuffer::clear(const eGPUFrameBufferBits buffers, +void VKFrameBuffer::clear(const GPUFrameBufferBits buffers, const float clear_color[4], float clear_depth, uint clear_stencil) @@ -186,7 +186,7 @@ void VKFrameBuffer::clear(const eGPUFrameBufferBits buffers, if (buffers & (GPU_DEPTH_BIT | GPU_STENCIL_BIT)) { VKContext &context = *VKContext::get(); - eGPUWriteMask needed_mask = GPU_WRITE_NONE; + GPUWriteMask needed_mask = GPU_WRITE_NONE; if (buffers & GPU_DEPTH_BIT) { needed_mask |= GPU_WRITE_DEPTH; } @@ -262,7 +262,7 @@ void VKFrameBuffer::attachment_set_loadstore_op(GPUAttachmentType type, GPULoadS load_stores[type] = ls; } -static VkAttachmentLoadOp to_vk_attachment_load_op(eGPULoadOp load_op) +static VkAttachmentLoadOp to_vk_attachment_load_op(GPULoadOp load_op) { switch (load_op) { case GPU_LOADACTION_DONT_CARE: @@ -276,7 +276,7 @@ static VkAttachmentLoadOp to_vk_attachment_load_op(eGPULoadOp load_op) return VK_ATTACHMENT_LOAD_OP_LOAD; } -static VkAttachmentStoreOp to_vk_attachment_store_op(eGPUStoreOp store_op) +static VkAttachmentStoreOp to_vk_attachment_store_op(GPUStoreOp store_op) { switch (store_op) { case GPU_STOREACTION_DONT_CARE: @@ -359,7 +359,7 @@ void VKFrameBuffer::subpass_transition_impl(const GPUAttachmentState depth_attac /** \name Read back * \{ */ -void VKFrameBuffer::read(eGPUFrameBufferBits plane, +void VKFrameBuffer::read(GPUFrameBufferBits plane, eGPUDataFormat format, const int area[4], int /*channel_len*/, @@ -453,7 +453,7 @@ static void blit_aspect(VKContext &context, context.render_graph().add_node(blit_image); } -void VKFrameBuffer::blit_to(eGPUFrameBufferBits planes, +void VKFrameBuffer::blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, diff --git a/source/blender/gpu/vulkan/vk_framebuffer.hh b/source/blender/gpu/vulkan/vk_framebuffer.hh index 274e838d95f..1874eeffd42 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.hh +++ b/source/blender/gpu/vulkan/vk_framebuffer.hh @@ -47,7 +47,7 @@ class VKFrameBuffer : public FrameBuffer { void bind(bool enabled_srgb) override; bool check(char err_out[256]) override; - void clear(eGPUFrameBufferBits buffers, + void clear(GPUFrameBufferBits buffers, const float clear_color[4], float clear_depth, uint clear_stencil) override; @@ -63,14 +63,14 @@ class VKFrameBuffer : public FrameBuffer { Span color_attachment_states) override; public: - void read(eGPUFrameBufferBits planes, + void read(GPUFrameBufferBits planes, eGPUDataFormat format, const int area[4], int channel_len, int slot, void *r_data) override; - void blit_to(eGPUFrameBufferBits planes, + void blit_to(GPUFrameBufferBits planes, int src_slot, FrameBuffer *dst, int dst_slot, @@ -136,7 +136,7 @@ class VKFrameBuffer : public FrameBuffer { private: /* Clearing attachments */ void build_clear_attachments_depth_stencil( - eGPUFrameBufferBits buffers, + GPUFrameBufferBits buffers, float clear_depth, uint32_t clear_stencil, render_graph::VKClearAttachmentsNode::CreateInfo &clear_attachments) const; diff --git a/source/blender/gpu/vulkan/vk_pipeline_pool.cc b/source/blender/gpu/vulkan/vk_pipeline_pool.cc index ab33f4dcd92..16965231a8c 100644 --- a/source/blender/gpu/vulkan/vk_pipeline_pool.cc +++ b/source/blender/gpu/vulkan/vk_pipeline_pool.cc @@ -281,7 +281,7 @@ VkPipeline VKPipelinePool::get_or_create_graphics_pipeline(VKGraphicsInfo &graph VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; vk_pipeline_rasterization_state_create_info_.cullMode = to_vk_cull_mode_flags( - static_cast(graphics_info.state.culling_test)); + static_cast(graphics_info.state.culling_test)); if (graphics_info.state.shadow_bias) { vk_pipeline_rasterization_state_create_info_.depthBiasEnable = VK_TRUE; vk_pipeline_rasterization_state_create_info_.depthBiasSlopeFactor = 2.0f; diff --git a/source/blender/gpu/vulkan/vk_state_manager.cc b/source/blender/gpu/vulkan/vk_state_manager.cc index 562c4511925..04e1e944106 100644 --- a/source/blender/gpu/vulkan/vk_state_manager.cc +++ b/source/blender/gpu/vulkan/vk_state_manager.cc @@ -29,7 +29,7 @@ void VKStateManager::force_state() /* Intentionally empty. State is polled during pipeline creation and is always forced. */ } -void VKStateManager::issue_barrier(eGPUBarrier barrier_bits) +void VKStateManager::issue_barrier(GPUBarrier barrier_bits) { /** * Workaround for EEVEE ThicknessFromShadow shader. diff --git a/source/blender/gpu/vulkan/vk_state_manager.hh b/source/blender/gpu/vulkan/vk_state_manager.hh index 7cbd4cf7e98..ce24ad62c3f 100644 --- a/source/blender/gpu/vulkan/vk_state_manager.hh +++ b/source/blender/gpu/vulkan/vk_state_manager.hh @@ -230,7 +230,7 @@ class VKStateManager : public StateManager { void apply_state() override; void force_state() override; - void issue_barrier(eGPUBarrier barrier_bits) override; + void issue_barrier(GPUBarrier barrier_bits) override; void texture_bind(Texture *tex, GPUSamplerState sampler, int unit) override; void texture_unbind(Texture *tex) override; diff --git a/source/blender/gpu/vulkan/vk_texture.cc b/source/blender/gpu/vulkan/vk_texture.cc index 6c4c27ebabf..7c0dec65f28 100644 --- a/source/blender/gpu/vulkan/vk_texture.cc +++ b/source/blender/gpu/vulkan/vk_texture.cc @@ -145,7 +145,7 @@ void VKTexture::clear(eGPUDataFormat format, const void *data) context.render_graph().add_node(clear_color_image); } -void VKTexture::clear_depth_stencil(const eGPUFrameBufferBits buffers, +void VKTexture::clear_depth_stencil(const GPUFrameBufferBits buffers, float clear_depth, uint clear_stencil, std::optional layer) @@ -577,7 +577,7 @@ bool VKTexture::is_texture_view() const } static VkImageUsageFlags to_vk_image_usage(const eGPUTextureUsage usage, - const eGPUTextureFormatFlag format_flag) + const GPUTextureFormatFlag format_flag) { const VKDevice &device = VKBackend::get().device; const bool supports_local_read = device.extensions_get().dynamic_rendering_local_read; @@ -624,8 +624,8 @@ static VkImageUsageFlags to_vk_image_usage(const eGPUTextureUsage usage, return result; } -static VkImageCreateFlags to_vk_image_create(const eGPUTextureType texture_type, - const eGPUTextureFormatFlag format_flag, +static VkImageCreateFlags to_vk_image_create(const GPUTextureType texture_type, + const GPUTextureFormatFlag format_flag, const eGPUTextureUsage usage) { VkImageCreateFlags result = 0; diff --git a/source/blender/gpu/vulkan/vk_texture.hh b/source/blender/gpu/vulkan/vk_texture.hh index 5e4322ae42a..38795e2fa79 100644 --- a/source/blender/gpu/vulkan/vk_texture.hh +++ b/source/blender/gpu/vulkan/vk_texture.hh @@ -82,7 +82,7 @@ class VKTexture : public Texture { void copy_to(Texture *tex) override; void copy_to(VKTexture &dst_texture, VkImageAspectFlags vk_image_aspect); void clear(eGPUDataFormat format, const void *data) override; - void clear_depth_stencil(const eGPUFrameBufferBits buffer, + void clear_depth_stencil(const GPUFrameBufferBits buffer, float clear_depth, uint clear_stencil, std::optional layer); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 55c0d4aa02e..adfac3f84af 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -502,7 +502,7 @@ typedef struct UserDef { char _pad16[2]; - /** #eGPUBackendType */ + /** #GPUBackendType */ short gpu_backend; /** Number of samples for FPS display calculations. */ @@ -827,7 +827,7 @@ typedef enum eUserpref_GPU_Flag { } eUserpref_GPU_Flag; /** #UserDef.gpu_backend - * NOTE: Keep in sync with eGPUBackendType. */ + * NOTE: Keep in sync with GPUBackendType. */ enum eUserPref_GPUBackendType { USER_GPU_BACKEND_OPENGL = 1 << 0, USER_GPU_BACKEND_METAL = 1 << 1, diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc b/source/blender/python/gpu/gpu_py_framebuffer.cc index b8341316d29..8ca999471a4 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.cc +++ b/source/blender/python/gpu/gpu_py_framebuffer.cc @@ -455,7 +455,7 @@ static PyObject *pygpu_framebuffer_clear(BPyGPUFrameBuffer *self, PyObject *args return nullptr; } - eGPUFrameBufferBits buffers = eGPUFrameBufferBits(0); + GPUFrameBufferBits buffers = GPUFrameBufferBits(0); float col[4] = {0.0f, 0.0f, 0.0f, 1.0f}; float depth = 1.0f; uint stencil = 0; diff --git a/source/blender/python/gpu/gpu_py_shader.cc b/source/blender/python/gpu/gpu_py_shader.cc index a93d9e6ec09..db4143b6a97 100644 --- a/source/blender/python/gpu/gpu_py_shader.cc +++ b/source/blender/python/gpu/gpu_py_shader.cc @@ -961,8 +961,7 @@ static PyObject *pygpu_shader_from_builtin(PyObject * /*self*/, PyObject *args, } blender::gpu::Shader *shader = GPU_shader_get_builtin_shader_with_config( - eGPUBuiltinShader(pygpu_bultinshader.value_found), - eGPUShaderConfig(pygpu_config.value_found)); + GPUBuiltinShader(pygpu_bultinshader.value_found), GPUShaderConfig(pygpu_config.value_found)); if (shader == nullptr) { PyErr_SetString(PyExc_ValueError, "Builtin shader doesn't exist in the requested config"); diff --git a/source/blender/python/gpu/gpu_py_state.cc b/source/blender/python/gpu/gpu_py_state.cc index 737d83bb1f2..f7171bf8c75 100644 --- a/source/blender/python/gpu/gpu_py_state.cc +++ b/source/blender/python/gpu/gpu_py_state.cc @@ -101,7 +101,7 @@ static PyObject *pygpu_state_blend_set(PyObject * /*self*/, PyObject *value) if (!PyC_ParseStringEnum(value, &pygpu_blend)) { return nullptr; } - GPU_blend(eGPUBlend(pygpu_blend.value_found)); + GPU_blend(GPUBlend(pygpu_blend.value_found)); Py_RETURN_NONE; } @@ -116,7 +116,7 @@ static PyObject *pygpu_state_blend_get(PyObject * /*self*/) { BPYGPU_IS_INIT_OR_ERROR_OBJ; - eGPUBlend blend = GPU_blend_get(); + GPUBlend blend = GPU_blend_get(); return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_blend_items, blend)); } @@ -165,7 +165,7 @@ static PyObject *pygpu_state_depth_test_set(PyObject * /*self*/, PyObject *value if (!PyC_ParseStringEnum(value, &pygpu_depth_test)) { return nullptr; } - GPU_depth_test(eGPUDepthTest(pygpu_depth_test.value_found)); + GPU_depth_test(GPUDepthTest(pygpu_depth_test.value_found)); Py_RETURN_NONE; } @@ -180,7 +180,7 @@ static PyObject *pygpu_state_depth_test_get(PyObject * /*self*/) { BPYGPU_IS_INIT_OR_ERROR_OBJ; - eGPUDepthTest test = GPU_depth_test_get(); + GPUDepthTest test = GPU_depth_test_get(); return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_state_depthtest_items, test)); } @@ -441,7 +441,7 @@ static PyObject *pygpu_state_face_culling_set(PyObject * /*self*/, PyObject *val return nullptr; } - GPU_face_culling(eGPUFaceCullTest(pygpu_faceculling.value_found)); + GPU_face_culling(GPUFaceCullTest(pygpu_faceculling.value_found)); Py_RETURN_NONE; } diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index c7f60b2ac13..3b664453aea 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -503,7 +503,7 @@ static void wm_gpu_backend_override_from_userdef() return; } - GPU_backend_type_selection_set_override(eGPUBackendType(U.gpu_backend)); + GPU_backend_type_selection_set_override(GPUBackendType(U.gpu_backend)); } /** diff --git a/source/blender/windowmanager/intern/wm_platform_support.cc b/source/blender/windowmanager/intern/wm_platform_support.cc index 4223b6a3a52..993a29263a3 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.cc +++ b/source/blender/windowmanager/intern/wm_platform_support.cc @@ -106,7 +106,7 @@ bool WM_platform_support_perform_checks() bool result = true; - eGPUSupportLevel support_level = GPU_platform_support_level(); + GPUSupportLevel support_level = GPU_platform_support_level(); const char *platform_key = GPU_platform_support_level_key(); CLOG_INFO(&LOG, "Using GPU \"%s\"", GPU_platform_gpu_name()); diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index d588fa503c1..bf885d49ef1 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -1593,7 +1593,7 @@ static GHOST_WindowHandle playanim_window_open( GHOST_SystemHandle ghost_system, const char *title, int posx, int posy, int sizex, int sizey) { GHOST_GPUSettings gpu_settings = {0}; - const eGPUBackendType gpu_backend = GPU_backend_type_selection_get(); + const GPUBackendType gpu_backend = GPU_backend_type_selection_get(); gpu_settings.context_type = wm_ghost_drawing_context_type(gpu_backend); gpu_settings.preferred_device.index = U.gpu_preferred_index; gpu_settings.preferred_device.vendor_id = U.gpu_preferred_vendor_id; diff --git a/source/blender/windowmanager/intern/wm_window.cc b/source/blender/windowmanager/intern/wm_window.cc index fe19ed4bccb..e1f469938cb 100644 --- a/source/blender/windowmanager/intern/wm_window.cc +++ b/source/blender/windowmanager/intern/wm_window.cc @@ -918,7 +918,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, gpu_settings.flags |= GHOST_gpuDebugContext; } - eGPUBackendType gpu_backend = GPU_backend_type_selection_get(); + GPUBackendType gpu_backend = GPU_backend_type_selection_get(); gpu_settings.context_type = wm_ghost_drawing_context_type(gpu_backend); gpu_settings.preferred_device.index = U.gpu_preferred_index; gpu_settings.preferred_device.vendor_id = U.gpu_preferred_vendor_id; @@ -2188,7 +2188,7 @@ const char *WM_ghost_backend() #endif } -GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gpu_backend) +GHOST_TDrawingContextType wm_ghost_drawing_context_type(const GPUBackendType gpu_backend) { switch (gpu_backend) { case GPU_BACKEND_NONE: @@ -3226,7 +3226,7 @@ void *WM_system_gpu_context_create() BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); GHOST_GPUSettings gpu_settings = {0}; - const eGPUBackendType gpu_backend = GPU_backend_type_selection_get(); + const GPUBackendType gpu_backend = GPU_backend_type_selection_get(); gpu_settings.context_type = wm_ghost_drawing_context_type(gpu_backend); if (G.debug & G_DEBUG_GPU) { gpu_settings.flags |= GHOST_gpuDebugContext; diff --git a/source/blender/windowmanager/intern/wm_window_private.hh b/source/blender/windowmanager/intern/wm_window_private.hh index ef27ca8b0ee..eb6395f7322 100644 --- a/source/blender/windowmanager/intern/wm_window_private.hh +++ b/source/blender/windowmanager/intern/wm_window_private.hh @@ -26,6 +26,6 @@ void WM_ghost_show_message_box(const char *title, const char *link, GHOST_DialogOptions dialog_options); -GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gpu_backend); +GHOST_TDrawingContextType wm_ghost_drawing_context_type(const GPUBackendType gpu_backend); void wm_test_gpu_backend_fallback(bContext *C); diff --git a/source/creator/creator_args.cc b/source/creator/creator_args.cc index ce01cb2f3fb..844c85db4c5 100644 --- a/source/creator/creator_args.cc +++ b/source/creator/creator_args.cc @@ -1587,7 +1587,7 @@ static int arg_handle_gpu_backend_set(int argc, const char **argv, void * /*data const char *backends_supported[3] = {nullptr}; int backends_supported_num = 0; - eGPUBackendType gpu_backend = GPU_BACKEND_NONE; + GPUBackendType gpu_backend = GPU_BACKEND_NONE; /* NOLINTBEGIN: bugprone-assignment-in-if-condition */ if (false) {