[Mesa-dev] [RFC 2/7] i965/blorp: Refactor depth override
Topi Pohjolainen
topi.pohjolainen at intel.com
Wed Jul 30 10:03:58 PDT 2014
It would be more natural to have this, for example, in "brw_state.h"
but unfortunately this is later needed when resolving renderbuffer
depth (in intel_fbo.h).
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 12 ++++++++++++
src/mesa/drivers/dri/i965/gen6_blorp.cpp | 4 ++--
src/mesa/drivers/dri/i965/gen7_blorp.cpp | 4 ++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 408939c..1cedba1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1436,6 +1436,18 @@ void brw_get_depthstencil_tile_masks(struct intel_mipmap_tree *depth_mt,
void brw_workaround_depthstencil_alignment(struct brw_context *brw,
GLbitfield clear_mask);
+inline static unsigned
+brw_adjust_depth(unsigned depth, GLenum gl_target)
+{
+ depth = MAX2(depth, 1);
+
+ if (gl_target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+ gl_target == GL_TEXTURE_CUBE_MAP)
+ depth *= 6;
+
+ return depth;
+}
+
/* brw_object_purgeable.c */
void brw_init_object_purgeable_functions(struct dd_function_table *functions);
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 4dab569..e0bdd23 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -789,9 +789,10 @@ gen6_blorp_emit_depth_stencil_config(struct brw_context *brw,
{
uint32_t surfwidth, surfheight;
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;
+ const unsigned depth = brw_adjust_depth(params->depth.mt->logical_depth0,
+ gl_target);
unsigned int lod;
switch (gl_target) {
@@ -803,7 +804,6 @@ gen6_blorp_emit_depth_stencil_config(struct brw_context *brw,
* equivalent.
*/
surftype = BRW_SURFACE_2D;
- depth *= 6;
break;
default:
surftype = translate_tex_target(gl_target);
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index c33cfeb..24320f0 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -684,9 +684,10 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
const uint8_t mocs = GEN7_MOCS_L3;
uint32_t surfwidth, surfheight;
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;
+ const unsigned depth = brw_adjust_depth(params->depth.mt->logical_depth0,
+ gl_target);
unsigned int lod;
switch (gl_target) {
@@ -698,7 +699,6 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
* equivalent.
*/
surftype = BRW_SURFACE_2D;
- depth *= 6;
break;
default:
surftype = translate_tex_target(gl_target);
--
1.8.3.1
More information about the mesa-dev
mailing list