From 4c27ca4700e4ba4ae19d77377a7776eb32f74647 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Fri, 13 Jul 2012 09:20:02 +0800 Subject: [PATCH] gles2: Fixed the compilation problem and some bugs. Previous patch doesn't set the offset to zero for GLESv2 path. Now fix it. This patch also fix a minor problem in pixmap uploading preparation. If the revert is not REVERT_NORMAL, then we don't need to prepare a fbo for it. As current mesa i965 gles2 driver doesn't support to set a A8 texture as a fbo target, we must fix this problem. As some A1/A8 picture need to be uploaded, this is the only place a A8 texture may be attached to a fbo. This patch also enable the shader gradient for GLESv2. The reason we disable it before is that some glsl linker doesn't support link different objects which have cross reference. Now we don't have that problem. Signed-off-by: Zhigang Gong --- glamor/glamor_glext.h | 3 +++ glamor/glamor_pixmap.c | 2 +- glamor/glamor_priv.h | 2 -- glamor/glamor_render.c | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/glamor/glamor_glext.h b/glamor/glamor_glext.h index d60c69690..1f7206b99 100644 --- a/glamor/glamor_glext.h +++ b/glamor/glamor_glext.h @@ -57,5 +57,8 @@ #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_PACK_INVERT_MESA 0x8758 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 #endif diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index 10066a6b5..f3a2a87ab 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -612,7 +612,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int return 0; if (!(no_alpha - || (revert != REVERT_NONE) + || (revert == REVERT_NORMAL) || (swap_rb != SWAP_NONE_UPLOADING) || !glamor_priv->yInverted)) { /* We don't need a fbo, a simple texture uploading should work. */ diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 0703c076d..3b64c31e7 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -1014,10 +1014,8 @@ glamor_composite_rectangles(CARD8 op, * this will increase performance obviously. */ #define GLAMOR_PIXMAP_DYNAMIC_UPLOAD -#ifndef GLAMOR_GLES2 #define GLAMOR_GRADIENT_SHADER //#define GLAMOR_TRAPEZOID_SHADER -#endif #define GLAMOR_TEXTURED_LARGE_PIXMAP 1 #define WALKAROUND_LARGE_TEXTURE_MAP #if 0 diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index b5046861d..6dacd4466 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -753,7 +753,9 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT); assert(glamor_priv->vb != NULL); glamor_priv->vb -= glamor_priv->vbo_offset; - } + } else + glamor_priv->vbo_offset = 0; + dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,