62
62
#if FEATURE_EXT_framebuffer_blit
65
st_BlitFramebuffer_resolve(struct gl_context *ctx,
67
struct pipe_resolve_info *info)
69
const GLbitfield depthStencil = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
71
struct st_context *st = st_context(ctx);
73
struct st_renderbuffer *srcRb, *dstRb;
75
if (mask & GL_COLOR_BUFFER_BIT) {
76
srcRb = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
77
dstRb = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
79
info->mask = PIPE_MASK_RGBA;
81
info->src.res = srcRb->texture;
82
info->src.layer = srcRb->surface->u.tex.first_layer;
83
info->dst.res = dstRb->texture;
84
info->dst.level = dstRb->surface->u.tex.level;
85
info->dst.layer = dstRb->surface->u.tex.first_layer;
87
st->pipe->resource_resolve(st->pipe, info);
90
if (mask & depthStencil) {
91
struct gl_renderbuffer_attachment *srcDepth, *srcStencil;
92
struct gl_renderbuffer_attachment *dstDepth, *dstStencil;
95
srcDepth = &ctx->ReadBuffer->Attachment[BUFFER_DEPTH];
96
dstDepth = &ctx->DrawBuffer->Attachment[BUFFER_DEPTH];
97
srcStencil = &ctx->ReadBuffer->Attachment[BUFFER_STENCIL];
98
dstStencil = &ctx->DrawBuffer->Attachment[BUFFER_STENCIL];
101
st_is_depth_stencil_combined(srcDepth, srcStencil) &&
102
st_is_depth_stencil_combined(dstDepth, dstStencil);
104
if ((mask & GL_DEPTH_BUFFER_BIT) || combined) {
105
/* resolve depth and, if combined and requested, stencil as well */
106
srcRb = st_renderbuffer(srcDepth->Renderbuffer);
107
dstRb = st_renderbuffer(dstDepth->Renderbuffer);
109
info->mask = (mask & GL_DEPTH_BUFFER_BIT) ? PIPE_MASK_Z : 0;
110
if (combined && (mask & GL_STENCIL_BUFFER_BIT)) {
111
mask &= ~GL_STENCIL_BUFFER_BIT;
112
info->mask |= PIPE_MASK_S;
115
info->src.res = srcRb->texture;
116
info->src.layer = srcRb->surface->u.tex.first_layer;
117
info->dst.res = dstRb->texture;
118
info->dst.level = dstRb->surface->u.tex.level;
119
info->dst.layer = dstRb->surface->u.tex.first_layer;
121
st->pipe->resource_resolve(st->pipe, info);
124
if (mask & GL_STENCIL_BUFFER_BIT) {
125
/* resolve separate stencil buffer */
126
srcRb = st_renderbuffer(srcStencil->Renderbuffer);
127
dstRb = st_renderbuffer(dstStencil->Renderbuffer);
129
info->mask = PIPE_MASK_S;
131
info->src.res = srcRb->texture;
132
info->src.layer = srcRb->surface->u.tex.first_layer;
133
info->dst.res = dstRb->texture;
134
info->dst.level = dstRb->surface->u.tex.level;
135
info->dst.layer = dstRb->surface->u.tex.first_layer;
137
st->pipe->resource_resolve(st->pipe, info);
65
143
st_BlitFramebuffer(struct gl_context *ctx,
66
144
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
67
145
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
95
173
srcY1 = readFB->Height - srcY1;
176
/* Disable conditional rendering. */
177
if (st->render_condition) {
178
st->pipe->render_condition(st->pipe, NULL, 0);
181
if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers) {
182
struct pipe_resolve_info info;
207
st_BlitFramebuffer_resolve(ctx, mask, &info); /* filter doesn't apply */
98
212
if (srcY0 > srcY1 && dstY0 > dstY1) {
99
213
/* Both src and dst are upside down. Swap Y to make it
100
214
* right-side up to increase odds of using a fast path.