Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-27 23:29:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-27 23:29:59 +0300
commit31f0c9182e80bcb7062f731d8451c0c59c87050e (patch)
treebda0df115179a87ef29a6e1564ee12aa78da8d95 /source
parent609805eed3eb9da2e81772279c4a501f644ac1f8 (diff)
Cleanup: style
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/multires.c4
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl2
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c20
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_fxaa.c11
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_taa.c52
-rw-r--r--source/blender/gpu/intern/gpu_state.c21
6 files changed, 49 insertions, 61 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index bead42aca0a..331b3797739 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -721,8 +721,8 @@ static DerivedMesh *multires_dm_create_local(Scene *scene, Object *ob, DerivedMe
static DerivedMesh *subsurf_dm_create_local(
Scene *scene, Object *ob, DerivedMesh *dm,
int lvl,
- bool is_simple, bool is_optimal, bool is_plain_uv, bool alloc_paint_mask,
- bool for_render)
+ bool is_simple, bool is_optimal, bool is_plain_uv, bool alloc_paint_mask,
+ bool for_render)
{
SubsurfModifierData smd = {{NULL}};
SubsurfFlags flags = 0;
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl
index cbd55322777..ee5a46ae7c8 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl
@@ -18,4 +18,4 @@ void main()
vec4 history_buffer = texelFetch(historyBuffer, texel, 0);
colorOutput = mix(history_buffer, color_buffer, mixFactor);
}
-} \ No newline at end of file
+}
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index d5505bf76d0..f2fb52d96d4 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -216,7 +216,7 @@ static float *create_disk_samples(int num_samples, int num_iterations)
{
/* vec4 to ensure memory alignment. */
const int total_samples = num_samples * num_iterations;
- float (*texels)[4] = MEM_mallocN(sizeof(float[4]) * total_samples, __func__);
+ float(*texels)[4] = MEM_mallocN(sizeof(float[4]) * total_samples, __func__);
const float num_samples_inv = 1.0f / num_samples;
for (int i = 0; i < total_samples; i++) {
@@ -637,13 +637,13 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
int color_type = workbench_material_determine_color_type(wpd, image);
WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type);
- struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR)
- ? wpd->prepass_solid_hair_sh
- : wpd->prepass_texture_hair_sh;
+ struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR) ?
+ wpd->prepass_solid_hair_sh :
+ wpd->prepass_texture_hair_sh;
DRWShadingGroup *shgrp = DRW_shgroup_hair_create(
- ob, psys, md,
- psl->prepass_hair_pass,
- shader);
+ ob, psys, md,
+ psl->prepass_hair_pass,
+ shader);
DRW_shgroup_stencil_mask(shgrp, 0xFF);
DRW_shgroup_uniform_int(shgrp, "object_id", &material->object_id, 1);
DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
@@ -848,8 +848,7 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
const bool taa_enabled = TAA_ENABLED(wpd);
- if (taa_enabled)
- {
+ if (taa_enabled) {
workbench_taa_draw_scene_start(vedata);
}
@@ -888,8 +887,7 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
}
GPUTexture *final_color_tx = e_data.composite_buffer_tx;
- if (taa_enabled)
- {
+ if (taa_enabled) {
workbench_taa_draw_pass(effect_info, psl->effect_aa_pass);
final_color_tx = effect_info->final_color_tx;
workbench_taa_draw_scene_end(vedata);
diff --git a/source/blender/draw/engines/workbench/workbench_effect_fxaa.c b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
index 2746a4f14f8..6b1d17d74cf 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
@@ -37,13 +37,12 @@ extern char datatoc_workbench_effect_fxaa_frag_glsl[];
/* *********** Functions *********** */
void workbench_fxaa_engine_init(void)
{
- if (e_data.effect_fxaa_sh == NULL)
- {
+ if (e_data.effect_fxaa_sh == NULL) {
e_data.effect_fxaa_sh = DRW_shader_create_with_lib(
- datatoc_common_fullscreen_vert_glsl, NULL,
- datatoc_workbench_effect_fxaa_frag_glsl,
- datatoc_common_fxaa_lib_glsl,
- NULL);
+ datatoc_common_fullscreen_vert_glsl, NULL,
+ datatoc_workbench_effect_fxaa_frag_glsl,
+ datatoc_common_fxaa_lib_glsl,
+ NULL);
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c
index 34db49b7009..973ad6c6eab 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_taa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -20,7 +20,7 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num)
int closest_index = 0;
float closest_squared_distance = 1.0f;
- for (int index = 0 ; index < num; index++) {
+ for (int index = 0; index < num; index++) {
const float squared_dist = SQUARE(table[index][0]) + SQUARE(table[index][1]);
if (squared_dist < closest_squared_distance) {
closest_squared_distance = squared_dist;
@@ -29,7 +29,7 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num)
}
/* move jitter table so that closest sample is in center */
- for (int index = 0 ; index < num; index++) {
+ for (int index = 0; index < num; index++) {
sub_v2_v2(table[index], table[closest_index]);
}
@@ -39,20 +39,17 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num)
}
/* sort list based on furtest distance with previous */
- for (int i = 0 ; i < num - 2; i ++)
- {
+ for (int i = 0; i < num - 2; i++) {
float f_squared_dist = 0.0;
int f_index = i;
- for(int j = i + 1; j < num; j ++)
- {
+ for (int j = i + 1; j < num; j++) {
const float squared_dist = SQUARE(table[i][0] - table[j][0]) + SQUARE(table[i][1] - table[j][1]);
- if (squared_dist > f_squared_dist)
- {
+ if (squared_dist > f_squared_dist) {
f_squared_dist = squared_dist;
f_index = j;
}
}
- swap_v2_v2(table[i+1], table[f_index]);
+ swap_v2_v2(table[i + 1], table[f_index]);
}
}
@@ -69,13 +66,16 @@ int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata)
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->g_data;
int result = 1;
- if (TAA_ENABLED(wpd))
- {
- if (IN_RANGE_INCL(wpd->user_preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_TAA8, GPU_VIEWPORT_QUALITY_TAA16))
+ if (TAA_ENABLED(wpd)) {
+ if (IN_RANGE_INCL(
+ wpd->user_preferences->gpu_viewport_quality,
+ GPU_VIEWPORT_QUALITY_TAA8, GPU_VIEWPORT_QUALITY_TAA16))
{
result = 8;
}
- else if (IN_RANGE_INCL(wpd->user_preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_TAA16, GPU_VIEWPORT_QUALITY_TAA32))
+ else if (IN_RANGE_INCL(
+ wpd->user_preferences->gpu_viewport_quality,
+ GPU_VIEWPORT_QUALITY_TAA16, GPU_VIEWPORT_QUALITY_TAA32))
{
result = 16;
}
@@ -92,23 +92,19 @@ void workbench_taa_engine_init(WORKBENCH_Data *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
- if (e_data.effect_taa_sh == NULL)
- {
+ if (e_data.effect_taa_sh == NULL) {
e_data.effect_taa_sh = DRW_shader_create_fullscreen(datatoc_workbench_effect_taa_frag_glsl, NULL);
workbench_taa_jitter_init();
}
/* reset complete drawing when navigating. */
- if (effect_info->jitter_index != 0)
- {
- if (rv3d && rv3d->rflag & RV3D_NAVIGATING)
- {
+ if (effect_info->jitter_index != 0) {
+ if (rv3d && rv3d->rflag & RV3D_NAVIGATING) {
effect_info->jitter_index = 0;
}
}
- if (effect_info->view_updated)
- {
+ if (effect_info->view_updated) {
effect_info->jitter_index = 0;
effect_info->view_updated = false;
}
@@ -119,7 +115,7 @@ void workbench_taa_engine_init(WORKBENCH_Data *vedata)
DRW_viewport_matrix_get(view, DRW_MAT_VIEW);
DRW_viewport_matrix_get(win, DRW_MAT_WIN);
mul_m4_m4m4(effect_info->curr_mat, view, win);
- if(!equals_m4m4(effect_info->curr_mat, effect_info->last_mat)){
+ if (!equals_m4m4(effect_info->curr_mat, effect_info->last_mat)) {
effect_info->jitter_index = 0;
}
}
@@ -179,8 +175,7 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu
DRW_shgroup_uniform_float(grp, "mixFactor", &effect_info->taa_mix_factor, 1);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
- if (previous_jitter_even)
- {
+ if (previous_jitter_even) {
effect_info->final_color_tx = txl->history_buffer1_tx;
effect_info->final_color_fb = fbl->effect_taa_even_fb;
}
@@ -208,8 +203,7 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
float mix_factor;
num_samples = workbench_taa_calculate_num_iterations(vedata);
- switch(num_samples)
- {
+ switch (num_samples) {
case 8:
samples = e_data.jitter_8;
break;
@@ -268,8 +262,7 @@ void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata)
const WORKBENCH_FramebufferList *fbl = vedata->fbl;
const DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
- if (effect_info->jitter_index == 1)
- {
+ if (effect_info->jitter_index == 1) {
GPU_framebuffer_blit(dfbl->depth_only_fb, 0, fbl->depth_buffer_fb, 0, GPU_DEPTH_BIT);
}
else {
@@ -287,8 +280,7 @@ void workbench_taa_draw_pass(WORKBENCH_EffectInfo *effect_info, DRWPass *pass)
DRW_draw_pass(pass);
copy_m4_m4(effect_info->last_mat, effect_info->curr_mat);
- if (effect_info->jitter_index != 0)
- {
+ if (effect_info->jitter_index != 0) {
DRW_viewport_request_redraw();
}
}
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
index 1cd531fee30..72d11c7c60e 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -30,17 +30,16 @@
static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
{
- switch (blend)
- {
- case GPU_ONE:
- return GL_ONE;
- case GPU_SRC_ALPHA:
- return GL_SRC_ALPHA;
- case GPU_ONE_MINUS_SRC_ALPHA:
- return GL_ONE_MINUS_SRC_ALPHA;
- default:
- BLI_assert(!"Unhandled blend mode");
- return GL_ZERO;
+ switch (blend) {
+ case GPU_ONE:
+ return GL_ONE;
+ case GPU_SRC_ALPHA:
+ return GL_SRC_ALPHA;
+ case GPU_ONE_MINUS_SRC_ALPHA:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ default:
+ BLI_assert(!"Unhandled blend mode");
+ return GL_ZERO;
}
}