[Mesa-dev] [PATCH 11/18] i965: Refactor effective depth calculation
Topi Pohjolainen
topi.pohjolainen at intel.com
Wed Apr 22 13:47:31 PDT 2015
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 4 ++--
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 11 +++++++++--
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 7 +------
src/mesa/drivers/dri/i965/gen8_surface_state.c | 8 +-------
4 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 1461310..bb375df 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -967,8 +967,8 @@ struct brw_context
struct gl_texture_object *tObj,
uint32_t tex_format,
bool is_integer_format,
- int swizzle,
- uint32_t *surf_offset,
+ uint32_t effective_depth,
+ int swizzle, uint32_t *surf_offset,
bool for_gather);
uint32_t (*update_renderbuffer_surface)(struct brw_context *brw,
struct gl_renderbuffer *rb,
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 c76d09d..ad03ffe 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -313,6 +313,7 @@ brw_update_texture_surface(struct brw_context *brw,
struct gl_texture_object *tObj,
uint32_t tex_format,
bool is_integer_format /* unused */,
+ uint32_t effective_depth /* unused */,
int swizzle /* unused */,
uint32_t *surf_offset,
bool for_gather)
@@ -826,9 +827,15 @@ update_texture_surface(struct gl_context *ctx,
const int swizzle = unlikely(alpha_depth)
? SWIZZLE_XYZW : brw_get_texture_swizzle(ctx, tObj);
+ /* if this is a view with restricted NumLayers, then
+ * our effective depth is not just the miptree depth.
+ */
+ uint32_t effective_depth = (tObj->Immutable && tObj->Target != GL_TEXTURE_3D)
+ ? tObj->NumLayers : mt->logical_depth0;
+
brw->vtbl.update_texture_surface(brw, mt, tObj, tex_format,
- tObj->_IsIntegerFormat, swizzle,
- surf_offset, for_gather);
+ tObj->_IsIntegerFormat, effective_depth,
+ swizzle, surf_offset, for_gather);
}
static void
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 46c96f7..005b4eb 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -268,6 +268,7 @@ gen7_update_texture_surface(struct brw_context *brw,
const struct intel_mipmap_tree *mt,
struct gl_texture_object *tObj,
uint32_t tex_format, bool is_integer_format,
+ uint32_t effective_depth,
int swizzle, uint32_t *surf_offset,
bool for_gather)
{
@@ -297,12 +298,6 @@ gen7_update_texture_surface(struct brw_context *brw,
tObj->Target == GL_TEXTURE_CUBE_MAP)
surf[0] |= GEN7_SURFACE_IS_ARRAY;
- /* if this is a view with restricted NumLayers, then
- * our effective depth is not just the miptree depth.
- */
- uint32_t effective_depth = (tObj->Immutable && tObj->Target != GL_TEXTURE_3D)
- ? tObj->NumLayers : mt->logical_depth0;
-
if (mt->array_layout == ALL_SLICES_AT_EACH_LOD)
surf[0] |= GEN7_SURFACE_ARYSPC_LOD0;
diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index d7287b8..feed343 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -155,6 +155,7 @@ gen8_update_texture_surface(struct brw_context *brw,
struct gl_texture_object *tObj,
uint32_t tex_format,
bool is_integer_format /* unused */,
+ uint32_t effective_depth,
int swizzle, uint32_t *surf_offset,
bool for_gather)
{
@@ -177,13 +178,6 @@ gen8_update_texture_surface(struct brw_context *brw,
aux_mode = GEN8_SURFACE_AUX_MODE_MCS;
}
- /* If this is a view with restricted NumLayers, then our effective depth
- * is not just the miptree depth.
- */
- uint32_t effective_depth =
- (tObj->Immutable && tObj->Target != GL_TEXTURE_3D) ? tObj->NumLayers
- : mt->logical_depth0;
-
uint32_t *surf = allocate_surface_state(brw, surf_offset);
surf[0] = translate_tex_target(tObj->Target) << BRW_SURFACE_TYPE_SHIFT |
--
1.9.3
More information about the mesa-dev
mailing list