struct intel_region *region = intel_image->mt->region;
BATCH_LOCALS;
- assert(intel_image->base.TexFormat == MESA_FORMAT_ARGB8888);
+ assert(intel_image->base.Base.TexFormat == MESA_FORMAT_ARGB8888);
/* get dest x/y in destination texture */
intel_miptree_get_image_offset(intel_image->mt,
- intel_image->base.Level,
- intel_image->base.Face,
+ intel_image->base.Base.Level,
+ intel_image->base.Base.Face,
0,
&image_x, &image_y);
x1 = image_x;
y1 = image_y;
- x2 = image_x + intel_image->base.Width;
- y2 = image_y + intel_image->base.Height;
+ x2 = image_x + intel_image->base.Base.Width;
+ y2 = image_y + intel_image->base.Base.Height;
pitch = region->pitch;
cpp = region->cpp;
/* compute offset of the particular 2D image within the texture region */
intel_miptree_get_image_offset(intel_image->mt,
- intel_image->base.Level,
- intel_image->base.Face,
+ intel_image->base.Base.Level,
+ intel_image->base.Base.Face,
zoffset,
&dst_x, &dst_y);
struct intel_mipmap_tree *new_mt;
new_mt = intel_miptree_create(intel, image->TexObject->Target,
- intel_image->base.TexFormat,
- intel_image->base.Level,
- intel_image->base.Level,
- intel_image->base.Width,
- intel_image->base.Height,
- intel_image->base.Depth,
+ 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,
GL_TRUE);
intel_miptree_image_copy(intel,
new_mt,
- intel_image->base.Face,
- intel_image->base.Level,
+ intel_image->base.Base.Face,
+ intel_image->base.Base.Level,
old_mt);
intel_miptree_release(intel, &intel_image->mt);
struct gl_texture_image *image)
{
struct intel_texture_image *intelImage = intel_texture_image(image);
- GLuint level = intelImage->base.Level;
+ GLuint level = intelImage->base.Base.Level;
/* Images with borders are never pulled into mipmap trees. */
if (image->Border)
{
struct gl_context *ctx = &intel->ctx;
struct intel_renderbuffer *irb;
- const GLenum internalFormat = intelImage->base.InternalFormat;
+ const GLenum internalFormat = intelImage->base.Base.InternalFormat;
bool copy_supported = false;
bool copy_supported_with_alpha_override = false;
return GL_FALSE;
}
- copy_supported = intelImage->base.TexFormat == irb->Base.Format;
+ copy_supported = intelImage->base.Base.TexFormat == irb->Base.Format;
/* Converting ARGB8888 to XRGB8888 is trivial: ignore the alpha bits */
if (irb->Base.Format == MESA_FORMAT_ARGB8888 &&
- intelImage->base.TexFormat == MESA_FORMAT_XRGB8888) {
+ intelImage->base.Base.TexFormat == MESA_FORMAT_XRGB8888) {
copy_supported = true;
}
/* Converting XRGB8888 to ARGB8888 requires setting the alpha bits to 1.0 */
if (irb->Base.Format == MESA_FORMAT_XRGB8888 &&
- intelImage->base.TexFormat == MESA_FORMAT_ARGB8888) {
+ intelImage->base.Base.TexFormat == MESA_FORMAT_ARGB8888) {
copy_supported_with_alpha_override = true;
}
if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS))
fprintf(stderr, "%s mismatched formats %s, %s\n",
__FUNCTION__,
- _mesa_get_format_name(intelImage->base.TexFormat),
+ _mesa_get_format_name(intelImage->base.Base.TexFormat),
_mesa_get_format_name(irb->Base.Format));
return GL_FALSE;
}
/* get dest x/y in destination texture */
intel_miptree_get_image_offset(intelImage->mt,
- intelImage->base.Level,
- intelImage->base.Face,
+ intelImage->base.Base.Level,
+ intelImage->base.Base.Face,
0,
&image_x, &image_y);
{
GLuint firstLevel;
GLuint lastLevel;
- GLuint width = intelImage->base.Width;
- GLuint height = intelImage->base.Height;
- GLuint depth = intelImage->base.Depth;
+ GLuint width = intelImage->base.Base.Width;
+ GLuint height = intelImage->base.Base.Height;
+ GLuint depth = intelImage->base.Base.Depth;
GLuint i;
DBG("%s\n", __FUNCTION__);
- if (intelImage->base.Border)
+ if (intelImage->base.Base.Border)
return NULL;
- if (intelImage->base.Level > intelObj->base.BaseLevel &&
- (intelImage->base.Width == 1 ||
+ if (intelImage->base.Base.Level > intelObj->base.BaseLevel &&
+ (intelImage->base.Base.Width == 1 ||
(intelObj->base.Target != GL_TEXTURE_1D &&
- intelImage->base.Height == 1) ||
+ intelImage->base.Base.Height == 1) ||
(intelObj->base.Target == GL_TEXTURE_3D &&
- intelImage->base.Depth == 1))) {
+ intelImage->base.Base.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
* from this info, so just allocate this one level.
*/
- firstLevel = intelImage->base.Level;
- lastLevel = intelImage->base.Level;
+ firstLevel = intelImage->base.Base.Level;
+ lastLevel = intelImage->base.Base.Level;
} else {
/* If this image disrespects BaseLevel, allocate from level zero.
* Usually BaseLevel == 0, so it's unlikely to happen.
*/
- if (intelImage->base.Level < intelObj->base.BaseLevel)
+ if (intelImage->base.Base.Level < intelObj->base.BaseLevel)
firstLevel = 0;
else
firstLevel = intelObj->base.BaseLevel;
/* Figure out image dimensions at start level. */
- for (i = intelImage->base.Level; i > firstLevel; i--) {
+ for (i = intelImage->base.Base.Level; i > firstLevel; i--) {
width <<= 1;
if (height != 1)
height <<= 1;
*/
if ((intelObj->base.Sampler.MinFilter == GL_NEAREST ||
intelObj->base.Sampler.MinFilter == GL_LINEAR) &&
- intelImage->base.Level == firstLevel &&
+ intelImage->base.Base.Level == firstLevel &&
(intel->gen < 4 || firstLevel == 0)) {
lastLevel = firstLevel;
} else {
return intel_miptree_create(intel,
intelObj->base.Target,
- intelImage->base.TexFormat,
+ intelImage->base.Base.TexFormat,
firstLevel,
lastLevel,
width,
else
src_stride = width;
- intel_miptree_get_image_offset(intelImage->mt, intelImage->base.Level,
- intelImage->base.Face, 0,
+ intel_miptree_get_image_offset(intelImage->mt, intelImage->base.Base.Level,
+ intelImage->base.Base.Face, 0,
&dst_x, &dst_y);
dst_stride = intelImage->mt->region->pitch;
else
src_stride = width;
- intel_miptree_get_image_offset(intelImage->mt, intelImage->base.Level,
- intelImage->base.Face, 0,
+ intel_miptree_get_image_offset(intelImage->mt, intelImage->base.Base.Level,
+ intelImage->base.Base.Face, 0,
&dst_x, &dst_y);
dst_stride = intelImage->mt->region->pitch;
struct gl_renderbuffer *depth_rb = intel_image->depth_rb;
struct gl_renderbuffer *stencil_rb = intel_image->stencil_rb;
- int w = intel_image->base.Width;
- int h = intel_image->base.Height;
+ int w = intel_image->base.Base.Width;
+ int h = intel_image->base.Base.Height;
uint32_t depth_row[w];
uint8_t stencil_row[w];
struct gl_context *ctx = &intel->ctx;
bool ok = true;
- int width = image->base.Width;
- int height = image->base.Height;
+ int width = image->base.Base.Width;
+ int height = image->base.Base.Height;
struct gl_renderbuffer *drb;
struct gl_renderbuffer *srb;
struct intel_renderbuffer *idrb;
struct intel_renderbuffer *isrb;
assert(intel->has_separate_stencil);
- assert(image->base.TexFormat == MESA_FORMAT_S8_Z24);
+ assert(image->base.Base.TexFormat == MESA_FORMAT_S8_Z24);
assert(image->mt != NULL);
drb = intel_create_wrapped_renderbuffer(ctx, width, height,
assert(!intelImage->mt);
if (intelObj->mt &&
- intel_miptree_match_image(intelObj->mt, &intelImage->base)) {
+ intel_miptree_match_image(intelObj->mt, &intelImage->base.Base)) {
/* Use an existing miptree when possible */
intel_miptree_reference(&intelImage->mt, intelObj->mt);
assert(intelImage->mt);
- } else if (intelImage->base.Border == 0) {
+ } else if (intelImage->base.Base.Border == 0) {
/* Didn't fit in the object miptree, but it's suitable for inclusion in
* a miptree, so create one just for our level and store it in the image.
* It'll get moved into the object miptree at validate time.
intelImage->mt &&
_mesa_is_bufferobj(unpack->BufferObj) &&
check_pbo_format(internalFormat, format,
- type, intelImage->base.TexFormat)) {
+ type, intelImage->base.Base.TexFormat)) {
DBG("trying pbo upload\n");
}
texImage->Data = intel_miptree_image_map(intel,
intelImage->mt,
- intelImage->base.Face,
- intelImage->base.Level,
+ intelImage->base.Base.Face,
+ intelImage->base.Base.Level,
&dstRowStride,
- intelImage->base.ImageOffsets);
+ intelImage->base.Base.ImageOffsets);
}
texImage->RowStride = dstRowStride / intelImage->mt->cpp;
/* Image is stored in hardware format in a buffer managed by the
* kernel. Need to explicitly map and unmap it.
*/
- intelImage->base.Data =
+ intelImage->base.Base.Data =
intel_miptree_image_map(intel,
intelImage->mt,
- intelImage->base.Face,
- intelImage->base.Level,
- &intelImage->base.RowStride,
- intelImage->base.ImageOffsets);
- intelImage->base.RowStride /= intelImage->mt->cpp;
+ intelImage->base.Base.Face,
+ intelImage->base.Base.Level,
+ &intelImage->base.Base.RowStride,
+ intelImage->base.Base.ImageOffsets);
+ intelImage->base.Base.RowStride /= intelImage->mt->cpp;
}
else {
/* Otherwise, the image should actually be stored in
- * intelImage->base.Data. This is pretty confusing for
+ * intelImage->base.Base.Data. This is pretty confusing for
* everybody, I'd much prefer to separate the two functions of
* texImage->Data - storage for texture images in main memory
* and access (ie mappings) of images. In other words, we'd
* create a new texImage->Map field and leave Data simply for
* storage.
*/
- assert(intelImage->base.Data);
+ assert(intelImage->base.Base.Data);
}
if (intelImage->stencil_rb) {
/* Unmap */
if (intelImage->mt) {
intel_miptree_image_unmap(intel, intelImage->mt);
- intelImage->base.Data = NULL;
+ intelImage->base.Base.Data = NULL;
}
}
texImage->RowStride = rb->region->pitch;
intel_miptree_reference(&intelImage->mt, intelObj->mt);
- if (!intel_miptree_match_image(intelObj->mt, &intelImage->base)) {
+ if (!intel_miptree_match_image(intelObj->mt, &intelImage->base.Base)) {
fprintf(stderr, "miptree doesn't match image\n");
}
texImage->RowStride = image->region->pitch;
intel_miptree_reference(&intelImage->mt, intelObj->mt);
- if (!intel_miptree_match_image(intelObj->mt, &intelImage->base))
+ if (!intel_miptree_match_image(intelObj->mt, &intelImage->base.Base))
fprintf(stderr, "miptree doesn't match image\n");
}
#endif
#ifndef _INTEL_TEX_OBJ_H
#define _INTEL_TEX_OBJ_H
+#include "swrast/s_context.h"
+
+
struct intel_texture_object
{
- struct gl_texture_object base; /* The "parent" object */
+ struct gl_texture_object base;
/* This is a mirror of base._MaxLevel, updated at validate time,
* except that we don't bother with the non-base levels for
struct intel_mipmap_tree *mt;
};
+
+/**
+ * intel_texture_image is a subclass of swrast_texture_image because we
+ * sometimes fall back to using the swrast module for software rendering.
+ */
struct intel_texture_image
{
- struct gl_texture_image base;
+ struct swrast_texture_image base;
/* If intelImage->mt != NULL, image data is stored here.
* Else if intelImage->base.Data != NULL, image is stored there.
dstRowStride = pitch;
intel_miptree_get_image_offset(intelImage->mt, level,
- intelImage->base.Face, 0,
+ intelImage->base.Base.Face, 0,
&blit_x, &blit_y);
blit_x += xoffset;
blit_y += yoffset;
*/
intel_miptree_image_copy(intel,
intelObj->mt,
- intelImage->base.Face,
- intelImage->base.Level, intelImage->mt);
+ intelImage->base.Base.Face,
+ intelImage->base.Base.Level, intelImage->mt);
intel_miptree_release(intel, &intelImage->mt);
}
else {
- assert(intelImage->base.Data != NULL);
+ assert(intelImage->base.Base.Data != NULL);
/* More straightforward upload.
*/
intel_miptree_image_data(intel,
intelObj->mt,
- intelImage->base.Face,
- intelImage->base.Level,
- intelImage->base.Data,
- intelImage->base.RowStride,
- intelImage->base.RowStride *
- intelImage->base.Height);
- _mesa_align_free(intelImage->base.Data);
- intelImage->base.Data = NULL;
+ intelImage->base.Base.Face,
+ intelImage->base.Base.Level,
+ intelImage->base.Base.Data,
+ intelImage->base.Base.RowStride,
+ intelImage->base.Base.RowStride *
+ intelImage->base.Base.Height);
+ _mesa_align_free(intelImage->base.Base.Data);
+ intelImage->base.Base.Data = NULL;
}
intel_miptree_reference(&intelImage->mt, intelObj->mt);
/* Fallback case:
*/
- if (firstImage->base.Border) {
+ if (firstImage->base.Base.Border) {
if (intelObj->mt) {
intel_miptree_release(intel, &intelObj->mt);
}
*/
if (intelObj->mt &&
(intelObj->mt->target != intelObj->base.Target ||
- intelObj->mt->format != firstImage->base.TexFormat ||
+ intelObj->mt->format != firstImage->base.Base.TexFormat ||
intelObj->mt->first_level != tObj->BaseLevel ||
intelObj->mt->last_level < intelObj->_MaxLevel ||
- intelObj->mt->width0 != firstImage->base.Width ||
- intelObj->mt->height0 != firstImage->base.Height ||
- intelObj->mt->depth0 != firstImage->base.Depth)) {
+ intelObj->mt->width0 != firstImage->base.Base.Width ||
+ intelObj->mt->height0 != firstImage->base.Base.Height ||
+ intelObj->mt->depth0 != firstImage->base.Base.Depth)) {
intel_miptree_release(intel, &intelObj->mt);
}
if (!intelObj->mt) {
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
- firstImage->base.TexFormat,
+ firstImage->base.Base.TexFormat,
tObj->BaseLevel,
intelObj->_MaxLevel,
- firstImage->base.Width,
- firstImage->base.Height,
- firstImage->base.Depth,
+ firstImage->base.Base.Width,
+ firstImage->base.Base.Height,
+ firstImage->base.Base.Depth,
GL_TRUE);
if (!intelObj->mt)
return GL_FALSE;
intel_texture_image(intelObj->base.Image[face][level]);
if (intelImage && intelImage->mt) {
- intelImage->base.Data =
+ intelImage->base.Base.Data =
intel_miptree_image_map(intel,
intelImage->mt,
- intelImage->base.Face,
- intelImage->base.Level,
- &intelImage->base.RowStride,
- intelImage->base.ImageOffsets);
+ intelImage->base.Base.Face,
+ intelImage->base.Base.Level,
+ &intelImage->base.Base.RowStride,
+ intelImage->base.Base.ImageOffsets);
/* convert stride to texels, not bytes */
- intelImage->base.RowStride /= intelImage->mt->cpp;
+ intelImage->base.Base.RowStride /= intelImage->mt->cpp;
/* intelImage->base.ImageStride /= intelImage->mt->cpp; */
}
}
if (intelImage && intelImage->mt) {
intel_miptree_image_unmap(intel, intelImage->mt);
- intelImage->base.Data = NULL;
+ intelImage->base.Base.Data = NULL;
}
}
}