X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fsvga%2Fsvga_state_vs.c;h=492a929bd8f1fab8a33ddb5d608a8f432fc19dc7;hb=9b75061386ea52bcd1041fb7840e0121d5a883c5;hp=a0ab868cbbab80ee4f17c61ef48b26a1544aae0f;hpb=4f3974d7586070fe72a9ef09d3df3f24b4a49f43;p=mesa.git diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c index a0ab868cbba..492a929bd8f 100644 --- a/src/gallium/drivers/svga/svga_state_vs.c +++ b/src/gallium/drivers/svga/svga_state_vs.c @@ -105,6 +105,9 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga, FREE((void *) vs->base.tokens); vs->base.tokens = dummy; + tgsi_scan_shader(vs->base.tokens, &vs->base.info); + vs->generic_outputs = svga_get_generic_outputs_mask(&vs->base.info); + variant = translate_vertex_program(svga, vs, key); return variant; } @@ -135,7 +138,7 @@ compile_vs(struct svga_context *svga, (unsigned) (variant->nr_tokens * sizeof(variant->tokens[0]))); /* Free the too-large variant */ - svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, variant); + svga_destroy_shader_variant(svga, variant); /* Use simple pass-through shader instead */ variant = get_compiled_dummy_vertex_shader(svga, vs, key); } @@ -144,9 +147,9 @@ compile_vs(struct svga_context *svga, return PIPE_ERROR; } - ret = svga_define_shader(svga, SVGA3D_SHADERTYPE_VS, variant); + ret = svga_define_shader(svga, variant); if (ret != PIPE_OK) { - svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, variant); + svga_destroy_shader_variant(svga, variant); return ret; } @@ -161,7 +164,7 @@ compile_vs(struct svga_context *svga, static void make_vs_key(struct svga_context *svga, struct svga_compile_key *key) { - const enum pipe_shader_type shader = PIPE_SHADER_VERTEX; + struct svga_vertex_shader *vs = svga->curr.vs; memset(key, 0, sizeof *key); @@ -172,8 +175,13 @@ make_vs_key(struct svga_context *svga, struct svga_compile_key *key) return; } + if (svga_have_vgpu10(svga)) { + key->vs.need_vertex_id_bias = 1; + } + /* SVGA_NEW_PRESCALE */ - key->vs.need_prescale = svga->state.hw_clear.prescale.enabled && + key->vs.need_prescale = svga->state.hw_clear.prescale[0].enabled && + (svga->curr.tes == NULL) && (svga->curr.gs == NULL); /* SVGA_NEW_RAST */ @@ -196,10 +204,16 @@ make_vs_key(struct svga_context *svga, struct svga_compile_key *key) key->vs.attrib_puint_to_sscaled = svga->curr.velems->attrib_puint_to_sscaled; /* SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER */ - svga_init_shader_key_common(svga, shader, key); + svga_init_shader_key_common(svga, PIPE_SHADER_VERTEX, &vs->base, key); /* SVGA_NEW_RAST */ key->clip_plane_enable = svga->curr.rast->templ.clip_plane_enable; + + /* Determine if this shader is the last shader in the vertex + * processing stage. + */ + key->last_vertex_stage = !(svga->curr.gs || + svga->curr.tcs || svga->curr.tes); } @@ -224,16 +238,15 @@ svga_reemit_vs_bindings(struct svga_context *svga) if (!svga_need_to_rebind_resources(svga)) { ret = svga->swc->resource_rebind(svga->swc, NULL, gbshader, SVGA_RELOC_READ); - goto out; + } + else { + if (svga_have_vgpu10(svga)) + ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS, + gbshader, shaderId); + else + ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader); } - if (svga_have_vgpu10(svga)) - ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS, - gbshader, shaderId); - else - ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader); - - out: if (ret != PIPE_OK) return ret; @@ -336,7 +349,7 @@ compile_passthrough_vs(struct svga_context *svga, static enum pipe_error -emit_hw_vs(struct svga_context *svga, unsigned dirty) +emit_hw_vs(struct svga_context *svga, uint64_t dirty) { struct svga_shader_variant *variant; struct svga_vertex_shader *vs = svga->curr.vs;