glamor: Make program APIs take DrawablePtrs instead of PixmapPtrs
Will give better results if the window depth doesn't match the backing pixmap depth.
This commit is contained in:
parent
0ed2d69217
commit
5893de5a22
|
@ -33,12 +33,12 @@ struct copy_args {
|
|||
};
|
||||
|
||||
static Bool
|
||||
use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_copyarea(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
struct copy_args *args = arg;
|
||||
glamor_pixmap_fbo *src = args->src;
|
||||
|
||||
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
|
||||
glamor_bind_texture(glamor_get_screen_private(drawable->pScreen),
|
||||
GL_TEXTURE0, src, TRUE);
|
||||
|
||||
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
|
||||
|
@ -62,19 +62,19 @@ static const glamor_facet glamor_facet_copyarea = {
|
|||
*/
|
||||
|
||||
static Bool
|
||||
use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_copyplane(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
struct copy_args *args = arg;
|
||||
glamor_pixmap_fbo *src = args->src;
|
||||
|
||||
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
|
||||
glamor_bind_texture(glamor_get_screen_private(drawable->pScreen),
|
||||
GL_TEXTURE0, src, TRUE);
|
||||
|
||||
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
|
||||
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
|
||||
|
||||
glamor_set_color(dst, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(dst, gc->bgPixel, prog->bg_uniform);
|
||||
glamor_set_color(drawable, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
|
||||
|
||||
/* XXX handle 2 10 10 10 and 1555 formats; presumably the pixmap private knows this? */
|
||||
switch (args->src_pixmap->drawable.depth) {
|
||||
|
@ -453,7 +453,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
|||
args.dy = dy + src_off_y - src_box->y1;
|
||||
args.src = glamor_pixmap_fbo_at(src_priv, src_box_index);
|
||||
|
||||
if (!glamor_use_program(dst_pixmap, gc, prog, &args))
|
||||
if (!glamor_use_program(dst, gc, prog, &args))
|
||||
goto bail_ctx;
|
||||
|
||||
glamor_pixmap_loop(dst_priv, dst_box_index) {
|
||||
|
|
|
@ -156,7 +156,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
|||
|
||||
switch (gc->lineStyle) {
|
||||
case LineOnOffDash:
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->on_off_dash_line_progs,
|
||||
&glamor_facet_on_off_dash_lines);
|
||||
if (!prog)
|
||||
|
@ -175,11 +175,11 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
|||
goto bail;
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
if (!glamor_use_program(drawable, gc, prog, NULL))
|
||||
goto bail;
|
||||
|
||||
glamor_set_color(pixmap, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
|
||||
glamor_set_color(drawable, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -57,7 +57,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_glyph_blt_progs,
|
||||
&glamor_facet_poly_glyph_blt);
|
||||
if (!prog)
|
||||
|
@ -188,7 +188,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_glyph_blt_progs,
|
||||
&glamor_facet_poly_glyph_blt);
|
||||
if (!prog)
|
||||
|
|
|
@ -61,7 +61,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_line_program,
|
||||
&glamor_facet_poly_lines);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
goto bail;
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
if (!glamor_use_program(drawable, gc, prog, NULL))
|
||||
goto bail;
|
||||
|
||||
vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset);
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "glamor_program.h"
|
||||
|
||||
static Bool
|
||||
use_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_solid(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
return glamor_set_solid(pixmap, gc, TRUE, prog->fg_uniform);
|
||||
return glamor_set_solid(drawable, gc, TRUE, prog->fg_uniform);
|
||||
}
|
||||
|
||||
const glamor_facet glamor_fill_solid = {
|
||||
|
@ -38,9 +38,9 @@ const glamor_facet glamor_fill_solid = {
|
|||
};
|
||||
|
||||
static Bool
|
||||
use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_tile(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
|
||||
return glamor_set_tiled(drawable, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
|
||||
}
|
||||
|
||||
static const glamor_facet glamor_fill_tile = {
|
||||
|
@ -52,9 +52,9 @@ static const glamor_facet glamor_fill_tile = {
|
|||
};
|
||||
|
||||
static Bool
|
||||
use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_stipple(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
return glamor_set_stippled(pixmap, gc, prog->fg_uniform,
|
||||
return glamor_set_stippled(drawable, gc, prog->fg_uniform,
|
||||
prog->fill_offset_uniform,
|
||||
prog->fill_size_inv_uniform);
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ static const glamor_facet glamor_fill_stipple = {
|
|||
};
|
||||
|
||||
static Bool
|
||||
use_opaque_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_opaque_stipple(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
if (!use_stipple(pixmap, gc, prog, arg))
|
||||
if (!use_stipple(drawable, gc, prog, arg))
|
||||
return FALSE;
|
||||
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
|
||||
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -401,29 +401,29 @@ fail:
|
|||
}
|
||||
|
||||
Bool
|
||||
glamor_use_program(PixmapPtr pixmap,
|
||||
glamor_use_program(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
glamor_program *prog,
|
||||
void *arg)
|
||||
{
|
||||
glUseProgram(prog->prog);
|
||||
|
||||
if (prog->prim_use && !prog->prim_use(pixmap, gc, prog, arg))
|
||||
if (prog->prim_use && !prog->prim_use(drawable, gc, prog, arg))
|
||||
return FALSE;
|
||||
|
||||
if (prog->fill_use && !prog->fill_use(pixmap, gc, prog, arg))
|
||||
if (prog->fill_use && !prog->fill_use(drawable, gc, prog, arg))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
glamor_program *
|
||||
glamor_use_program_fill(PixmapPtr pixmap,
|
||||
glamor_use_program_fill(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
glamor_program_fill *program_fill,
|
||||
const glamor_facet *prim)
|
||||
{
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
ScreenPtr screen = drawable->pScreen;
|
||||
glamor_program *prog = &program_fill->progs[gc->fillStyle];
|
||||
|
||||
int fill_style = gc->fillStyle;
|
||||
|
@ -441,7 +441,7 @@ glamor_use_program_fill(PixmapPtr pixmap,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
if (!glamor_use_program(drawable, gc, prog, NULL))
|
||||
return NULL;
|
||||
|
||||
return prog;
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef enum {
|
|||
|
||||
typedef struct _glamor_program glamor_program;
|
||||
|
||||
typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg);
|
||||
typedef Bool (*glamor_use) (DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg);
|
||||
|
||||
typedef Bool (*glamor_use_render) (CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog);
|
||||
|
||||
|
@ -108,13 +108,13 @@ glamor_build_program(ScreenPtr screen,
|
|||
const char *defines);
|
||||
|
||||
Bool
|
||||
glamor_use_program(PixmapPtr pixmap,
|
||||
glamor_use_program(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
glamor_program *prog,
|
||||
void *arg);
|
||||
|
||||
glamor_program *
|
||||
glamor_use_program_fill(PixmapPtr pixmap,
|
||||
glamor_use_program_fill(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
glamor_program_fill *program_fill,
|
||||
const glamor_facet *prim);
|
||||
|
|
|
@ -70,7 +70,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
}
|
||||
|
||||
if (glamor_glsl_has_ints(glamor_priv)) {
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_fill_rect_program,
|
||||
&glamor_facet_polyfillrect_130);
|
||||
|
||||
|
@ -97,7 +97,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
} else {
|
||||
int n;
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_fill_rect_program,
|
||||
&glamor_facet_polyfillrect_120);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
prog = glamor_use_program_fill(drawable, gc,
|
||||
&glamor_priv->poly_segment_program,
|
||||
&glamor_facet_poly_segment);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (glamor_glsl_has_ints(glamor_priv)) {
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
|
||||
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->fill_spans_program,
|
||||
&glamor_facet_fillspans_130);
|
||||
|
||||
if (!prog)
|
||||
|
@ -90,7 +90,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
|
||||
glamor_put_vbo_space(screen);
|
||||
} else {
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
|
||||
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->fill_spans_program,
|
||||
&glamor_facet_fillspans_120);
|
||||
|
||||
if (!prog)
|
||||
|
|
|
@ -288,7 +288,7 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
|
||||
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
|
||||
|
||||
if (!prog)
|
||||
goto bail;
|
||||
|
@ -346,9 +346,9 @@ static const glamor_facet glamor_facet_image_text = {
|
|||
};
|
||||
|
||||
static Bool
|
||||
use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
use_image_solid(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform);
|
||||
return glamor_set_solid(drawable, gc, FALSE, prog->fg_uniform);
|
||||
}
|
||||
|
||||
static const glamor_facet glamor_facet_image_fill = {
|
||||
|
@ -359,11 +359,11 @@ static const glamor_facet glamor_facet_image_fill = {
|
|||
};
|
||||
|
||||
static Bool
|
||||
glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
glamor_te_text_use(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform))
|
||||
if (!glamor_set_solid(drawable, gc, FALSE, prog->fg_uniform))
|
||||
return FALSE;
|
||||
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
|
||||
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
|
|||
RegionUninit(®ion);
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
if (!glamor_use_program(drawable, gc, prog, NULL))
|
||||
goto bail;
|
||||
|
||||
(void) glamor_text(drawable, gc, glamor_font, prog,
|
||||
|
|
|
@ -130,7 +130,7 @@ glamor_set_color_depth(ScreenPtr pScreen,
|
|||
}
|
||||
|
||||
Bool
|
||||
glamor_set_solid(PixmapPtr pixmap,
|
||||
glamor_set_solid(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
Bool use_alu,
|
||||
GLint uniform)
|
||||
|
@ -143,7 +143,7 @@ glamor_set_solid(PixmapPtr pixmap,
|
|||
|
||||
pixel = gc->fgPixel;
|
||||
|
||||
if (!glamor_set_alu(pixmap->drawable.pScreen, alu)) {
|
||||
if (!glamor_set_alu(drawable->pScreen, alu)) {
|
||||
switch (gc->alu) {
|
||||
case GXclear:
|
||||
pixel = 0;
|
||||
|
@ -158,7 +158,7 @@ glamor_set_solid(PixmapPtr pixmap,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
glamor_set_color(pixmap, pixel, uniform);
|
||||
glamor_set_color(drawable, pixel, uniform);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -204,12 +204,12 @@ glamor_set_texture(PixmapPtr texture,
|
|||
}
|
||||
|
||||
Bool
|
||||
glamor_set_tiled(PixmapPtr pixmap,
|
||||
glamor_set_tiled(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
GLint offset_uniform,
|
||||
GLint size_inv_uniform)
|
||||
{
|
||||
if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu))
|
||||
if (!glamor_set_alu(drawable->pScreen, gc->alu))
|
||||
return FALSE;
|
||||
|
||||
if (!glamor_set_planemask(gc->depth, gc->planemask))
|
||||
|
@ -282,7 +282,7 @@ bail:
|
|||
}
|
||||
|
||||
Bool
|
||||
glamor_set_stippled(PixmapPtr pixmap,
|
||||
glamor_set_stippled(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
GLint fg_uniform,
|
||||
GLint offset_uniform,
|
||||
|
@ -294,7 +294,7 @@ glamor_set_stippled(PixmapPtr pixmap,
|
|||
if (!stipple)
|
||||
return FALSE;
|
||||
|
||||
if (!glamor_set_solid(pixmap, gc, TRUE, fg_uniform))
|
||||
if (!glamor_set_solid(drawable, gc, TRUE, fg_uniform))
|
||||
return FALSE;
|
||||
|
||||
return glamor_set_texture(stipple,
|
||||
|
|
|
@ -39,12 +39,12 @@ glamor_set_color_depth(ScreenPtr pScreen,
|
|||
GLint uniform);
|
||||
|
||||
static inline void
|
||||
glamor_set_color(PixmapPtr pixmap,
|
||||
glamor_set_color(DrawablePtr drawable,
|
||||
CARD32 pixel,
|
||||
GLint uniform)
|
||||
{
|
||||
glamor_set_color_depth(pixmap->drawable.pScreen,
|
||||
pixmap->drawable.depth, pixel, uniform);
|
||||
glamor_set_color_depth(drawable->pScreen,
|
||||
drawable->depth, pixel, uniform);
|
||||
}
|
||||
|
||||
Bool
|
||||
|
@ -60,19 +60,19 @@ glamor_set_texture(PixmapPtr texture,
|
|||
GLint size_uniform);
|
||||
|
||||
Bool
|
||||
glamor_set_solid(PixmapPtr pixmap,
|
||||
glamor_set_solid(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
Bool use_alu,
|
||||
GLint uniform);
|
||||
|
||||
Bool
|
||||
glamor_set_tiled(PixmapPtr pixmap,
|
||||
glamor_set_tiled(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
GLint offset_uniform,
|
||||
GLint size_uniform);
|
||||
|
||||
Bool
|
||||
glamor_set_stippled(PixmapPtr pixmap,
|
||||
glamor_set_stippled(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
GLint fg_uniform,
|
||||
GLint offset_uniform,
|
||||
|
|
Loading…
Reference in New Issue