summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index dfd9e1f73a6..d6734401029 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -106,6 +106,37 @@ etna_update_state_for_draw(struct etna_context *ctx, const struct pipe_draw_info
}
}
+static bool
+etna_get_vs(struct etna_context *ctx, struct etna_shader_key key)
+{
+ const struct etna_shader_variant *old = ctx->shader.vs;
+
+ ctx->shader.vs = etna_shader_variant(ctx->shader.bind_vs, key, &ctx->debug);
+
+ if (!ctx->shader.vs)
+ return false;
+
+ if (old != ctx->shader.vs)
+ ctx->dirty |= ETNA_DIRTY_SHADER;
+
+ return true;
+}
+
+static bool
+etna_get_fs(struct etna_context *ctx, struct etna_shader_key key)
+{
+ const struct etna_shader_variant *old = ctx->shader.fs;
+
+ ctx->shader.fs = etna_shader_variant(ctx->shader.bind_fs, key, &ctx->debug);
+
+ if (!ctx->shader.fs)
+ return false;
+
+ if (old != ctx->shader.fs)
+ ctx->dirty |= ETNA_DIRTY_SHADER;
+
+ return true;
+}
static void
etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
@@ -152,6 +183,13 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
return;
}
+ struct etna_shader_key key = {};
+
+ if (!etna_get_vs(ctx, key) || !etna_get_fs(ctx, key)) {
+ BUG("compiled shaders are not okay");
+ return;
+ }
+
/* Update any derived state */
if (!etna_state_update(ctx))
return;