st/mesa: accelerate glCopyPixels(STENCIL)
Tested-by: Dieter Nützel
This commit is contained in:
parent
65dc4db08e
commit
131d40cfc9
|
@ -1515,21 +1515,21 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||||
struct gl_pixelstore_attrib pack, unpack;
|
struct gl_pixelstore_attrib pack, unpack;
|
||||||
GLint readX, readY, readW, readH, drawX, drawY, drawW, drawH;
|
GLint readX, readY, readW, readH, drawX, drawY, drawW, drawH;
|
||||||
|
|
||||||
if (type == GL_COLOR &&
|
if (ctx->Pixel.ZoomX == 1.0 &&
|
||||||
ctx->Pixel.ZoomX == 1.0 &&
|
|
||||||
ctx->Pixel.ZoomY == 1.0 &&
|
ctx->Pixel.ZoomY == 1.0 &&
|
||||||
ctx->_ImageTransferState == 0x0 &&
|
(type != GL_COLOR ||
|
||||||
!ctx->Color.BlendEnabled &&
|
(ctx->_ImageTransferState == 0x0 &&
|
||||||
!ctx->Color.AlphaEnabled &&
|
!ctx->Color.BlendEnabled &&
|
||||||
(!ctx->Color.ColorLogicOpEnabled || ctx->Color.LogicOp == GL_COPY) &&
|
!ctx->Color.AlphaEnabled &&
|
||||||
!ctx->Depth.Test &&
|
(!ctx->Color.ColorLogicOpEnabled || ctx->Color.LogicOp == GL_COPY) &&
|
||||||
!ctx->Fog.Enabled &&
|
!ctx->Depth.Test &&
|
||||||
!ctx->Stencil.Enabled &&
|
!ctx->Fog.Enabled &&
|
||||||
!ctx->FragmentProgram.Enabled &&
|
!ctx->Stencil.Enabled &&
|
||||||
!ctx->VertexProgram.Enabled &&
|
!ctx->FragmentProgram.Enabled &&
|
||||||
!ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT] &&
|
!ctx->VertexProgram.Enabled &&
|
||||||
!_mesa_ati_fragment_shader_enabled(ctx) &&
|
!ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT] &&
|
||||||
ctx->DrawBuffer->_NumColorDrawBuffers == 1 &&
|
!_mesa_ati_fragment_shader_enabled(ctx) &&
|
||||||
|
ctx->DrawBuffer->_NumColorDrawBuffers == 1)) &&
|
||||||
!ctx->Query.CondRenderQuery &&
|
!ctx->Query.CondRenderQuery &&
|
||||||
!ctx->Query.CurrentOcclusionObject) {
|
!ctx->Query.CurrentOcclusionObject) {
|
||||||
struct st_renderbuffer *rbRead, *rbDraw;
|
struct st_renderbuffer *rbRead, *rbDraw;
|
||||||
|
@ -1562,8 +1562,18 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||||
drawW = readW;
|
drawW = readW;
|
||||||
drawH = readH;
|
drawH = readH;
|
||||||
|
|
||||||
rbRead = st_get_color_read_renderbuffer(ctx);
|
if (type == GL_COLOR) {
|
||||||
rbDraw = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
|
rbRead = st_get_color_read_renderbuffer(ctx);
|
||||||
|
rbDraw = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
|
||||||
|
} else if (type == GL_DEPTH || type == GL_DEPTH_STENCIL) {
|
||||||
|
rbRead = st_renderbuffer(ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer);
|
||||||
|
rbDraw = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer);
|
||||||
|
} else if (type == GL_STENCIL) {
|
||||||
|
rbRead = st_renderbuffer(ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer);
|
||||||
|
rbDraw = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Flip src/dst position depending on the orientation of buffers. */
|
/* Flip src/dst position depending on the orientation of buffers. */
|
||||||
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
||||||
|
@ -1604,9 +1614,17 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||||
blit.dst.box.width = drawW;
|
blit.dst.box.width = drawW;
|
||||||
blit.dst.box.height = drawH;
|
blit.dst.box.height = drawH;
|
||||||
blit.dst.box.depth = 1;
|
blit.dst.box.depth = 1;
|
||||||
blit.mask = PIPE_MASK_RGBA;
|
|
||||||
blit.filter = PIPE_TEX_FILTER_NEAREST;
|
blit.filter = PIPE_TEX_FILTER_NEAREST;
|
||||||
|
|
||||||
|
if (type == GL_COLOR)
|
||||||
|
blit.mask |= PIPE_MASK_RGBA;
|
||||||
|
if (type == GL_DEPTH)
|
||||||
|
blit.mask |= PIPE_MASK_Z;
|
||||||
|
if (type == GL_STENCIL)
|
||||||
|
blit.mask |= PIPE_MASK_S;
|
||||||
|
if (type == GL_DEPTH_STENCIL)
|
||||||
|
blit.mask |= PIPE_MASK_ZS;
|
||||||
|
|
||||||
if (ctx->DrawBuffer != ctx->WinSysDrawBuffer)
|
if (ctx->DrawBuffer != ctx->WinSysDrawBuffer)
|
||||||
st_window_rectangles_to_blit(ctx, &blit);
|
st_window_rectangles_to_blit(ctx, &blit);
|
||||||
|
|
||||||
|
@ -1657,6 +1675,9 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||||
|
|
||||||
st_validate_state(st, ST_PIPELINE_META);
|
st_validate_state(st, ST_PIPELINE_META);
|
||||||
|
|
||||||
|
if (blit_copy_pixels(ctx, srcx, srcy, width, height, dstx, dsty, type))
|
||||||
|
return;
|
||||||
|
|
||||||
if (type == GL_DEPTH_STENCIL) {
|
if (type == GL_DEPTH_STENCIL) {
|
||||||
/* XXX make this more efficient */
|
/* XXX make this more efficient */
|
||||||
st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_STENCIL);
|
st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_STENCIL);
|
||||||
|
@ -1670,9 +1691,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blit_copy_pixels(ctx, srcx, srcy, width, height, dstx, dsty, type))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The subsequent code implements glCopyPixels by copying the source
|
* The subsequent code implements glCopyPixels by copying the source
|
||||||
* pixels into a temporary texture that's then applied to a textured quad.
|
* pixels into a temporary texture that's then applied to a textured quad.
|
||||||
|
|
Loading…
Reference in New Issue