summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-28 16:06:27 -0800
committerJason Ekstrand <[email protected]>2018-02-21 18:18:16 -0800
commit5b1b710e6f5321bed06b8c28524d8360412545f7 (patch)
tree9e59cb6a8565b6ed6f07055bb8265353015b7357
parent183ce5e629ee973d72a3e8b3361aa2de196cc203 (diff)
i965/state: Ignore intel_obj->_Format for depth/stencil and ETC2
We're about to start letting the intel_obj->_Format be the "real" texture format. For depth/stencil textures, this may be a combined depth stencil format. For ETC2 on gen7 and earlier, this will be the actual ETC2 format. This makes a bit more GL sense but means we have to be careful in state upload. Reviewed-by: Chad Versace <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index a5424ae3201..0b6016427bd 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -487,7 +487,21 @@ static void brw_update_texture_surface(struct gl_context *ctx,
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);