summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_shader.c
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-03-19 16:32:40 +0100
committerChristian Gmeiner <[email protected]>2017-04-05 19:58:07 +0200
commit9da54fdcb5b591a7d6c96871e92f8b183c0a5130 (patch)
tree0abb110cb69f3a9bed76a647ced1699877454c3b /src/gallium/drivers/etnaviv/etnaviv_shader.c
parentffd47623102a7c873684c5024d87747d280d3d5d (diff)
etnaviv: pass a preallocated variant to compiler
In the long run the compiler needs to know the specifc variant 'key' in order to compile appropriate assembly. With this commit the variant knows its shader and we are able pass the preallocated variant into etna_compile_shader(..). This saves us from passing extra ptrs everywhere. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Lucas Stach <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_shader.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_shader.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c
index 6996187871f..5035eaffde6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_shader.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c
@@ -270,17 +270,27 @@ etna_shader_update_vertex(struct etna_context *ctx)
static struct etna_shader_variant *
create_variant(struct etna_shader *shader)
{
- struct etna_shader_variant *v;
+ struct etna_shader_variant *v = CALLOC_STRUCT(etna_shader_variant);
+ int ret;
- v = etna_compile_shader(shader->specs, shader->tokens);
- if (!v) {
- debug_error("compile failed!");
+ if (!v)
return NULL;
+
+ v->shader = shader;
+
+ ret = etna_compile_shader(v);
+ if (!ret) {
+ debug_error("compile failed!");
+ goto fail;
}
v->id = ++shader->variant_count;
return v;
+
+fail:
+ FREE(v);
+ return NULL;
}
static void *