diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-19 09:06:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-19 09:06:37 +0300 |
commit | 9df1e54079344ed4e2becef9e57cf1b925b46dff (patch) | |
tree | 09014669c19f24015ab924f612d30a20ddb79939 /source/blender/gpu | |
parent | 34a45c54e00c18da06df97674e1d614c24ae58bf (diff) |
Cleanup: style
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_common.h | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_attr_binding.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_attr_binding_private.h | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch_private.h | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffer_id.cpp | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.c | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate_util.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_interface.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_vertex_array_id.cpp | 26 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_vertex_format.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_vertex_format_private.h | 4 |
11 files changed, 38 insertions, 36 deletions
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 <GL/glew.h> +# include <GL/glew.h> #endif #include <stdbool.h> @@ -48,7 +48,7 @@ #include "BLI_sys_types.h" #if TRUST_NO_ONE - #include <assert.h> +# include <assert.h> #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 <stdlib.h> #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 <cstdio> +# include <cstdio> #endif static std::vector<GLuint> 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 <stdio.h> +# include <stdio.h> #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<GPUBatch*> batches; /* Batches that have VAOs from this context */ + std::unordered_set<GPUBatch *> batches; /* Batches that have VAOs from this context */ std::vector<GLuint> 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 <stdio.h> +# include <stdio.h> #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__ */ |