From 9df1e54079344ed4e2becef9e57cf1b925b46dff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 19 Jul 2018 16:06:37 +1000 Subject: Cleanup: style --- .../blender/blenkernel/intern/subdiv_converter.h | 6 +-- source/blender/blenkernel/intern/subdiv_mesh.c | 32 ++++++------ source/blender/blenlib/intern/hash_mm3.c | 18 +++---- .../compositor/nodes/COM_CryptomatteNode.cpp | 10 ++-- .../operations/COM_CryptomatteOperation.cpp | 2 +- source/blender/depsgraph/DEG_depsgraph.h | 6 +-- .../depsgraph/intern/builder/deg_builder_map.cc | 15 ++++-- .../depsgraph/intern/builder/deg_builder_nodes.h | 2 +- .../draw/engines/workbench/workbench_data.c | 4 +- .../draw/engines/workbench/workbench_volume.c | 2 +- source/blender/draw/intern/draw_cache.c | 2 +- source/blender/editors/render/render_preview.c | 2 +- source/blender/gpu/GPU_common.h | 8 +-- source/blender/gpu/intern/gpu_attr_binding.c | 2 +- .../blender/gpu/intern/gpu_attr_binding_private.h | 8 +-- source/blender/gpu/intern/gpu_batch_private.h | 6 +-- source/blender/gpu/intern/gpu_buffer_id.cpp | 2 +- source/blender/gpu/intern/gpu_immediate.c | 12 ++--- source/blender/gpu/intern/gpu_immediate_util.c | 2 +- source/blender/gpu/intern/gpu_shader_interface.c | 2 +- source/blender/gpu/intern/gpu_vertex_array_id.cpp | 26 +++++----- source/blender/gpu/intern/gpu_vertex_format.c | 2 +- .../blender/gpu/intern/gpu_vertex_format_private.h | 4 +- source/blender/makesrna/intern/rna_nodetree.c | 5 +- .../composite/nodes/node_composite_cryptomatte.c | 58 +++++++++++----------- .../nodes/node_shader_bsdf_hair_principled.c | 2 +- source/blender/python/gpu/gpu_py_types.c | 2 - 27 files changed, 126 insertions(+), 116 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/subdiv_converter.h b/source/blender/blenkernel/intern/subdiv_converter.h index 748d97f4178..4c552a9164e 100644 --- a/source/blender/blenkernel/intern/subdiv_converter.h +++ b/source/blender/blenkernel/intern/subdiv_converter.h @@ -23,8 +23,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifndef __BKE_SUBDIV_CONVERTER_H__ -#define __BKE_SUBDIV_CONVERTER_H__ +#ifndef __SUBDIV_CONVERTER_H__ +#define __SUBDIV_CONVERTER_H__ #include "BKE_subdiv.h" @@ -54,4 +54,4 @@ void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter); int BKE_subdiv_converter_fvar_linear_from_settings( const SubdivSettings *settings); -#endif /* __BKE_SUBDIV_CONVERTER_H__ */ +#endif /* __SUBDIV_CONVERTER_H__ */ diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 8a58605ba19..c2a10483e26 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -152,7 +152,7 @@ static void edges_of_ptex_get( typedef struct VerticesForInterpolation { /* This field points to a vertex data which is to be used for interpolation. * The idea is to avoid unnecessary allocations for regular faces, where - * we can simply + * we can simply */ const CustomData *vertex_data; /* Vertices data calculated for ptex corners. There are always 4 elements @@ -176,7 +176,7 @@ typedef struct VerticesForInterpolation { static void vertex_interpolation_init( const SubdivMeshContext *ctx, VerticesForInterpolation *vertex_interpolation, - const MPoly *coarse_poly) + const MPoly *coarse_poly) { const Mesh *coarse_mesh = ctx->coarse_mesh; const MLoop *coarse_mloop = coarse_mesh->mloop; @@ -234,7 +234,8 @@ static void vertex_interpolation_from_ptex( { if (coarse_poly->totloop == 4) { /* Nothing to do, all indices and data is already assigned. */ - } else { + } + else { const CustomData *vertex_data = &ctx->coarse_mesh->vdata; const Mesh *coarse_mesh = ctx->coarse_mesh; const MLoop *coarse_mloop = coarse_mesh->mloop; @@ -287,7 +288,7 @@ static void vertex_interpolation_end( typedef struct LoopsForInterpolation { /* This field points to a loop data which is to be used for interpolation. * The idea is to avoid unnecessary allocations for regular faces, where - * we can simply + * we can simply */ const CustomData *loop_data; /* Loops data calculated for ptex corners. There are always 4 elements @@ -311,7 +312,7 @@ typedef struct LoopsForInterpolation { static void loop_interpolation_init( const SubdivMeshContext *ctx, LoopsForInterpolation *loop_interpolation, - const MPoly *coarse_poly) + const MPoly *coarse_poly) { const Mesh *coarse_mesh = ctx->coarse_mesh; if (coarse_poly->totloop == 4) { @@ -363,7 +364,8 @@ static void loop_interpolation_from_ptex( { if (coarse_poly->totloop == 4) { /* Nothing to do, all indices and data is already assigned. */ - } else { + } + else { const CustomData *loop_data = &ctx->coarse_mesh->ldata; const Mesh *coarse_mesh = ctx->coarse_mesh; const MLoop *coarse_mloop = coarse_mesh->mloop; @@ -481,9 +483,10 @@ static void subdiv_evaluate_vertices(SubdivMeshContext *ctx, vertex_interpolation_end(&vertex_interpolation); } -static void subdiv_copy_edge_data(SubdivMeshContext *ctx, - MEdge *subdiv_edge, - const MEdge *coarse_edge) +static void subdiv_copy_edge_data( + SubdivMeshContext *ctx, + MEdge *subdiv_edge, + const MEdge *coarse_edge) { if (coarse_edge == NULL) { subdiv_edge->crease = 0; @@ -586,11 +589,12 @@ static void subdiv_create_edges(SubdivMeshContext *ctx, int poly_index) EdgesOfPtex edges_of_ptex; edges_of_ptex_get(ctx, &edges_of_ptex, coarse_poly, i); /* Create bottom row of edges (0-1, 1-2). */ - subdiv_edge = subdiv_create_edges_row(ctx, - subdiv_edge, - edges_of_ptex.first_edge, - start_ptex_face_vertex_index, - resolution); + subdiv_edge = subdiv_create_edges_row( + ctx, + subdiv_edge, + edges_of_ptex.first_edge, + start_ptex_face_vertex_index, + resolution); /* Create remaining edges. */ for (int row = 0; row < resolution - 1; row++) { const int start_row_vertex_index = diff --git a/source/blender/blenlib/intern/hash_mm3.c b/source/blender/blenlib/intern/hash_mm3.c index 5ead9ceca63..105c1f46832 100644 --- a/source/blender/blenlib/intern/hash_mm3.c +++ b/source/blender/blenlib/intern/hash_mm3.c @@ -92,7 +92,7 @@ BLI_INLINE uint64_t fmix64(uint64_t k) uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed) { - const uint8_t *data = (const uint8_t*)in; + const uint8_t *data = (const uint8_t *)in; const int nblocks = len / 4; uint32_t h1 = seed; @@ -102,23 +102,23 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed) /* body */ - const uint32_t *blocks = (const uint32_t *)(data + nblocks*4); + const uint32_t *blocks = (const uint32_t *)(data + nblocks * 4); for (int i = -nblocks; i; i++) { - uint32_t k1 = getblock32(blocks,i); + uint32_t k1 = getblock32(blocks, i); k1 *= c1; - k1 = ROTL32(k1,15); + k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1; - h1 = ROTL32(h1,13); - h1 = h1*5+0xe6546b64; + h1 = ROTL32(h1, 13); + h1 = h1 * 5 + 0xe6546b64; } /* tail */ - const uint8_t *tail = (const uint8_t*)(data + nblocks*4); + const uint8_t *tail = (const uint8_t *)(data + nblocks * 4); uint32_t k1 = 0; @@ -132,10 +132,10 @@ uint32_t BLI_hash_mm3(const unsigned char *in, size_t len, uint32_t seed) case 1: k1 ^= tail[0]; k1 *= c1; - k1 = ROTL32(k1,15); + k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1; - }; + } /* finalization */ diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp index bc115e66c20..648ea4556ad 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp @@ -62,7 +62,7 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos bNode *node = this->getbNode(); NodeCryptomatte *cryptoMatteSettings = (NodeCryptomatte *)node->storage; - CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets()-1); + CryptomatteOperation *operation = new CryptomatteOperation(getNumberOfInputSockets() - 1); if (cryptoMatteSettings) { if (cryptoMatteSettings->matte_id) { /* Split the string by commas, ignoring white space. */ @@ -83,7 +83,7 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos operation->addObjectIndex(atof(token.substr(1, token.length() - 2).c_str())); } else { - uint32_t hash = BLI_hash_mm3((const unsigned char*)token.c_str(), token.length(), 0); + uint32_t hash = BLI_hash_mm3((const unsigned char *)token.c_str(), token.length(), 0); operation->addObjectIndex(hash_to_float(hash)); } } @@ -93,14 +93,14 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos converter.addOperation(operation); - for (int i = 0; i < getNumberOfInputSockets()-1; ++i) { + for (int i = 0; i < getNumberOfInputSockets() - 1; ++i) { converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i)); } SeparateChannelOperation *separateOperation = new SeparateChannelOperation; separateOperation->setChannel(3); converter.addOperation(separateOperation); - + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); converter.addOperation(operationAlpha); @@ -117,5 +117,5 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos converter.mapOutputSocket(outputSocketMatte, separateOperation->getOutputSocket(0)); converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket(0)); converter.mapOutputSocket(outputSocketPick, clearAlphaOperation->getOutputSocket(0)); - + } diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp index 9dd36863d37..f3fa81075c6 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp @@ -63,7 +63,7 @@ void CryptomatteOperation::executePixel(float output[4], output[1] = ((float) ((m3hash << 8)) / (float) UINT32_MAX); output[2] = ((float) ((m3hash << 16)) / (float) UINT32_MAX); } - for(size_t i = 0; i < m_objectIndex.size(); i++) { + for (size_t i = 0; i < m_objectIndex.size(); i++) { if (m_objectIndex[i] == input[0]) { output[3] += input[1]; } diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 71376d94ca8..2e566752a6f 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -269,9 +269,9 @@ void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph, const void *parent_address); void DEG_debug_print_eval_time(struct Depsgraph *depsgraph, - const char* function_name, - const char* object_name, - const void* object_address, + const char *function_name, + const char *object_name, + const void *object_address, float time); #ifdef __cplusplus diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc index 218483d1dc5..cde7b9721b7 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc @@ -37,24 +37,29 @@ namespace DEG { -BuilderMap::BuilderMap() { +BuilderMap::BuilderMap() +{ set = BLI_gset_ptr_new("deg builder gset"); } -BuilderMap::~BuilderMap() { +BuilderMap::~BuilderMap() +{ BLI_gset_free(set, NULL); } -bool BuilderMap::checkIsBuilt(ID *id) { +bool BuilderMap::checkIsBuilt(ID *id) +{ return BLI_gset_haskey(set, id); } -void BuilderMap::tagBuild(ID *id) { +void BuilderMap::tagBuild(ID *id) +{ BLI_gset_insert(set, id); } -bool BuilderMap::checkIsBuiltAndTag(ID *id) { +bool BuilderMap::checkIsBuiltAndTag(ID *id) +{ void **key_p; if (!BLI_gset_ensure_p_ex(set, id, &key_p)) { *key_p = id; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 6899a86b3e9..66293a91e85 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -158,7 +158,7 @@ struct DepsgraphNodeBuilder { const char *name = "", int name_tag = -1); - void build_id(ID* id); + void build_id(ID *id); void build_layer_collections(ListBase *lb); void build_view_layer(Scene *scene, ViewLayer *view_layer, diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 07df067f324..5c3ab5f6688 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -33,11 +33,11 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) if (wpd->shading.light == V3D_LIGHTING_MATCAP) { wpd->studio_light = BKE_studiolight_find( - wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL); + wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL); } else { wpd->studio_light = BKE_studiolight_find( - wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD); + wpd->shading.studio_light, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD); } wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity; diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index f28bfd01ae8..ea4152486af 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -19,7 +19,7 @@ * */ -/** \file workbench_volumed.c +/** \file workbench_volume.c * \ingroup draw_engine */ diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index bb73a8c1b19..dff863b11bb 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -901,7 +901,7 @@ GPUBatch *DRW_cache_empty_capsule_cap_get(void) float v[3] = {0.0f, 0.0f, 0.0f}; copy_v2_v2(v, p[(i) % NSEGMENTS]); GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v); - copy_v2_v2(v, p[(i+1) % NSEGMENTS]); + copy_v2_v2(v, p[(i + 1) % NSEGMENTS]); GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v); } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 6ced3f2e430..450897382dd 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -828,7 +828,7 @@ static void shader_preview_free(void *customdata) ShaderPreview *sp = customdata; Main *pr_main = sp->pr_main; - if (sp->id_copy){ + if (sp->id_copy) { switch (GS(sp->id_copy->name)) { case ID_MA: BKE_material_free((Material *)sp->id_copy); diff --git a/source/blender/gpu/GPU_common.h b/source/blender/gpu/GPU_common.h index 7d86a6ec8a5..3acc7fad5c2 100644 --- a/source/blender/gpu/GPU_common.h +++ b/source/blender/gpu/GPU_common.h @@ -33,14 +33,14 @@ #define PROGRAM_NO_OPTI 0 #if defined(NDEBUG) - #define TRUST_NO_ONE 0 +# define TRUST_NO_ONE 0 #else /* strict error checking, enabled for debug builds during early development */ - #define TRUST_NO_ONE 1 +# define TRUST_NO_ONE 1 #endif #if defined(WITH_OPENGL) - #include +# include #endif #include @@ -48,7 +48,7 @@ #include "BLI_sys_types.h" #if TRUST_NO_ONE - #include +# include #endif /* GPU_INLINE */ diff --git a/source/blender/gpu/intern/gpu_attr_binding.c b/source/blender/gpu/intern/gpu_attr_binding.c index e66fac390f1..398b97c7f9d 100644 --- a/source/blender/gpu/intern/gpu_attr_binding.c +++ b/source/blender/gpu/intern/gpu_attr_binding.c @@ -35,7 +35,7 @@ #include #if GPU_VERT_ATTR_MAX_LEN != 16 - #error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16" +# error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16" #endif void AttribBinding_clear(GPUAttrBinding *binding) diff --git a/source/blender/gpu/intern/gpu_attr_binding_private.h b/source/blender/gpu/intern/gpu_attr_binding_private.h index 240509de0d4..cb338b10aa4 100644 --- a/source/blender/gpu/intern/gpu_attr_binding_private.h +++ b/source/blender/gpu/intern/gpu_attr_binding_private.h @@ -35,9 +35,11 @@ #include "GPU_vertex_format.h" #include "GPU_shader_interface.h" -void AttribBinding_clear(GPUAttrBinding*); +void AttribBinding_clear(GPUAttrBinding *binding); -void get_attrib_locations(const GPUVertFormat*, GPUAttrBinding*, const GPUShaderInterface*); -unsigned read_attrib_location(const GPUAttrBinding*, unsigned a_idx); +void get_attrib_locations( + const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface); +unsigned read_attrib_location( + const GPUAttrBinding *binding, unsigned a_idx); #endif /* __GPU_ATTR_BINDING_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_batch_private.h b/source/blender/gpu/intern/gpu_batch_private.h index 0b25c0aef05..51040ff751a 100644 --- a/source/blender/gpu/intern/gpu_batch_private.h +++ b/source/blender/gpu/intern/gpu_batch_private.h @@ -41,10 +41,10 @@ extern "C" { #include "GPU_context.h" #include "GPU_shader_interface.h" -void gpu_batch_remove_interface_ref(GPUBatch*, const GPUShaderInterface*); +void gpu_batch_remove_interface_ref(GPUBatch *batch, const GPUShaderInterface *interface); -void gpu_context_add_batch(GPUContext*, GPUBatch*); -void gpu_context_remove_batch(GPUContext*, GPUBatch*); +void gpu_context_add_batch(GPUContext *ctx, GPUBatch *batch); +void gpu_context_remove_batch(GPUContext *ctx, GPUBatch *batch); #ifdef __cplusplus } diff --git a/source/blender/gpu/intern/gpu_buffer_id.cpp b/source/blender/gpu/intern/gpu_buffer_id.cpp index c1aaf1945aa..f3faba9c766 100644 --- a/source/blender/gpu/intern/gpu_buffer_id.cpp +++ b/source/blender/gpu/intern/gpu_buffer_id.cpp @@ -37,7 +37,7 @@ #define ORPHAN_DEBUG 0 #if ORPHAN_DEBUG - #include +# include #endif static std::vector orphaned_buffer_ids; diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index 06b487fbb25..66a467e339e 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -701,17 +701,17 @@ void immVertex2iv(uint attrib_id, const int data[2]) /* --- generic uniform functions --- */ #if 0 - #if TRUST_NO_ONE - #define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform); - #else - #define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); - #endif +# if TRUST_NO_ONE +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform); +# else +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); +# endif #else /* NOTE: It is possible to have uniform fully optimized out from the shader. * In this case we can't assert failure or allow NULL-pointer dereference. * TODO(sergey): How can we detect existing-but-optimized-out uniform but still * catch typos in uniform names passed to immUniform*() functions? */ - #define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return; +# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return; #endif void immUniform1f(const char *name, float x) diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index cf594367bdf..8384ef3b5d0 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -18,7 +18,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/gpu/intern/gpu_imm_util.c +/** \file blender/gpu/intern/gpu_immediate_util.c * \ingroup gpu * * GPU immediate mode drawing utilities diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c index 7e1d942da2d..4b8413d0cc3 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.c +++ b/source/blender/gpu/intern/gpu_shader_interface.c @@ -39,7 +39,7 @@ #define DEBUG_SHADER_INTERFACE 0 #if DEBUG_SHADER_INTERFACE - #include +# include #endif static const char *BuiltinUniform_name(GPUUniformBuiltin u) diff --git a/source/blender/gpu/intern/gpu_vertex_array_id.cpp b/source/blender/gpu/intern/gpu_vertex_array_id.cpp index 2f29bbfbc33..64f704bb107 100644 --- a/source/blender/gpu/intern/gpu_vertex_array_id.cpp +++ b/source/blender/gpu/intern/gpu_vertex_array_id.cpp @@ -23,7 +23,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/gpu/gpu_vertex_array_id.cpp +/** \file blender/gpu/intern/gpu_vertex_array_id.cpp * \ingroup gpu * * Manage GL vertex array IDs in a thread-safe way @@ -58,7 +58,7 @@ static bool thread_is_main() { struct GPUContext { GLuint default_vao; - std::unordered_set batches; /* Batches that have VAOs from this context */ + std::unordered_set batches; /* Batches that have VAOs from this context */ std::vector orphaned_vertarray_ids; std::mutex orphans_mutex; /* todo: try spinlock instead */ #if TRUST_NO_ONE @@ -73,12 +73,12 @@ struct GPUContext { #if defined(_MSC_VER) && (_MSC_VER == 1800) #define thread_local __declspec(thread) -thread_local GPUContext* active_ctx = NULL; +thread_local GPUContext *active_ctx = NULL; #else -static thread_local GPUContext* active_ctx = NULL; +static thread_local GPUContext *active_ctx = NULL; #endif -static void clear_orphans(GPUContext* ctx) +static void clear_orphans(GPUContext *ctx) { ctx->orphans_mutex.lock(); if (!ctx->orphaned_vertarray_ids.empty()) { @@ -89,19 +89,19 @@ static void clear_orphans(GPUContext* ctx) ctx->orphans_mutex.unlock(); } -GPUContext* GPU_context_create(void) +GPUContext *GPU_context_create(void) { #if TRUST_NO_ONE /* assert(thread_is_main()); */ #endif - GPUContext* ctx = new GPUContext; + GPUContext *ctx = new GPUContext; glGenVertexArrays(1, &ctx->default_vao); GPU_context_active_set(ctx); return ctx; } /* to be called after GPU_context_active_set(ctx_to_destroy) */ -void GPU_context_discard(GPUContext* ctx) +void GPU_context_discard(GPUContext *ctx) { #if TRUST_NO_ONE /* Make sure no other thread has locked it. */ @@ -120,7 +120,7 @@ void GPU_context_discard(GPUContext* ctx) } /* ctx can be NULL */ -void GPU_context_active_set(GPUContext* ctx) +void GPU_context_active_set(GPUContext *ctx) { #if TRUST_NO_ONE if (active_ctx) { @@ -140,7 +140,7 @@ void GPU_context_active_set(GPUContext* ctx) active_ctx = ctx; } -GPUContext* GPU_context_active_get(void) +GPUContext *GPU_context_active_get(void) { return active_ctx; } @@ -168,7 +168,7 @@ GLuint GPU_vao_alloc(void) } /* this can be called from multiple thread */ -void GPU_vao_free(GLuint vao_id, GPUContext* ctx) +void GPU_vao_free(GLuint vao_id, GPUContext *ctx) { #if TRUST_NO_ONE assert(ctx); @@ -183,12 +183,12 @@ void GPU_vao_free(GLuint vao_id, GPUContext* ctx) } } -void gpu_context_add_batch(GPUContext* ctx, GPUBatch* batch) +void gpu_context_add_batch(GPUContext *ctx, GPUBatch *batch) { ctx->batches.emplace(batch); } -void gpu_context_remove_batch(GPUContext* ctx, GPUBatch* batch) +void gpu_context_remove_batch(GPUContext *ctx, GPUBatch *batch) { ctx->orphans_mutex.lock(); ctx->batches.erase(batch); diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c index f1f75f449d4..eef4945d9ef 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.c +++ b/source/blender/gpu/intern/gpu_vertex_format.c @@ -37,7 +37,7 @@ #define PACK_DEBUG 0 #if PACK_DEBUG - #include +# include #endif void GPU_vertformat_clear(GPUVertFormat *format) diff --git a/source/blender/gpu/intern/gpu_vertex_format_private.h b/source/blender/gpu/intern/gpu_vertex_format_private.h index 4ce3ebba714..e4fe61e8697 100644 --- a/source/blender/gpu/intern/gpu_vertex_format_private.h +++ b/source/blender/gpu/intern/gpu_vertex_format_private.h @@ -32,8 +32,8 @@ #ifndef __GPU_VERTEX_FORMAT_PRIVATE_H__ #define __GPU_VERTEX_FORMAT_PRIVATE_H__ -void VertexFormat_pack(GPUVertFormat*); +void VertexFormat_pack(GPUVertFormat *format); uint padding(uint offset, uint alignment); -uint vertex_buffer_size(const GPUVertFormat*, uint vertex_len); +uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len); #endif /* __GPU_VERTEX_FORMAT_PRIVATE_H__ */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index e672ae0e6f7..b9a8f306baf 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -6976,8 +6976,9 @@ static void def_cmp_cryptomatte(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage"); prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_NodeCryptomatte_matte_get", "rna_NodeCryptomatte_matte_length", - "rna_NodeCryptomatte_matte_set"); + RNA_def_property_string_funcs( + prop, "rna_NodeCryptomatte_matte_get", "rna_NodeCryptomatte_matte_length", + "rna_NodeCryptomatte_matte_set"); RNA_def_property_ui_text(prop, "Matte Objects", "List of object and material crypto IDs to include in matte"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c index 0231e4717b2..bf9ab4a5064 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c @@ -39,10 +39,10 @@ static inline float hash_to_float(uint32_t hash) { - uint32_t mantissa = hash & (( 1 << 23) - 1); + uint32_t mantissa = hash & ((1 << 23) - 1); uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); - exponent = MAX2(exponent, (uint32_t) 1); - exponent = MIN2(exponent, (uint32_t) 254); + exponent = MAX2(exponent, (uint32_t)1); + exponent = MIN2(exponent, (uint32_t)254); exponent = exponent << 23; uint32_t sign = (hash >> 31); sign = sign << 31; @@ -54,7 +54,7 @@ static inline float hash_to_float(uint32_t hash) return f; } -static void cryptomatte_add(NodeCryptomatte* n, float f) +static void cryptomatte_add(NodeCryptomatte *n, float f) { /* Turn the number into a string. */ char number[32]; @@ -72,16 +72,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f) } /* Find the next seprator. */ - char* token_end = strchr(n->matte_id+start, ','); - if (token_end == NULL || token_end == n->matte_id+start) { - token_end = n->matte_id+end; + char *token_end = strchr(n->matte_id + start, ','); + if (token_end == NULL || token_end == n->matte_id + start) { + token_end = n->matte_id + end; } /* Be aware that token_len still contains any trailing white space. */ token_len = token_end - (n->matte_id + start); /* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */ if (n->matte_id[start] == '<') { - if (strncmp(n->matte_id+start, number, strlen(number)) == 0) { + if (strncmp(n->matte_id + start, number, strlen(number)) == 0) { /* This number is already there, so continue. */ return; } @@ -89,16 +89,16 @@ static void cryptomatte_add(NodeCryptomatte* n, float f) else { /* Remove trailing white space */ size_t name_len = token_len; - while (n->matte_id[start+name_len] == ' ' && name_len > 0) { + while (n->matte_id[start + name_len] == ' ' && name_len > 0) { name_len--; } /* Calculate the hash of the token and compare. */ - uint32_t hash = BLI_hash_mm3((const unsigned char*)(n->matte_id+start), name_len, 0); + uint32_t hash = BLI_hash_mm3((const unsigned char *)(n->matte_id + start), name_len, 0); if (f == hash_to_float(hash)) { return; } } - start += token_len+1; + start += token_len + 1; } } @@ -107,12 +107,12 @@ static void cryptomatte_add(NodeCryptomatte* n, float f) return; } - if(n->matte_id) { + if (n->matte_id) { BLI_dynstr_append(new_matte, n->matte_id); MEM_freeN(n->matte_id); } - if(BLI_dynstr_get_len(new_matte) > 0) { + if (BLI_dynstr_get_len(new_matte) > 0) { BLI_dynstr_append(new_matte, ","); } BLI_dynstr_append(new_matte, number); @@ -120,7 +120,7 @@ static void cryptomatte_add(NodeCryptomatte* n, float f) BLI_dynstr_free(new_matte); } -static void cryptomatte_remove(NodeCryptomatte*n, float f) +static void cryptomatte_remove(NodeCryptomatte *n, float f) { if (n->matte_id == NULL || strlen(n->matte_id) == 0) { /* Empty string, nothing to remove. */ @@ -150,9 +150,9 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f) } /* Find the next seprator. */ - char* token_end = strchr(n->matte_id+start+1, ','); - if (token_end == NULL || token_end == n->matte_id+start) { - token_end = n->matte_id+end; + char *token_end = strchr(n->matte_id + start + 1, ','); + if (token_end == NULL || token_end == n->matte_id + start) { + token_end = n->matte_id + end; } /* Be aware that token_len still contains any trailing white space. */ token_len = token_end - (n->matte_id + start); @@ -162,7 +162,7 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f) } /* If this has a leading bracket, assume a raw floating point number and look for the closing bracket. */ else if (n->matte_id[start] == '<') { - if (strncmp(n->matte_id+start, number, strlen(number)) == 0) { + if (strncmp(n->matte_id + start, number, strlen(number)) == 0) { /* This number is already there, so skip it. */ skip = true; } @@ -170,11 +170,11 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f) else { /* Remove trailing white space */ size_t name_len = token_len; - while (n->matte_id[start+name_len] == ' ' && name_len > 0) { + while (n->matte_id[start + name_len] == ' ' && name_len > 0) { name_len--; } /* Calculate the hash of the token and compare. */ - uint32_t hash = BLI_hash_mm3((const unsigned char*)(n->matte_id+start), name_len, 0); + uint32_t hash = BLI_hash_mm3((const unsigned char *)(n->matte_id + start), name_len, 0); if (f == hash_to_float(hash)) { skip = true; } @@ -186,26 +186,26 @@ static void cryptomatte_remove(NodeCryptomatte*n, float f) else { BLI_dynstr_append(new_matte, ", "); } - BLI_dynstr_nappend(new_matte, n->matte_id+start, token_len); + BLI_dynstr_nappend(new_matte, n->matte_id + start, token_len); } - start += token_len+1; + start += token_len + 1; } - if(n->matte_id) { + if (n->matte_id) { MEM_freeN(n->matte_id); n->matte_id = NULL; } - if(BLI_dynstr_get_len(new_matte) > 0) { + if (BLI_dynstr_get_len(new_matte) > 0) { n->matte_id = BLI_dynstr_get_cstring(new_matte); } BLI_dynstr_free(new_matte); } static bNodeSocketTemplate outputs[] = { - { SOCK_RGBA, 0, N_("Image")}, - { SOCK_FLOAT, 0, N_("Matte")}, - { SOCK_RGBA, 0, N_("Pick")}, - { -1, 0, "" } + { SOCK_RGBA, 0, N_("Image")}, + { SOCK_FLOAT, 0, N_("Matte")}, + { SOCK_RGBA, 0, N_("Pick")}, + { -1, 0, "" } }; void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *UNUSED(ntree), bNode *node) @@ -235,7 +235,7 @@ bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node) NodeCryptomatte *n = node->storage; char sockname[32]; n->num_inputs++; - BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs-1); + BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs - 1); bNodeSocket *sock = nodeAddStaticSocket(ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, NULL, sockname); return sock; } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c index 5fff2548ba1..83e4bf1731b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c @@ -40,7 +40,7 @@ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = { { SOCK_FLOAT, 1, N_("Radial Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("IOR"), 1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - { SOCK_FLOAT, 1, N_("Offset"), 2.f*((float)M_PI)/180.f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE}, + { SOCK_FLOAT, 1, N_("Offset"), 2.0f * ((float)M_PI) / 180.f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE}, { SOCK_FLOAT, 1, N_("Random Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Random Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, diff --git a/source/blender/python/gpu/gpu_py_types.c b/source/blender/python/gpu/gpu_py_types.c index 0a21da5682b..4e564fdf849 100644 --- a/source/blender/python/gpu/gpu_py_types.c +++ b/source/blender/python/gpu/gpu_py_types.c @@ -32,8 +32,6 @@ #include "BLI_math.h" -#include "GPU_batch.h" - #include "MEM_guardedalloc.h" #include "../generic/py_capi_utils.h" -- cgit v1.2.3