~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/state_tracker/st_cb_blit.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
#if FEATURE_EXT_framebuffer_blit
63
63
 
64
64
static void
 
65
st_BlitFramebuffer_resolve(struct gl_context *ctx,
 
66
                           GLbitfield mask,
 
67
                           struct pipe_resolve_info *info)
 
68
{
 
69
   const GLbitfield depthStencil = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
 
70
 
 
71
   struct st_context *st = st_context(ctx);
 
72
 
 
73
   struct st_renderbuffer *srcRb, *dstRb;
 
74
 
 
75
   if (mask & GL_COLOR_BUFFER_BIT) {
 
76
      srcRb = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
 
77
      dstRb = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
 
78
 
 
79
      info->mask = PIPE_MASK_RGBA;
 
80
 
 
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;
 
86
 
 
87
      st->pipe->resource_resolve(st->pipe, info);
 
88
   }
 
89
 
 
90
   if (mask & depthStencil) {
 
91
      struct gl_renderbuffer_attachment *srcDepth, *srcStencil;
 
92
      struct gl_renderbuffer_attachment *dstDepth, *dstStencil;
 
93
      boolean combined;
 
94
 
 
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];
 
99
 
 
100
      combined =
 
101
         st_is_depth_stencil_combined(srcDepth, srcStencil) &&
 
102
         st_is_depth_stencil_combined(dstDepth, dstStencil);
 
103
 
 
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);
 
108
 
 
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;
 
113
         }
 
114
 
 
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;
 
120
 
 
121
         st->pipe->resource_resolve(st->pipe, info);
 
122
      }
 
123
 
 
124
      if (mask & GL_STENCIL_BUFFER_BIT) {
 
125
         /* resolve separate stencil buffer */
 
126
         srcRb = st_renderbuffer(srcStencil->Renderbuffer);
 
127
         dstRb = st_renderbuffer(dstStencil->Renderbuffer);
 
128
 
 
129
         info->mask = PIPE_MASK_S;
 
130
 
 
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;
 
136
 
 
137
         st->pipe->resource_resolve(st->pipe, info);
 
138
      }
 
139
   }
 
140
}
 
141
 
 
142
static void
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;
96
174
   }
97
175
 
 
176
   /* Disable conditional rendering. */
 
177
   if (st->render_condition) {
 
178
      st->pipe->render_condition(st->pipe, NULL, 0);
 
179
   }
 
180
 
 
181
   if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers) {
 
182
      struct pipe_resolve_info info;
 
183
 
 
184
      if (dstX0 < dstX1) {
 
185
         info.dst.x0 = dstX0;
 
186
         info.dst.x1 = dstX1;
 
187
         info.src.x0 = srcX0;
 
188
         info.src.x1 = srcX1;
 
189
      } else {
 
190
         info.dst.x0 = dstX1;
 
191
         info.dst.x1 = dstX0;
 
192
         info.src.x0 = srcX1;
 
193
         info.src.x1 = srcX0;
 
194
      }
 
195
      if (dstY0 < dstY1) {
 
196
         info.dst.y0 = dstY0;
 
197
         info.dst.y1 = dstY1;
 
198
         info.src.y0 = srcY0;
 
199
         info.src.y1 = srcY1;
 
200
      } else {
 
201
         info.dst.y0 = dstY1;
 
202
         info.dst.y1 = dstY0;
 
203
         info.src.y0 = srcY1;
 
204
         info.src.y1 = srcY0;
 
205
      }
 
206
 
 
207
      st_BlitFramebuffer_resolve(ctx, mask, &info); /* filter doesn't apply */
 
208
 
 
209
      goto done;
 
210
   }
 
211
 
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.
109
223
      dstY1 = tmp;
110
224
   }
111
225
 
112
 
   /* Disable conditional rendering. */
113
 
   if (st->render_condition) {
114
 
      st->pipe->render_condition(st->pipe, NULL, 0);
115
 
   }
116
 
 
117
226
   if (mask & GL_COLOR_BUFFER_BIT) {
118
227
      struct gl_renderbuffer_attachment *srcAtt =
119
228
         &readFB->Attachment[readFB->_ColorReadBufferIndex];