Merge remote branch 'origin/master' into lp-setup-llvm
[mesa.git] / src / mesa / drivers / dri / i965 / brw_wm_state.c
index 1789b21451d3118b311b67f3eedcd4a70cfb1539..817adefb0cc8a2ae7043c1cf308ed1f72000fa20 100644 (file)
@@ -58,7 +58,7 @@ struct brw_wm_unit_key {
 static void
 wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 {
-   GLcontext *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->intel.ctx;
    const struct gl_fragment_program *fp = brw->fragment_program;
    const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp;
    struct intel_context *intel = &brw->intel;
@@ -104,8 +104,17 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
    key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
    key->is_glsl = bfp->isGLSL;
 
-   /* temporary sanity check assertion */
-   ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp));
+   /* If using the fragment shader backend, the program is always
+    * 8-wide.
+    */
+   if (ctx->Shader.CurrentProgram) {
+      struct brw_shader *shader = (struct brw_shader *)
+        ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT];
+
+      if (shader != NULL && shader->ir != NULL) {
+        key->is_glsl = GL_TRUE;
+      }
+   }
 
    /* _NEW_DEPTH */
    key->stats_wm = intel->stats_wm;
@@ -222,7 +231,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
       drm_intel_bo_emit_reloc(bo, offsetof(struct brw_wm_unit_state, thread2),
                              brw->wm.scratch_bo,
                              wm.thread2.per_thread_scratch_space,
-                             0, 0);
+                             I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
    }
 
    /* Emit sampler state relocation */