struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
const GLuint surf_index = SURF_INDEX_TEXTURE(unit);
uint32_t *surf;
+ int width, height, depth;
+
+ intel_miptree_get_dimensions_for_image(firstImage, &width, &height, &depth);
surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
6 * 4, 32, &brw->wm.surf_offset[surf_index]);
surf[1] = intelObj->mt->region->bo->offset; /* reloc */
surf[2] = ((intelObj->_MaxLevel - tObj->BaseLevel) << BRW_SURFACE_LOD_SHIFT |
- (firstImage->Width - 1) << BRW_SURFACE_WIDTH_SHIFT |
- (firstImage->Height - 1) << BRW_SURFACE_HEIGHT_SHIFT);
+ (width - 1) << BRW_SURFACE_WIDTH_SHIFT |
+ (height - 1) << BRW_SURFACE_HEIGHT_SHIFT);
surf[3] = (brw_get_surface_tiling_bits(intelObj->mt->region->tiling) |
- (firstImage->Depth - 1) << BRW_SURFACE_DEPTH_SHIFT |
+ (depth - 1) << BRW_SURFACE_DEPTH_SHIFT |
((intelObj->mt->region->pitch * intelObj->mt->cpp) - 1) <<
BRW_SURFACE_PITCH_SHIFT);
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
const GLuint surf_index = SURF_INDEX_TEXTURE(unit);
struct gen7_surface_state *surf;
+ int width, height, depth;
+
+ intel_miptree_get_dimensions_for_image(firstImage, &width, &height, &depth);
surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
sizeof(*surf), 32, &brw->wm.surf_offset[surf_index]);
surf->ss1.base_addr = intelObj->mt->region->bo->offset; /* reloc */
- surf->ss2.width = firstImage->Width - 1;
- surf->ss2.height = firstImage->Height - 1;
+ surf->ss2.width = width - 1;
+ surf->ss2.height = height - 1;
surf->ss3.pitch = (intelObj->mt->region->pitch * intelObj->mt->cpp) - 1;
- surf->ss3.depth = firstImage->Depth - 1;
+ surf->ss3.depth = depth - 1;
/* ss4: ignored? */
int pitch, cpp;
drm_intel_bo *aper_array[2];
struct intel_region *region = intel_image->mt->region;
+ int width, height, depth;
BATCH_LOCALS;
+ intel_miptree_get_dimensions_for_image(&intel_image->base.Base,
+ &width, &height, &depth);
+ assert(depth == 1);
+
assert(intel_image->base.Base.TexFormat == MESA_FORMAT_ARGB8888);
/* get dest x/y in destination texture */
x1 = image_x;
y1 = image_y;
- x2 = image_x + intel_image->base.Base.Width;
- y2 = image_y + intel_image->base.Base.Height;
+ x2 = image_x + width;
+ y2 = image_y + height;
pitch = region->pitch;
cpp = region->cpp;
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(texImage);
+ int width, height, depth;
if (!intel_span_supports_format(texImage->TexFormat)) {
DBG("Render to texture BAD FORMAT %s\n",
DBG("Render to texture %s\n", _mesa_get_format_name(texImage->TexFormat));
}
+ intel_miptree_get_dimensions_for_image(texImage, &width, &height, &depth);
+
irb->Base.Format = texImage->TexFormat;
irb->Base.DataType = intel_mesa_format_to_rb_datatype(texImage->TexFormat);
irb->Base.InternalFormat = texImage->InternalFormat;
irb->Base._BaseFormat = _mesa_base_tex_format(ctx, irb->Base.InternalFormat);
- irb->Base.Width = texImage->Width;
- irb->Base.Height = texImage->Height;
+ irb->Base.Width = width;
+ irb->Base.Height = height;
irb->Base.Delete = intel_delete_renderbuffer;
irb->Base.AllocStorage = intel_nop_alloc_storage;
*/
struct intel_context *intel = intel_context(ctx);
struct intel_mipmap_tree *new_mt;
+ int width, height, depth;
+
+ intel_miptree_get_dimensions_for_image(image, &width, &height, &depth);
new_mt = intel_miptree_create(intel, image->TexObject->Target,
intel_image->base.Base.TexFormat,
intel_image->base.Base.Level,
intel_image->base.Base.Level,
- intel_image->base.Base.Width,
- intel_image->base.Base.Height,
- intel_image->base.Base.Depth,
+ width, height, depth,
GL_TRUE);
intel_miptree_copy_teximage(intel, intel_image, new_mt);
*mt = NULL;
}
+void
+intel_miptree_get_dimensions_for_image(struct gl_texture_image *image,
+ int *width, int *height, int *depth)
+{
+ switch (image->TexObject->Target) {
+ case GL_TEXTURE_1D_ARRAY:
+ *width = image->Width;
+ *height = 1;
+ *depth = image->Height;
+ break;
+ default:
+ *width = image->Width;
+ *height = image->Height;
+ *depth = image->Depth;
+ break;
+ }
+}
/**
* Can the image be pulled into a unified mipmap tree? This mirrors
{
struct intel_texture_image *intelImage = intel_texture_image(image);
GLuint level = intelImage->base.Base.Level;
+ int width, height, depth;
/* Images with borders are never pulled into mipmap trees. */
if (image->Border)
if (image->TexFormat != mt->format)
return GL_FALSE;
+ intel_miptree_get_dimensions_for_image(image, &width, &height, &depth);
+
/* Test image dimensions against the base level image adjusted for
* minification. This will also catch images not present in the
* tree, changed targets, etc.
*/
- if (image->Width != mt->level[level].width ||
- image->Height != mt->level[level].height ||
- image->Depth != mt->level[level].depth)
+ if (width != mt->level[level].width ||
+ height != mt->level[level].height ||
+ depth != mt->level[level].depth)
return GL_FALSE;
return GL_TRUE;
GLuint level, GLuint face, GLuint depth,
GLuint *x, GLuint *y);
+void
+intel_miptree_get_dimensions_for_image(struct gl_texture_image *image,
+ int *width, int *height, int *depth);
+
void intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
GLuint level,
GLuint nr_images,
{
GLuint firstLevel;
GLuint lastLevel;
- GLuint width = intelImage->base.Base.Width;
- GLuint height = intelImage->base.Base.Height;
- GLuint depth = intelImage->base.Base.Depth;
+ int width, height, depth;
GLuint i;
+ intel_miptree_get_dimensions_for_image(&intelImage->base.Base,
+ &width, &height, &depth);
+
DBG("%s\n", __FUNCTION__);
if (intelImage->base.Base.Border)
return NULL;
if (intelImage->base.Base.Level > intelObj->base.BaseLevel &&
- (intelImage->base.Base.Width == 1 ||
- (intelObj->base.Target != GL_TEXTURE_1D &&
- intelImage->base.Base.Height == 1) ||
- (intelObj->base.Target == GL_TEXTURE_3D &&
- intelImage->base.Base.Depth == 1))) {
+ (width == 1 ||
+ (intelObj->base.Target != GL_TEXTURE_1D && height == 1) ||
+ (intelObj->base.Target == GL_TEXTURE_3D && depth == 1))) {
/* For this combination, we're at some lower mipmap level and
* some important dimension is 1. We can't extrapolate up to a
* likely base level width/height/depth for a full mipmap stack
struct gl_context *ctx = &intel->ctx;
struct gl_renderbuffer *depth_rb = intel_image->depth_rb;
struct gl_renderbuffer *stencil_rb = intel_image->stencil_rb;
+ int w, h, d;
- int w = intel_image->base.Base.Width;
- int h = intel_image->base.Base.Height;
+ intel_miptree_get_dimensions_for_image(&intel_image->base.Base, &w, &h, &d);
+ assert(d == 1); /* FINISHME */
uint32_t depth_row[w];
uint8_t stencil_row[w];
struct intel_texture_image *image)
{
struct gl_context *ctx = &intel->ctx;
-
bool ok = true;
- int width = image->base.Base.Width;
- int height = image->base.Base.Height;
+ int width, height, depth;
struct gl_renderbuffer *drb;
struct gl_renderbuffer *srb;
struct intel_renderbuffer *idrb;
struct intel_renderbuffer *isrb;
+ intel_miptree_get_dimensions_for_image(&image->base.Base,
+ &width, &height, &depth);
+ assert(depth == 1); /* FINISHME */
+
assert(intel->has_separate_stencil);
assert(image->base.Base.TexFormat == MESA_FORMAT_S8_Z24);
assert(image->mt != NULL);
GLuint face, i;
GLuint nr_faces = 0;
struct intel_texture_image *firstImage;
+ int width, height, depth;
/* We know/require this is true by now:
*/
return GL_FALSE;
}
+ intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
+ &width, &height, &depth);
+
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
*
intelObj->mt->format != firstImage->base.Base.TexFormat ||
intelObj->mt->first_level != tObj->BaseLevel ||
intelObj->mt->last_level < intelObj->_MaxLevel ||
- intelObj->mt->width0 != firstImage->base.Base.Width ||
- intelObj->mt->height0 != firstImage->base.Base.Height ||
- intelObj->mt->depth0 != firstImage->base.Base.Depth)) {
+ intelObj->mt->width0 != width ||
+ intelObj->mt->height0 != height ||
+ intelObj->mt->depth0 != depth)) {
intel_miptree_release(&intelObj->mt);
}
firstImage->base.Base.TexFormat,
tObj->BaseLevel,
intelObj->_MaxLevel,
- firstImage->base.Base.Width,
- firstImage->base.Base.Height,
- firstImage->base.Base.Depth,
+ width,
+ height,
+ depth,
GL_TRUE);
if (!intelObj->mt)
return GL_FALSE;