[Mesa-dev] [PATCH 14/23] i965: Use BRW_SURFACE_* in place of GL_TEXTURE_*

Anuj Phogat anuj.phogat at gmail.com
Mon Mar 30 14:04:45 PDT 2015


Makes no functional changes in the code.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/dri/i965/gen8_surface_state.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index e9ba938..84fa383 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -174,6 +174,7 @@ gen8_update_texture_surface(struct gl_context *ctx,
    struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
    struct intel_mipmap_tree *aux_mt = NULL;
    uint32_t aux_mode = 0;
+   uint32_t surf_type;
    mesa_format format = intelObj->_Format;
    uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;
 
@@ -203,29 +204,31 @@ gen8_update_texture_surface(struct gl_context *ctx,
       aux_mode = GEN8_SURFACE_AUX_MODE_MCS;
    }
 
+   surf_type = translate_tex_target(tObj->Target);
+
    /* 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;
+      (tObj->Immutable && surf_type != BRW_SURFACE_3D) ? tObj->NumLayers
+                                                       : mt->logical_depth0;
 
    uint32_t tex_format = translate_tex_format(brw, format, sampler->sRGBDecode);
 
    uint32_t *surf = allocate_surface_state(brw, surf_offset);
 
+
    surf[0] = translate_tex_target(tObj->Target) << BRW_SURFACE_TYPE_SHIFT |
              tex_format << BRW_SURFACE_FORMAT_SHIFT |
              vertical_alignment(mt) |
              horizontal_alignment(mt) |
              tiling_mode;
 
-   if (tObj->Target == GL_TEXTURE_CUBE_MAP ||
-       tObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY) {
+   if (surf_type == BRW_SURFACE_CUBE) {
       surf[0] |= BRW_SURFACE_CUBEFACE_ENABLES;
    }
 
-   if (mt->logical_depth0 > 1 && tObj->Target != GL_TEXTURE_3D)
+   if (mt->logical_depth0 > 1 && surf_type != BRW_SURFACE_3D)
       surf[0] |= GEN8_SURFACE_IS_ARRAY;
 
    surf[1] = SET_FIELD(mocs_wb, GEN8_SURFACE_MOCS) | mt->qpitch >> 2;
-- 
2.3.4



More information about the mesa-dev mailing list