i915g: enable separate depth/stencil clears
[mesa.git] / src / gallium / drivers / i915 / i915_fpc_translate.c
index 25c53210be8eb2552440c4e1c74575459b2e2c62..b145b58be30aab28ee6329f561be824af56dbc6f 100644 (file)
@@ -924,6 +924,14 @@ i915_translate_instructions(struct i915_fp_compile *p,
       tgsi_parse_token( &parse );
 
       switch( parse.FullToken.Token.Type ) {
+      case TGSI_TOKEN_TYPE_PROPERTY:
+         /*
+          * We only support one cbuf, but we still need to ignore the property
+          * correctly so we don't hit the assert at the end of the switch case.
+          */
+         assert(parse.FullToken.FullProperty.Property.PropertyName ==
+                TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS);
+         break;
       case TGSI_TOKEN_TYPE_DECLARATION:
          if (parse.FullToken.FullDeclaration.Declaration.File
                   == TGSI_FILE_CONSTANT) {
@@ -1166,15 +1174,24 @@ void
 i915_translate_fragment_program( struct i915_context *i915,
                                  struct i915_fragment_shader *fs)
 {
-   struct i915_fp_compile *p = i915_init_compile(i915, fs);
+   struct i915_fp_compile *p;
    const struct tgsi_token *tokens = fs->state.tokens;
 
-   i915_find_wpos_space(p);
-
 #if 0
    tgsi_dump(tokens, 0);
 #endif
 
+   /* hw doesn't seem to like empty frag programs, even when the depth write
+    * fixup gets emitted below - may that one is fishy, too? */
+   if (fs->info.num_instructions == 1) {
+      i915_use_passthrough_shader(fs);
+
+      return;
+   }
+
+   p = i915_init_compile(i915, fs);
+   i915_find_wpos_space(p);
+
    i915_translate_instructions(p, tokens);
    i915_fixup_depth_write(p);