diff options
-rw-r--r-- | src/mesa/drivers/common/meta.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 10 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_blit.c | 33 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_fbo.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_fbo.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_driver.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 2 |
8 files changed, 56 insertions, 25 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 3ef3f79714e..f90d5bd424e 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2860,11 +2860,11 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, * are too strict for CopyTexImage. We know meta will be fine with format * changes. */ - _mesa_meta_BlitFramebuffer(ctx, x, y, - x + width, y + height, - xoffset, yoffset, - xoffset + width, yoffset + height, - mask, GL_NEAREST); + _mesa_meta_and_swrast_BlitFramebuffer(ctx, x, y, + x + width, y + height, + xoffset, yoffset, + xoffset + width, yoffset + height, + mask, GL_NEAREST); ctx->Meta->Blit.no_ctsi_fallback = false; success = true; diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 2186a39f8d9..007f1040bdb 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -422,13 +422,21 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, const struct gl_texture_object *texObj, GLenum target, GLenum filter, GLuint srcLevel); -extern void +extern GLbitfield _mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); extern void +_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx, + GLint srcX0, GLint srcY0, + GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + +extern void _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers); extern void diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index bd6118b9455..e10a181d68b 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -644,7 +644,7 @@ _mesa_meta_setup_sampler(struct gl_context *ctx, * Meta implementation of ctx->Driver.BlitFramebuffer() in terms * of texture mapping and polygon rendering. */ -void +GLbitfield _mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, @@ -669,7 +669,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, /* Multisample texture blit support requires texture multisample. */ if (ctx->ReadBuffer->Visual.samples > 0 && !ctx->Extensions.ARB_texture_multisample) { - goto fallback; + return mask; } /* Clip a copy of the blit coordinates. If these differ from the input @@ -678,7 +678,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, if (!_mesa_clip_blit(ctx, &clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1, &clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) { /* clipped/scissored everything away */ - return; + return 0; } /* Only scissor affects blit, but we're doing to set a custom scissor if @@ -723,11 +723,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_meta_end(ctx); -fallback: - if (mask) { - _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, mask, filter); - } + return mask; } void @@ -745,3 +741,24 @@ _mesa_meta_glsl_blit_cleanup(struct blit_state *blit) _mesa_DeleteTextures(1, &blit->depthTex.TexObj); blit->depthTex.TexObj = 0; } + +void +_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx, + GLint srcX0, GLint srcY0, + GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + mask = _mesa_meta_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); + if (mask == 0x0) + return; + + _swrast_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); +} diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c index 2538facf141..a77c3d6064b 100644 --- a/src/mesa/drivers/dri/i915/intel_fbo.c +++ b/src/mesa/drivers/dri/i915/intel_fbo.c @@ -741,10 +741,10 @@ intel_blit_framebuffer(struct gl_context *ctx, return; - _mesa_meta_BlitFramebuffer(ctx, - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); + _mesa_meta_and_swrast_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); } /** diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 6c99de9513b..e43e18b78a2 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -898,11 +898,17 @@ intel_blit_framebuffer(struct gl_context *ctx, if (mask == 0x0) return; + mask = _mesa_meta_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); + if (mask == 0x0) + return; - _mesa_meta_BlitFramebuffer(ctx, - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); + _swrast_BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); } /** diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 1a8afa2af12..b0afb69e221 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -155,5 +155,5 @@ nouveau_driver_functions_init(struct dd_function_table *functions) functions->DrawPixels = _mesa_meta_DrawPixels; functions->CopyPixels = _mesa_meta_CopyPixels; functions->Bitmap = _mesa_meta_Bitmap; - functions->BlitFramebuffer = _mesa_meta_BlitFramebuffer; + functions->BlitFramebuffer = _mesa_meta_and_swrast_BlitFramebuffer; } diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 12ad438771c..5a6d9da771c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -873,7 +873,7 @@ void radeon_fbo_init(struct radeon_context *radeon) radeon->glCtx.Driver.RenderTexture = radeon_render_texture; radeon->glCtx.Driver.FinishRenderTexture = radeon_finish_render_texture; radeon->glCtx.Driver.ValidateFramebuffer = radeon_validate_framebuffer; - radeon->glCtx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer; + radeon->glCtx.Driver.BlitFramebuffer = _mesa_meta_and_swrast_BlitFramebuffer; radeon->glCtx.Driver.EGLImageTargetRenderbufferStorage = radeon_image_target_renderbuffer_storage; } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3fe1f01c4ed..10634fe73c0 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -841,7 +841,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, if (TEST_META_FUNCS) { driver->Clear = _mesa_meta_Clear; driver->CopyPixels = _mesa_meta_CopyPixels; - driver->BlitFramebuffer = _mesa_meta_BlitFramebuffer; + driver->BlitFramebuffer = _mesa_meta_and_swrast_BlitFramebuffer; driver->DrawPixels = _mesa_meta_DrawPixels; driver->Bitmap = _mesa_meta_Bitmap; } |