+ if (color_depth_match &&
+ (depth_bits[k] || stencil_bits[k])) {
+ /* Depth can really only be 0, 16, 24, or 32. A 32-bit
+ * color format still matches 24-bit depth, as there
+ * is an implicit 8-bit stencil. So really we just
+ * need to make sure that color/depth are both 16 or
+ * both non-16.
+ */
+ if ((depth_bits[k] + stencil_bits[k] == 16) !=
+ (red_bits + green_bits + blue_bits + alpha_bits == 16))
+ continue;
+ }
+