[Mesa-dev] [PATCH 1/2] gallium: replace [0-9]*.f with [0-9]*.0f

Brian Paul brianp at vmware.com
Wed Jun 15 14:58:03 UTC 2016


Why is this change needed?  Does some compiler balk at 1.f?

-Brian

On 06/15/2016 04:08 AM, Nayan Deshmukh wrote:
> Signed-off-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
> ---
>   src/gallium/auxiliary/draw/draw_pipe_clip.c  |  2 +-
>   src/gallium/auxiliary/gallivm/lp_bld_arit.c  |  4 ++--
>   src/gallium/drivers/i915/i915_state_emit.c   |  2 +-
>   src/gallium/drivers/nouveau/nouveau_fence.c  |  2 +-
>   src/gallium/drivers/nouveau/nv30/nv30_draw.c |  4 ++--
>   src/gallium/drivers/r300/r300_context.c      |  4 ++--
>   src/gallium/drivers/swr/swr_shader.cpp       |  2 +-
>   src/gallium/state_trackers/nine/adapter9.c   |  2 +-
>   src/gallium/state_trackers/xa/xa_renderer.c  | 34 ++++++++++++++--------------
>   9 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
> index 78845ac..7f3de50 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
> @@ -234,7 +234,7 @@ is_tri_null(const struct clip_stage *clip, const struct prim_header *header)
>      float vy = x1 * z2 - z1 * x2;
>      float vz = x1 * y2 - y1 * x2;
>
> -   return (vx*vx  + vy*vy + vz*vz) == 0.f;
> +   return (vx*vx  + vy*vy + vz*vz) == 0.0f;
>   }
>
>   /**
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> index 114c766..c651255 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> @@ -2853,8 +2853,8 @@ lp_build_sin_or_cos(struct lp_build_context *bld,
>
>      /* clamp output to be within [-1, 1] */
>      y_result = lp_build_clamp(bld, y_result,
> -                             lp_build_const_vec(bld->gallivm, bld->type,  -1.f),
> -                             lp_build_const_vec(bld->gallivm, bld->type,  1.f));
> +                             lp_build_const_vec(bld->gallivm, bld->type,  -1.0f),
> +                             lp_build_const_vec(bld->gallivm, bld->type,  1.0f));
>      /* If a is -inf, inf or NaN then return NaN */
>      y_result = lp_build_select(bld, isfinite, y_result,
>                                 lp_build_const_vec(bld->gallivm, bld->type,  NAN));
> diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c
> index a407020..70db8a5 100644
> --- a/src/gallium/drivers/i915/i915_state_emit.c
> +++ b/src/gallium/drivers/i915/i915_state_emit.c
> @@ -508,7 +508,7 @@ static int counter_total = 0;
>         *batch_space += tmp;\
>         counter_##atom += tmp;\
>         counter_total += tmp;\
> -      printf("%s: \t%d/%d \t%2.2f\n",#atom, counter_##atom, counter_total, counter_##atom*100.f/counter_total);}
> +      printf("%s: \t%d/%d \t%2.2f\n",#atom, counter_##atom, counter_total, counter_##atom*100.0f/counter_total);}
>   #else
>   #define VALIDATE_ATOM(atom, hw_dirty) \
>      if (i915->hardware_dirty & hw_dirty) { \
> diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
> index 691553a..f0fd1b5 100644
> --- a/src/gallium/drivers/nouveau/nouveau_fence.c
> +++ b/src/gallium/drivers/nouveau/nouveau_fence.c
> @@ -209,7 +209,7 @@ nouveau_fence_wait(struct nouveau_fence *fence, struct pipe_debug_callback *debu
>            if (debug && debug->debug_message)
>               pipe_debug_message(debug, PERF_INFO,
>                                  "stalled %.3f ms waiting for fence",
> -                               (os_time_get_nano() - start) / 1000000.f);
> +                               (os_time_get_nano() - start) / 1000000.0f);
>            return true;
>         }
>         if (!spins)
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> index 7b0d074..3346955 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> @@ -516,8 +516,8 @@ nv30_draw_init(struct pipe_context *pipe)
>
>      draw_set_render(draw, render);
>      draw_set_rasterize_stage(draw, stage);
> -   draw_wide_line_threshold(draw, 10000000.f);
> -   draw_wide_point_threshold(draw, 10000000.f);
> +   draw_wide_line_threshold(draw, 10000000.0f);
> +   draw_wide_point_threshold(draw, 10000000.0f);
>      draw_wide_point_sprites(draw, true);
>      nv30->draw = draw;
>   }
> diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
> index d100a9d..3c4ae5d 100644
> --- a/src/gallium/drivers/r300/r300_context.c
> +++ b/src/gallium/drivers/r300/r300_context.c
> @@ -397,8 +397,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
>           /* Enable our renderer. */
>           draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
>           /* Disable converting points/lines to triangles. */
> -        draw_wide_line_threshold(r300->draw, 10000000.f);
> -        draw_wide_point_threshold(r300->draw, 10000000.f);
> +        draw_wide_line_threshold(r300->draw, 10000000.0f);
> +        draw_wide_point_threshold(r300->draw, 10000000.0f);
>           draw_wide_point_sprites(r300->draw, FALSE);
>           draw_enable_line_stipple(r300->draw, TRUE);
>           draw_enable_point_sprites(r300->draw, FALSE);
> diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
> index 8af0700..b3f6a1f 100644
> --- a/src/gallium/drivers/swr/swr_shader.cpp
> +++ b/src/gallium/drivers/swr/swr_shader.cpp
> @@ -466,7 +466,7 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
>            }
>         } else {
>            pAttribs = pRawAttribs;
> -         vw = VIMMED1(1.f);
> +         vw = VIMMED1(1.0f);
>         }
>
>         vw->setName("w");
> diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
> index 41140d4..518ff81 100644
> --- a/src/gallium/state_trackers/nine/adapter9.c
> +++ b/src/gallium/state_trackers/nine/adapter9.c
> @@ -807,7 +807,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
>
>       pCaps->PixelShaderVersion = D3DPS_VERSION(3,0);
>       /* Value for GeForce 9600 GT */
> -    pCaps->PixelShader1xMaxValue = 65504.f;
> +    pCaps->PixelShader1xMaxValue = 65504.0f;
>
>       pCaps->DevCaps2 = D3DDEVCAPS2_STREAMOFFSET |
>                         D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET |
> diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c
> index bc55f87..ee87106 100644
> --- a/src/gallium/state_trackers/xa/xa_renderer.c
> +++ b/src/gallium/state_trackers/xa/xa_renderer.c
> @@ -142,8 +142,8 @@ add_vertex_color(struct xa_context *r, float x, float y, float color[4])
>
>       vertex[0] = x;
>       vertex[1] = y;
> -    vertex[2] = 0.f;		/*z */
> -    vertex[3] = 1.f;		/*w */
> +    vertex[2] = 0.0f;		/*z */
> +    vertex[3] = 1.0f;		/*w */
>
>       vertex[4] = color[0];	/*r */
>       vertex[5] = color[1];	/*g */
> @@ -160,13 +160,13 @@ add_vertex_1tex(struct xa_context *r, float x, float y, float s, float t)
>
>       vertex[0] = x;
>       vertex[1] = y;
> -    vertex[2] = 0.f;		/*z */
> -    vertex[3] = 1.f;		/*w */
> +    vertex[2] = 0.0f;		/*z */
> +    vertex[3] = 1.0f;		/*w */
>
>       vertex[4] = s;		/*s */
>       vertex[5] = t;		/*t */
> -    vertex[6] = 0.f;		/*r */
> -    vertex[7] = 1.f;		/*q */
> +    vertex[6] = 0.0f;		/*r */
> +    vertex[7] = 1.0f;		/*q */
>
>       r->buffer_size += 8;
>   }
> @@ -179,18 +179,18 @@ add_vertex_2tex(struct xa_context *r,
>
>       vertex[0] = x;
>       vertex[1] = y;
> -    vertex[2] = 0.f;		/*z */
> -    vertex[3] = 1.f;		/*w */
> +    vertex[2] = 0.0f;		/*z */
> +    vertex[3] = 1.0f;		/*w */
>
>       vertex[4] = s0;		/*s */
>       vertex[5] = t0;		/*t */
> -    vertex[6] = 0.f;		/*r */
> -    vertex[7] = 1.f;		/*q */
> +    vertex[6] = 0.0f;		/*r */
> +    vertex[7] = 1.0f;		/*q */
>
>       vertex[8] = s1;		/*s */
>       vertex[9] = t1;		/*t */
> -    vertex[10] = 0.f;		/*r */
> -    vertex[11] = 1.f;		/*q */
> +    vertex[10] = 0.0f;		/*r */
> +    vertex[11] = 1.0f;		/*q */
>
>       r->buffer_size += 12;
>   }
> @@ -358,18 +358,18 @@ renderer_bind_destination(struct xa_context *r,
>
>       /* Viewport just touches the bit we're interested in:
>        */
> -    viewport.scale[0] = width / 2.f;
> -    viewport.scale[1] = height / 2.f;
> +    viewport.scale[0] = width / 2.0f;
> +    viewport.scale[1] = height / 2.0f;
>       viewport.scale[2] = 1.0;
> -    viewport.translate[0] = width / 2.f;
> -    viewport.translate[1] = height / 2.f;
> +    viewport.translate[0] = width / 2.0f;
> +    viewport.translate[1] = height / 2.0f;
>       viewport.translate[2] = 0.0;
>
>       /* Constant buffer set up to match viewport dimensions:
>        */
>       if (r->fb_width != width || r->fb_height != height) {
>   	float vs_consts[8] = {
> -	    2.f / width, 2.f / height, 1, 1,
> +	    2.0f / width, 2.0f / height, 1, 1,
>   	    -1, -1, 0, 0
>   	};
>
>



More information about the mesa-dev mailing list