svga: Fix banded DMA upload unmap
[mesa.git] / src / gallium / drivers / svga / svga_tgsi.c
index c62d4d671ef08d160eefdfd1b5183a94ec2fa4a8..5c3afee38453e8cbcf34cb7b3c4b1d38152d415e 100644 (file)
  */
 static char err_buf[128];
 
-#if 0
-static void
-svga_destroy_shader_emitter(struct svga_shader_emitter *emit)
-{
-   if (emit->buf != err_buf)
-      FREE(emit->buf);
-}
-#endif
-
 
 static boolean
 svga_shader_expand(struct svga_shader_emitter *emit)
@@ -177,11 +168,14 @@ svga_shader_emit_header(struct svga_shader_emitter *emit)
 struct svga_shader_variant *
 svga_tgsi_vgpu9_translate(struct svga_context *svga,
                           const struct svga_shader *shader,
-                          const struct svga_compile_key *key, unsigned unit)
+                          const struct svga_compile_key *key,
+                          enum pipe_shader_type unit)
 {
    struct svga_shader_variant *variant = NULL;
    struct svga_shader_emitter emit;
 
+   SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_TGSIVGPU9TRANSLATE);
+
    memset(&emit, 0, sizeof(emit));
 
    emit.size = 1024;
@@ -216,6 +210,12 @@ svga_tgsi_vgpu9_translate(struct svga_context *svga,
       goto fail;
    }
 
+   if (emit.info.indirect_files & (1 << TGSI_FILE_TEMPORARY)) {
+      debug_printf(
+         "svga: indirect indexing of temporary registers is not supported.\n");
+      goto fail;
+   }
+
    emit.in_main_func = TRUE;
 
    if (!svga_shader_emit_header(&emit)) {
@@ -228,7 +228,7 @@ svga_tgsi_vgpu9_translate(struct svga_context *svga,
       goto fail;
    }
 
-   variant = svga_new_shader_variant(svga);
+   variant = svga_new_shader_variant(svga, unit);
    if (!variant)
       goto fail;
 
@@ -261,10 +261,15 @@ svga_tgsi_vgpu9_translate(struct svga_context *svga,
    }
 #endif
 
-   return variant;
+   goto done;
 
- fail:
+fail:
    FREE(variant);
-   FREE(emit.buf);
-   return NULL;
+   if (emit.buf != err_buf)
+      FREE(emit.buf);
+   variant = NULL;
+
+done:
+   SVGA_STATS_TIME_POP(svga_sws(svga));
+   return variant;
 }