Commit 5f1560c8 authored by He Junyan's avatar He Junyan Committed by Eric Anholt

Modilfy the composite logic to two phases

 We seperate the composite to two phases, firstly to
 select the shader according to source type and logic
 op, setting the right parameters. Then we emit the
 vertex array to generate the dest result.
 The reason why we do this is that the shader may be
 used to composite no only rect, trapezoid and triangle
 render function can also use it to render triangles and
 polygens. The old function glamor_composite_with_shader
 do the whole two phases work and can not match the
 new request.
Signed-off-by: He Junyan's avatarJunyan He <junyan.he@linux.intel.com>
parent 0b039176
......@@ -788,7 +788,6 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
glamor_pixmap_private *pixmap_priv;
PixmapPtr pixmap = NULL;
glamor_gl_dispatch *dispatch = NULL;
float tmp;
pixmap = glamor_get_drawable_pixmap(dst_picture->pDrawable);
pixmap_priv = glamor_get_pixmap_private(pixmap);
......
......@@ -127,6 +127,12 @@ enum shader_in {
SHADER_IN_COUNT,
};
struct shader_key {
enum shader_source source;
enum shader_mask mask;
enum shader_in in;
};
enum gradient_shader {
SHADER_GRADIENT_LINEAR,
SHADER_GRADIENT_RADIAL,
......@@ -158,6 +164,8 @@ enum glamor_gl_flavor {
#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2
#define GLAMOR_COMPOSITE_VBO_VERT_CNT 1024
typedef struct {
PicturePtr picture; /* Where the glyphs of the cache are stored */
GlyphPtr *glyphs;
......@@ -704,6 +712,15 @@ void glamor_composite_rects (CARD8 op,
xRectangle *rects);
void glamor_init_trapezoid_shader(ScreenPtr screen);
void glamor_fini_trapezoid_shader(ScreenPtr screen);
PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
PicturePtr source,
int x_source,
int y_source, int width, int height);
void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
void glamor_emit_composite_vert(ScreenPtr screen,
const float *src_coords,
const float *mask_coords,
const float *dst_coords, int i);
/* glamor_trapezoid.c */
void glamor_trapezoids(CARD8 op,
......@@ -939,10 +956,10 @@ glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
#ifndef GLAMOR_GLES2
#define GLAMOR_GRADIENT_SHADER
//#define GLAMOR_TRAPEZOID_SHADER
#define GLAMOR_TRAPEZOID_SHADER
#endif
#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
#if 1
#if 0
#define MAX_FBO_SIZE 32 /* For test purpose only. */
#endif
......
This diff is collapsed.
......@@ -395,7 +395,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
BoxRec one_trap_bound;
float vertices[8];
float tex_vertices[8];
float tmp;
int i;
glamor_priv = glamor_get_screen_private(screen);
......@@ -410,8 +409,8 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
}
/* First, clear all to zero */
if (!glamor_solid(pixmap, 0, 0, pixmap_priv->container->drawable.width,
pixmap_priv->container->drawable.height,
if (!glamor_solid(pixmap, 0, 0, pixmap_priv->base.pixmap->drawable.width,
pixmap_priv->base.pixmap->drawable.height,
GXclear, 0xFFFFFFFF, 0)) {
DEBUGF("glamor_solid failed, fallback\n");
return FALSE;
......@@ -490,8 +489,8 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
xFixedToInt(ptrap->right.p2.y), ptrap->right.p2.y);
miTrapezoidBounds(1, ptrap, &one_trap_bound);
glamor_set_tcoords_tri_strip((pixmap_priv->container->drawable.width),
(pixmap_priv->container->drawable.height),
glamor_set_tcoords_tri_strip((pixmap_priv->base.pixmap->drawable.width),
(pixmap_priv->base.pixmap->drawable.height),
(one_trap_bound.x1),
(one_trap_bound.y1),
(one_trap_bound.x2),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment