glamor_upload_pixmap: Use glTexImage2D for a fully update.
Currently, intel's mesa dri driver will not check pbo for a TexSubImage2D. So we use glTexImage2D if we are a fully updating. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
2806f1eace
commit
1761768f49
@ -418,36 +418,36 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, int *tex,
|
|||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
glamor_gl_dispatch *dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
int non_sub = 0;
|
||||||
|
int iformat;
|
||||||
|
|
||||||
dispatch = glamor_get_dispatch(glamor_priv);
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
if (*tex == 0) {
|
if (*tex == 0) {
|
||||||
int iformat;
|
|
||||||
dispatch->glGenTextures(1, tex);
|
dispatch->glGenTextures(1, tex);
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||||
gl_iformat_for_depth(pixmap->drawable.depth, &iformat);
|
gl_iformat_for_depth(pixmap->drawable.depth, &iformat);
|
||||||
else
|
else
|
||||||
iformat = format;
|
iformat = format;
|
||||||
|
non_sub = 1;
|
||||||
|
assert(x == 0 && y == 0);
|
||||||
|
}
|
||||||
|
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, *tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, *tex);
|
||||||
dispatch->glTexImage2D(GL_TEXTURE_2D,
|
|
||||||
0,
|
|
||||||
iformat,
|
|
||||||
w, h, 0, format, type,
|
|
||||||
bits);
|
|
||||||
} else
|
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, *tex);
|
|
||||||
|
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
|
|
||||||
dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
|
|
||||||
if (bits == NULL)
|
if (bits == NULL)
|
||||||
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
|
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
|
||||||
pbo);
|
pbo);
|
||||||
|
if (non_sub)
|
||||||
|
dispatch->glTexImage2D(GL_TEXTURE_2D,
|
||||||
|
0, iformat, w, h, 0,
|
||||||
|
format, type,
|
||||||
|
bits);
|
||||||
|
else
|
||||||
dispatch->glTexSubImage2D(GL_TEXTURE_2D,
|
dispatch->glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
0, x, y, w, h,
|
0, x, y, w, h,
|
||||||
format, type,
|
format, type,
|
||||||
|
Loading…
Reference in New Issue
Block a user