<div dir="ltr">On 15 July 2013 17:14, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This will be used in 3DSTATE_DEPTH_BUFFER in a later patch.<br>
<br>
Note: Cube maps are treated as 2D arrays with 6 times as<br>
many array elements as the cube map array would have. <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/gen7_blorp.cpp | 11 +++++++++++<br>
src/mesa/drivers/dri/i965/gen7_misc_state.c | 26 ++++++++++++++++++++++++++<br>
2 files changed, 37 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp<br>
index acd6237..32dadf7 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp<br>
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp<br>
@@ -657,12 +657,23 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,<br>
uint32_t draw_x = params->depth.x_offset;<br>
uint32_t draw_y = params->depth.y_offset;<br>
uint32_t tile_mask_x, tile_mask_y;<br>
+ uint32_t surftype;<br>
+ GLenum gl_target = params->depth.mt->target;<br>
<br>
brw_get_depthstencil_tile_masks(params-><a href="http://depth.mt" target="_blank">depth.mt</a>,<br>
params->depth.level,<br>
params->depth.layer,<br>
NULL,<br>
&tile_mask_x, &tile_mask_y);<br>
+ switch (gl_target) {<br>
+ case GL_TEXTURE_CUBE_MAP_ARRAY:<br>
+ case GL_TEXTURE_CUBE_MAP:<br>
+ surftype = BRW_SURFACE_2D;<br></blockquote><div><br></div><div>The PRM claims that this shouldn't be necessary (it should be possible to set the surface type to BRW_SURFACE_CUBE, which is what translate_tex_target does). However, as you and I have discussed previously, this doesn't work--there appears to be a bug in either the hardware or the documentation.<br>
<br>Since we're deliberately doing something that the docs claim is unnecessary, I'd recommend adding a comment here (and gen7_emit_depth_stencil_hiz) just to make sure no one tries to come along in the future and delete the code you're adding. Maybe something like this?<br>
<br><br> /* The PRM claims that we should use BRW_SURFACE_CUBE for this<br> * situation, but experiments show that gl_Layer doesn't work when we do<br> * this. So we use BRW_SURFACE_2D, since for rendering purposes this is<br>
* equivalent.<br> */<br> surftype = BRW_SURFACE_2D;<br><br></div><div>With that change, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ break;<br>
+ default:<br>
+ surftype = translate_tex_target(gl_target);<br>
+ break;<br>
+ }<br>
<br>
/* 3DSTATE_DEPTH_BUFFER */<br>
{<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c<br>
index fe63fef..b3734e0 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c<br>
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c<br>
@@ -21,6 +21,7 @@<br>
* IN THE SOFTWARE.<br>
*/<br>
<br>
+#include "main/mtypes.h"<br>
#include "intel_batchbuffer.h"<br>
#include "intel_mipmap_tree.h"<br>
#include "intel_regions.h"<br>
@@ -40,9 +41,34 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,<br>
uint32_t tile_x, uint32_t tile_y)<br>
{<br>
struct gl_context *ctx = &brw->ctx;<br>
+ struct gl_framebuffer *fb = ctx->DrawBuffer;<br>
+ uint32_t surftype;<br>
+ GLenum gl_target = GL_TEXTURE_2D;<br>
+ const struct intel_renderbuffer *irb = NULL;<br>
+ const struct gl_renderbuffer *rb = NULL;<br>
<br>
intel_emit_depth_stall_flushes(brw);<br>
<br>
+ irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);<br>
+ if (!irb)<br>
+ irb = intel_get_renderbuffer(fb, BUFFER_STENCIL);<br>
+ rb = (struct gl_renderbuffer*) irb;<br>
+<br>
+ if (rb) {<br>
+ if (rb->TexImage)<br>
+ gl_target = rb->TexImage->TexObject->Target;<br>
+ }<br>
+<br>
+ switch (gl_target) {<br>
+ case GL_TEXTURE_CUBE_MAP_ARRAY:<br>
+ case GL_TEXTURE_CUBE_MAP:<br>
+ surftype = BRW_SURFACE_2D;<br>
+ break;<br>
+ default:<br>
+ surftype = translate_tex_target(gl_target);<br>
+ break;<br>
+ }<br>
+<br>
/* _NEW_DEPTH, _NEW_STENCIL, _NEW_BUFFERS */<br>
BEGIN_BATCH(7);<br>
OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));<br>
<span class=""><font color="#888888">--<br>
1.7.10.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>