static bool do_check_fallback(struct brw_context *brw)
{
struct gl_context *ctx = &brw->intel.ctx;
- GLuint i;
if (brw->intel.no_rast) {
DBG("FALLBACK: rasterization disabled\n");
return true;
}
- /* _NEW_TEXTURE:
- */
- for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
- if (texUnit->_ReallyEnabled) {
- struct gl_texture_object *tex_obj = texUnit->_Current;
- struct gl_texture_image *texImage = tex_obj->Image[0][tex_obj->BaseLevel];
- if (texImage->Border) {
- DBG("FALLBACK: texture border\n");
- return true;
- }
- }
- }
-
return false;
}
const struct brw_tracked_state brw_check_fallback = {
.dirty = {
- .mesa = _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_STENCIL,
+ .mesa = _NEW_RENDERMODE | _NEW_STENCIL,
.brw = 0,
.cache = 0
},
GLuint level = intelImage->base.Base.Level;
int width, height, depth;
- /* Images with borders are never pulled into mipmap trees. */
- if (image->Border)
- return false;
-
if (image->TexFormat != mt->format)
return false;
struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
GLuint slices;
+ assert(image->Border == 0);
+
/* Because the driver uses AllocTextureImageBuffer() internally, it may end
* up mismatched with FreeTextureImageBuffer(), but that is safe to call
* multiple times.
DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n",
__FUNCTION__, texobj, image->Level,
width, height, depth, intel_texobj->mt);
- return true;
- } else if (image->Border == 0) {
+ } else {
intel_image->mt = intel_miptree_create_for_teximage(intel, intel_texobj,
intel_image,
false);
DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n",
__FUNCTION__, texobj, image->Level,
width, height, depth, intel_image->mt);
- return true;
}
- DBG("%s: alloc obj %p level %d %dx%dx%d using swrast\n",
- __FUNCTION__, texobj, image->Level, width, height, depth);
-
- return _swrast_alloc_texture_image_buffer(ctx, image, format,
- width, height, depth);
+ return true;
}
static void
struct intel_texture_image *intel_image = intel_texture_image(tex_image);
struct intel_mipmap_tree *mt = intel_image->mt;
unsigned int bw, bh;
+ void *base;
+ unsigned int image_x, image_y;
+
+ /* Our texture data is always stored in a miptree. */
+ assert(mt);
/* Check that our caller wasn't confused about how to map a 1D texture. */
assert(tex_image->TexObject->Target != GL_TEXTURE_1D_ARRAY ||
assert(y % bh == 0);
y /= bh;
- if (likely(mt)) {
- void *base = intel_region_map(intel, mt->region, mode);
- unsigned int image_x, image_y;
-
- intel_miptree_get_image_offset(mt, tex_image->Level, tex_image->Face,
- slice, &image_x, &image_y);
- x += image_x;
- y += image_y;
+ base = intel_region_map(intel, mt->region, mode);
+ intel_miptree_get_image_offset(mt, tex_image->Level, tex_image->Face,
+ slice, &image_x, &image_y);
+ x += image_x;
+ y += image_y;
- *stride = mt->region->pitch * mt->cpp;
- *map = base + y * *stride + x * mt->cpp;
+ *stride = mt->region->pitch * mt->cpp;
+ *map = base + y * *stride + x * mt->cpp;
- DBG("%s: %d,%d %dx%d from mt %p %d,%d = %p/%d\n", __FUNCTION__,
- x - image_x, y - image_y, w, h,
- mt, x, y, *map, *stride);
- } else {
- /* texture data is in malloc'd memory */
- GLuint width = tex_image->Width;
- GLuint height = ALIGN(tex_image->Height, bh) / bh;
- GLuint texelSize = _mesa_get_format_bytes(tex_image->TexFormat);
-
- assert(map);
-
- *stride = _mesa_format_row_stride(tex_image->TexFormat, width);
- *map = intel_image->base.Buffer + (slice * height + y) * *stride + x * texelSize;
-
- DBG("%s: %d,%d %dx%d from data %p = %p/%d\n", __FUNCTION__,
- x, y, w, h,
- intel_image->base.Buffer, *map, *stride);
- }
+ DBG("%s: %d,%d %dx%d from mt %p %d,%d = %p/%d\n", __FUNCTION__,
+ x - image_x, y - image_y, w, h,
+ mt, x, y, *map, *stride);
}
static void
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(tex_image);
- if (intel_image->mt)
- intel_region_unmap(intel, intel_image->mt->region);
+ intel_region_unmap(intel, intel_image->mt->region);
if (intel_image->stencil_rb) {
/*
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
-/* Functions to store texture images. Where possible, mipmap_tree's
- * will be created or further instantiated with image data, otherwise
- * images will be stored in malloc'd memory. A validation step is
- * required to pull those images into a mipmap tree, or otherwise
- * decide a fallback is required.
- */
-
-
-
-/* Otherwise, store it in memory if (Border != 0) or (any dimension ==
- * 1).
- *
- * Otherwise, if max_level >= level >= min_level, create tree with
- * space for textures from min_level down to max_level.
- *
- * Otherwise, create tree with space for textures from (level
- * 0)..(1x1). Consider pruning this tree at a validation if the
- * saving is worth it.
+/* Work back from the specified level of the image to the baselevel and create a
+ * miptree of that size.
*/
struct intel_mipmap_tree *
intel_miptree_create_for_teximage(struct intel_context *intel,
DBG("%s\n", __FUNCTION__);
- if (intelImage->base.Base.Border)
- return NULL;
-
if (intelImage->base.Base.Level > intelObj->base.BaseLevel &&
(width == 1 ||
(intelObj->base.Target != GL_TEXTURE_1D && height == 1) ||
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
- GLint border,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *unpack,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage, GLsizei imageSize)
{
- DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(target), level, width, height, depth, border);
+ DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__,
+ _mesa_lookup_enum_by_nr(target), level, width, height, depth);
/* Attempt to use the blitter for PBO image uploads.
*/
__FUNCTION__, width, height, depth, pixels);
_mesa_store_teximage3d(ctx, target, level, internalFormat,
- width, height, depth, border,
+ width, height, depth, 0,
format, type, pixels,
unpack, texObj, texImage);
}
struct gl_texture_image *texImage)
{
intelTexImage(ctx, 3, target, level,
- internalFormat, width, height, depth, border,
+ internalFormat, width, height, depth,
format, type, pixels, unpack, texObj, texImage, 0);
}
struct gl_texture_image *texImage)
{
intelTexImage(ctx, 2, target, level,
- internalFormat, width, height, 1, border,
+ internalFormat, width, height, 1,
format, type, pixels, unpack, texObj, texImage, 0);
}
struct gl_texture_image *texImage)
{
intelTexImage(ctx, 1, target, level,
- internalFormat, width, 1, 1, border,
+ internalFormat, width, 1, 1,
format, type, pixels, unpack, texObj, texImage, 0);
}
intel_update_max_level(intelObj, sampler);
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
- /* Fallback case:
- */
- if (firstImage->base.Base.Border) {
- intel_miptree_release(&intelObj->mt);
- return false;
- }
-
intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
&width, &height, &depth);