diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_batch.h | 5 | ||||
-rw-r--r-- | source/blender/gpu/GPU_matrix.h | 12 | ||||
-rw-r--r-- | source/blender/gpu/GPU_vertex_buffer.h | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_context.cpp | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_vertex_format.c | 6 |
6 files changed, 26 insertions, 18 deletions
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index 5b0cab220c0..365dd89a006 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -105,8 +105,9 @@ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src); #define GPU_batch_create(prim, verts, elem) GPU_batch_create_ex(prim, verts, elem, 0) #define GPU_batch_init(batch, prim, verts, elem) GPU_batch_init_ex(batch, prim, verts, elem, 0) -void GPU_batch_clear( - GPUBatch *); /* Same as discard but does not free. (does not clal free callback) */ +/* Same as discard but does not free. (does not call free callback). */ +void GPU_batch_clear(GPUBatch *); + void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */ void GPU_batch_vao_cache_clear(GPUBatch *); diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h index 61622c40ff0..a424f3180de 100644 --- a/source/blender/gpu/GPU_matrix.h +++ b/source/blender/gpu/GPU_matrix.h @@ -52,12 +52,12 @@ void GPU_matrix_translate_3f(float x, float y, float z); void GPU_matrix_translate_3fv(const float vec[3]); void GPU_matrix_scale_3f(float x, float y, float z); void GPU_matrix_scale_3fv(const float vec[3]); -void GPU_matrix_rotate_3f(float deg, - float x, - float y, - float z); /* axis of rotation should be a unit vector */ -void GPU_matrix_rotate_3fv(float deg, - const float axis[3]); /* axis of rotation should be a unit vector */ + +/* Axis of rotation should be a unit vector. */ +void GPU_matrix_rotate_3f(float deg, float x, float y, float z); +/* Axis of rotation should be a unit vector. */ +void GPU_matrix_rotate_3fv(float deg, const float axis[3]); + void GPU_matrix_rotate_axis(float deg, char axis); /* TODO: enum for axis? */ void GPU_matrix_look_at(float eyeX, diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h index 3e178e193dc..2d728422c42 100644 --- a/source/blender/gpu/GPU_vertex_buffer.h +++ b/source/blender/gpu/GPU_vertex_buffer.h @@ -87,9 +87,10 @@ void GPU_vertbuf_data_len_set(GPUVertBuf *, uint v_len); * should not be a problem. */ void GPU_vertbuf_attr_set(GPUVertBuf *, uint a_idx, uint v_idx, const void *data); -void GPU_vertbuf_attr_fill(GPUVertBuf *, - uint a_idx, - const void *data); /* tightly packed, non interleaved input data */ + +/* Tightly packed, non interleaved input data. */ +void GPU_vertbuf_attr_fill(GPUVertBuf *, uint a_idx, const void *data); + void GPU_vertbuf_attr_fill_stride(GPUVertBuf *, uint a_idx, uint stride, const void *data); /* For low level access only */ diff --git a/source/blender/gpu/intern/gpu_context.cpp b/source/blender/gpu/intern/gpu_context.cpp index 93df65006ff..17b86e3eec8 100644 --- a/source/blender/gpu/intern/gpu_context.cpp +++ b/source/blender/gpu/intern/gpu_context.cpp @@ -103,9 +103,11 @@ static void orphans_add(GPUContext *ctx, std::vector<GLuint> *orphan_list, GLuin static void orphans_clear(GPUContext *ctx) { - BLI_assert(ctx); /* need at least an active context */ - BLI_assert(pthread_equal(pthread_self(), - ctx->thread)); /* context has been activated by another thread! */ + /* need at least an active context */ + BLI_assert(ctx); + + /* context has been activated by another thread! */ + BLI_assert(pthread_equal(pthread_self(), ctx->thread)); ctx->orphans_mutex.lock(); if (!ctx->orphaned_vertarray_ids.empty()) { diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index 6b5c4836e83..0e3019ad122 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -220,8 +220,10 @@ void immBegin(GPUPrimType prim_type, uint vertex_len) /* does the current buffer have enough room? */ const uint available_bytes = IMM_BUFFER_SIZE - imm.buffer_offset; /* ensure vertex data is aligned */ - const uint pre_padding = padding( - imm.buffer_offset, imm.vertex_format.stride); /* might waste a little space, but it's safe */ + + /* Might waste a little space, but it's safe. */ + const uint pre_padding = padding(imm.buffer_offset, imm.vertex_format.stride); + if ((bytes_needed + pre_padding) <= available_bytes) { imm.buffer_offset += pre_padding; } diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c index e745c525df6..493c6d3ec59 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.c +++ b/source/blender/gpu/intern/gpu_vertex_format.c @@ -163,8 +163,10 @@ uint GPU_vertformat_attr_add(GPUVertFormat *format, /* 10_10_10 format intended for normals (xyz) or colors (rgb) * extra component packed.w can be manually set to { -2, -1, 0, 1 } */ assert(comp_len == 3 || comp_len == 4); - assert(fetch_mode == - GPU_FETCH_INT_TO_FLOAT_UNIT); /* not strictly required, may relax later */ + + /* Not strictly required, may relax later. */ + assert(fetch_mode == GPU_FETCH_INT_TO_FLOAT_UNIT); + break; default: /* integer types can be kept as int or converted/normalized to float */ |