summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2016-06-11 18:16:47 -0700
committerJordan Justen <jordan.l.justen@intel.com>2016-06-24 18:13:18 -0700
commit727a9b24933d384f5440ed4318fb720ed11d6dd1 (patch)
treeed6e4f3bb50799108e3df91b29be2829529e1782 /src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
parentc4a6b0d2d222667944f78a7688936534b2be0e96 (diff)
downloadexternal_mesa3d-727a9b24933d384f5440ed4318fb720ed11d6dd1.zip
external_mesa3d-727a9b24933d384f5440ed4318fb720ed11d6dd1.tar.gz
external_mesa3d-727a9b24933d384f5440ed4318fb720ed11d6dd1.tar.bz2
i965: Skip update_texture_surface when the plane doesn't exist
Reported-by: Grazvydas Ignotas <notasas@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96607 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Cc: Kristian Høgsberg <krh@bitplanet.net> Cc: "12.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_wm_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen7_wm_surface_state.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index 2a7ae31..932e62e 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -365,6 +365,13 @@ gen7_update_texture_surface(struct gl_context *ctx,
} else {
struct intel_texture_object *intel_obj = intel_texture_object(obj);
struct intel_mipmap_tree *mt = intel_obj->mt;
+
+ if (plane > 0) {
+ if (mt->plane[plane - 1] == NULL)
+ return;
+ mt = mt->plane[plane - 1];
+ }
+
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
/* If this is a view with restricted NumLayers, then our effective depth
* is not just the miptree depth.
@@ -383,17 +390,9 @@ gen7_update_texture_surface(struct gl_context *ctx,
const unsigned swizzle = (unlikely(alpha_depth) ? SWIZZLE_XYZW :
brw_get_texture_swizzle(&brw->ctx, obj));
- unsigned format = translate_tex_format(
- brw, intel_obj->_Format, sampler->sRGBDecode);
-
- if (obj->Target == GL_TEXTURE_EXTERNAL_OES) {
- if (plane > 0)
- mt = mt->plane[plane - 1];
- if (mt == NULL)
- return;
-
- format = translate_tex_format(brw, mt->format, sampler->sRGBDecode);
- }
+ mesa_format mesa_fmt = plane == 0 ? intel_obj->_Format : mt->format;
+ unsigned format = translate_tex_format(brw, mesa_fmt,
+ sampler->sRGBDecode);
if (for_gather && format == BRW_SURFACEFORMAT_R32G32_FLOAT)
format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;