i965: Fixed the CopyImageSubData for ETC2 on Gen < 8

For CopyImageSubData to copy the data during the 1st draw call, we need
to update the shadow tree right before the rendering.

v2:
  - Added assertion that the miptree doesn't need update at the time we
  update the texture surface. (Nanley Chery)

v3:
  - As we now update the tree before the rendering we don't need to copy
  the data during the unmap anymore. Removed the unnecessary update from
  the intel_miptree_unmap in intel_mipmap_tree.c (Nanley Chery)

v4:
  - Fixed unrelated empty line removal (Nanley Chery)
  - As now the intel_upate_etc_shadow of intel_mipmap_tree.c is only
  called inside its following function, we don't need to declare it at
  the top of the file anymore. (Nanley Chery)

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
This commit is contained in:
Eleni Maria Stea
2019-02-15 15:29:42 +02:00
committed by Nanley Chery
parent d8eb7287fe
commit db0c379c06
3 changed files with 6 additions and 18 deletions
+5
View File
@@ -559,6 +559,11 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
tex_obj->mt->format == MESA_FORMAT_S_UINT8) {
intel_update_r8stencil(brw, tex_obj->mt);
}
if (intel_miptree_has_etc_shadow(brw, tex_obj->mt) &&
tex_obj->mt->shadow_needs_update) {
intel_miptree_update_etc_shadow_levels(brw, tex_obj->mt);
}
}
/* Resolve color for each active shader image. */
@@ -582,7 +582,7 @@ static void brw_update_texture_surface(struct gl_context *ctx,
mt = mt->shadow_mt;
format = ISL_FORMAT_R8_UINT;
} else if (intel_miptree_needs_fake_etc(brw, mt)) {
assert(mt->shadow_mt);
assert(mt->shadow_mt && !mt->shadow_needs_update);
mt = mt->shadow_mt;
}
@@ -57,11 +57,6 @@ static void *intel_miptree_map_raw(struct brw_context *brw,
GLbitfield mode);
static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
static void intel_miptree_update_etc_shadow(struct brw_context *brw,
struct intel_mipmap_tree *mt,
unsigned int level,
unsigned int slice,
int level_w, int level_h);
static bool
intel_miptree_supports_mcs(struct brw_context *brw,
@@ -3779,7 +3774,6 @@ intel_miptree_unmap(struct brw_context *brw,
unsigned int slice)
{
struct intel_miptree_map *map = mt->level[level].slice[slice].map;
int level_w, level_h;
assert(mt->surf.samples == 1);
@@ -3789,21 +3783,10 @@ intel_miptree_unmap(struct brw_context *brw,
DBG("%s: mt %p (%s) level %d slice %d\n", __func__,
mt, _mesa_get_format_name(mt->format), level, slice);
level_w = minify(mt->surf.phys_level0_sa.width,
level - mt->first_level);
level_h = minify(mt->surf.phys_level0_sa.height,
level - mt->first_level);
if (map->unmap)
map->unmap(brw, mt, map, level, slice);
intel_miptree_release_map(mt, level, slice);
if (intel_miptree_has_etc_shadow(brw, mt) && mt->shadow_needs_update) {
mt->shadow_needs_update = false;
intel_miptree_update_etc_shadow(brw, mt, level, slice, level_w,
level_h);
}
}
enum isl_surf_dim