const unsigned swizzle = (unlikely(alpha_depth) ? SWIZZLE_XYZW :
brw_get_texture_swizzle(&brw->ctx, obj));
- mesa_format mesa_fmt = plane == 0 ? intel_obj->_Format : mt->format;
+ mesa_format mesa_fmt;
+ if (firstImage->_BaseFormat == GL_DEPTH_STENCIL ||
+ firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
+ /* The format from intel_obj may be a combined depth stencil format
+ * when we just want depth. Pull it from the miptree instead. This
+ * is safe because texture views aren't allowed on depth/stencil.
+ */
+ mesa_fmt = mt->format;
+ } else if (mt->etc_format != MESA_FORMAT_NONE) {
+ mesa_fmt = mt->format;
+ } else if (plane > 0) {
+ mesa_fmt = mt->format;
+ } else {
+ mesa_fmt = intel_obj->_Format;
+ }
enum isl_format format = translate_tex_format(brw, mesa_fmt,
for_txf ? GL_DECODE_EXT :
sampler->sRGBDecode);