glamor: Add ALU support to solid, tile, and putimage.
This commit is contained in:
parent
2b657d91d8
commit
e3c02c09c1
|
@ -68,6 +68,67 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glamor_set_alu(unsigned char alu)
|
||||||
|
{
|
||||||
|
if (alu == GXcopy) {
|
||||||
|
glDisable(GL_LOGIC_OP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable(GL_LOGIC_OP);
|
||||||
|
|
||||||
|
switch (alu) {
|
||||||
|
case GXclear:
|
||||||
|
glLogicOp(GL_CLEAR);
|
||||||
|
break;
|
||||||
|
case GXand:
|
||||||
|
glLogicOp(GL_AND);
|
||||||
|
break;
|
||||||
|
case GXandReverse:
|
||||||
|
glLogicOp(GL_AND_REVERSE);
|
||||||
|
break;
|
||||||
|
case GXandInverted:
|
||||||
|
glLogicOp(GL_AND_INVERTED);
|
||||||
|
break;
|
||||||
|
case GXnoop:
|
||||||
|
glLogicOp(GL_NOOP);
|
||||||
|
break;
|
||||||
|
case GXxor:
|
||||||
|
glLogicOp(GL_XOR);
|
||||||
|
break;
|
||||||
|
case GXor:
|
||||||
|
glLogicOp(GL_OR);
|
||||||
|
break;
|
||||||
|
case GXnor:
|
||||||
|
glLogicOp(GL_NOR);
|
||||||
|
break;
|
||||||
|
case GXequiv:
|
||||||
|
glLogicOp(GL_EQUIV);
|
||||||
|
break;
|
||||||
|
case GXinvert:
|
||||||
|
glLogicOp(GL_INVERT);
|
||||||
|
break;
|
||||||
|
case GXorReverse:
|
||||||
|
glLogicOp(GL_OR_REVERSE);
|
||||||
|
break;
|
||||||
|
case GXcopyInverted:
|
||||||
|
glLogicOp(GL_COPY_INVERTED);
|
||||||
|
break;
|
||||||
|
case GXorInverted:
|
||||||
|
glLogicOp(GL_OR_INVERTED);
|
||||||
|
break;
|
||||||
|
case GXnand:
|
||||||
|
glLogicOp(GL_NAND);
|
||||||
|
break;
|
||||||
|
case GXset:
|
||||||
|
glLogicOp(GL_SET);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FatalError("unknown logic op\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_get_transform_uniform_locations(GLint prog,
|
glamor_get_transform_uniform_locations(GLint prog,
|
||||||
glamor_transform_uniforms *uniform_locations)
|
glamor_transform_uniforms *uniform_locations)
|
||||||
|
|
|
@ -153,6 +153,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
|
|
||||||
if (!glamor_set_destination_pixmap(pixmap))
|
if (!glamor_set_destination_pixmap(pixmap))
|
||||||
return;
|
return;
|
||||||
|
glamor_set_alu(alu);
|
||||||
|
|
||||||
glUseProgramObjectARB(glamor_priv->solid_prog);
|
glUseProgramObjectARB(glamor_priv->solid_prog);
|
||||||
glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color);
|
glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color);
|
||||||
|
@ -167,6 +168,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glUseProgramObjectARB(0);
|
glUseProgramObjectARB(0);
|
||||||
|
glamor_set_alu(GXcopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Highlight places where we're doing it wrong. */
|
/* Highlight places where we're doing it wrong. */
|
||||||
|
|
|
@ -100,6 +100,7 @@ void glamor_link_glsl_prog(GLint prog);
|
||||||
void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, unsigned long fg_pixel,
|
void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, unsigned long fg_pixel,
|
||||||
GLfloat *color);
|
GLfloat *color);
|
||||||
Bool glamor_set_destination_pixmap(PixmapPtr pixmap);
|
Bool glamor_set_destination_pixmap(PixmapPtr pixmap);
|
||||||
|
void glamor_set_alu(unsigned char alu);
|
||||||
void glamor_get_transform_uniform_locations(GLint prog,
|
void glamor_get_transform_uniform_locations(GLint prog,
|
||||||
glamor_transform_uniforms *uniform_locations);
|
glamor_transform_uniforms *uniform_locations);
|
||||||
void glamor_set_transform_for_pixmap(PixmapPtr pixmap,
|
void glamor_set_transform_for_pixmap(PixmapPtr pixmap,
|
||||||
|
|
|
@ -44,10 +44,12 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
int bpp = drawable->bitsPerPixel;
|
int bpp = drawable->bitsPerPixel;
|
||||||
int src_stride = PixmapBytePad(w, drawable->depth);
|
int src_stride = PixmapBytePad(w, drawable->depth);
|
||||||
|
|
||||||
if (gc->alu != GXcopy) {
|
if (!glamor_set_destination_pixmap(pixmap)) {
|
||||||
ErrorF("putimage: non-copy alu\n");
|
fbPutImage(drawable, gc, depth, x, y, w, h, left_pad,
|
||||||
goto fail;
|
image_format, bits);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!glamor_pm_is_solid(drawable, gc->planemask)) {
|
if (!glamor_pm_is_solid(drawable, gc->planemask)) {
|
||||||
ErrorF("putimage: non-solid planemask\n");
|
ErrorF("putimage: non-solid planemask\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -80,11 +82,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!glamor_set_destination_pixmap(pixmap)) {
|
glamor_set_alu(gc->alu);
|
||||||
fbPutImage(drawable, gc, depth, x, y, w, h, left_pad,
|
|
||||||
image_format, bits);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
x += drawable->x;
|
x += drawable->x;
|
||||||
y += drawable->y;
|
y += drawable->y;
|
||||||
|
@ -122,6 +120,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
src);
|
src);
|
||||||
}
|
}
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
glamor_set_alu(GXcopy);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -109,15 +109,12 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
ErrorF("Non-FBO tile pixmap\n");
|
ErrorF("Non-FBO tile pixmap\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (alu != GXcopy) {
|
|
||||||
ErrorF("tile alu\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
if (!glamor_pm_is_solid(&pixmap->drawable, planemask)) {
|
if (!glamor_pm_is_solid(&pixmap->drawable, planemask)) {
|
||||||
ErrorF("tile pm\n");
|
ErrorF("tile pm\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glamor_set_alu(alu);
|
||||||
glUseProgramObjectARB(glamor_priv->tile_prog);
|
glUseProgramObjectARB(glamor_priv->tile_prog);
|
||||||
glamor_set_transform_for_pixmap(pixmap, &glamor_priv->tile_transform);
|
glamor_set_transform_for_pixmap(pixmap, &glamor_priv->tile_transform);
|
||||||
|
|
||||||
|
@ -143,6 +140,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
|
|
||||||
glUseProgramObjectARB(0);
|
glUseProgramObjectARB(0);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glamor_set_alu(GXcopy);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user