Commit 3e9c35bd authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

glamor_set_alu: Fallback for non GXcopy ops with GLES2.

As GLES2 doesn't support LogiOps, we have to fallback
here. GLES2 programing guide's statement is as below:

"In addition, LogicOp is removed as it is very
infrequently used by applications and the OpenGL ES
working group did not get requests from independent
software vendors (ISVs) to support this feature in
OpenGL ES 2.0."

So, I think, fallback here may not a big deal ;).
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 1a238e89
......@@ -194,7 +194,11 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, alu);
if (!glamor_set_alu(dispatch, alu)) {
glamor_put_dispatch(glamor_priv);
return FALSE;
}
if (alu != GXcopy) {
glamor_set_destination_pixmap_priv_nc (src_pixmap_priv);
glamor_validate_pixmap(src_pixmap);
......
......@@ -189,7 +189,10 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glamor_validate_pixmap(pixmap);
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, alu);
if (!glamor_set_alu(dispatch, alu)) {
glamor_put_dispatch(glamor_priv);
return FALSE;
}
dispatch->glUseProgram(glamor_priv->solid_prog);
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location,
......
......@@ -144,15 +144,13 @@ glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask)
return GL_FALSE;
}
void
Bool
glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu)
{
#ifndef GLAMOR_GLES2
if (alu == GXcopy) {
dispatch->glDisable(GL_COLOR_LOGIC_OP);
return;
return TRUE;
}
dispatch->glEnable(GL_COLOR_LOGIC_OP);
switch (alu) {
......@@ -202,12 +200,16 @@ glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu)
dispatch->glLogicOp(GL_SET);
break;
default:
FatalError("unknown logic op\n");
glamor_fallback("unsupported alu %x\n", alu);
return FALSE;
}
#else
if (alu != GXcopy)
ErrorF("unsupported alu %x \n", alu);
if (alu != GXcopy) {
glamor_fallback("unsupported alu %x\n", alu);
return FALSE;
}
#endif
return TRUE;
}
void *
......
......@@ -468,7 +468,7 @@ glamor_pixmap_fbo *
glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum format,
GLenum type, int no_alpha, int revert, int swap_rb);
void glamor_set_alu(struct glamor_gl_dispatch *dispatch,
Bool glamor_set_alu(struct glamor_gl_dispatch *dispatch,
unsigned char alu);
Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
......
......@@ -321,7 +321,11 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, gc->alu);
if (!glamor_set_alu(dispatch, gc->alu)) {
glamor_put_dispatch(glamor_priv);
goto fail;
}
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
......
......@@ -75,7 +75,11 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, gc->alu);
if (!glamor_set_alu(dispatch, gc->alu)) {
glamor_put_dispatch(glamor_priv);
goto fail;
}
for (i = 0; i < n; i++) {
n = REGION_NUM_RECTS(clip);
......
......@@ -162,7 +162,10 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
dispatch = glamor_get_dispatch(glamor_priv);
glamor_set_alu(dispatch, alu);
if (!glamor_set_alu(dispatch, alu)) {
glamor_put_dispatch(glamor_priv);
goto fail;
}
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,
......
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