i965: Prepare framebuffer validator for isl based miptrees
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 25 Apr 2017 10:11:07 +0000 (13:11 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 19 Jun 2017 19:41:45 +0000 (22:41 +0300)
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/intel_fbo.c

index 478e7b88842de99b5e5ddca19b2bfe6ec7774fc2..e49f6df408deab1dca75523b81b8fafd9a8896c2 100644 (file)
@@ -670,14 +670,41 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 
    if (depth_mt && stencil_mt) {
       if (brw->gen >= 6) {
+         unsigned d_width, d_height, d_depth;
+         unsigned s_width, s_height, s_depth;
+
+         if (depth_mt->surf.size > 0) {
+             d_width = depth_mt->surf.phys_level0_sa.width;
+             d_height = depth_mt->surf.phys_level0_sa.height;
+             d_depth = depth_mt->surf.dim == ISL_SURF_DIM_3D ?
+                          depth_mt->surf.phys_level0_sa.depth :
+                          depth_mt->surf.phys_level0_sa.array_len;
+         } else {
+             d_width = depth_mt->physical_width0;
+             d_height = depth_mt->physical_height0;
+             d_depth = depth_mt->physical_depth0;
+         }
+
+         if (stencil_mt->surf.size > 0) {
+             s_width = stencil_mt->surf.phys_level0_sa.width;
+             s_height = stencil_mt->surf.phys_level0_sa.height;
+             s_depth = stencil_mt->surf.dim == ISL_SURF_DIM_3D ?
+                          stencil_mt->surf.phys_level0_sa.depth :
+                          stencil_mt->surf.phys_level0_sa.array_len;
+         } else {
+             s_width = stencil_mt->physical_width0;
+             s_height = stencil_mt->physical_height0;
+             s_depth = stencil_mt->physical_depth0;
+         }
+
          /* For gen >= 6, we are using the lod/minimum-array-element fields
           * and supporting layered rendering. This means that we must restrict
           * the depth & stencil attachments to match in various more retrictive
           * ways. (width, height, depth, LOD and layer)
           */
-        if (depth_mt->physical_width0 != stencil_mt->physical_width0 ||
-             depth_mt->physical_height0 != stencil_mt->physical_height0 ||
-             depth_mt->physical_depth0 != stencil_mt->physical_depth0 ||
+        if (d_width != s_width ||
+             d_height != s_height ||
+             d_depth != s_depth ||
              depthRb->mt_level != stencilRb->mt_level ||
             depthRb->mt_layer != stencilRb->mt_layer) {
            fbo_incomplete(fb,