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

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/intel/intel_pixel_copy.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:
34
34
 
35
35
#include "intel_context.h"
36
36
#include "intel_buffers.h"
 
37
#include "intel_mipmap_tree.h"
37
38
#include "intel_regions.h"
38
39
#include "intel_pixel.h"
39
40
#include "intel_fbo.h"
45
46
 * glCopyPixels.  Differs from intel_check_blit_fragment_ops in that
46
47
 * we allow Scissor.
47
48
 */
48
 
static GLboolean
 
49
static bool
49
50
intel_check_copypixel_blit_fragment_ops(struct gl_context * ctx)
50
51
{
51
52
   if (ctx->NewState)
71
72
/**
72
73
 * CopyPixels with the blitter.  Don't support zooming, pixel transfer, etc.
73
74
 */
74
 
static GLboolean
 
75
static bool
75
76
do_blit_copypixels(struct gl_context * ctx,
76
77
                   GLint srcx, GLint srcy,
77
78
                   GLsizei width, GLsizei height,
84
85
   GLint orig_dsty;
85
86
   GLint orig_srcx;
86
87
   GLint orig_srcy;
87
 
   GLboolean flip = GL_FALSE;
 
88
   bool flip = false;
88
89
   struct intel_renderbuffer *draw_irb = NULL;
89
90
   struct intel_renderbuffer *read_irb = NULL;
 
91
   gl_format read_format, draw_format;
90
92
 
91
93
   /* Update draw buffer bounds */
92
94
   _mesa_update_state(ctx);
95
97
   case GL_COLOR:
96
98
      if (fb->_NumColorDrawBuffers != 1) {
97
99
         fallback_debug("glCopyPixels() fallback: MRT\n");
98
 
         return GL_FALSE;
 
100
         return false;
99
101
      }
100
102
 
101
103
      draw_irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
108
110
      break;
109
111
   case GL_DEPTH:
110
112
      fallback_debug("glCopyPixels() fallback: GL_DEPTH\n");
111
 
      return GL_FALSE;
 
113
      return false;
112
114
   case GL_STENCIL:
113
115
      fallback_debug("glCopyPixels() fallback: GL_STENCIL\n");
114
 
      return GL_FALSE;
 
116
      return false;
115
117
   default:
116
118
      fallback_debug("glCopyPixels(): Unknown type\n");
117
 
      return GL_FALSE;
 
119
      return false;
118
120
   }
119
121
 
120
122
   if (!draw_irb) {
121
123
      fallback_debug("glCopyPixels() fallback: missing draw buffer\n");
122
 
      return GL_FALSE;
 
124
      return false;
123
125
   }
124
126
 
125
127
   if (!read_irb) {
126
128
      fallback_debug("glCopyPixels() fallback: missing read buffer\n");
127
 
      return GL_FALSE;
 
129
      return false;
128
130
   }
129
131
 
130
 
   if (draw_irb->Base.Format != read_irb->Base.Format &&
131
 
       !(draw_irb->Base.Format == MESA_FORMAT_XRGB8888 &&
132
 
         read_irb->Base.Format == MESA_FORMAT_ARGB8888)) {
 
132
   read_format = intel_rb_format(read_irb);
 
133
   draw_format = intel_rb_format(draw_irb);
 
134
 
 
135
   if (draw_format != read_format &&
 
136
       !(draw_format == MESA_FORMAT_XRGB8888 &&
 
137
         read_format == MESA_FORMAT_ARGB8888)) {
133
138
      fallback_debug("glCopyPixels() fallback: mismatched formats (%s -> %s\n",
134
 
                     _mesa_get_format_name(read_irb->Base.Format),
135
 
                     _mesa_get_format_name(draw_irb->Base.Format));
136
 
      return GL_FALSE;
 
139
                     _mesa_get_format_name(read_format),
 
140
                     _mesa_get_format_name(draw_format));
 
141
      return false;
137
142
   }
138
143
 
139
144
   /* Copypixels can be more than a straight copy.  Ensure all the
141
146
    */
142
147
   if (!intel_check_copypixel_blit_fragment_ops(ctx) ||
143
148
       ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F)
144
 
      return GL_FALSE;
 
149
      return false;
145
150
 
146
151
   intel_prepare_render(intel);
147
152
 
188
193
   dsty += draw_irb->draw_y;
189
194
 
190
195
   if (!intel_region_copy(intel,
191
 
                          draw_irb->region, 0, dstx, dsty,
192
 
                          read_irb->region, 0, srcx, srcy,
 
196
                          draw_irb->mt->region, 0, dstx, dsty,
 
197
                          read_irb->mt->region, 0, srcx, srcy,
193
198
                          width, height, flip,
194
199
                          ctx->Color.ColorLogicOpEnabled ?
195
200
                          ctx->Color.LogicOp : GL_COPY)) {
196
201
      DBG("%s: blit failure\n", __FUNCTION__);
197
 
      return GL_FALSE;
 
202
      return false;
198
203
   }
199
204
 
200
205
out:
201
206
   intel_check_front_buffer_rendering(intel);
202
207
 
203
208
   DBG("%s: success\n", __FUNCTION__);
204
 
   return GL_TRUE;
 
209
   return true;
205
210
}
206
211
 
207
212