instead of update_texture_surface(). For gen < 7 this interface can be supported relatively easily by changing the interface of brw_update_texture_surface().
I didn't switch BRW_SURFACE_LOD_SHIFT to be emitted using SET_FIELD() as the mask for it is not defined yet. This can be addressed as a simple follow-up. Note also that the common dispatcher already considers the texture buffer case and hence the corresponding calls in gen7 and gen8 dependent logic are redundant and are therefore safe to drop. Fixes piglit test arb_copy_image-formats on ILK as the minimun layer is taken into account. Normally this isn't needed for gen < 7 as those do not support GL_ARB_texture_view. However, our meta path for 2D blits requires it regardless if the extension is officially supported. Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 40 +++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index f2e6e44..367e222 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -307,16 +307,16 @@ brw_update_buffer_texture_surface(struct brw_context *brw, } static void -brw_update_texture_surface(struct gl_context *ctx, - const struct intel_mipmap_tree *mt, - struct gl_texture_object *tObj, - uint32_t tex_format, int swizzle /* unused */, - uint32_t depth /* unused */, - uint32_t *surf_offset, - bool for_gather) +brw_emit_texture_surface_state(struct brw_context *brw, + const struct intel_mipmap_tree *mt, + GLenum target, + unsigned min_layer, unsigned max_layer, + unsigned min_level, unsigned max_level, + unsigned tex_format, + unsigned swizzle, + uint32_t *surf_offset, + bool rw, bool for_gather) { - struct brw_context *brw = brw_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(tObj); uint32_t *surf; surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, @@ -351,14 +351,14 @@ brw_update_texture_surface(struct gl_context *ctx, } } - surf[0] = (translate_tex_target(tObj->Target) << BRW_SURFACE_TYPE_SHIFT | - BRW_SURFACE_MIPMAPLAYOUT_BELOW << BRW_SURFACE_MIPLAYOUT_SHIFT | - BRW_SURFACE_CUBEFACE_ENABLES | - tex_format << BRW_SURFACE_FORMAT_SHIFT); + surf[0] = SET_FIELD(translate_tex_target(target), BRW_SURFACE_TYPE) | + BRW_SURFACE_MIPMAPLAYOUT_BELOW << BRW_SURFACE_MIPLAYOUT_SHIFT | + BRW_SURFACE_CUBEFACE_ENABLES | + SET_FIELD(tex_format, BRW_SURFACE_FORMAT); surf[1] = mt->bo->offset64 + mt->offset; /* reloc */ - surf[2] = ((intelObj->_MaxLevel - tObj->BaseLevel) << BRW_SURFACE_LOD_SHIFT | + surf[2] = ((max_level - min_level - 1) << BRW_SURFACE_LOD_SHIFT | (mt->logical_width0 - 1) << BRW_SURFACE_WIDTH_SHIFT | (mt->logical_height0 - 1) << BRW_SURFACE_HEIGHT_SHIFT); @@ -367,7 +367,7 @@ brw_update_texture_surface(struct gl_context *ctx, (mt->pitch - 1) << BRW_SURFACE_PITCH_SHIFT); surf[4] = (brw_get_surface_num_multisamples(mt->num_samples) | - SET_FIELD(tObj->BaseLevel - mt->first_level, BRW_SURFACE_MIN_LOD)); + SET_FIELD(min_level - mt->first_level, BRW_SURFACE_MIN_LOD)); surf[5] = mt->align_h == 4 ? BRW_SURFACE_VERTICAL_ALIGN_ENABLE : 0; @@ -860,8 +860,12 @@ update_stage_texture_surfaces(struct brw_context *brw, tex->NumLayers : mt->logical_depth0; /* _NEW_TEXTURE */ - brw->vtbl.update_texture_surface(ctx, mt, tex, format, swizzle, depth, - surf_offset + s, for_gather); + brw->vtbl.emit_texture_surface_state( + brw, mt, tex->Target, + tex->MinLayer, tex->MinLayer + depth, + tex->MinLevel + tex->BaseLevel, + tex->MinLevel + itex->_MaxLevel + 1, + format, swizzle, surf_offset + s, false, for_gather); } } @@ -1060,8 +1064,8 @@ const struct brw_tracked_state brw_cs_abo_surfaces = { void gen4_init_vtable_surface_functions(struct brw_context *brw) { - brw->vtbl.update_texture_surface = brw_update_texture_surface; brw->vtbl.update_renderbuffer_surface = brw_update_renderbuffer_surface; brw->vtbl.emit_null_surface_state = brw_emit_null_surface_state; + brw->vtbl.emit_texture_surface_state = brw_emit_texture_surface_state; brw->vtbl.emit_buffer_surface_state = gen4_emit_buffer_surface_state; } -- 1.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev