summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-27 02:10:53 -0800
committerEric Anholt <eric@anholt.net>2014-02-14 18:30:01 -0800
commit1adac62a7d9da099c779e65527ece611cf4d2f2c (patch)
tree1e78b58a65d1e650a308187c252d652e5851d49f
parent3747c260816a36352bb91ce06befcbffbbd747c7 (diff)
glamor: Unifdef the picture-format-to-format-and-type functions.
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--glamor/glamor_pixmap.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 1dbeb04ca..77197b5d1 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -194,14 +194,13 @@ glamor_set_alu(ScreenPtr screen, unsigned char alu)
*
* Return 0 if find a matched texture type. Otherwise return -1.
**/
-#ifndef GLAMOR_GLES2
static int
-glamor_get_tex_format_type_from_pictformat(PictFormatShort format,
- GLenum *tex_format,
- GLenum *tex_type,
- int *no_alpha,
- int *revert,
- int *swap_rb, int is_upload)
+glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format,
+ GLenum *tex_format,
+ GLenum *tex_type,
+ int *no_alpha,
+ int *revert,
+ int *swap_rb, int is_upload)
{
*no_alpha = 0;
*revert = REVERT_NONE;
@@ -291,16 +290,15 @@ glamor_get_tex_format_type_from_pictformat(PictFormatShort format,
return 0;
}
-#else
#define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst)
static int
-glamor_get_tex_format_type_from_pictformat(PictFormatShort format,
- GLenum *tex_format,
- GLenum *tex_type,
- int *no_alpha,
- int *revert,
- int *swap_rb, int is_upload)
+glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format,
+ GLenum *tex_format,
+ GLenum *tex_type,
+ int *no_alpha,
+ int *revert,
+ int *swap_rb, int is_upload)
{
int need_swap_rb = 0;
@@ -463,8 +461,6 @@ glamor_get_tex_format_type_from_pictformat(PictFormatShort format,
return 0;
}
-#endif
-
static int
glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
GLenum *format,
@@ -474,6 +470,8 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
{
glamor_pixmap_private *pixmap_priv;
PictFormatShort pict_format;
+ glamor_screen_private *glamor_priv =
+ glamor_get_screen_private(pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
@@ -481,11 +479,21 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
else
pict_format = format_for_depth(pixmap->drawable.depth);
- return glamor_get_tex_format_type_from_pictformat(pict_format,
- format, type,
- no_alpha,
- revert,
- swap_rb, is_upload);
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ return glamor_get_tex_format_type_from_pictformat_gl(pict_format,
+ format, type,
+ no_alpha,
+ revert,
+ swap_rb,
+ is_upload);
+ } else {
+ return glamor_get_tex_format_type_from_pictformat_gles2(pict_format,
+ format, type,
+ no_alpha,
+ revert,
+ swap_rb,
+ is_upload);
+ }
}
static void *