[Mesa-dev] [PATCH 4/7] i965: Refactor effective depth calculation
Francisco Jerez
currojerez at riseup.net
Thu May 7 07:15:38 PDT 2015
From: Topi Pohjolainen <topi.pohjolainen at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
[ Francisco Jerez: Non-trivial rebase. Pass a half-open interval of
layers like emit_texture_surface_state does. ]
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
---
src/mesa/drivers/dri/i965/brw_context.h | 2 ++
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++++++++--
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 10 +++-------
src/mesa/drivers/dri/i965/gen8_surface_state.c | 9 +++------
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 9e85dd7..0e9ede9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -986,6 +986,8 @@ struct brw_context
void (*update_texture_surface)(struct brw_context *brw,
struct intel_mipmap_tree *mt,
struct gl_texture_object *tObj,
+ unsigned min_layer,
+ unsigned max_layer,
uint32_t tex_format, unsigned swizzle,
uint32_t *surf_offset,
bool for_gather);
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 3dddf89..92383e1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -311,6 +311,8 @@ static void
brw_update_texture_surface(struct brw_context *brw,
struct intel_mipmap_tree *mt,
struct gl_texture_object *tObj,
+ unsigned min_layer /* unused */,
+ unsigned max_layer /* unused */,
uint32_t tex_format, unsigned swizzle /* unused */,
uint32_t *surf_offset,
bool for_gather)
@@ -800,6 +802,11 @@ update_texture_surface(struct gl_context *ctx,
struct intel_mipmap_tree *mt = intel_obj->mt;
const struct gl_texture_image *firstImage = obj->Image[0][obj->BaseLevel];
const struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
+ /* If this is a view with restricted NumLayers, then our effective depth
+ * is not just the miptree depth.
+ */
+ const unsigned depth = (obj->Immutable && obj->Target != GL_TEXTURE_3D ?
+ obj->NumLayers : mt->logical_depth0);
/* Handling GL_ALPHA as a surface format override breaks 1.30+ style
* texturing functions that return a float, as our code generation always
@@ -820,8 +827,9 @@ update_texture_surface(struct gl_context *ctx,
format = BRW_SURFACEFORMAT_R8_UINT;
}
- brw->vtbl.update_texture_surface(brw, mt, obj, format, swizzle,
- surf_offset, for_gather);
+ brw->vtbl.update_texture_surface(brw, mt, obj,
+ obj->MinLayer, obj->MinLayer + depth,
+ format, swizzle, surf_offset, for_gather);
}
}
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index 7576b20..9755236 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -351,22 +351,18 @@ static void
gen7_update_texture_surface(struct brw_context *brw,
struct intel_mipmap_tree *mt,
struct gl_texture_object *obj,
+ unsigned min_layer,
+ unsigned max_layer,
uint32_t tex_format, unsigned swizzle,
uint32_t *surf_offset,
bool for_gather)
{
struct intel_texture_object *intel_obj = intel_texture_object(obj);
- /* If this is a view with restricted NumLayers, then our effective depth
- * is not just the miptree depth.
- */
- const unsigned depth = (obj->Immutable && obj->Target != GL_TEXTURE_3D ?
- obj->NumLayers : mt->logical_depth0);
-
if (for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT)
tex_format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
gen7_emit_texture_surface_state(brw, mt, obj->Target,
- obj->MinLayer, obj->MinLayer + depth,
+ min_layer, max_layer,
obj->MinLevel + obj->BaseLevel,
obj->MinLevel + intel_obj->_MaxLevel + 1,
tex_format, swizzle,
diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index 6dc0f9b..580c1a3 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -250,19 +250,16 @@ static void
gen8_update_texture_surface(struct brw_context *brw,
struct intel_mipmap_tree *mt,
struct gl_texture_object *obj,
+ unsigned min_layer,
+ unsigned max_layer,
uint32_t tex_format, unsigned swizzle,
uint32_t *surf_offset,
bool for_gather)
{
struct intel_texture_object *intel_obj = intel_texture_object(obj);
- /* If this is a view with restricted NumLayers, then our effective depth
- * is not just the miptree depth.
- */
- const unsigned depth = (obj->Immutable && obj->Target != GL_TEXTURE_3D ?
- obj->NumLayers : mt->logical_depth0);
gen8_emit_texture_surface_state(brw, mt, obj->Target,
- obj->MinLayer, obj->MinLayer + depth,
+ min_layer, max_layer,
obj->MinLevel + obj->BaseLevel,
obj->MinLevel + intel_obj->_MaxLevel + 1,
tex_format, swizzle, surf_offset,
--
2.3.5
More information about the mesa-dev
mailing list