gallium: add PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION
[mesa.git] / src / gallium / drivers / svga / svga_state_vs.c
index f46e6b3d4da6e9a838fd0010853afc429ebf53fc..325ef3ebad4393ba8c8f8c5de45e682f0fcc76b4 100644 (file)
@@ -52,7 +52,6 @@ get_dummy_vertex_shader(void)
    const struct tgsi_token *tokens;
    struct ureg_src src;
    struct ureg_dst dst;
-   unsigned num_tokens;
 
    ureg = ureg_create(PIPE_SHADER_VERTEX);
    if (!ureg)
@@ -63,7 +62,7 @@ get_dummy_vertex_shader(void)
    ureg_MOV(ureg, dst, src);
    ureg_END(ureg);
 
-   tokens = ureg_get_tokens(ureg, &num_tokens);
+   tokens = ureg_get_tokens(ureg, NULL);
 
    ureg_destroy(ureg);
 
@@ -162,7 +161,7 @@ compile_vs(struct svga_context *svga,
 static void
 make_vs_key(struct svga_context *svga, struct svga_compile_key *key)
 {
-   const unsigned shader = PIPE_SHADER_VERTEX;
+   const enum pipe_shader_type shader = PIPE_SHADER_VERTEX;
 
    memset(key, 0, sizeof *key);
 
@@ -264,7 +263,6 @@ compile_passthrough_vs(struct svga_context *svga,
    struct ureg_src src[PIPE_MAX_SHADER_INPUTS];
    struct ureg_dst dst[PIPE_MAX_SHADER_OUTPUTS];
    struct ureg_program *ureg;
-   unsigned num_tokens;
    struct svga_compile_key key;
    enum pipe_error ret;
 
@@ -313,7 +311,7 @@ compile_passthrough_vs(struct svga_context *svga,
    ureg_END(ureg);
 
    memset(&new_vs, 0, sizeof(new_vs));
-   new_vs.base.tokens = ureg_get_tokens(ureg, &num_tokens);
+   new_vs.base.tokens = ureg_get_tokens(ureg, NULL);
    tgsi_scan_shader(new_vs.base.tokens, &new_vs.base.info);
 
    memset(&key, 0, sizeof(key));
@@ -346,6 +344,8 @@ emit_hw_vs(struct svga_context *svga, unsigned dirty)
    enum pipe_error ret = PIPE_OK;
    struct svga_compile_key key;
 
+   SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_EMITVS);
+
    /* If there is an active geometry shader, and it has stream output
     * defined, then we will skip the stream output from the vertex shader
     */
@@ -381,7 +381,7 @@ emit_hw_vs(struct svga_context *svga, unsigned dirty)
             ret = compile_vs(svga, vs, &key, &variant);
          }
          if (ret != PIPE_OK)
-            return ret;
+            goto done;
 
          /* insert the new variant at head of linked list */
          assert(variant);
@@ -395,7 +395,7 @@ emit_hw_vs(struct svga_context *svga, unsigned dirty)
       if (variant) {
          ret = svga_set_shader(svga, SVGA3D_SHADERTYPE_VS, variant);
          if (ret != PIPE_OK)
-            return ret;
+            goto done;
          svga->rebind.flags.vs = FALSE;
       }
 
@@ -403,7 +403,9 @@ emit_hw_vs(struct svga_context *svga, unsigned dirty)
       svga->state.hw_draw.vs = variant;
    }
 
-   return PIPE_OK;
+done:
+   SVGA_STATS_TIME_POP(svga_sws(svga));
+   return ret;
 }
 
 struct svga_tracked_state svga_hw_vs =