Consolidate the choose of internal texture format to one function.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
a74596be0e
commit
96085017c8
|
@ -169,20 +169,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||||
if (w == 0 || h == 0 || type == GLAMOR_MEMORY)
|
if (w == 0 || h == 0 || type == GLAMOR_MEMORY)
|
||||||
return pixmap;
|
return pixmap;
|
||||||
|
|
||||||
switch (depth) {
|
gl_iformat_for_depth(depth, &format);
|
||||||
#if 0
|
|
||||||
case 8:
|
|
||||||
format = GL_ALPHA;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 24:
|
|
||||||
format = GL_RGB;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
format = GL_RGBA;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create the texture used to store the pixmap's data. */
|
/* Create the texture used to store the pixmap's data. */
|
||||||
dispatch->glGenTextures(1, &tex);
|
dispatch->glGenTextures(1, &tex);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
|
|
|
@ -221,23 +221,10 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
void *texels;
|
void *texels;
|
||||||
GLenum iformat;
|
GLenum iformat;
|
||||||
|
|
||||||
switch (pixmap->drawable.depth) {
|
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2)
|
||||||
#if 0
|
|
||||||
case 8:
|
|
||||||
iformat = GL_ALPHA;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 24:
|
|
||||||
iformat = GL_RGB;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iformat = GL_RGBA;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
|
|
||||||
iformat = format;
|
iformat = format;
|
||||||
}
|
else
|
||||||
|
gl_iformat_for_depth(pixmap->drawable.depth, &iformat);
|
||||||
|
|
||||||
stride = pixmap->devKind;
|
stride = pixmap->devKind;
|
||||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||||
|
|
|
@ -224,6 +224,26 @@ format_for_depth(int depth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
gl_iformat_for_depth(int depth, GLenum * format)
|
||||||
|
{
|
||||||
|
switch (depth) {
|
||||||
|
#if 0
|
||||||
|
case 8:
|
||||||
|
*format = GL_ALPHA;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case 24:
|
||||||
|
*format = GL_RGB;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*format = GL_RGBA;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline CARD32
|
static inline CARD32
|
||||||
format_for_pixmap(PixmapPtr pixmap)
|
format_for_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue