Fix confusion over pitch. demos/texobj renders correctly.

This commit is contained in:
Keith Whitwell 2006-01-25 17:16:46 +00:00
parent 4578d7b9f0
commit f67bb30314
5 changed files with 15 additions and 14 deletions

View file

@ -62,7 +62,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt )
GLuint face;
/* double pitch for cube layouts */
mt->pitch = (dim * mt->cpp * 2 + 3) & ~3;
mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
mt->total_height = dim * 4;
for ( face = 0 ; face < 6 ; face++) {
@ -95,7 +95,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt )
* minimum of 8 mipmaps, some of which might ultimately not be
* used:
*/
mt->pitch = (mt->width0 * mt->cpp + 3) & ~3;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
/* XXX: fixme! hardware expects/requires 9 levels at minimum.
@ -128,7 +128,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt )
GLuint width = mt->width0;
GLuint height = mt->height0;
mt->pitch = (mt->width0 * mt->cpp + 3) & ~3;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
@ -169,9 +169,9 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt )
* or the final row of 4x4, 2x2 and 1x1 faces below this.
*/
if (dim > 32)
mt->pitch = (dim * mt->cpp * 2 + 3) & ~3;
mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
else
mt->pitch = 14 * 8 * mt->cpp;
mt->pitch = 14 * 8;
mt->total_height = dim * 4 + 4;
@ -245,10 +245,10 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt )
GLuint depth_pack_pitch;
GLuint depth_packing = 0;
mt->pitch = (mt->width0 * mt->cpp + 3) & ~3;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
depth_pack_pitch = mt->pitch;
depth_pack_pitch = mt->pitch * mt->cpp;
for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
@ -287,7 +287,7 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt )
GLuint width = mt->width0;
GLuint height = mt->height0;
mt->pitch = (mt->width0 * mt->cpp + 3) & ~3;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
@ -301,7 +301,7 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt )
/* LPT change: step right after second mipmap.
*/
if (i == 1)
x += mt->pitch / (2 * mt->cpp);
x += mt->pitch / 2;
else {
GLuint img_height;

View file

@ -130,7 +130,7 @@ static GLboolean i915_update_tex_unit( GLcontext *ctx,
MS3_USE_FENCE_REGS);
state[I915_TEXREG_MS4] =
((((intelObj->mt->pitch / 4) - 1) << MS4_PITCH_SHIFT) |
(((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) - 1) << MS4_PITCH_SHIFT) |
MS4_CUBE_FACE_ENA_MASK |
((((intelObj->lastLevel - intelObj->firstLevel) * 4)) << MS4_MAX_LOD_SHIFT) |
((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));

View file

@ -34,7 +34,7 @@
#define BATCH_LOCALS GLubyte *batch_ptr;
#define VERBOSE 1
#define VERBOSE 0
#define BEGIN_BATCH(n) \

View file

@ -98,8 +98,9 @@ void intel_dump_batchbuffer( long offset,
int i;
fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count);
for (i = 0; i < count/4; i += 4)
fprintf(stderr, "\t0x%x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
(unsigned int)offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
fprintf(stderr, "\t0x%08x 0x%08x 0x%08x 0x%08x\n",
/* (unsigned int)offset + i*4, */
ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
fprintf(stderr, "END BATCH\n\n\n");
}

View file

@ -183,7 +183,7 @@ GLubyte *intel_miptree_image_map(struct intel_context *intel,
GLuint level,
GLuint *stride)
{
_mesa_printf("%s\n", __FUNCTION__);
_mesa_printf("%s \n", __FUNCTION__);
if (stride)
*stride = mt->pitch * mt->cpp;