[Mesa-dev] [RFC PATCH 03/12] gen7 depth surface: calculate depth (array size) for depth surface

Ian Romanick idr at freedesktop.org
Wed Jul 17 16:45:07 PDT 2013


On 07/15/2013 05:14 PM, Jordan Justen wrote:
> 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/gen7_blorp.cpp    |    2 ++
>   src/mesa/drivers/dri/i965/gen7_misc_state.c |    3 +++
>   2 files changed, 5 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> index 32dadf7..1ec05ad 100644
> --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> @@ -658,6 +658,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
>      uint32_t draw_y = params->depth.y_offset;
>      uint32_t tile_mask_x, tile_mask_y;
>      uint32_t surftype;
> +   int depth = MAX2(params->depth.mt->logical_depth0, 1);
>      GLenum gl_target = params->depth.mt->target;
>
>      brw_get_depthstencil_tile_masks(params->depth.mt,
> @@ -669,6 +670,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
>      case GL_TEXTURE_CUBE_MAP_ARRAY:
>      case GL_TEXTURE_CUBE_MAP:
>         surftype = BRW_SURFACE_2D;
> +      depth *= 6;
>         break;
>      default:
>         surftype = translate_tex_target(gl_target);
> diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c
> index b3734e0..798da41 100644
> --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
> @@ -43,6 +43,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
>      struct gl_context *ctx = &brw->ctx;
>      struct gl_framebuffer *fb = ctx->DrawBuffer;
>      uint32_t surftype;
> +   int depth = 1;

gl_renderbuffer::Depth is unsigned, so this should be too.

>      GLenum gl_target = GL_TEXTURE_2D;
>      const struct intel_renderbuffer *irb = NULL;
>      const struct gl_renderbuffer *rb = NULL;
> @@ -55,6 +56,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
>      rb = (struct gl_renderbuffer*) irb;
>
>      if (rb) {
> +      depth = MAX2(rb->Depth, 1);
>         if (rb->TexImage)
>            gl_target = rb->TexImage->TexObject->Target;
>      }
> @@ -63,6 +65,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
>      case GL_TEXTURE_CUBE_MAP_ARRAY:
>      case GL_TEXTURE_CUBE_MAP:
>         surftype = BRW_SURFACE_2D;
> +      depth *= 6;
>         break;
>      default:
>         surftype = translate_tex_target(gl_target);
>



More information about the mesa-dev mailing list