summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAlbert Astals Cid <[email protected]>2020-02-26 23:05:51 +0100
committerAlbert Astals Cid <[email protected]>2020-04-18 19:55:45 +0000
commit06c5875fd6b8fa387a103bd0c6fad4fa5ef847a5 (patch)
tree0c8f53e84198b1e808e9aef4100a47996d721665 /src/mesa
parent94cb129d514b748db1342c6208ae4b7390bd33da (diff)
Fix promotion of floats to doubles
Use the f variants of the math functions if the input parameter is a float, saves converting from float to double and running the double variant of the math function for gaining no precision at all Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3969>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tnl.c2
-rw-r--r--src/mesa/program/program.c2
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--src/mesa/swrast/s_texfilter.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
index 9f80e413577..247cad4a38b 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
@@ -244,7 +244,7 @@ nv10_get_spot_coeff(struct gl_light *l, float k[7])
float a0, b0, a1, a2, b2, a3;
if (e > 0)
- a0 = -1 - 5.36e-3 / sqrt(e);
+ a0 = -1 - 5.36e-3 / sqrtf(e);
else
a0 = -1;
b0 = 1 / (1 + 0.273 * e);
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 6ab1bf50177..754e3d480b8 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -539,7 +539,7 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
SYSTEM_BIT_SAMPLE_POS)))
return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
else if (ctx->Multisample.SampleShading)
- return MAX2(ceil(ctx->Multisample.MinSampleShadingValue *
+ return MAX2(ceilf(ctx->Multisample.MinSampleShadingValue *
_mesa_geometric_samples(ctx->DrawBuffer)), 1);
else
return 1;
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 44ad5334175..475ab2fc8cd 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -479,7 +479,7 @@ accum_bitmap(struct gl_context *ctx,
if (px < 0 || px + width > BITMAP_CACHE_WIDTH ||
py < 0 || py + height > BITMAP_CACHE_HEIGHT ||
!TEST_EQ_4V(ctx->Current.RasterColor, cache->color) ||
- ((fabs(z - cache->zpos) > Z_EPSILON))) {
+ ((fabsf(z - cache->zpos) > Z_EPSILON))) {
/* This bitmap would extend beyond cache bounds, or the bitmap
* color is changing
* so flush and continue.
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index f73037791de..cb91b81260e 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -1628,7 +1628,7 @@ create_filter_table(void)
for (i = 0; i < WEIGHT_LUT_SIZE; ++i) {
GLfloat alpha = 2;
GLfloat r2 = (GLfloat) i / (GLfloat) (WEIGHT_LUT_SIZE - 1);
- GLfloat weight = (GLfloat) exp(-alpha * r2);
+ GLfloat weight = expf(-alpha * r2);
weightLut[i] = weight;
}
}