meta: Split _swrast_BlitFramebuffer out of the meta blit path.
Separating the software fallbacks from the rest of the meta path (which is usually hardware accelerated) gives callers better control over their blitting options. For example, i965 might want to try meta blit, hardware blits, then swrast as a last resort. Splitting it makes that possible. This updates all callers to maintain the existing behavior (even in the few cases where it isn't desirable behavior - later patches can change that). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Cc: "10.2" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -422,12 +422,20 @@ _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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user