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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-02-27 06:26:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-27 06:52:58 +0300
commit5520b8df4b578595afcfc074a1acb96359bce49c (patch)
treea14ab9f8047492364370370e7e40bfd2ac16bb49 /source/blender/gpu
parent2a5e92c989d80d79d3eaf43202ee979a2dc88042 (diff)
cleanup: double promotion
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_compositing.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 08291d0d1c6..89b8ba2e681 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -148,22 +148,23 @@ static GPUTexture * create_concentric_sample_texture(int side)
}
#endif
-static GPUTexture * create_spiral_sample_texture(int numsaples)
+static GPUTexture *create_spiral_sample_texture(int numsaples)
{
GPUTexture *tex;
- float *texels = (float *)MEM_mallocN(sizeof(float) * 2 * numsaples, "concentric_tex");
+ float (*texels)[2] = MEM_mallocN(sizeof(float[2]) * numsaples, "concentric_tex");
+ const float numsaples_inv = 1.0f / numsaples;
int i;
- /* random number to ensure we don't get conciding samples every circle */
+ /* arbitrary number to ensure we don't get conciding samples every circle */
const float spirals = 7.357;
for (i = 0; i < numsaples; i++) {
- float r = (i + 0.5f) / (float) numsaples;
- float phi = 2.0f * M_PI * r * spirals;
- texels[i * 2] = r * cos(phi);
- texels[i * 2 + 1] = r * sin(phi);
+ float r = (i + 0.5f) * numsaples_inv;
+ float phi = r * spirals * (float)(2.0 * M_PI);
+ texels[i][0] = r * cosf(phi);
+ texels[i][1] = r * sinf(phi);
}
- tex = GPU_texture_create_1D_procedural(numsaples, texels, NULL);
+ tex = GPU_texture_create_1D_procedural(numsaples, (float *)texels, NULL);
MEM_freeN(texels);
return tex;
}
@@ -273,8 +274,8 @@ static GPUTexture * create_jitter_texture(void)
int i;
for (i = 0; i < 64 * 64; i++) {
- jitter[i][0] = 2.0f * BLI_frand() - 1.0;
- jitter[i][1] = 2.0f * BLI_frand() - 1.0;
+ jitter[i][0] = 2.0f * BLI_frand() - 1.0f;
+ jitter[i][1] = 2.0f * BLI_frand() - 1.0f;
normalize_v2(jitter[i]);
}
@@ -714,7 +715,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
float scale_camera = 0.001f / scale;
float aperture = 2.0f * scale_camera * fx_dof->focal_length / fx_dof->fstop;
- dof_params[0] = aperture * fabs(scale_camera * fx_dof->focal_length / (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
+ dof_params[0] = aperture * fabsf(scale_camera * fx_dof->focal_length / (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
dof_params[1] = fx_dof->focus_distance;
dof_params[2] = fx->gbuffer_dim[0] / (scale_camera * fx_dof->sensor);
dof_params[3] = 0.0f;