DD: Refactor BlitFramebuffer.
In preparation for glBlitNamedFramebuffer, the DD table function BlitFramebuffer needs to accept two arbitrary framebuffer objects rather than assuming ctx->ReadBuffer and ctx->DrawBuffer. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
@@ -2793,7 +2793,8 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims,
|
|||||||
* are too strict for CopyTexImage. We know meta will be fine with format
|
* are too strict for CopyTexImage. We know meta will be fine with format
|
||||||
* changes.
|
* changes.
|
||||||
*/
|
*/
|
||||||
mask = _mesa_meta_BlitFramebuffer(ctx, x, y,
|
mask = _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
x, y,
|
||||||
x + width, y + height,
|
x + width, y + height,
|
||||||
xoffset, yoffset,
|
xoffset, yoffset,
|
||||||
xoffset + width, yoffset + height,
|
xoffset + width, yoffset + height,
|
||||||
|
@@ -475,12 +475,16 @@ _mesa_meta_setup_sampler(struct gl_context *ctx,
|
|||||||
|
|
||||||
extern GLbitfield
|
extern GLbitfield
|
||||||
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter);
|
GLbitfield mask, GLenum filter);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
|
_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0,
|
GLint srcX0, GLint srcY0,
|
||||||
GLint srcX1, GLint srcY1,
|
GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0,
|
GLint dstX0, GLint dstY0,
|
||||||
|
@@ -232,6 +232,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
|
|||||||
static void
|
static void
|
||||||
setup_glsl_msaa_blit_shader(struct gl_context *ctx,
|
setup_glsl_msaa_blit_shader(struct gl_context *ctx,
|
||||||
struct blit_state *blit,
|
struct blit_state *blit,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
struct gl_renderbuffer *src_rb,
|
struct gl_renderbuffer *src_rb,
|
||||||
GLenum target)
|
GLenum target)
|
||||||
{
|
{
|
||||||
@@ -267,7 +268,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
|
|||||||
/* Update the assert if we plan to support more than 16X MSAA. */
|
/* Update the assert if we plan to support more than 16X MSAA. */
|
||||||
assert(shader_offset >= 0 && shader_offset <= 4);
|
assert(shader_offset >= 0 && shader_offset <= 4);
|
||||||
|
|
||||||
if (ctx->DrawBuffer->Visual.samples > 1) {
|
if (drawFb->Visual.samples > 1) {
|
||||||
/* If you're calling meta_BlitFramebuffer with the destination
|
/* If you're calling meta_BlitFramebuffer with the destination
|
||||||
* multisampled, this is the only path that will work -- swrast and
|
* multisampled, this is the only path that will work -- swrast and
|
||||||
* CopyTexImage won't work on it either.
|
* CopyTexImage won't work on it either.
|
||||||
@@ -508,6 +509,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
|
|||||||
static void
|
static void
|
||||||
setup_glsl_blit_framebuffer(struct gl_context *ctx,
|
setup_glsl_blit_framebuffer(struct gl_context *ctx,
|
||||||
struct blit_state *blit,
|
struct blit_state *blit,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
struct gl_renderbuffer *src_rb,
|
struct gl_renderbuffer *src_rb,
|
||||||
GLenum target, GLenum filter,
|
GLenum target, GLenum filter,
|
||||||
bool is_scaled_blit,
|
bool is_scaled_blit,
|
||||||
@@ -530,7 +532,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
|
|||||||
if (is_target_multisample && is_filter_scaled_resolve && is_scaled_blit) {
|
if (is_target_multisample && is_filter_scaled_resolve && is_scaled_blit) {
|
||||||
setup_glsl_msaa_blit_scaled_shader(ctx, blit, src_rb, target, filter);
|
setup_glsl_msaa_blit_scaled_shader(ctx, blit, src_rb, target, filter);
|
||||||
} else if (is_target_multisample) {
|
} else if (is_target_multisample) {
|
||||||
setup_glsl_msaa_blit_shader(ctx, blit, src_rb, target);
|
setup_glsl_msaa_blit_shader(ctx, blit, drawFb, src_rb, target);
|
||||||
} else {
|
} else {
|
||||||
_mesa_meta_setup_blit_shader(ctx, target, do_depth,
|
_mesa_meta_setup_blit_shader(ctx, target, do_depth,
|
||||||
do_depth ? &blit->shaders_with_depth
|
do_depth ? &blit->shaders_with_depth
|
||||||
@@ -546,12 +548,13 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
blitframebuffer_texture(struct gl_context *ctx,
|
blitframebuffer_texture(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLenum filter, GLint flipX, GLint flipY,
|
GLenum filter, GLint flipX, GLint flipY,
|
||||||
GLboolean glsl_version, GLboolean do_depth)
|
GLboolean glsl_version, GLboolean do_depth)
|
||||||
{
|
{
|
||||||
const struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
|
||||||
int att_index = do_depth ? BUFFER_DEPTH : readFb->_ColorReadBufferIndex;
|
int att_index = do_depth ? BUFFER_DEPTH : readFb->_ColorReadBufferIndex;
|
||||||
const struct gl_renderbuffer_attachment *readAtt =
|
const struct gl_renderbuffer_attachment *readAtt =
|
||||||
&readFb->Attachment[att_index];
|
&readFb->Attachment[att_index];
|
||||||
@@ -645,7 +648,7 @@ blitframebuffer_texture(struct gl_context *ctx,
|
|||||||
scaled_blit = dstW != srcW || dstH != srcH;
|
scaled_blit = dstW != srcW || dstH != srcH;
|
||||||
|
|
||||||
if (glsl_version) {
|
if (glsl_version) {
|
||||||
setup_glsl_blit_framebuffer(ctx, blit, rb, target, filter, scaled_blit,
|
setup_glsl_blit_framebuffer(ctx, blit, drawFb, rb, target, filter, scaled_blit,
|
||||||
do_depth);
|
do_depth);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -681,7 +684,7 @@ blitframebuffer_texture(struct gl_context *ctx,
|
|||||||
*/
|
*/
|
||||||
if (ctx->Extensions.EXT_texture_sRGB_decode) {
|
if (ctx->Extensions.EXT_texture_sRGB_decode) {
|
||||||
if (_mesa_get_format_color_encoding(rb->Format) == GL_SRGB &&
|
if (_mesa_get_format_color_encoding(rb->Format) == GL_SRGB &&
|
||||||
ctx->DrawBuffer->Visual.sRGBCapable) {
|
drawFb->Visual.sRGBCapable) {
|
||||||
_mesa_SamplerParameteri(fb_tex_blit.sampler,
|
_mesa_SamplerParameteri(fb_tex_blit.sampler,
|
||||||
GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
|
GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
|
||||||
_mesa_set_framebuffer_srgb(ctx, GL_TRUE);
|
_mesa_set_framebuffer_srgb(ctx, GL_TRUE);
|
||||||
@@ -873,6 +876,8 @@ _mesa_meta_setup_sampler(struct gl_context *ctx,
|
|||||||
*/
|
*/
|
||||||
GLbitfield
|
GLbitfield
|
||||||
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
@@ -894,7 +899,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
ctx->Extensions.ARB_fragment_shader;
|
ctx->Extensions.ARB_fragment_shader;
|
||||||
|
|
||||||
/* Multisample texture blit support requires texture multisample. */
|
/* Multisample texture blit support requires texture multisample. */
|
||||||
if (ctx->ReadBuffer->Visual.samples > 0 &&
|
if (readFb->Visual.samples > 0 &&
|
||||||
!ctx->Extensions.ARB_texture_multisample) {
|
!ctx->Extensions.ARB_texture_multisample) {
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
@@ -902,7 +907,8 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
/* Clip a copy of the blit coordinates. If these differ from the input
|
/* Clip a copy of the blit coordinates. If these differ from the input
|
||||||
* coordinates, then we'll set the scissor.
|
* coordinates, then we'll set the scissor.
|
||||||
*/
|
*/
|
||||||
if (!_mesa_clip_blit(ctx, &clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
|
if (!_mesa_clip_blit(ctx, readFb, drawFb,
|
||||||
|
&clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
|
||||||
&clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
|
&clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
|
||||||
/* clipped/scissored everything away */
|
/* clipped/scissored everything away */
|
||||||
return 0;
|
return 0;
|
||||||
@@ -930,7 +936,8 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
|
|
||||||
/* Try faster, direct texture approach first */
|
/* Try faster, direct texture approach first */
|
||||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||||
if (blitframebuffer_texture(ctx, srcX0, srcY0, srcX1, srcY1,
|
if (blitframebuffer_texture(ctx, readFb, drawFb,
|
||||||
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
filter, dstFlipX, dstFlipY,
|
filter, dstFlipX, dstFlipY,
|
||||||
use_glsl_version, false)) {
|
use_glsl_version, false)) {
|
||||||
@@ -939,7 +946,8 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mask & GL_DEPTH_BUFFER_BIT && use_glsl_version) {
|
if (mask & GL_DEPTH_BUFFER_BIT && use_glsl_version) {
|
||||||
if (blitframebuffer_texture(ctx, srcX0, srcY0, srcX1, srcY1,
|
if (blitframebuffer_texture(ctx, readFb, drawFb,
|
||||||
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
filter, dstFlipX, dstFlipY,
|
filter, dstFlipX, dstFlipY,
|
||||||
use_glsl_version, true)) {
|
use_glsl_version, true)) {
|
||||||
@@ -975,20 +983,22 @@ _mesa_meta_glsl_blit_cleanup(struct blit_state *blit)
|
|||||||
|
|
||||||
void
|
void
|
||||||
_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
|
_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0,
|
GLint srcX0, GLint srcY0,
|
||||||
GLint srcX1, GLint srcY1,
|
GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0,
|
GLint dstX0, GLint dstY0,
|
||||||
GLint dstX1, GLint dstY1,
|
GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
{
|
{
|
||||||
mask = _mesa_meta_BlitFramebuffer(ctx,
|
mask = _mesa_meta_BlitFramebuffer(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
if (mask == 0x0)
|
if (mask == 0x0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_swrast_BlitFramebuffer(ctx,
|
_swrast_BlitFramebuffer(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
|
@@ -189,7 +189,8 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
|
|||||||
* We have already created views to ensure that the texture formats
|
* We have already created views to ensure that the texture formats
|
||||||
* match.
|
* match.
|
||||||
*/
|
*/
|
||||||
ctx->Driver.BlitFramebuffer(ctx, src_x, src_y,
|
ctx->Driver.BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
src_x, src_y,
|
||||||
src_x + src_width, src_y + src_height,
|
src_x + src_width, src_y + src_height,
|
||||||
dst_x, dst_y,
|
dst_x, dst_y,
|
||||||
dst_x + src_width, dst_y + src_height,
|
dst_x + src_width, dst_y + src_height,
|
||||||
|
@@ -206,7 +206,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
|
|||||||
|
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
if (_mesa_meta_BlitFramebuffer(ctx, 0, 0, width, height,
|
if (_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
0, 0, width, height,
|
||||||
xoffset, yoffset,
|
xoffset, yoffset,
|
||||||
xoffset + width, yoffset + height,
|
xoffset + width, yoffset + height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST))
|
GL_COLOR_BUFFER_BIT, GL_NEAREST))
|
||||||
@@ -220,7 +221,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
|
|||||||
|
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
_mesa_meta_BlitFramebuffer(ctx, 0, 0, width, height,
|
_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
0, 0, width, height,
|
||||||
xoffset, yoffset,
|
xoffset, yoffset,
|
||||||
xoffset + width, yoffset + height,
|
xoffset + width, yoffset + height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
@@ -324,7 +326,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
|
|||||||
|
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
if (_mesa_meta_BlitFramebuffer(ctx, xoffset, yoffset,
|
if (_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
xoffset, yoffset,
|
||||||
xoffset + width, yoffset + height,
|
xoffset + width, yoffset + height,
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST))
|
GL_COLOR_BUFFER_BIT, GL_NEAREST))
|
||||||
@@ -338,7 +341,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
|
|||||||
|
|
||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
_mesa_meta_BlitFramebuffer(ctx, xoffset, yoffset,
|
_mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
|
xoffset, yoffset,
|
||||||
xoffset + width, yoffset + height,
|
xoffset + width, yoffset + height,
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
|
@@ -649,6 +649,8 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||||||
*/
|
*/
|
||||||
static GLbitfield
|
static GLbitfield
|
||||||
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0,
|
GLint srcX0, GLint srcY0,
|
||||||
GLint srcX1, GLint srcY1,
|
GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0,
|
GLint dstX0, GLint dstY0,
|
||||||
@@ -659,8 +661,6 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||||
GLint i;
|
GLint i;
|
||||||
const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
|
|
||||||
const struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
|
||||||
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
|
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
|
||||||
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
|
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
|
||||||
|
|
||||||
@@ -696,8 +696,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
* results are undefined if any destination pixels have a dependency on
|
* results are undefined if any destination pixels have a dependency on
|
||||||
* source pixels.
|
* source pixels.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
|
for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
|
||||||
struct gl_renderbuffer *dst_rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
|
struct gl_renderbuffer *dst_rb = drawFb->_ColorDrawBuffers[i];
|
||||||
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
|
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
|
||||||
|
|
||||||
if (!dst_irb) {
|
if (!dst_irb) {
|
||||||
@@ -738,12 +738,14 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
intel_blit_framebuffer(struct gl_context *ctx,
|
intel_blit_framebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
{
|
{
|
||||||
/* Try using the BLT engine. */
|
/* Try using the BLT engine. */
|
||||||
mask = intel_blit_framebuffer_with_blitter(ctx,
|
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
@@ -751,7 +753,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
_mesa_meta_and_swrast_BlitFramebuffer(ctx,
|
_mesa_meta_and_swrast_BlitFramebuffer(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
|
@@ -125,6 +125,8 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit,
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
try_blorp_blit(struct brw_context *brw,
|
try_blorp_blit(struct brw_context *brw,
|
||||||
|
const struct gl_framebuffer *read_fb,
|
||||||
|
const struct gl_framebuffer *draw_fb,
|
||||||
GLfloat srcX0, GLfloat srcY0, GLfloat srcX1, GLfloat srcY1,
|
GLfloat srcX0, GLfloat srcY0, GLfloat srcX1, GLfloat srcY1,
|
||||||
GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
|
GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
|
||||||
GLenum filter, GLbitfield buffer_bit)
|
GLenum filter, GLbitfield buffer_bit)
|
||||||
@@ -136,11 +138,8 @@ try_blorp_blit(struct brw_context *brw,
|
|||||||
*/
|
*/
|
||||||
intel_prepare_render(brw);
|
intel_prepare_render(brw);
|
||||||
|
|
||||||
const struct gl_framebuffer *read_fb = ctx->ReadBuffer;
|
|
||||||
const struct gl_framebuffer *draw_fb = ctx->DrawBuffer;
|
|
||||||
|
|
||||||
bool mirror_x, mirror_y;
|
bool mirror_x, mirror_y;
|
||||||
if (brw_meta_mirror_clip_and_scissor(ctx,
|
if (brw_meta_mirror_clip_and_scissor(ctx, read_fb, draw_fb,
|
||||||
&srcX0, &srcY0, &srcX1, &srcY1,
|
&srcX0, &srcY0, &srcX1, &srcY1,
|
||||||
&dstX0, &dstY0, &dstX1, &dstY1,
|
&dstX0, &dstY0, &dstX1, &dstY1,
|
||||||
&mirror_x, &mirror_y))
|
&mirror_x, &mirror_y))
|
||||||
@@ -154,8 +153,8 @@ try_blorp_blit(struct brw_context *brw,
|
|||||||
switch (buffer_bit) {
|
switch (buffer_bit) {
|
||||||
case GL_COLOR_BUFFER_BIT:
|
case GL_COLOR_BUFFER_BIT:
|
||||||
src_irb = intel_renderbuffer(read_fb->_ColorReadBuffer);
|
src_irb = intel_renderbuffer(read_fb->_ColorReadBuffer);
|
||||||
for (unsigned i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; ++i) {
|
for (unsigned i = 0; i < draw_fb->_NumColorDrawBuffers; ++i) {
|
||||||
dst_irb = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[i]);
|
dst_irb = intel_renderbuffer(draw_fb->_ColorDrawBuffers[i]);
|
||||||
if (dst_irb)
|
if (dst_irb)
|
||||||
do_blorp_blit(brw, buffer_bit,
|
do_blorp_blit(brw, buffer_bit,
|
||||||
src_irb, src_irb->Base.Base.Format,
|
src_irb, src_irb->Base.Base.Format,
|
||||||
@@ -317,6 +316,8 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
|
|||||||
|
|
||||||
GLbitfield
|
GLbitfield
|
||||||
brw_blorp_framebuffer(struct brw_context *brw,
|
brw_blorp_framebuffer(struct brw_context *brw,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
@@ -333,7 +334,7 @@ brw_blorp_framebuffer(struct brw_context *brw,
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < ARRAY_SIZE(buffer_bits); ++i) {
|
for (unsigned int i = 0; i < ARRAY_SIZE(buffer_bits); ++i) {
|
||||||
if ((mask & buffer_bits[i]) &&
|
if ((mask & buffer_bits[i]) &&
|
||||||
try_blorp_blit(brw,
|
try_blorp_blit(brw, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
filter, buffer_bits[i])) {
|
filter, buffer_bits[i])) {
|
||||||
|
@@ -1489,6 +1489,8 @@ void brw_meta_updownsample(struct brw_context *brw,
|
|||||||
struct intel_mipmap_tree *dst);
|
struct intel_mipmap_tree *dst);
|
||||||
|
|
||||||
void brw_meta_fbo_stencil_blit(struct brw_context *brw,
|
void brw_meta_fbo_stencil_blit(struct brw_context *brw,
|
||||||
|
struct gl_framebuffer *read_fb,
|
||||||
|
struct gl_framebuffer *draw_fb,
|
||||||
GLfloat srcX0, GLfloat srcY0,
|
GLfloat srcX0, GLfloat srcY0,
|
||||||
GLfloat srcX1, GLfloat srcY1,
|
GLfloat srcX1, GLfloat srcY1,
|
||||||
GLfloat dstX0, GLfloat dstY0,
|
GLfloat dstX0, GLfloat dstY0,
|
||||||
@@ -1713,6 +1715,8 @@ gen7_resume_transform_feedback(struct gl_context *ctx,
|
|||||||
/* brw_blorp_blit.cpp */
|
/* brw_blorp_blit.cpp */
|
||||||
GLbitfield
|
GLbitfield
|
||||||
brw_blorp_framebuffer(struct brw_context *brw,
|
brw_blorp_framebuffer(struct brw_context *brw,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter);
|
GLbitfield mask, GLenum filter);
|
||||||
|
@@ -460,15 +460,17 @@ error:
|
|||||||
|
|
||||||
void
|
void
|
||||||
brw_meta_fbo_stencil_blit(struct brw_context *brw,
|
brw_meta_fbo_stencil_blit(struct brw_context *brw,
|
||||||
|
struct gl_framebuffer *read_fb,
|
||||||
|
struct gl_framebuffer *draw_fb,
|
||||||
GLfloat src_x0, GLfloat src_y0,
|
GLfloat src_x0, GLfloat src_y0,
|
||||||
GLfloat src_x1, GLfloat src_y1,
|
GLfloat src_x1, GLfloat src_y1,
|
||||||
GLfloat dst_x0, GLfloat dst_y0,
|
GLfloat dst_x0, GLfloat dst_y0,
|
||||||
GLfloat dst_x1, GLfloat dst_y1)
|
GLfloat dst_x1, GLfloat dst_y1)
|
||||||
{
|
{
|
||||||
struct gl_context *ctx = &brw->ctx;
|
struct gl_context *ctx = &brw->ctx;
|
||||||
struct gl_renderbuffer *draw_fb =
|
struct gl_renderbuffer *draw_rb =
|
||||||
ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
|
draw_fb->Attachment[BUFFER_STENCIL].Renderbuffer;
|
||||||
const struct intel_renderbuffer *dst_irb = intel_renderbuffer(draw_fb);
|
const struct intel_renderbuffer *dst_irb = intel_renderbuffer(draw_rb);
|
||||||
struct intel_mipmap_tree *dst_mt = dst_irb->mt;
|
struct intel_mipmap_tree *dst_mt = dst_irb->mt;
|
||||||
|
|
||||||
if (!dst_mt)
|
if (!dst_mt)
|
||||||
@@ -478,7 +480,7 @@ brw_meta_fbo_stencil_blit(struct brw_context *brw,
|
|||||||
dst_mt = dst_mt->stencil_mt;
|
dst_mt = dst_mt->stencil_mt;
|
||||||
|
|
||||||
bool mirror_x, mirror_y;
|
bool mirror_x, mirror_y;
|
||||||
if (brw_meta_mirror_clip_and_scissor(ctx,
|
if (brw_meta_mirror_clip_and_scissor(ctx, read_fb, draw_fb,
|
||||||
&src_x0, &src_y0, &src_x1, &src_y1,
|
&src_x0, &src_y0, &src_x1, &src_y1,
|
||||||
&dst_x0, &dst_y0, &dst_x1, &dst_y1,
|
&dst_x0, &dst_y0, &dst_x1, &dst_y1,
|
||||||
&mirror_x, &mirror_y))
|
&mirror_x, &mirror_y))
|
||||||
|
@@ -104,15 +104,14 @@ clip_or_scissor(bool mirror,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
|
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *read_fb,
|
||||||
|
const struct gl_framebuffer *draw_fb,
|
||||||
GLfloat *srcX0, GLfloat *srcY0,
|
GLfloat *srcX0, GLfloat *srcY0,
|
||||||
GLfloat *srcX1, GLfloat *srcY1,
|
GLfloat *srcX1, GLfloat *srcY1,
|
||||||
GLfloat *dstX0, GLfloat *dstY0,
|
GLfloat *dstX0, GLfloat *dstY0,
|
||||||
GLfloat *dstX1, GLfloat *dstY1,
|
GLfloat *dstX1, GLfloat *dstY1,
|
||||||
bool *mirror_x, bool *mirror_y)
|
bool *mirror_x, bool *mirror_y)
|
||||||
{
|
{
|
||||||
const struct gl_framebuffer *read_fb = ctx->ReadBuffer;
|
|
||||||
const struct gl_framebuffer *draw_fb = ctx->DrawBuffer;
|
|
||||||
|
|
||||||
*mirror_x = false;
|
*mirror_x = false;
|
||||||
*mirror_y = false;
|
*mirror_y = false;
|
||||||
|
|
||||||
|
@@ -33,6 +33,8 @@ extern "C" {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
|
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *read_fb,
|
||||||
|
const struct gl_framebuffer *draw_fb,
|
||||||
GLfloat *srcX0, GLfloat *srcY0,
|
GLfloat *srcX0, GLfloat *srcY0,
|
||||||
GLfloat *srcX1, GLfloat *srcY1,
|
GLfloat *srcX1, GLfloat *srcY1,
|
||||||
GLfloat *dstX0, GLfloat *dstY0,
|
GLfloat *dstX0, GLfloat *dstY0,
|
||||||
|
@@ -779,6 +779,8 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
|
|||||||
*/
|
*/
|
||||||
static GLbitfield
|
static GLbitfield
|
||||||
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0,
|
GLint srcX0, GLint srcY0,
|
||||||
GLint srcX1, GLint srcY1,
|
GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0,
|
GLint dstX0, GLint dstY0,
|
||||||
@@ -794,8 +796,6 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (mask & GL_COLOR_BUFFER_BIT) {
|
if (mask & GL_COLOR_BUFFER_BIT) {
|
||||||
GLint i;
|
GLint i;
|
||||||
const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
|
|
||||||
const struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
|
||||||
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
|
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
|
||||||
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
|
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
|
||||||
|
|
||||||
@@ -831,8 +831,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
* results are undefined if any destination pixels have a dependency on
|
* results are undefined if any destination pixels have a dependency on
|
||||||
* source pixels.
|
* source pixels.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
|
for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
|
||||||
struct gl_renderbuffer *dst_rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
|
struct gl_renderbuffer *dst_rb = drawFb->_ColorDrawBuffers[i];
|
||||||
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
|
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
|
||||||
|
|
||||||
if (!dst_irb) {
|
if (!dst_irb) {
|
||||||
@@ -863,6 +863,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
intel_blit_framebuffer(struct gl_context *ctx,
|
intel_blit_framebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
@@ -876,7 +878,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
|
|||||||
if (!_mesa_check_conditional_render(ctx))
|
if (!_mesa_check_conditional_render(ctx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mask = brw_blorp_framebuffer(brw,
|
mask = brw_blorp_framebuffer(brw, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
@@ -884,7 +886,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (brw->gen >= 8 && (mask & GL_STENCIL_BUFFER_BIT)) {
|
if (brw->gen >= 8 && (mask & GL_STENCIL_BUFFER_BIT)) {
|
||||||
brw_meta_fbo_stencil_blit(brw_context(ctx),
|
brw_meta_fbo_stencil_blit(brw_context(ctx), readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1);
|
dstX0, dstY0, dstX1, dstY1);
|
||||||
mask &= ~GL_STENCIL_BUFFER_BIT;
|
mask &= ~GL_STENCIL_BUFFER_BIT;
|
||||||
@@ -893,21 +895,21 @@ intel_blit_framebuffer(struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try using the BLT engine. */
|
/* Try using the BLT engine. */
|
||||||
mask = intel_blit_framebuffer_with_blitter(ctx,
|
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
if (mask == 0x0)
|
if (mask == 0x0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mask = _mesa_meta_BlitFramebuffer(ctx,
|
mask = _mesa_meta_BlitFramebuffer(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
if (mask == 0x0)
|
if (mask == 0x0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_swrast_BlitFramebuffer(ctx,
|
_swrast_BlitFramebuffer(ctx, readFb, drawFb,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
|
@@ -506,7 +506,7 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(ctx->Driver.BlitFramebuffer);
|
ASSERT(ctx->Driver.BlitFramebuffer);
|
||||||
ctx->Driver.BlitFramebuffer(ctx,
|
ctx->Driver.BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
srcX0, srcY0, srcX1, srcY1,
|
srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1,
|
dstX0, dstY0, dstX1, dstY1,
|
||||||
mask, filter);
|
mask, filter);
|
||||||
|
@@ -713,6 +713,8 @@ struct dd_function_table {
|
|||||||
struct gl_framebuffer *fb);
|
struct gl_framebuffer *fb);
|
||||||
/*@}*/
|
/*@}*/
|
||||||
void (*BlitFramebuffer)(struct gl_context *ctx,
|
void (*BlitFramebuffer)(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter);
|
GLbitfield mask, GLenum filter);
|
||||||
|
@@ -861,19 +861,21 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
|
|||||||
*/
|
*/
|
||||||
GLboolean
|
GLboolean
|
||||||
_mesa_clip_blit(struct gl_context *ctx,
|
_mesa_clip_blit(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
|
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
|
||||||
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1)
|
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1)
|
||||||
{
|
{
|
||||||
const GLint srcXmin = 0;
|
const GLint srcXmin = 0;
|
||||||
const GLint srcXmax = ctx->ReadBuffer->Width;
|
const GLint srcXmax = readFb->Width;
|
||||||
const GLint srcYmin = 0;
|
const GLint srcYmin = 0;
|
||||||
const GLint srcYmax = ctx->ReadBuffer->Height;
|
const GLint srcYmax = readFb->Height;
|
||||||
|
|
||||||
/* these include scissor bounds */
|
/* these include scissor bounds */
|
||||||
const GLint dstXmin = ctx->DrawBuffer->_Xmin;
|
const GLint dstXmin = drawFb->_Xmin;
|
||||||
const GLint dstXmax = ctx->DrawBuffer->_Xmax;
|
const GLint dstXmax = drawFb->_Xmax;
|
||||||
const GLint dstYmin = ctx->DrawBuffer->_Ymin;
|
const GLint dstYmin = drawFb->_Ymin;
|
||||||
const GLint dstYmax = ctx->DrawBuffer->_Ymax;
|
const GLint dstYmax = drawFb->_Ymax;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
printf("PreClipX: src: %d .. %d dst: %d .. %d\n",
|
printf("PreClipX: src: %d .. %d dst: %d .. %d\n",
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
struct gl_context;
|
struct gl_context;
|
||||||
struct gl_pixelstore_attrib;
|
struct gl_pixelstore_attrib;
|
||||||
|
struct gl_framebuffer;
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_swap2_copy(GLushort *dst, GLushort *src, GLuint n);
|
_mesa_swap2_copy(GLushort *dst, GLushort *src, GLuint n);
|
||||||
@@ -140,6 +141,8 @@ _mesa_clip_to_region(GLint xmin, GLint ymin,
|
|||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_mesa_clip_blit(struct gl_context *ctx,
|
_mesa_clip_blit(struct gl_context *ctx,
|
||||||
|
const struct gl_framebuffer *readFb,
|
||||||
|
const struct gl_framebuffer *drawFb,
|
||||||
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
|
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
|
||||||
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
|
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
|
||||||
|
|
||||||
|
@@ -73,6 +73,8 @@ st_adjust_blit_for_msaa_resolve(struct pipe_blit_info *blit)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
st_BlitFramebuffer(struct gl_context *ctx,
|
st_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFB,
|
||||||
|
struct gl_framebuffer *drawFB,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
@@ -83,8 +85,6 @@ st_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
const uint pFilter = ((filter == GL_NEAREST)
|
const uint pFilter = ((filter == GL_NEAREST)
|
||||||
? PIPE_TEX_FILTER_NEAREST
|
? PIPE_TEX_FILTER_NEAREST
|
||||||
: PIPE_TEX_FILTER_LINEAR);
|
: PIPE_TEX_FILTER_LINEAR);
|
||||||
struct gl_framebuffer *readFB = ctx->ReadBuffer;
|
|
||||||
struct gl_framebuffer *drawFB = ctx->DrawBuffer;
|
|
||||||
struct {
|
struct {
|
||||||
GLint srcX0, srcY0, srcX1, srcY1;
|
GLint srcX0, srcY0, srcX1, srcY1;
|
||||||
GLint dstX0, dstY0, dstX1, dstY1;
|
GLint dstX0, dstY0, dstX1, dstY1;
|
||||||
@@ -108,7 +108,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
*
|
*
|
||||||
* XXX: This should depend on mask !
|
* XXX: This should depend on mask !
|
||||||
*/
|
*/
|
||||||
if (!_mesa_clip_blit(ctx,
|
if (!_mesa_clip_blit(ctx, readFB, drawFB,
|
||||||
&clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
|
&clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
|
||||||
&clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
|
&clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
|
||||||
return; /* nothing to draw/blit */
|
return; /* nothing to draw/blit */
|
||||||
|
@@ -107,14 +107,14 @@ RESAMPLE(resample_row_16, GLuint, 4)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
blit_nearest(struct gl_context *ctx,
|
blit_nearest(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield buffer)
|
GLbitfield buffer)
|
||||||
{
|
{
|
||||||
struct gl_renderbuffer *readRb, *drawRb = NULL;
|
struct gl_renderbuffer *readRb, *drawRb = NULL;
|
||||||
struct gl_renderbuffer_attachment *readAtt = NULL, *drawAtt = NULL;
|
struct gl_renderbuffer_attachment *readAtt = NULL, *drawAtt = NULL;
|
||||||
struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
|
||||||
struct gl_framebuffer *drawFb = ctx->DrawBuffer;
|
|
||||||
GLuint numDrawBuffers = 0;
|
GLuint numDrawBuffers = 0;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
@@ -508,11 +508,11 @@ resample_linear_row_float(GLint srcWidth, GLint dstWidth,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
blit_linear(struct gl_context *ctx,
|
blit_linear(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
|
||||||
{
|
{
|
||||||
struct gl_framebuffer *drawFb = ctx->DrawBuffer;
|
|
||||||
struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
|
||||||
struct gl_renderbuffer *readRb = readFb->_ColorReadBuffer;
|
struct gl_renderbuffer *readRb = readFb->_ColorReadBuffer;
|
||||||
struct gl_renderbuffer_attachment *readAtt =
|
struct gl_renderbuffer_attachment *readAtt =
|
||||||
&readFb->Attachment[readFb->_ColorReadBufferIndex];
|
&readFb->Attachment[readFb->_ColorReadBufferIndex];
|
||||||
@@ -733,6 +733,8 @@ fail_no_memory:
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_swrast_BlitFramebuffer(struct gl_context *ctx,
|
_swrast_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter)
|
GLbitfield mask, GLenum filter)
|
||||||
@@ -756,7 +758,7 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
if (!_mesa_check_conditional_render(ctx))
|
if (!_mesa_check_conditional_render(ctx))
|
||||||
return; /* Do not blit */
|
return; /* Do not blit */
|
||||||
|
|
||||||
if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
|
if (!_mesa_clip_blit(ctx, readFb, drawFb, &srcX0, &srcY0, &srcX1, &srcY1,
|
||||||
&dstX0, &dstY0, &dstX1, &dstY1)) {
|
&dstX0, &dstY0, &dstX1, &dstY1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -775,14 +777,15 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
dstY0 < dstY1) {
|
dstY0 < dstY1) {
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (mask & buffers[i]) {
|
if (mask & buffers[i]) {
|
||||||
if (swrast_fast_copy_pixels(ctx,
|
if (swrast_fast_copy_pixels(ctx,
|
||||||
srcX0, srcY0,
|
readFb, drawFb,
|
||||||
srcX1 - srcX0, srcY1 - srcY0,
|
srcX0, srcY0,
|
||||||
dstX0, dstY0,
|
srcX1 - srcX0, srcY1 - srcY0,
|
||||||
buffer_enums[i])) {
|
dstX0, dstY0,
|
||||||
mask &= ~buffers[i];
|
buffer_enums[i])) {
|
||||||
}
|
mask &= ~buffers[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mask)
|
if (!mask)
|
||||||
@@ -791,17 +794,17 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (filter == GL_NEAREST) {
|
if (filter == GL_NEAREST) {
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (mask & buffers[i]) {
|
if (mask & buffers[i]) {
|
||||||
blit_nearest(ctx, srcX0, srcY0, srcX1, srcY1,
|
blit_nearest(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1, buffers[i]);
|
dstX0, dstY0, dstX1, dstY1, buffers[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT(filter == GL_LINEAR);
|
ASSERT(filter == GL_LINEAR);
|
||||||
if (mask & GL_COLOR_BUFFER_BIT) { /* depth/stencil not allowed */
|
if (mask & GL_COLOR_BUFFER_BIT) { /* depth/stencil not allowed */
|
||||||
blit_linear(ctx, srcX0, srcY0, srcX1, srcY1,
|
blit_linear(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1,
|
||||||
dstX0, dstY0, dstX1, dstY1);
|
dstX0, dstY0, dstX1, dstY1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -442,11 +442,11 @@ end:
|
|||||||
*/
|
*/
|
||||||
GLboolean
|
GLboolean
|
||||||
swrast_fast_copy_pixels(struct gl_context *ctx,
|
swrast_fast_copy_pixels(struct gl_context *ctx,
|
||||||
GLint srcX, GLint srcY, GLsizei width, GLsizei height,
|
struct gl_framebuffer *srcFb,
|
||||||
GLint dstX, GLint dstY, GLenum type)
|
struct gl_framebuffer *dstFb,
|
||||||
|
GLint srcX, GLint srcY, GLsizei width, GLsizei height,
|
||||||
|
GLint dstX, GLint dstY, GLenum type)
|
||||||
{
|
{
|
||||||
struct gl_framebuffer *srcFb = ctx->ReadBuffer;
|
|
||||||
struct gl_framebuffer *dstFb = ctx->DrawBuffer;
|
|
||||||
struct gl_renderbuffer *srcRb, *dstRb;
|
struct gl_renderbuffer *srcRb, *dstRb;
|
||||||
GLint row;
|
GLint row;
|
||||||
GLuint pixelBytes, widthInBytes;
|
GLuint pixelBytes, widthInBytes;
|
||||||
@@ -637,8 +637,9 @@ _swrast_CopyPixels( struct gl_context *ctx,
|
|||||||
ctx->Pixel.ZoomX != 1.0F ||
|
ctx->Pixel.ZoomX != 1.0F ||
|
||||||
ctx->Pixel.ZoomY != 1.0F ||
|
ctx->Pixel.ZoomY != 1.0F ||
|
||||||
ctx->_ImageTransferState) &&
|
ctx->_ImageTransferState) &&
|
||||||
swrast_fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty,
|
swrast_fast_copy_pixels(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
|
||||||
type)) {
|
srcx, srcy, width, height, destx, desty,
|
||||||
|
type)) {
|
||||||
/* all done */
|
/* all done */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -140,8 +140,10 @@ _swrast_CopyPixels( struct gl_context *ctx,
|
|||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
swrast_fast_copy_pixels(struct gl_context *ctx,
|
swrast_fast_copy_pixels(struct gl_context *ctx,
|
||||||
GLint srcX, GLint srcY, GLsizei width, GLsizei height,
|
struct gl_framebuffer *srcFb,
|
||||||
GLint dstX, GLint dstY, GLenum type);
|
struct gl_framebuffer *dstFb,
|
||||||
|
GLint srcX, GLint srcY, GLsizei width, GLsizei height,
|
||||||
|
GLint dstX, GLint dstY, GLenum type);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_swrast_DrawPixels( struct gl_context *ctx,
|
_swrast_DrawPixels( struct gl_context *ctx,
|
||||||
@@ -153,6 +155,8 @@ _swrast_DrawPixels( struct gl_context *ctx,
|
|||||||
|
|
||||||
extern void
|
extern void
|
||||||
_swrast_BlitFramebuffer(struct gl_context *ctx,
|
_swrast_BlitFramebuffer(struct gl_context *ctx,
|
||||||
|
struct gl_framebuffer *readFb,
|
||||||
|
struct gl_framebuffer *drawFb,
|
||||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||||
GLbitfield mask, GLenum filter);
|
GLbitfield mask, GLenum filter);
|
||||||
|
Reference in New Issue
Block a user