mt->level[level].slice[img].y_offset);
}
-
-/**
- * For cube map textures, either the \c face parameter can be used, of course,
- * or the cube face can be interpreted as a depth layer and the \c layer
- * parameter used.
- */
void
intel_miptree_get_image_offset(struct intel_mipmap_tree *mt,
- GLuint level, GLuint face, GLuint layer,
+ GLuint level, GLuint slice,
GLuint *x, GLuint *y)
{
- int slice;
-
- if (face > 0) {
- assert(mt->target == GL_TEXTURE_CUBE_MAP);
- assert(face < 6);
- assert(layer == 0);
- slice = face;
- } else {
- /* This branch may be taken even if the texture target is a cube map. In
- * that case, the caller chose to interpret each cube face as a layer.
- */
- assert(face == 0);
- slice = layer;
- }
+ assert(slice < mt->level[level].depth);
*x = mt->level[level].slice[slice].x_offset;
*y = mt->level[level].slice[slice].y_offset;
gl_format format = src_mt->format;
uint32_t width = src_mt->level[level].width;
uint32_t height = src_mt->level[level].height;
+ int slice;
+
+ if (face > 0)
+ slice = face;
+ else
+ slice = depth;
assert(depth < src_mt->level[level].depth);
}
uint32_t dst_x, dst_y, src_x, src_y;
- intel_miptree_get_image_offset(dst_mt, level, face, depth,
- &dst_x, &dst_y);
- intel_miptree_get_image_offset(src_mt, level, face, depth,
- &src_x, &src_y);
+ intel_miptree_get_image_offset(dst_mt, level, slice, &dst_x, &dst_y);
+ intel_miptree_get_image_offset(src_mt, level, slice, &src_x, &src_y);
DBG("validate blit mt %s %p %d,%d/%d -> mt %s %p %d,%d/%d (%dx%d)\n",
_mesa_get_format_name(src_mt->format),
/* Note that in the case of cube maps, the caller must have passed the
* slice number referencing the face.
*/
- intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
+ intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
x += image_x;
y += image_y;
goto fail;
}
- intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
+ intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
x += image_x;
y += image_y;
GL_MAP_READ_BIT);
unsigned int image_x, image_y;
- intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
+ intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
for (uint32_t y = 0; y < map->h; y++) {
for (uint32_t x = 0; x < map->w; x++) {
uint8_t *untiled_s8_map = map->ptr;
uint8_t *tiled_s8_map = intel_region_map(intel, mt->region, map->mode);
- intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
+ intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
for (uint32_t y = 0; y < map->h; y++) {
for (uint32_t x = 0; x < map->w; x++) {
{
uint32_t image_x;
uint32_t image_y;
- intel_miptree_get_image_offset(mt, level, 0, slice, &image_x, &image_y);
+ intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
uint8_t *xbgr = intel_region_map(intel, mt->region, map->mode)
+ image_y * mt->region->pitch * mt->region->cpp
unsigned int s_image_x, s_image_y;
unsigned int z_image_x, z_image_y;
- intel_miptree_get_image_offset(s_mt, level, 0, slice,
+ intel_miptree_get_image_offset(s_mt, level, slice,
&s_image_x, &s_image_y);
- intel_miptree_get_image_offset(z_mt, level, 0, slice,
+ intel_miptree_get_image_offset(z_mt, level, slice,
&z_image_x, &z_image_y);
for (uint32_t y = 0; y < map->h; y++) {
unsigned int s_image_x, s_image_y;
unsigned int z_image_x, z_image_y;
- intel_miptree_get_image_offset(s_mt, level, 0, slice,
+ intel_miptree_get_image_offset(s_mt, level, slice,
&s_image_x, &s_image_y);
- intel_miptree_get_image_offset(z_mt, level, 0, slice,
+ intel_miptree_get_image_offset(z_mt, level, slice,
&z_image_x, &z_image_y);
for (uint32_t y = 0; y < map->h; y++) {
* share code with the normal path.
*/
for (i = 0; i < mt->level[level].depth; i++) {
- intel_miptree_get_image_offset(mt, level, face, i, &x, &y);
+ intel_miptree_get_image_offset(mt, level, i, &x, &y);
intel_image->base.ImageOffsets[i] = x + y * mt->region->pitch;
}
intel_image->base.Map = intel_region_map(intel, mt->region, mode);
} else {
assert(intel_image->base.Base.Depth == 1);
- intel_miptree_get_image_offset(mt, level, face, 0, &x, &y);
+ intel_miptree_get_image_offset(mt, level, face, &x, &y);
DBG("%s: (%d,%d) -> (%d, %d)/%d\n",
__FUNCTION__, face, level, x, y, mt->region->pitch * mt->cpp);