summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott D Phillips <scott.d.phillips@intel.com>2018-11-29 09:56:54 +0200
committerTapani Pälli <tapani.palli@intel.com>2018-11-29 09:56:54 +0200
commit4d59b8232a7f1f80db424f13032df39141bc60df (patch)
tree01a32d2bad8e3d0232bd75e552b86a7c54e3c1d8
parente43d6a76f6de39aa84bcec12303336b87a06c822 (diff)
i965/miptree: recurse to miptree_map for depth in map_depthstencilscott
Call back to intel_miptree_map when mapping the separate depth miptree in map_depthstencil. This brings us back to the mapping method decision tree in miptree_map where we will then find the best mapping method for depth.
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 87d62c71b56..5483012f341 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3493,44 +3493,49 @@ intel_miptree_unmap_depthstencil(struct brw_context *brw,
if (map->mode & GL_MAP_WRITE_BIT) {
uint32_t *packed_map = map->ptr;
uint8_t *s_map = intel_miptree_map_raw(brw, s_mt, GL_MAP_WRITE_BIT);
- uint32_t *z_map = intel_miptree_map_raw(brw, z_mt, GL_MAP_WRITE_BIT);
unsigned int s_image_x, s_image_y;
- unsigned int z_image_x, z_image_y;
intel_miptree_get_image_offset(s_mt, level, slice,
&s_image_x, &s_image_y);
- intel_miptree_get_image_offset(z_mt, level, slice,
- &z_image_x, &z_image_y);
+
+ struct intel_miptree_map z_map = {
+ .mode = GL_MAP_WRITE_BIT | BRW_MAP_DIRECT_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
+ .x = map->x,
+ .y = map->y,
+ .w = map->w,
+ .h = map->h,
+ };
+ __intel_miptree_map(brw, z_mt, level, slice, &z_map);
+ assert(z_map.ptr);
for (uint32_t y = 0; y < map->h; y++) {
+ uint32_t *z_line =
+ (uint32_t *)((uint8_t *)z_map.ptr + z_map.stride * y);
for (uint32_t x = 0; x < map->w; x++) {
ptrdiff_t s_offset = intel_offset_S8(s_mt->surf.row_pitch_B,
x + s_image_x + map->x,
y + s_image_y + map->y,
brw->has_swizzling);
- ptrdiff_t z_offset = ((y + z_image_y + map->y) *
- (z_mt->surf.row_pitch_B / 4) +
- (x + z_image_x + map->x));
-
if (map_z32f_x24s8) {
- z_map[z_offset] = packed_map[(y * map->w + x) * 2 + 0];
+ z_line[x] = packed_map[(y * map->w + x) * 2 + 0];
s_map[s_offset] = packed_map[(y * map->w + x) * 2 + 1];
} else {
uint32_t packed = packed_map[y * map->w + x];
s_map[s_offset] = packed >> 24;
- z_map[z_offset] = packed;
+ z_line[x] = packed;
}
}
}
+ __intel_miptree_unmap(brw, z_mt, level, slice, &z_map);
intel_miptree_unmap_raw(s_mt);
- intel_miptree_unmap_raw(z_mt);
- DBG("%s: %d,%d %dx%d from z mt %p (%s) %d,%d, s mt %p %d,%d = %p/%d\n",
+ DBG("%s: %d,%d %dx%d from z mt %p (%s) %d,%d @ (level: %d, slice: %d),"
+ " s mt %p %d,%d = %p/%d\n",
__func__,
map->x, map->y, map->w, map->h,
z_mt, _mesa_get_format_name(z_mt->format),
- map->x + z_image_x, map->y + z_image_y,
+ map->x, map->y, level, slice,
s_mt, map->x + s_image_x, map->y + s_image_y,
map->ptr, map->stride);
}
@@ -3567,27 +3572,32 @@ intel_miptree_map_depthstencil(struct brw_context *brw,
if (!(map->mode & GL_MAP_INVALIDATE_RANGE_BIT)) {
uint32_t *packed_map = map->ptr;
uint8_t *s_map = intel_miptree_map_raw(brw, s_mt, GL_MAP_READ_BIT);
- uint32_t *z_map = intel_miptree_map_raw(brw, z_mt, GL_MAP_READ_BIT);
unsigned int s_image_x, s_image_y;
- unsigned int z_image_x, z_image_y;
intel_miptree_get_image_offset(s_mt, level, slice,
&s_image_x, &s_image_y);
- intel_miptree_get_image_offset(z_mt, level, slice,
- &z_image_x, &z_image_y);
+
+ struct intel_miptree_map z_map = {
+ .mode = GL_MAP_READ_BIT | BRW_MAP_DIRECT_BIT,
+ .x = map->x,
+ .y = map->y,
+ .w = map->w,
+ .h = map->h,
+ };
+ __intel_miptree_map(brw, z_mt, level, slice, &z_map);
+ assert(z_map.ptr);
for (uint32_t y = 0; y < map->h; y++) {
+ uint32_t *z_line =
+ (uint32_t *)((uint8_t *)z_map.ptr + z_map.stride * y);
for (uint32_t x = 0; x < map->w; x++) {
int map_x = map->x + x, map_y = map->y + y;
ptrdiff_t s_offset = intel_offset_S8(s_mt->surf.row_pitch_B,
map_x + s_image_x,
map_y + s_image_y,
brw->has_swizzling);
- ptrdiff_t z_offset = ((map_y + z_image_y) *
- (z_mt->surf.row_pitch_B / 4) +
- (map_x + z_image_x));
uint8_t s = s_map[s_offset];
- uint32_t z = z_map[z_offset];
+ uint32_t z = z_line[x];
if (map_z32f_x24s8) {
packed_map[(y * map->w + x) * 2 + 0] = z;
@@ -3598,13 +3608,14 @@ intel_miptree_map_depthstencil(struct brw_context *brw,
}
}
+ __intel_miptree_unmap(brw, z_mt, level, slice, &z_map);
intel_miptree_unmap_raw(s_mt);
- intel_miptree_unmap_raw(z_mt);
- DBG("%s: %d,%d %dx%d from z mt %p %d,%d, s mt %p %d,%d = %p/%d\n",
+ DBG("%s: %d,%d %dx%d from z mt %p %d,%d @ (level: %d, slice: %d),"
+ " s mt %p %d,%d = %p/%d\n",
__func__,
map->x, map->y, map->w, map->h,
- z_mt, map->x + z_image_x, map->y + z_image_y,
+ z_mt, map->x, map->y, level, slice,
s_mt, map->x + s_image_x, map->y + s_image_y,
map->ptr, map->stride);
} else {