aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/nouveau/nouveau_util.h
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-08-10 15:13:44 -0400
committerIlia Mirkin <[email protected]>2014-08-14 02:05:06 -0400
commita89353381ac3603bacb7ec56f5e4b3bf6ef6fb59 (patch)
tree500aa9b731579346f86c41e0e551c94aff797cc7 /src/mesa/drivers/dri/nouveau/nouveau_util.h
parentc66d928f2c9fa59e162c391fbdd37df969959718 (diff)
nouveau: force luminance clear colors to have the same g/b values as r
Fixes the LUMINANCE_ALPHA formats of fbo-clear-formats piglit test. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nouveau_util.h')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 56b819bcff8..e9721c3a7ab 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -31,7 +31,7 @@
#include "main/colormac.h"
static inline unsigned
-pack_rgba_i(mesa_format f, uint8_t c[])
+pack_rgba_i(mesa_format f, const uint8_t c[])
{
switch (f) {
case MESA_FORMAT_B8G8R8A8_UNORM:
@@ -69,7 +69,7 @@ pack_zs_i(mesa_format f, uint32_t z, uint8_t s)
}
static inline unsigned
-pack_rgba_f(mesa_format f, float c[])
+pack_rgba_f(mesa_format f, const float c[])
{
return pack_rgba_i(f, (uint8_t []) {
FLOAT_TO_UBYTE(c[RCOMP]),
@@ -79,7 +79,7 @@ pack_rgba_f(mesa_format f, float c[])
}
static inline unsigned
-pack_rgba_clamp_f(mesa_format f, float c[])
+pack_rgba_clamp_f(mesa_format f, const float c[])
{
GLubyte bytes[4];
_mesa_unclamped_float_rgba_to_ubyte(bytes, c);
@@ -92,6 +92,15 @@ pack_zs_f(mesa_format f, float z, uint8_t s)
return pack_zs_i(f, FLOAT_TO_UINT(z), s);
}
+static inline unsigned
+pack_la_clamp_f(mesa_format f, float l, float a)
+{
+ GLubyte lb, ab;
+ UNCLAMPED_FLOAT_TO_UBYTE(lb, l);
+ UNCLAMPED_FLOAT_TO_UBYTE(ab, a);
+ return pack_rgba_i(f, (uint8_t []) { lb, lb, lb, ab });
+}
+
/* Integer base-2 logarithm, rounded towards zero. */
static inline unsigned
log2i(unsigned i)