[Mesa-dev] [wip 1/2] i965/blorp: allow clear programs to use surface types other than 2D

Topi Pohjolainen topi.pohjolainen at intel.com
Sun Dec 29 03:58:06 PST 2013


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp       |  3 ++-
 src/mesa/drivers/dri/i965/brw_blorp.h         |  5 +++++
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 13 +++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index ab3e75c..1e6ff82 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -46,7 +46,8 @@ brw_blorp_mip_info::brw_blorp_mip_info()
 
 brw_blorp_surface_info::brw_blorp_surface_info()
    : map_stencil_as_y_tiled(false),
-     num_samples(0)
+     num_samples(0),
+     surftype(BRW_SURFACE_2D)
 {
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index 1030e4e..1aa0670 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -165,6 +165,11 @@ public:
     * surface state for this surface.
     */
    intel_msaa_layout msaa_layout;
+
+   /**
+    * Defaults to BRW_SURFACE_2D but is explicitly altered for clear programs.
+    */
+   uint32_t surftype;
 };
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 072ad55..e42b9e3 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -179,6 +179,18 @@ compute_fast_clear_color_bits(const union gl_color_union *color)
    return bits;
 }
 
+static uint32_t
+resolve_surface_type(const struct gl_renderbuffer *rb)
+{
+   GLenum gl_target = rb->TexImage ? rb->TexImage->TexObject->Target :
+                                     GL_TEXTURE_2D;
+
+   if (gl_target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+       gl_target == GL_TEXTURE_CUBE_MAP)
+      return BRW_SURFACE_2D;
+
+   return translate_tex_target(gl_target);
+}
 
 brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
                                                struct gl_framebuffer *fb,
@@ -191,6 +203,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 
    dst.set(brw, irb->mt, irb->mt_level, layer, true);
+   dst.surftype = resolve_surface_type(rb);
 
    /* Override the surface format according to the context's sRGB rules. */
    gl_format format = _mesa_get_render_format(ctx, irb->mt->format);
-- 
1.8.3.1



More information about the mesa-dev mailing list