summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_tex_layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_tex_layout.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index d77bf4d..eaea49b 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -41,39 +41,31 @@
static void
brw_miptree_layout_texture_array(struct intel_context *intel,
- struct intel_mipmap_tree *mt,
- int slices)
+ struct intel_mipmap_tree *mt)
{
- GLuint align_w;
- GLuint align_h;
GLuint level;
GLuint qpitch = 0;
int h0, h1, q;
- intel_get_texture_alignment_unit(mt->format, &align_w, &align_h);
-
- h0 = ALIGN(mt->height0, align_h);
- h1 = ALIGN(minify(mt->height0), align_h);
- qpitch = (h0 + h1 + (intel->gen >= 7 ? 12 : 11) * align_h);
+ h0 = ALIGN(mt->height0, mt->align_h);
+ h1 = ALIGN(minify(mt->height0), mt->align_h);
+ qpitch = (h0 + h1 + (intel->gen >= 7 ? 12 : 11) * mt->align_h);
if (mt->compressed)
qpitch /= 4;
- i945_miptree_layout_2d(mt, slices);
+ i945_miptree_layout_2d(mt);
for (level = mt->first_level; level <= mt->last_level; level++) {
- for (q = 0; q < slices; q++) {
+ for (q = 0; q < mt->depth0; q++) {
intel_miptree_set_image_offset(mt, level, q, 0, q * qpitch);
}
}
- mt->total_height = qpitch * slices;
+ mt->total_height = qpitch * mt->depth0;
}
void
brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
{
- /* XXX: these vary depending on image format: */
- /* GLint align_w = 4; */
-
switch (mt->target) {
case GL_TEXTURE_CUBE_MAP:
if (intel->gen >= 5) {
@@ -82,7 +74,7 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
* pitch of qpitch rows, where qpitch is defined by the equation given
* in Volume 1 of the BSpec.
*/
- brw_miptree_layout_texture_array(intel, mt, 6);
+ brw_miptree_layout_texture_array(intel, mt);
break;
}
/* FALLTHROUGH */
@@ -94,18 +86,15 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
GLuint pack_x_pitch, pack_x_nr;
GLuint pack_y_pitch;
GLuint level;
- GLuint align_h = 2;
- GLuint align_w = 4;
mt->total_height = 0;
- intel_get_texture_alignment_unit(mt->format, &align_w, &align_h);
if (mt->compressed) {
- mt->total_width = ALIGN(width, align_w);
+ mt->total_width = ALIGN(width, mt->align_w);
pack_y_pitch = (height + 3) / 4;
} else {
mt->total_width = mt->width0;
- pack_y_pitch = ALIGN(mt->height0, align_h);
+ pack_y_pitch = ALIGN(mt->height0, mt->align_h);
}
pack_x_pitch = width;
@@ -117,7 +106,7 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
GLint y = 0;
GLint q, j;
- intel_miptree_set_level_info(mt, level, nr_images,
+ intel_miptree_set_level_info(mt, level,
0, mt->total_height,
width, height, depth);
@@ -140,8 +129,8 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
if (mt->compressed) {
pack_y_pitch = (height + 3) / 4;
- if (pack_x_pitch > ALIGN(width, align_w)) {
- pack_x_pitch = ALIGN(width, align_w);
+ if (pack_x_pitch > ALIGN(width, mt->align_w)) {
+ pack_x_pitch = ALIGN(width, mt->align_w);
pack_x_nr <<= 1;
}
} else {
@@ -153,7 +142,7 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
if (pack_y_pitch > 2) {
pack_y_pitch >>= 1;
- pack_y_pitch = ALIGN(pack_y_pitch, align_h);
+ pack_y_pitch = ALIGN(pack_y_pitch, mt->align_h);
}
}
@@ -170,11 +159,11 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_1D_ARRAY:
- brw_miptree_layout_texture_array(intel, mt, mt->depth0);
+ brw_miptree_layout_texture_array(intel, mt);
break;
default:
- i945_miptree_layout_2d(mt, 1);
+ i945_miptree_layout_2d(mt);
break;
}
DBG("%s: %dx%dx%d\n", __FUNCTION__,