summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2013-07-09 15:24:56 -0700
committerJordan Justen <jordan.l.justen@intel.com>2013-08-04 11:52:37 -0700
commita23cfb86489af20ddc1f67395b1552560001f0d0 (patch)
tree14b1b7b14399220a71c83a4d38f97b0b6b6702a9 /src/mesa/drivers/dri
parent08ef1dde1b7129463e8b603fd35df86646995232 (diff)
gen7 depth surface: calculate minimum array element being rendered
In layered rendering this will be 0. Otherwise it will be the selected slice. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/gen7_blorp.cpp7
-rw-r--r--src/mesa/drivers/dri/i965/gen7_misc_state.c10
2 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 2ab7c5787e..9ce1a75839 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -665,6 +665,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
uint8_t mocs = brw->is_haswell ? GEN7_MOCS_L3 : 0;
uint32_t surftype;
unsigned int depth = MAX2(params->depth.mt->logical_depth0, 1);
+ unsigned int min_array_element;
GLenum gl_target = params->depth.mt->target;
unsigned int lod;
@@ -689,6 +690,12 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
break;
}
+ min_array_element = params->depth.layer;
+ if (params->depth.mt->num_samples > 1) {
+ /* Convert physical layer to logical layer. */
+ min_array_element /= params->depth.mt->num_samples;
+ }
+
lod = params->depth.level - params->depth.mt->first_level;
/* 3DSTATE_DEPTH_BUFFER */
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index acbf79d1c3..e9167b7023 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -45,6 +45,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
struct gl_framebuffer *fb = ctx->DrawBuffer;
uint32_t surftype;
unsigned int depth = 1;
+ unsigned int min_array_element;
GLenum gl_target = GL_TEXTURE_2D;
unsigned int lod;
const struct intel_renderbuffer *irb = NULL;
@@ -79,6 +80,15 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
break;
}
+ if (fb->Layered || !irb) {
+ min_array_element = 0;
+ } else if (irb->mt->num_samples > 1) {
+ /* Convert physical layer to logical layer. */
+ min_array_element = irb->mt_layer / irb->mt->num_samples;
+ } else {
+ min_array_element = irb->mt_layer;
+ }
+
lod = irb ? irb->mt_level - irb->mt->first_level : 0;
/* _NEW_DEPTH, _NEW_STENCIL, _NEW_BUFFERS */