Cleanup: format

This commit is contained in:
Chris Blackbourn 2023-02-26 11:55:22 +13:00
parent 52ded6ab56
commit 86ceb6722f
12 changed files with 40 additions and 41 deletions

@ -116,7 +116,9 @@ class MetalDevice : public Device {
bool use_local_atomic_sort() const;
string preprocess_source(MetalPipelineType pso_type, const uint kernel_features, string* source = nullptr);
string preprocess_source(MetalPipelineType pso_type,
const uint kernel_features,
string *source = nullptr);
bool make_source_and_check_if_compile_needed(MetalPipelineType pso_type);

@ -310,7 +310,9 @@ bool MetalDevice::use_local_atomic_sort() const
return DebugFlags().metal.use_local_atomic_sort;
}
string MetalDevice::preprocess_source(MetalPipelineType pso_type, const uint kernel_features, string* source)
string MetalDevice::preprocess_source(MetalPipelineType pso_type,
const uint kernel_features,
string *source)
{
string global_defines;
if (use_adaptive_compilation()) {
@ -362,18 +364,18 @@ string MetalDevice::preprocess_source(MetalPipelineType pso_type, const uint ker
const double starttime = time_dt();
# define KERNEL_STRUCT_BEGIN(name, parent) \
string_replace_same_length(*source, "kernel_data." #parent ".", "kernel_data_" #parent "_");
string_replace_same_length(*source, "kernel_data." #parent ".", "kernel_data_" #parent "_");
bool next_member_is_specialized = true;
# define KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE next_member_is_specialized = false;
# define KERNEL_STRUCT_MEMBER(parent, _type, name) \
if (!next_member_is_specialized) { \
string_replace( \
*source, "kernel_data_" #parent "_" #name, "kernel_data." #parent ".__unused_" #name); \
next_member_is_specialized = true; \
}
if (!next_member_is_specialized) { \
string_replace( \
*source, "kernel_data_" #parent "_" #name, "kernel_data." #parent ".__unused_" #name); \
next_member_is_specialized = true; \
}
# include "kernel/data_template.h"
@ -411,7 +413,7 @@ void MetalDevice::make_source(MetalPipelineType pso_type, const uint kernel_feat
string &source = this->source[pso_type];
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
source = path_source_replace_includes(source, path_get("source"));
/* Perform any required specialization on the source.
* With Metal function constants we can generate a single variant of the kernel source which can
* be repeatedly respecialized.
@ -463,7 +465,8 @@ bool MetalDevice::make_source_and_check_if_compile_needed(MetalPipelineType pso_
# define KERNEL_STRUCT_MEMBER_DONT_SPECIALIZE next_member_is_specialized = false;
/* Add specialization constants to md5 so that 'get_best_pipeline' is able to return a suitable match. */
/* Add specialization constants to md5 so that 'get_best_pipeline' is able to return a suitable
* match. */
# define KERNEL_STRUCT_MEMBER(parent, _type, name) \
if (next_member_is_specialized) { \
constant_values += string(#parent "." #name "=") + \

@ -443,7 +443,7 @@ bool MetalKernelPipeline::should_use_binary_archive() const
if ((device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND &&
device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) ||
(device_kernel >= DEVICE_KERNEL_SHADER_EVAL_DISPLACE &&
(device_kernel >= DEVICE_KERNEL_SHADER_EVAL_DISPLACE &&
device_kernel <= DEVICE_KERNEL_SHADER_EVAL_CURVE_SHADOW_TRANSPARENCY)) {
/* Archive all shade kernels - they take a long time to compile. */
return true;

@ -215,11 +215,8 @@ class GHOST_IWindow {
* Needs to be called after each swap events as the framebuffer will change.
* \return A boolean success indicator.
*/
virtual GHOST_TSuccess getVulkanBackbuffer(void *image,
void *framebuffer,
void *render_pass,
void *extent,
uint32_t *fb_id) = 0;
virtual GHOST_TSuccess getVulkanBackbuffer(
void *image, void *framebuffer, void *render_pass, void *extent, uint32_t *fb_id) = 0;
/**
* Invalidates the contents of this window.

@ -107,14 +107,10 @@ uint GHOST_Window::getDefaultFramebuffer()
return (m_context) ? m_context->getDefaultFramebuffer() : 0;
}
GHOST_TSuccess GHOST_Window::getVulkanBackbuffer(void *image,
void *framebuffer,
void *render_pass,
void *extent,
uint32_t *fb_id)
GHOST_TSuccess GHOST_Window::getVulkanBackbuffer(
void *image, void *framebuffer, void *render_pass, void *extent, uint32_t *fb_id)
{
return m_context->getVulkanBackbuffer(
image, framebuffer, render_pass, extent, fb_id);
return m_context->getVulkanBackbuffer(image, framebuffer, render_pass, extent, fb_id);
}
GHOST_TSuccess GHOST_Window::activateDrawingContext()

@ -15,7 +15,6 @@
#include "BLI_path_util.h"
#include "BLI_string.h"
/* Extended file attribute used by OneDrive to mark placeholder files. */
static const char *ONEDRIVE_RECALLONOPEN_ATTRIBUTE = "com.microsoft.OneDrive.RecallOnOpen";
@ -188,7 +187,8 @@ const char *BLI_expand_tilde(const char *path_with_tilde)
return path_expanded;
}
char *BLI_current_working_dir(char *dir, const size_t maxncpy) {
char *BLI_current_working_dir(char *dir, const size_t maxncpy)
{
/* Can't just copy to the *dir pointer, as [path getCString gets grumpy.*/
static char path_expanded[PATH_MAX];
@autoreleasepool {
@ -200,10 +200,11 @@ char *BLI_current_working_dir(char *dir, const size_t maxncpy) {
}
}
bool BLI_change_working_dir(const char* dir) {
bool BLI_change_working_dir(const char *dir)
{
@autoreleasepool {
NSString* path = [[NSString alloc] initWithUTF8String: dir];
if ([[NSFileManager defaultManager] changeCurrentDirectoryPath: path] == YES) {
NSString *path = [[NSString alloc] initWithUTF8String:dir];
if ([[NSFileManager defaultManager] changeCurrentDirectoryPath:path] == YES) {
return true;
}
else {

@ -89,7 +89,7 @@ TEST_F(ChangeWorkingDirectoryTest, change_working_directory)
* picks the true var folder, not the alias, meaning the below
* comparison always fails unless we prepend with the correct value. */
test_temp_dir = "/private" + test_temp_dir;
#endif // #ifdef __APPLE__
#endif // #ifdef __APPLE__
ASSERT_EQ(BLI_path_cmp_normalized(cwd, test_temp_dir.c_str()), 0)
<< "the path of the current working directory should equal the path of the temporary "

@ -117,10 +117,10 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW;
const bool is_tiled_image = image && (image->source == IMA_SRC_TILED);
const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ?
/* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge
* on the mesh may cause single UV vertices to be selected. */
false :
(ts->uv_selectmode == UV_SELECT_EDGE);
/* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge
* on the mesh may cause single UV vertices to be selected. */
false :
(ts->uv_selectmode == UV_SELECT_EDGE);
const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0);
const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ?
(ts->selectmode & SCE_SELECT_FACE) != 0 :

@ -9657,7 +9657,7 @@ static int ui_handle_viewlist_items_hover(const wmEvent *event, const ARegion *r
bool has_item = false;
LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
if (ELEM(but->type, UI_BTYPE_VIEW_ITEM,UI_BTYPE_LISTROW)) {
if (ELEM(but->type, UI_BTYPE_VIEW_ITEM, UI_BTYPE_LISTROW)) {
but->flag &= ~UI_ACTIVE;
has_item = true;
}

@ -4092,7 +4092,7 @@ static void widget_list_itembut(uiWidgetColors *wcol,
const float rad = widget_radius_from_zoom(zoom, wcol);
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
if (state->but_flag & UI_ACTIVE && !(state->but_flag & UI_SELECT)) {
if (state->but_flag & UI_ACTIVE && !(state->but_flag & UI_SELECT)) {
copy_v3_v3_uchar(wcol->inner, wcol->text);
wcol->inner[3] = 20;
}

@ -234,7 +234,6 @@ static void build_poly_connections(blender::AtomicDisjointSet &islands,
/* Polys are connected if they share edges. By connecting all edges of a loop (as long as they
* are not a seam) we can find connected faces. */
threading::parallel_for(polys.index_range(), 1024, [&](const IndexRange range) {
for (const int poly_index : range) {
if (hide_poly[poly_index]) {
continue;
@ -259,9 +258,7 @@ static void build_poly_connections(blender::AtomicDisjointSet &islands,
islands.join(inner_mloop.e, outer_mloop.e);
}
}
}
});
}

@ -194,7 +194,8 @@ void USDMeshReader::read_object_data(Main *bmain, const double motionSampleTime)
Mesh *mesh = (Mesh *)object_->data;
is_initial_load_ = true;
const USDMeshReadParams params = create_mesh_read_params(motionSampleTime, import_params_.mesh_read_flag);
const USDMeshReadParams params = create_mesh_read_params(motionSampleTime,
import_params_.mesh_read_flag);
Mesh *read_mesh = this->read_mesh(mesh, params, nullptr);
@ -850,7 +851,8 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
}
}
read_mesh_sample(&settings, active_mesh, params.motion_sample_time, new_mesh || is_initial_load_);
read_mesh_sample(
&settings, active_mesh, params.motion_sample_time, new_mesh || is_initial_load_);
if (new_mesh) {
/* Here we assume that the number of materials doesn't change, i.e. that
@ -862,7 +864,8 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
bke::MutableAttributeAccessor attributes = active_mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
attributes.lookup_or_add_for_write_span<int>("material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(params.motion_sample_time, material_indices.span, &mat_map);
assign_facesets_to_material_indices(
params.motion_sample_time, material_indices.span, &mat_map);
material_indices.finish();
}
}