glamor: Use small internal texture format if possible.
Reduce some texture memory requirement and also save some bandwidth. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
01489f9da9
commit
9b667ffd56
|
@ -151,10 +151,10 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
|||
if (w == 0 || h == 0 || type == GLAMOR_PIXMAP_MEMORY)
|
||||
return pixmap;
|
||||
|
||||
/* We should probably take advantage of ARB_fbo's allowance of GL_ALPHA.
|
||||
* FBOs, which EXT_fbo forgot to do.
|
||||
*/
|
||||
switch (depth) {
|
||||
case 8:
|
||||
format = GL_ALPHA;
|
||||
break;
|
||||
case 24:
|
||||
format = GL_RGB;
|
||||
break;
|
||||
|
|
|
@ -199,7 +199,20 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format, GLenum type,
|
|||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
unsigned int stride, row_length;
|
||||
void *texels;
|
||||
GLenum iformat = GL_RGBA;
|
||||
GLenum iformat;
|
||||
|
||||
switch (pixmap->drawable.depth) {
|
||||
case 8:
|
||||
iformat = GL_ALPHA;
|
||||
break;
|
||||
case 24:
|
||||
iformat = GL_RGB;
|
||||
break;
|
||||
default:
|
||||
iformat = GL_RGBA;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
stride = pixmap->devKind;
|
||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||
|
|
Loading…
Reference in New Issue