i965: Move brw_get_rb_for_slice to brw_meta_util
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 12 May 2016 03:55:37 +0000 (20:55 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 14 May 2016 21:18:21 +0000 (14:18 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_meta_updownsample.c
src/mesa/drivers/dri/i965/brw_meta_util.c
src/mesa/drivers/dri/i965/brw_meta_util.h

index 035cbe9d325538fdf9adf87f075a928cdd3f1dc5..69cedbc2faf1517f9a3a8ad2f4e80640b1dfc913 100644 (file)
@@ -1372,11 +1372,6 @@ GLboolean brwCreateContext(gl_api api,
 /*======================================================================
  * brw_misc_state.c
  */
-struct gl_renderbuffer *brw_get_rb_for_slice(struct brw_context *brw,
-                                             struct intel_mipmap_tree *mt,
-                                             unsigned level, unsigned layer,
-                                             bool flat);
-
 void brw_meta_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
                            struct intel_mipmap_tree *dst);
index f5fc2072dd7c522f4b01ed87def70beb01dbae4a..91c92bdbacd874316ef24502f4dfb0414d45a424 100644 (file)
@@ -24,6 +24,7 @@
 #include "brw_context.h"
 #include "intel_batchbuffer.h"
 #include "intel_fbo.h"
+#include "brw_meta_util.h"
 
 #include "main/blit.h"
 #include "main/buffers.h"
  * framebuffers.
  */
 
-/**
- * Creates a new named renderbuffer that wraps the first slice
- * of an existing miptree.
- *
- * Clobbers the current renderbuffer binding (ctx->CurrentRenderbuffer).
- */
-struct gl_renderbuffer *
-brw_get_rb_for_slice(struct brw_context *brw,
-                     struct intel_mipmap_tree *mt,
-                     unsigned level, unsigned layer, bool flat)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct gl_renderbuffer *rb = ctx->Driver.NewRenderbuffer(ctx, 0xDEADBEEF);
-   struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-
-   rb->RefCount = 1;
-   rb->Format = mt->format;
-   rb->_BaseFormat = _mesa_get_format_base_format(mt->format);
-
-   /* Program takes care of msaa and mip-level access manually for stencil.
-    * The surface is also treated as Y-tiled instead of as W-tiled calling for
-    * twice the width and half the height in dimensions.
-    */
-   if (flat) {
-      const unsigned halign_stencil = 8;
-
-      rb->NumSamples = 0;
-      rb->Width = ALIGN(mt->total_width, halign_stencil) * 2;
-      rb->Height = (mt->total_height / mt->physical_depth0) / 2;
-      irb->mt_level = 0;
-   } else {
-      rb->NumSamples = mt->num_samples;
-      rb->Width = mt->logical_width0;
-      rb->Height = mt->logical_height0;
-      irb->mt_level = level;
-   }
-
-   irb->mt_layer = layer;
-
-   intel_miptree_reference(&irb->mt, mt);
-
-   return rb;
-}
-
 /**
  * Implementation of up or downsampling for window-system MSAA miptrees.
  */
index b250d8a8146a1186d0d74ec00b25abe354b0752c..ac4f6154dc78191798d16de8c191e593480cf829 100644 (file)
@@ -21,6 +21,8 @@
  * IN THE SOFTWARE.
  */
 
+#include "brw_context.h"
+#include "intel_fbo.h"
 #include "brw_meta_util.h"
 #include "main/fbobject.h"
 
@@ -259,3 +261,47 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
 
    return false;
 }
+
+/**
+ * Creates a new named renderbuffer that wraps the first slice
+ * of an existing miptree.
+ *
+ * Clobbers the current renderbuffer binding (ctx->CurrentRenderbuffer).
+ */
+struct gl_renderbuffer *
+brw_get_rb_for_slice(struct brw_context *brw,
+                     struct intel_mipmap_tree *mt,
+                     unsigned level, unsigned layer, bool flat)
+{
+   struct gl_context *ctx = &brw->ctx;
+   struct gl_renderbuffer *rb = ctx->Driver.NewRenderbuffer(ctx, 0xDEADBEEF);
+   struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+
+   rb->RefCount = 1;
+   rb->Format = mt->format;
+   rb->_BaseFormat = _mesa_get_format_base_format(mt->format);
+
+   /* Program takes care of msaa and mip-level access manually for stencil.
+    * The surface is also treated as Y-tiled instead of as W-tiled calling for
+    * twice the width and half the height in dimensions.
+    */
+   if (flat) {
+      const unsigned halign_stencil = 8;
+
+      rb->NumSamples = 0;
+      rb->Width = ALIGN(mt->total_width, halign_stencil) * 2;
+      rb->Height = (mt->total_height / mt->physical_depth0) / 2;
+      irb->mt_level = 0;
+   } else {
+      rb->NumSamples = mt->num_samples;
+      rb->Width = mt->logical_width0;
+      rb->Height = mt->logical_height0;
+      irb->mt_level = level;
+   }
+
+   irb->mt_layer = layer;
+
+   intel_miptree_reference(&irb->mt, mt);
+
+   return rb;
+}
index ac051e2b721ba0d9b62ecb23a0991c222978a825..0929497b1869962b54fa5fd6910d73cb3fb85f11 100644 (file)
@@ -70,6 +70,11 @@ brw_is_color_fast_clear_compatible(struct brw_context *brw,
                                    const struct intel_mipmap_tree *mt,
                                    const union gl_color_union *color);
 
+struct gl_renderbuffer *brw_get_rb_for_slice(struct brw_context *brw,
+                                             struct intel_mipmap_tree *mt,
+                                             unsigned level, unsigned layer,
+                                             bool flat);
+
 #ifdef __cplusplus
 }
 #endif