summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pack.h
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-10-29 13:32:43 +0100
committerIago Toral Quiroga <[email protected]>2015-01-12 11:20:29 +0100
commitd71a1adff253aa75a3474723209c35831bb3f048 (patch)
treec76d0ebf4fbe34b10a6ada644dad7b67beb505ad /src/mesa/main/pack.h
parenta177b30f1f2a74c14a649e9990eaab8826523c69 (diff)
mesa: Add RGBA to Luminance conversion helpers
For glReadPixels with a Luminance destination format we compute luminance values from RGBA as L=R+G+B. This, however, requires ad-hoc implementation, since pack/unpack functions or _mesa_swizzle_and_convert won't do this (and thus, neither will _mesa_format_convert). This patch adds helpers to do this computation so they can be used to support conversion to luminance formats. The current implementation of glReadPixels does this computation as part of the span functions in pack.c (see _mesa_pack_rgba_span_float), that do this together with other things like type conversion, etc. We do not want to use these functions but use _mesa_format_convert instead (later patches will remove the color span functions), so we need to extract this functionality as helpers. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/pack.h')
-rw-r--r--src/mesa/main/pack.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index 2173b652e75..9988bea4fd1 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -155,4 +155,14 @@ _mesa_rebase_rgba_float(GLuint n, GLfloat rgba[][4], GLenum baseFormat);
extern void
_mesa_rebase_rgba_uint(GLuint n, GLuint rgba[][4], GLenum baseFormat);
+extern void
+_mesa_pack_luminance_from_rgba_float(GLuint n, GLfloat rgba[][4],
+ GLvoid *dstAddr, GLenum dst_format,
+ GLbitfield transferOps);
+
+extern void
+_mesa_pack_luminance_from_rgba_integer(GLuint n, GLuint rgba[][4], bool rgba_is_signed,
+ GLvoid *dstAddr, GLenum dst_format,
+ GLenum dst_type);
+
#endif