Files
test/source/blender/windowmanager/wm_surface.hh
Brecht Van Lommel 920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00

56 lines
1.3 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup wm
*
* \name WM-Surface
*
* Container to manage painting in an off-screen context.
*/
#pragma once
#include "GHOST_Types.h"
struct bContext;
struct GPUContext;
struct wmSurface {
wmSurface *next, *prev;
GHOST_ContextHandle system_gpu_context;
GPUContext *blender_gpu_context;
void *customdata;
void (*draw)(bContext *);
/* To evaluate the surface's depsgraph. Called as part of the main loop. */
void (*do_depsgraph)(bContext *C);
/** Free customdata, not the surface itself (done by wm_surface API). */
void (*free_data)(wmSurface *);
/** Called when surface is activated for drawing (made drawable). */
void (*activate)();
/** Called when surface is deactivated for drawing (current drawable cleared). */
void (*deactivate)();
};
/* Create/Free. */
void wm_surface_add(wmSurface *surface);
void wm_surface_remove(wmSurface *surface);
void wm_surfaces_free();
/* Utils. */
void wm_surfaces_iter(bContext *C, void (*cb)(bContext *, wmSurface *));
/* Evaluation. */
void wm_surfaces_do_depsgraph(bContext *C);
/* Drawing. */
void wm_surface_make_drawable(wmSurface *surface);
void wm_surface_clear_drawable();
void wm_surface_set_drawable(wmSurface *surface, bool activate);
void wm_surface_reset_drawable();