WIP: Vulkan: Workbench #107886

Closed
Jeroen Bakker wants to merge 88 commits from Jeroen-Bakker:vulkan-draw-manager-workbench into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
14 changed files with 303 additions and 331 deletions
Showing only changes of commit 7d8c94cb62 - Show all commits

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@
/* Logging, use `ghost.wl.*` prefix. */
#include "CLG_log.h"
static const struct xdg_activation_token_v1_listener *xdg_activation_listener_get();
static const xdg_activation_token_v1_listener *xdg_activation_listener_get();
static constexpr size_t base_dpi = 96;
@ -57,7 +57,7 @@ static constexpr size_t base_dpi = 96;
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
struct WGL_LibDecor_Window {
struct libdecor_frame *frame = nullptr;
libdecor_frame *frame = nullptr;
bool configured = false;
};
@ -69,9 +69,9 @@ static void gwl_libdecor_window_destroy(WGL_LibDecor_Window *decor)
#endif /* WITH_GHOST_WAYLAND_LIBDECOR */
struct WGL_XDG_Decor_Window {
struct xdg_surface *surface = nullptr;
struct zxdg_toplevel_decoration_v1 *toplevel_decor = nullptr;
struct xdg_toplevel *toplevel = nullptr;
xdg_surface *surface = nullptr;
zxdg_toplevel_decoration_v1 *toplevel_decor = nullptr;
xdg_toplevel *toplevel = nullptr;
enum zxdg_toplevel_decoration_v1_mode mode = (enum zxdg_toplevel_decoration_v1_mode)0;
/**
@ -220,14 +220,14 @@ struct GWL_Window {
std::vector<GWL_Output *> outputs;
/** A temporary token used for the window to be notified of it's activation. */
struct xdg_activation_token_v1 *xdg_activation_token = nullptr;
xdg_activation_token_v1 *xdg_activation_token = nullptr;
struct wp_viewport *viewport = nullptr;
wp_viewport *viewport = nullptr;
/**
* When set, only respond to the #wp_fractional_scale_v1_listener::preferred_scale callback
* and ignore updated scale based on #wl_surface_listener::enter & exit events.
*/
struct wp_fractional_scale_v1 *fractional_scale_handle = nullptr;
wp_fractional_scale_v1 *fractional_scale_handle = nullptr;
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
WGL_LibDecor_Window *libdecor = nullptr;
@ -299,7 +299,7 @@ static GHOST_TWindowState gwl_window_state_get(const GWL_Window *win)
/**
* \note Keep in sync with #gwl_window_state_set_for_xdg.
*/
static bool gwl_window_state_set_for_libdecor(struct libdecor_frame *frame,
static bool gwl_window_state_set_for_libdecor(libdecor_frame *frame,
const GHOST_TWindowState state,
const GHOST_TWindowState state_current)
{
@ -344,7 +344,7 @@ static bool gwl_window_state_set_for_libdecor(struct libdecor_frame *frame,
/**
* \note Keep in sync with #gwl_window_state_set_for_libdecor.
*/
static bool gwl_window_state_set_for_xdg(struct xdg_toplevel *toplevel,
static bool gwl_window_state_set_for_xdg(xdg_toplevel *toplevel,
const GHOST_TWindowState state,
const GHOST_TWindowState state_current)
{
@ -452,7 +452,7 @@ static bool gwl_window_viewport_set(GWL_Window *win,
if (win->viewport != nullptr) {
return false;
}
struct wp_viewporter *viewporter = win->ghost_system->wp_viewporter();
wp_viewporter *viewporter = win->ghost_system->wp_viewporter();
if (viewporter == nullptr) {
return false;
}
@ -547,7 +547,7 @@ static bool gwl_window_viewport_size_update(GWL_Window *win)
static void gwl_window_activate(GWL_Window *win)
{
GHOST_SystemWayland *system = win->ghost_system;
struct xdg_activation_v1 *activation_manager = system->xdg_activation_manager();
xdg_activation_v1 *activation_manager = system->xdg_activation_manager();
if (UNLIKELY(activation_manager == nullptr)) {
return;
}
@ -566,7 +566,7 @@ static void gwl_window_activate(GWL_Window *win)
/* The serial of the input device requesting activation. */
{
uint32_t serial = 0;
struct wl_seat *seat = system->wl_seat_active_get_with_input_serial(serial);
wl_seat *seat = system->wl_seat_active_get_with_input_serial(serial);
if (seat) {
xdg_activation_token_v1_set_serial(win->xdg_activation_token, serial, seat);
}
@ -577,7 +577,7 @@ static void gwl_window_activate(GWL_Window *win)
GHOST_WindowWayland *ghost_window_active = static_cast<GHOST_WindowWayland *>(
system->getWindowManager()->getActiveWindow());
if (ghost_window_active) {
struct wl_surface *surface = ghost_window_active->wl_surface();
wl_surface *surface = ghost_window_active->wl_surface();
if (surface) {
xdg_activation_token_v1_set_surface(win->xdg_activation_token, surface);
}
@ -977,7 +977,7 @@ static const xdg_toplevel_listener xdg_toplevel_listener = {
* \{ */
static void xdg_activation_handle_done(void *data,
struct xdg_activation_token_v1 *xdg_activation_token_v1,
xdg_activation_token_v1 *xdg_activation_token_v1,
const char *token)
{
GWL_Window *win = static_cast<GWL_Window *>(data);
@ -986,17 +986,17 @@ static void xdg_activation_handle_done(void *data,
}
GHOST_SystemWayland *system = win->ghost_system;
struct xdg_activation_v1 *activation_manager = system->xdg_activation_manager();
xdg_activation_v1 *activation_manager = system->xdg_activation_manager();
xdg_activation_v1_activate(activation_manager, token, win->wl_surface);
xdg_activation_token_v1_destroy(win->xdg_activation_token);
win->xdg_activation_token = nullptr;
}
static const struct xdg_activation_token_v1_listener xdg_activation_listener = {
static const xdg_activation_token_v1_listener xdg_activation_listener = {
/*done*/ xdg_activation_handle_done,
};
static const struct xdg_activation_token_v1_listener *xdg_activation_listener_get()
static const xdg_activation_token_v1_listener *xdg_activation_listener_get()
{
return &xdg_activation_listener;
}
@ -1013,7 +1013,7 @@ static CLG_LogRef LOG_WL_FRACTIONAL_SCALE = {"ghost.wl.handle.fractional_scale"}
#define LOG (&LOG_WL_FRACTIONAL_SCALE)
static void wp_fractional_scale_handle_preferred_scale(
void *data, struct wp_fractional_scale_v1 * /*wp_fractional_scale_v1*/, uint preferred_scale)
void *data, wp_fractional_scale_v1 * /*wp_fractional_scale_v1*/, uint preferred_scale)
{
#ifdef USE_EVENT_BACKGROUND_THREAD
std::lock_guard lock_frame_guard{static_cast<GWL_Window *>(data)->frame_pending_mutex};
@ -1031,7 +1031,7 @@ static void wp_fractional_scale_handle_preferred_scale(
}
}
static const struct wp_fractional_scale_v1_listener wp_fractional_scale_listener = {
static const wp_fractional_scale_v1_listener wp_fractional_scale_listener = {
/*preferred_scale*/ wp_fractional_scale_handle_preferred_scale,
};
@ -1048,8 +1048,8 @@ static const struct wp_fractional_scale_v1_listener wp_fractional_scale_listener
static CLG_LogRef LOG_WL_LIBDECOR_FRAME = {"ghost.wl.handle.libdecor_frame"};
# define LOG (&LOG_WL_LIBDECOR_FRAME)
static void frame_handle_configure(struct libdecor_frame *frame,
struct libdecor_configuration *configuration,
static void frame_handle_configure(libdecor_frame *frame,
libdecor_configuration *configuration,
void *data)
{
CLOG_INFO(LOG, 2, "configure");
@ -1098,7 +1098,7 @@ static void frame_handle_configure(struct libdecor_frame *frame,
/* Commit the changes. */
{
GWL_Window *win = static_cast<GWL_Window *>(data);
struct libdecor_state *state = libdecor_state_new(UNPACK2(size_next));
libdecor_state *state = libdecor_state_new(UNPACK2(size_next));
libdecor_frame_commit(frame, state, configuration);
libdecor_state_free(state);
@ -1122,7 +1122,7 @@ static void frame_handle_configure(struct libdecor_frame *frame,
}
}
static void frame_handle_close(struct libdecor_frame * /*frame*/, void *data)
static void frame_handle_close(libdecor_frame * /*frame*/, void *data)
{
CLOG_INFO(LOG, 2, "close");
@ -1131,7 +1131,7 @@ static void frame_handle_close(struct libdecor_frame * /*frame*/, void *data)
win->ghost_window->close();
}
static void frame_handle_commit(struct libdecor_frame * /*frame*/, void *data)
static void frame_handle_commit(libdecor_frame * /*frame*/, void *data)
{
CLOG_INFO(LOG, 2, "commit");
@ -1164,9 +1164,7 @@ static CLG_LogRef LOG_WL_XDG_TOPLEVEL_DECORATION = {"ghost.wl.handle.xdg_topleve
#define LOG (&LOG_WL_XDG_TOPLEVEL_DECORATION)
static void xdg_toplevel_decoration_handle_configure(
void *data,
struct zxdg_toplevel_decoration_v1 * /*zxdg_toplevel_decoration_v1*/,
const uint32_t mode)
void *data, zxdg_toplevel_decoration_v1 * /*zxdg_toplevel_decoration_v1*/, const uint32_t mode)
{
CLOG_INFO(LOG, 2, "configure (mode=%u)", mode);
@ -1238,9 +1236,7 @@ static const xdg_surface_listener xdg_surface_listener = {
static CLG_LogRef LOG_WL_SURFACE = {"ghost.wl.handle.surface"};
#define LOG (&LOG_WL_SURFACE)
static void surface_handle_enter(void *data,
struct wl_surface * /*wl_surface*/,
struct wl_output *wl_output)
static void surface_handle_enter(void *data, wl_surface * /*wl_surface*/, wl_output *wl_output)
{
if (!ghost_wl_output_own(wl_output)) {
CLOG_INFO(LOG, 2, "enter (skipped)");
@ -1255,9 +1251,7 @@ static void surface_handle_enter(void *data,
}
}
static void surface_handle_leave(void *data,
struct wl_surface * /*wl_surface*/,
struct wl_output *wl_output)
static void surface_handle_leave(void *data, wl_surface * /*wl_surface*/, wl_output *wl_output)
{
if (!ghost_wl_output_own(wl_output)) {
CLOG_INFO(LOG, 2, "leave (skipped)");
@ -1356,8 +1350,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
window_->egl_window = wl_egl_window_create(
window_->wl_surface, int(window_->frame.size[0]), int(window_->frame.size[1]));
struct wp_fractional_scale_manager_v1 *fractional_scale_manager =
system->wp_fractional_scale_manager();
wp_fractional_scale_manager_v1 *fractional_scale_manager = system->wp_fractional_scale_manager();
if (fractional_scale_manager) {
window_->fractional_scale_handle = wp_fractional_scale_manager_v1_get_fractional_scale(
fractional_scale_manager, window_->wl_surface);
@ -1443,7 +1436,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
/* NOTE: LIBDECOR requires the window to be created & configured before the state can be set.
* Workaround this by using the underlying `xdg_toplevel` */
WGL_LibDecor_Window &decor = *window_->libdecor;
struct xdg_toplevel *toplevel = libdecor_frame_get_xdg_toplevel(decor.frame);
xdg_toplevel *toplevel = libdecor_frame_get_xdg_toplevel(decor.frame);
gwl_window_state_set_for_xdg(toplevel, state, GHOST_kWindowStateNormal);
}
else
@ -1831,7 +1824,7 @@ int GHOST_WindowWayland::scale() const
return window_->frame.buffer_scale;
}
const struct GWL_WindowScaleParams &GHOST_WindowWayland::scale_params() const
const GWL_WindowScaleParams &GHOST_WindowWayland::scale_params() const
{
/* NOTE(@ideasman42): This could be kept initialized,
* since it's such a small struct it's not so important. */

View File

@ -142,7 +142,7 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
# if defined(WITH_GHOST_WAYLAND)
/* #GHOST_SystemWayland */
oxr_binding.wl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WAYLAND_KHR;
oxr_binding.wl.display = (struct wl_display *)ctx_egl.m_nativeDisplay;
oxr_binding.wl.display = (wl_display *)ctx_egl.m_nativeDisplay;
# else
GHOST_ASSERT(false, "Unexpected State: logical error, unreachable!");
# endif /* !WITH_GHOST_WAYLAND */

View File

@ -147,8 +147,8 @@ static const char *check_memlist(MemHead *memh);
static uint totblock = 0;
static size_t mem_in_use = 0, peak_mem = 0;
static volatile struct localListBase _membase;
static volatile struct localListBase *membase = &_membase;
static volatile localListBase _membase;
static volatile localListBase *membase = &_membase;
static void (*error_callback)(const char *) = NULL;
static bool malloc_debug_memset = false;
@ -923,7 +923,7 @@ void MEM_guarded_freeN(void *vmemh)
static void addtail(volatile localListBase *listbase, void *vlink)
{
struct localLink *link = vlink;
localLink *link = vlink;
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
@ -938,7 +938,7 @@ static void addtail(volatile localListBase *listbase, void *vlink)
link->prev = listbase->last;
if (listbase->last) {
((struct localLink *)listbase->last)->next = link;
((localLink *)listbase->last)->next = link;
}
if (listbase->first == NULL) {
listbase->first = link;
@ -948,7 +948,7 @@ static void addtail(volatile localListBase *listbase, void *vlink)
static void remlink(volatile localListBase *listbase, void *vlink)
{
struct localLink *link = vlink;
localLink *link = vlink;
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
@ -1127,7 +1127,7 @@ static const char *check_memlist(MemHead *memh)
}
else {
forwok->next = NULL;
membase->last = (struct localLink *)&forwok->next;
membase->last = (localLink *)&forwok->next;
}
}
else {

View File

@ -468,7 +468,7 @@ void DebugInfo::delete_operation_exports()
{
const std::string dir = get_operations_export_dir();
if (BLI_exists(dir.c_str())) {
struct direntry *file_list;
direntry *file_list;
int file_list_num = BLI_filelist_dir_contents(dir.c_str(), &file_list);
for (int i = 0; i < file_list_num; i++) {
direntry *file = &file_list[i];

View File

@ -66,7 +66,7 @@ void PreviewOperation::execute_region(rcti *rect, uint /*tile_number*/)
{
int offset;
float color[4];
struct ColormanageProcessor *cm_processor;
ColormanageProcessor *cm_processor;
cm_processor = IMB_colormanagement_display_processor_new(view_settings_, display_settings_);
@ -160,7 +160,7 @@ void PreviewOperation::update_memory_buffer_partial(MemoryBuffer * /*output*/,
Span<MemoryBuffer *> inputs)
{
MemoryBuffer *input = inputs[0];
struct ColormanageProcessor *cm_processor = IMB_colormanagement_display_processor_new(
ColormanageProcessor *cm_processor = IMB_colormanagement_display_processor_new(
view_settings_, display_settings_);
rcti buffer_area;

View File

@ -1480,7 +1480,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
ED_area_status_text(t->area, str);
}
static void edge_slide_transform_matrix_fn(struct TransInfo *t, float mat_xform[4][4])
static void edge_slide_transform_matrix_fn(TransInfo *t, float mat_xform[4][4])
{
float delta[3], orig_co[3], final_co[3];

View File

@ -286,7 +286,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
ED_area_status_text(t->area, str);
}
static void resize_transform_matrix_fn(struct TransInfo *t, float mat_xform[4][4])
static void resize_transform_matrix_fn(TransInfo *t, float mat_xform[4][4])
{
float mat4[4][4];
copy_m4_m3(mat4, t->mat);

View File

@ -40,11 +40,8 @@ struct SnapSouceCustomData {
eSnapTargetOP target_operation_prev;
struct {
void (*apply)(struct TransInfo *t,
struct MouseInput *mi,
const double mval[2],
float output[3]);
void (*post)(struct TransInfo *t, float values[3]);
void (*apply)(TransInfo *t, MouseInput *mi, const double mval[2], float output[3]);
void (*post)(TransInfo *t, float values[3]);
bool use_virtual_mval;
} mouse_prev;
};
@ -111,7 +108,7 @@ static void snapsource_confirm(TransInfo *t)
t->tsnap.flag &= ~SCE_SNAP_PROJECT;
}
static eRedrawFlag snapsource_handle_event_fn(struct TransInfo *t, const struct wmEvent *event)
static eRedrawFlag snapsource_handle_event_fn(TransInfo *t, const wmEvent *event)
{
if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
@ -224,7 +221,7 @@ void transform_mode_snap_source_init(TransInfo *t, wmOperator *UNUSED(op))
#ifdef REMOVE_GIZMO
struct wmGizmo *gz = WM_gizmomap_get_modal(t->region->gizmo_map);
if (gz) {
const struct wmEvent *event = CTX_wm_window(t->context)->eventstate;
const wmEvent *event = CTX_wm_window(t->context)->eventstate;
# ifdef RESET_TRANSFORMATION
wmGizmoFnModal modal_fn = gz->custom_modal ? gz->custom_modal : gz->type->modal;
modal_fn(t->context, gz, event, 0);

View File

@ -610,7 +610,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
ED_area_status_text(t->area, str);
}
static void vert_slide_transform_matrix_fn(struct TransInfo *t, float mat_xform[4][4])
static void vert_slide_transform_matrix_fn(TransInfo *t, float mat_xform[4][4])
{
float delta[3], orig_co[3], final_co[3];

View File

@ -936,7 +936,7 @@ void Controller::InsertStyleModule(uint index, const char *iName, const char *iB
_Canvas->InsertStyleModule(index, sm);
}
void Controller::InsertStyleModule(uint index, const char *iName, struct Text *iText)
void Controller::InsertStyleModule(uint index, const char *iName, Text *iText)
{
StyleModule *sm = new BlenderStyleModule(iText, iName, _inter);
_Canvas->InsertStyleModule(index, sm);

View File

@ -260,7 +260,7 @@ void BlenderFileLoader::clipTriangle(int numTris,
(void)numTris; /* Ignored in release builds. */
}
void BlenderFileLoader::addTriangle(struct LoaderState *ls,
void BlenderFileLoader::addTriangle(LoaderState *ls,
float v1[3],
float v2[3],
float v3[3],
@ -502,7 +502,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
uint *NIndices = new uint[niSize];
uint *MIndices = new uint[viSize]; // Material Indices
struct LoaderState ls;
LoaderState ls;
ls.pv = vertices;
ls.pn = normals;
ls.pm = faceEdgeMarks;

View File

@ -51,7 +51,7 @@ using namespace Freestyle;
extern "C" {
struct FreestyleGlobals g_freestyle;
FreestyleGlobals g_freestyle;
// Freestyle configuration
static bool freestyle_is_initialized = false;
@ -63,8 +63,8 @@ static AppView *view = nullptr;
static FreestyleLineSet lineset_buffer;
static bool lineset_copied = false;
static void load_post_callback(struct Main * /*main*/,
struct PointerRNA ** /*pointers*/,
static void load_post_callback(Main * /*main*/,
PointerRNA ** /*pointers*/,
const int /*num_pointers*/,
void * /*arg*/)
{
@ -190,7 +190,7 @@ struct edge_type_condition {
};
// examines the conditions and returns true if the target edge type needs to be computed
static bool test_edge_type_conditions(struct edge_type_condition *conditions,
static bool test_edge_type_conditions(edge_type_condition *conditions,
int num_edge_types,
bool logical_and,
int target,
@ -330,7 +330,7 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
int use_ridges_and_valleys = 0;
int use_suggestive_contours = 0;
int use_material_boundaries = 0;
struct edge_type_condition conditions[] = {
edge_type_condition conditions[] = {
{FREESTYLE_FE_SILHOUETTE, 0},
{FREESTYLE_FE_BORDER, 0},
{FREESTYLE_FE_CREASE, 0},
@ -765,7 +765,7 @@ bool FRS_move_active_lineset(FreestyleConfig *config, int direction)
// Testing
Material *FRS_create_stroke_material(Main *bmain, struct FreestyleLineStyle *linestyle)
Material *FRS_create_stroke_material(Main *bmain, FreestyleLineStyle *linestyle)
{
bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : nullptr;
Material *ma = BlenderStrokeRenderer::GetStrokeShader(bmain, nt, true);

View File

@ -21,12 +21,12 @@ string SceneHash::toString()
void SceneHash::visitNodeViewLayer(NodeViewLayer &node)
{
struct RenderData *r = &node.scene().r;
RenderData *r = &node.scene().r;
adler32((uchar *)&r->xsch, sizeof(r->xsch)); // resolution_x
adler32((uchar *)&r->ysch, sizeof(r->ysch)); // resolution_y
adler32((uchar *)&r->size, sizeof(r->size)); // resolution_percentage
struct FreestyleConfig *config = &node.sceneLayer().freestyle_config;
FreestyleConfig *config = &node.sceneLayer().freestyle_config;
adler32((uchar *)&config->flags, sizeof(config->flags));
adler32((uchar *)&config->crease_angle, sizeof(config->crease_angle));
adler32((uchar *)&config->sphere_radius, sizeof(config->sphere_radius));