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

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i915/i915_tex_layout.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:
112
112
 *
113
113
 */
114
114
static void
115
 
i915_miptree_layout_cube(struct intel_context *intel,
116
 
                         struct intel_mipmap_tree * mt,
117
 
                         uint32_t tiling)
 
115
i915_miptree_layout_cube(struct intel_mipmap_tree * mt)
118
116
{
119
117
   const GLuint dim = mt->width0;
120
118
   GLuint face;
128
126
   mt->total_height = dim * 4;
129
127
 
130
128
   for (level = mt->first_level; level <= mt->last_level; level++) {
131
 
      intel_miptree_set_level_info(mt, level, 6,
 
129
      intel_miptree_set_level_info(mt, level,
132
130
                                   0, 0,
133
131
                                   lvlWidth, lvlHeight,
134
 
                                   1);
 
132
                                   6);
135
133
      lvlWidth /= 2;
136
134
      lvlHeight /= 2;
137
135
   }
156
154
}
157
155
 
158
156
static void
159
 
i915_miptree_layout_3d(struct intel_context *intel,
160
 
                       struct intel_mipmap_tree * mt,
161
 
                       uint32_t tiling)
 
157
i915_miptree_layout_3d(struct intel_mipmap_tree * mt)
162
158
{
163
159
   GLuint width = mt->width0;
164
160
   GLuint height = mt->height0;
171
167
 
172
168
   /* XXX: hardware expects/requires 9 levels at minimum. */
173
169
   for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) {
174
 
      intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height,
 
170
      intel_miptree_set_level_info(mt, level, 0, mt->total_height,
175
171
                                   width, height, depth);
176
172
 
177
173
      stack_height += MAX2(2, height);
201
197
}
202
198
 
203
199
static void
204
 
i915_miptree_layout_2d(struct intel_context *intel,
205
 
                       struct intel_mipmap_tree * mt,
206
 
                       uint32_t tiling)
 
200
i915_miptree_layout_2d(struct intel_mipmap_tree * mt)
207
201
{
208
202
   GLuint width = mt->width0;
209
203
   GLuint height = mt->height0;
214
208
   mt->total_height = 0;
215
209
 
216
210
   for (level = mt->first_level; level <= mt->last_level; level++) {
217
 
      intel_miptree_set_level_info(mt, level, 1,
 
211
      intel_miptree_set_level_info(mt, level,
218
212
                                   0, mt->total_height,
219
213
                                   width, height, 1);
220
214
 
230
224
   }
231
225
}
232
226
 
233
 
GLboolean
234
 
i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
235
 
                    uint32_t tiling)
 
227
void
 
228
i915_miptree_layout(struct intel_mipmap_tree * mt)
236
229
{
237
230
   switch (mt->target) {
238
231
   case GL_TEXTURE_CUBE_MAP:
239
 
      i915_miptree_layout_cube(intel, mt, tiling);
 
232
      i915_miptree_layout_cube(mt);
240
233
      break;
241
234
   case GL_TEXTURE_3D:
242
 
      i915_miptree_layout_3d(intel, mt, tiling);
 
235
      i915_miptree_layout_3d(mt);
243
236
      break;
244
237
   case GL_TEXTURE_1D:
245
238
   case GL_TEXTURE_2D:
246
239
   case GL_TEXTURE_RECTANGLE_ARB:
247
 
      i915_miptree_layout_2d(intel, mt, tiling);
 
240
      i915_miptree_layout_2d(mt);
248
241
      break;
249
242
   default:
250
243
      _mesa_problem(NULL, "Unexpected tex target in i915_miptree_layout()");
253
246
 
254
247
   DBG("%s: %dx%dx%d\n", __FUNCTION__,
255
248
       mt->total_width, mt->total_height, mt->cpp);
256
 
 
257
 
   return GL_TRUE;
258
249
}
259
250
 
260
251
 
319
310
 */
320
311
 
321
312
static void
322
 
i945_miptree_layout_cube(struct intel_context *intel,
323
 
                         struct intel_mipmap_tree * mt,
324
 
                         uint32_t tiling)
 
313
i945_miptree_layout_cube(struct intel_mipmap_tree * mt)
325
314
{
326
315
   const GLuint dim = mt->width0;
327
316
   GLuint face;
346
335
 
347
336
   /* Set all the levels to effectively occupy the whole rectangular region. */
348
337
   for (level = mt->first_level; level <= mt->last_level; level++) {
349
 
      intel_miptree_set_level_info(mt, level, 6,
 
338
      intel_miptree_set_level_info(mt, level,
350
339
                                   0, 0,
351
 
                                   lvlWidth, lvlHeight, 1);
 
340
                                   lvlWidth, lvlHeight, 6);
352
341
      lvlWidth /= 2;
353
342
      lvlHeight /= 2;
354
343
   }
411
400
}
412
401
 
413
402
static void
414
 
i945_miptree_layout_3d(struct intel_context *intel,
415
 
                       struct intel_mipmap_tree * mt,
416
 
                       uint32_t tiling)
 
403
i945_miptree_layout_3d(struct intel_mipmap_tree * mt)
417
404
{
418
405
   GLuint width = mt->width0;
419
406
   GLuint height = mt->height0;
434
421
      GLint y = 0;
435
422
      GLint q, j;
436
423
 
437
 
      intel_miptree_set_level_info(mt, level, depth,
 
424
      intel_miptree_set_level_info(mt, level,
438
425
                                   0, mt->total_height,
439
426
                                   width, height, depth);
440
427
 
466
453
   }
467
454
}
468
455
 
469
 
GLboolean
470
 
i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
471
 
                    uint32_t tiling)
 
456
void
 
457
i945_miptree_layout(struct intel_mipmap_tree * mt)
472
458
{
473
459
   switch (mt->target) {
474
460
   case GL_TEXTURE_CUBE_MAP:
475
461
      if (mt->compressed)
476
 
         i945_miptree_layout_cube(intel, mt, tiling);
 
462
         i945_miptree_layout_cube(mt);
477
463
      else
478
 
         i915_miptree_layout_cube(intel, mt, tiling);
 
464
         i915_miptree_layout_cube(mt);
479
465
      break;
480
466
   case GL_TEXTURE_3D:
481
 
      i945_miptree_layout_3d(intel, mt, tiling);
 
467
      i945_miptree_layout_3d(mt);
482
468
      break;
483
469
   case GL_TEXTURE_1D:
484
470
   case GL_TEXTURE_2D:
485
471
   case GL_TEXTURE_RECTANGLE_ARB:
486
 
      i945_miptree_layout_2d(intel, mt, tiling, 1);
 
472
      i945_miptree_layout_2d(mt);
487
473
      break;
488
474
   default:
489
475
      _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
492
478
 
493
479
   DBG("%s: %dx%dx%d\n", __FUNCTION__,
494
480
       mt->total_width, mt->total_height, mt->cpp);
495
 
 
496
 
   return GL_TRUE;
497
481
}