Cleanup: format

This commit is contained in:
Chris Blackbourn 2023-05-05 23:44:56 +12:00
parent 29053c5c02
commit 48abc09d84
6 changed files with 23 additions and 28 deletions

View File

@ -26,8 +26,7 @@ void Cryptomatte::begin_sync()
session_.reset(BKE_cryptomatte_init_from_view_layer(inst_.view_layer));
for (const std::string &layer_name :
bke::cryptomatte::BKE_cryptomatte_layer_names_get(*session_))
{
bke::cryptomatte::BKE_cryptomatte_layer_names_get(*session_)) {
StringRef layer_name_ref = layer_name;
bke::cryptomatte::CryptomatteLayer *layer = bke::cryptomatte::BKE_cryptomatte_layer_get(
*session_, layer_name);

View File

@ -300,8 +300,7 @@ void DRW_stats_draw(const rcti *rect)
BLI_snprintf(stat_string, sizeof(stat_string), "GPU Memory");
draw_stat(rect, 0, v, stat_string, sizeof(stat_string));
BLI_snprintf(
stat_string, sizeof(stat_string), "%.2fMB", double(tex_mem + vbo_mem) / 1000000.0);
BLI_snprintf(stat_string, sizeof(stat_string), "%.2fMB", double(tex_mem + vbo_mem) / 1000000.0);
draw_stat_5row(rect, 1, v++, stat_string, sizeof(stat_string));
BLI_snprintf(stat_string, sizeof(stat_string), "Textures");
draw_stat(rect, 1, v, stat_string, sizeof(stat_string));

View File

@ -240,8 +240,7 @@ void Shader::print_log(Span<const char *> sources,
CLG_Severity severity = error ? CLG_SEVERITY_ERROR : CLG_SEVERITY_WARN;
if (((LOG.type->flag & CLG_FLAG_USE) && (LOG.type->level >= 0)) ||
(severity >= CLG_SEVERITY_WARN))
{
(severity >= CLG_SEVERITY_WARN)) {
const char *_str = BLI_dynstr_get_cstring(dynstr);
CLG_log_str(LOG.type, severity, this->name, stage, _str);
MEM_freeN((void *)_str);

View File

@ -338,8 +338,7 @@ bool MTLShader::finalize(const shader::ShaderCreateInfo *info)
if (error) {
/* Only exit out if genuine error and not warning. */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound)
{
NSNotFound) {
const char *errors_c_str = [[error localizedDescription] UTF8String];
const char *sources_c_str = shd_builder_->glsl_fragment_source_.c_str();
@ -878,8 +877,7 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
}
else {
for (const uint i :
IndexRange(pipeline_descriptor.vertex_descriptor.max_attribute_value + 1))
{
IndexRange(pipeline_descriptor.vertex_descriptor.max_attribute_value + 1)) {
/* Metal back-end attribute descriptor state. */
const MTLVertexAttributeDescriptorPSO &attribute_desc =
@ -1072,8 +1070,7 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
bool null_pointsize = true;
float MTL_pointsize = pipeline_descriptor.point_size;
if (pipeline_descriptor.vertex_descriptor.prim_topology_class ==
MTLPrimitiveTopologyClassPoint)
{
MTLPrimitiveTopologyClassPoint) {
/* `if pointsize is > 0.0`, PROGRAM_POINT_SIZE is enabled, and `gl_PointSize` shader keyword
* overrides the value. Otherwise, if < 0.0, use global constant point size. */
if (MTL_pointsize < 0.0) {
@ -1145,8 +1142,7 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
/* Setup pixel format state */
for (int color_attachment = 0; color_attachment < GPU_FB_MAX_COLOR_ATTACHMENT;
color_attachment++)
{
color_attachment++) {
/* Fetch color attachment pixel format in back-end pipeline state. */
MTLPixelFormat pixel_format = pipeline_descriptor.color_attachment_format[color_attachment];
/* Populate MTL API PSO attachment descriptor. */
@ -1387,8 +1383,7 @@ bool MTLShader::bake_compute_pipeline_state(MTLContext *ctx)
/* Only exit out if genuine error and not warning */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound)
{
NSNotFound) {
BLI_assert(false);
return false;
}

View File

@ -48,15 +48,15 @@ void weightvg_do_map(
/* Return immediately, if we have nothing to do! */
/* Also security checks... */
if (!do_invert &&
(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == nullptr)) || !ELEM(falloff_type,
MOD_WVG_MAPPING_CURVE,
MOD_WVG_MAPPING_SHARP,
MOD_WVG_MAPPING_SMOOTH,
MOD_WVG_MAPPING_ROOT,
MOD_WVG_MAPPING_SPHERE,
MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP)))
if (!do_invert && (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == nullptr)) ||
!ELEM(falloff_type,
MOD_WVG_MAPPING_CURVE,
MOD_WVG_MAPPING_SHARP,
MOD_WVG_MAPPING_SMOOTH,
MOD_WVG_MAPPING_ROOT,
MOD_WVG_MAPPING_SPHERE,
MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP)))
{
return;
}
@ -283,8 +283,9 @@ void weightvg_update_vg(MDeformVert *dvert,
for (i = 0; i < num; i++) {
float w = weights[i];
MDeformVert *dv = &dvert[indices ? indices[i] : i];
MDeformWeight *dw = dws ? dws[i] :
((defgrp_idx >= 0) ? BKE_defvert_find_index(dv, defgrp_idx) : nullptr);
MDeformWeight *dw = dws ?
dws[i] :
((defgrp_idx >= 0) ? BKE_defvert_find_index(dv, defgrp_idx) : nullptr);
if (do_normalize) {
w = (w - min_w) * norm_fac;
@ -320,7 +321,8 @@ void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr,
uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE);
if (!has_mask_texture) {
modifier_vgroup_ui(layout, ptr, ob_ptr, "mask_vertex_group", "invert_mask_vertex_group", nullptr);
modifier_vgroup_ui(
layout, ptr, ob_ptr, "mask_vertex_group", "invert_mask_vertex_group", nullptr);
}
if (!has_mask_vertex_group) {

View File

@ -174,6 +174,7 @@ class ImBufBrokenTest(AbstractImBufTest):
bpy.ops.image.open(filepath=str(image_path))
class ImBufLoadBrokenTest(ImBufBrokenTest):
def test_load_exr(self):
self.skip_if_format_missing("OPENEXR")