[Mesa-dev] [PATCH 05/17] i965/gen6 depth surface: calculate more specific surface type

Pohjolainen, Topi topi.pohjolainen at intel.com
Tue Jul 22 02:19:48 PDT 2014


On Fri, Jul 18, 2014 at 02:16:40PM -0700, Jordan Justen wrote:
> (171e633 for gen6)
> 
> This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.
> 
> Note: Cube maps are treated as 2D arrays with 6 times as
> many array elements as the cube map array would have.
> 
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/gen6_blorp.cpp     | 17 ++++++++++++++
>  src/mesa/drivers/dri/i965/gen6_depth_state.c | 33 ++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> index eb865b9..3fc36aa 100644
> --- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
> @@ -791,6 +791,23 @@ gen6_blorp_emit_depth_stencil_config(struct brw_context *brw,
>     uint32_t draw_x = params->depth.x_offset;
>     uint32_t draw_y = params->depth.y_offset;
>     uint32_t tile_mask_x, tile_mask_y;
> +   uint32_t surftype;
> +   GLenum gl_target = params->depth.mt->target;
> +
> +   switch (gl_target) {
> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> +   case GL_TEXTURE_CUBE_MAP:
> +      /* The PRM claims that we should use BRW_SURFACE_CUBE for this
> +       * situation, but experiments show that gl_Layer doesn't work when we do
> +       * this.  So we use BRW_SURFACE_2D, since for rendering purposes this is
> +       * equivalent.
> +       */
> +      surftype = BRW_SURFACE_2D;
> +      break;
> +   default:
> +      surftype = translate_tex_target(gl_target);
> +      break;
> +   }

Patches 5-7 look identical to the gen7 equivalent and hence in principle:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

But having said that I think we need to start planning how to merge all the
duplicate surface state logic between gen6-gen8. For example, the switch
statement above can be now found twice per generation.

>  
>     brw_get_depthstencil_tile_masks(params->depth.mt,
>                                     params->depth.level,
> diff --git a/src/mesa/drivers/dri/i965/gen6_depth_state.c b/src/mesa/drivers/dri/i965/gen6_depth_state.c
> index d37aae8..0480142 100644
> --- a/src/mesa/drivers/dri/i965/gen6_depth_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_depth_state.c
> @@ -30,6 +30,7 @@
>  #include "brw_state.h"
>  #include "brw_defines.h"
>  
> +#include "main/mtypes.h"
>  #include "main/fbobject.h"
>  #include "main/glformats.h"
>  
> @@ -43,6 +44,13 @@ gen6_emit_depth_stencil_hiz(struct brw_context *brw,
>                              uint32_t width, uint32_t height,
>                              uint32_t tile_x, uint32_t tile_y)
>  {
> +   struct gl_context *ctx = &brw->ctx;
> +   struct gl_framebuffer *fb = ctx->DrawBuffer;
> +   uint32_t surftype;
> +   GLenum gl_target = GL_TEXTURE_2D;
> +   const struct intel_renderbuffer *irb = NULL;
> +   const struct gl_renderbuffer *rb = NULL;
> +
>     /* Enable the hiz bit if we're doing separate stencil, because it and the
>      * separate stencil bit must have the same value. From Section 2.11.5.6.1.1
>      * 3DSTATE_DEPTH_BUFFER, Bit 1.21 "Separate Stencil Enable":
> @@ -63,6 +71,31 @@ gen6_emit_depth_stencil_hiz(struct brw_context *brw,
>        intel_emit_depth_stall_flushes(brw);
>     }
>  
> +   irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
> +   if (!irb)
> +      irb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
> +   rb = (struct gl_renderbuffer*) irb;
> +
> +   if (rb) {
> +      if (rb->TexImage)
> +         gl_target = rb->TexImage->TexObject->Target;
> +   }
> +
> +   switch (gl_target) {
> +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> +   case GL_TEXTURE_CUBE_MAP:
> +      /* The PRM claims that we should use BRW_SURFACE_CUBE for this
> +       * situation, but experiments show that gl_Layer doesn't work when we do
> +       * this.  So we use BRW_SURFACE_2D, since for rendering purposes this is
> +       * equivalent.
> +       */
> +      surftype = BRW_SURFACE_2D;
> +      break;
> +   default:
> +      surftype = translate_tex_target(gl_target);
> +      break;
> +   }
> +
>     unsigned int len;
>     if (brw->gen >= 6)
>        len = 7;
> -- 
> 2.0.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list