aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_tex_layout.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-04-30 15:27:13 +0200
committerRoland Scheidegger <[email protected]>2010-04-30 15:27:13 +0200
commit7662e3519bef3802024da3050b886068281e02b1 (patch)
treebc5bf675e67febffaf9e4d1fadd139e8c253ae32 /src/mesa/drivers/dri/i965/brw_tex_layout.c
parent9a966b93c03aecac8eb72e6133aa9a2f2c7673f3 (diff)
parent7c769bef052fc1936d7ab33e291bb4646dc5b0d1 (diff)
Merge commit 'origin/master' into gallium-msaa
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_tex_layout.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c80
1 files changed, 18 insertions, 62 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 9a215ab8a4d..768ccfd79c4 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -49,74 +49,30 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
switch (mt->target) {
case GL_TEXTURE_CUBE_MAP:
if (intel->gen == 5) {
- GLuint align_h = 2, align_w = 4;
+ GLuint align_h = 2;
GLuint level;
- GLuint x = 0;
- GLuint y = 0;
- GLuint width = mt->width0;
- GLuint height = mt->height0;
GLuint qpitch = 0;
- GLuint y_pitch = 0;
+ int h0, h1, q;
- mt->total_width = mt->width0;
- intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h);
- y_pitch = ALIGN(height, align_h);
+ /* On Ironlake, cube maps are finally represented as just a series
+ * of MIPLAYOUT_BELOW 2D textures (like 2D texture arrays), separated
+ * by a pitch of qpitch rows, where qpitch is defined by the equation
+ * given in Volume 1 of the BSpec.
+ */
+ h0 = ALIGN(mt->height0, align_h);
+ h1 = ALIGN(minify(h0), align_h);
+ qpitch = (h0 + h1 + 11 * align_h);
+ if (mt->compressed)
+ qpitch /= 4;
- if (mt->compressed) {
- mt->total_width = ALIGN(mt->width0, align_w);
- }
-
- if (mt->first_level != mt->last_level) {
- GLuint mip1_width;
-
- if (mt->compressed) {
- mip1_width = ALIGN(minify(mt->width0), align_w)
- + ALIGN(minify(minify(mt->width0)), align_w);
- } else {
- mip1_width = ALIGN(minify(mt->width0), align_w)
- + minify(minify(mt->width0));
- }
-
- if (mip1_width > mt->total_width) {
- mt->total_width = mip1_width;
- }
- }
-
- if (mt->compressed) {
- qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4;
- mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * 6;
- } else {
- qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h);
- mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * 6;
- }
+ i945_miptree_layout_2d(intel, mt, tiling, 6);
for (level = mt->first_level; level <= mt->last_level; level++) {
- GLuint img_height;
- GLuint nr_images = 6;
- GLuint q = 0;
-
- intel_miptree_set_level_info(mt, level, nr_images, x, y, width,
- height, 1);
-
- for (q = 0; q < nr_images; q++)
- intel_miptree_set_image_offset(mt, level, q,
- x, y + q * qpitch);
-
- if (mt->compressed)
- img_height = MAX2(1, height/4);
- else
- img_height = ALIGN(height, align_h);
-
- if (level == mt->first_level + 1) {
- x += ALIGN(width, align_w);
- }
- else {
- y += img_height;
- }
-
- width = minify(width);
- height = minify(height);
+ for (q = 0; q < 6; q++) {
+ intel_miptree_set_image_offset(mt, level, q, 0, q * qpitch);
+ }
}
+ mt->total_height = qpitch * 6;
break;
}
@@ -206,7 +162,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
}
default:
- i945_miptree_layout_2d(intel, mt, tiling);
+ i945_miptree_layout_2d(intel, mt, tiling, 1);
break;
}
DBG("%s: %dx%dx%d\n", __FUNCTION__,