summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-02-15 00:00:39 -0800
committerKenneth Graunke <[email protected]>2019-02-19 15:56:19 -0800
commit3b4929ec6e6456fb093483e2dc9ce008622373d6 (patch)
tree35f66fe55fb2be2d37a8207389cbd39d2d24d07f /src/mesa/state_tracker
parentba7519ca36ce0de74657b01fe4fa2c97aace538e (diff)
st/mesa: Copy VP TGSI tokens if they exist, even for NIR shaders.
Even if the driver wants to use NIR shaders, we may need to have TGSI tokens for creating draw module vertex shaders for the feedback/select render modes. So...if the st_vertex_program has any TGSI...copy it to the variant. Acked-by: Eric Anholt <[email protected]> Tested-by: Eric Anholt <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_program.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 422b7b2a593..4d017d8c61d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -554,6 +554,14 @@ st_create_vp_variant(struct st_context *st,
vpv->tgsi.stream_output = stvp->tgsi.stream_output;
vpv->num_inputs = stvp->num_inputs;
+ /* When generating a NIR program, we usually don't have TGSI tokens.
+ * However, we do create them for ARB_vertex_program / fixed-function VS
+ * programs which we may need to use with the draw module for legacy
+ * feedback/select emulation. If they exist, copy them.
+ */
+ if (stvp->tgsi.tokens)
+ vpv->tgsi.tokens = tgsi_dup_tokens(stvp->tgsi.tokens);
+
if (stvp->tgsi.type == PIPE_SHADER_IR_NIR) {
vpv->tgsi.type = PIPE_SHADER_IR_NIR;
vpv->tgsi.ir.nir = nir_shader_clone(NULL, stvp->tgsi.ir.nir);
@@ -573,8 +581,6 @@ st_create_vp_variant(struct st_context *st,
return vpv;
}
- vpv->tgsi.tokens = tgsi_dup_tokens(stvp->tgsi.tokens);
-
/* Emulate features. */
if (key->clamp_color || key->passthrough_edgeflags) {
const struct tgsi_token *tokens;