summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/program.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-04-07 15:15:09 -0700
committerKenneth Graunke <[email protected]>2015-04-11 12:35:33 -0700
commit89c1feb78d010bc457f5d02be84c955eebf3549f (patch)
tree558425e1ff2c21b99d66ba218f143b6c2759540b /src/mesa/program/program.c
parentb3e286c4575bf6af343c1a03471fd876cdfb5c43 (diff)
i965: Create NIR during LinkShader() and ProgramStringNotify().
Previously, we translated into NIR and did all the optimizations and lowering as part of running fs_visitor. This meant that we did all of that work twice for fragment shaders - once for SIMD8, and again for SIMD16. We also had to redo it every time we hit a state based recompile. We now generate NIR once at link time. ARB programs don't have linking, so we instead generate it at ProgramStringNotify time. Mesa's fixed function vertex program handling doesn't bother to inform the driver about new programs at all (which is rather mean), so we generate NIR at the last minute, if it hasn't happened already. shader-db runs ~9.4% faster on my i7-5600U, with a release build. v2: Check NirOptions != NULL in ProgramStringNotify(). Don't bother using _mesa_program_enum_to_shader_stage as we already know it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/program/program.c')
-rw-r--r--src/mesa/program/program.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 3c214d5e361..4f28e2a3b54 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -37,6 +37,7 @@
#include "prog_cache.h"
#include "prog_parameter.h"
#include "prog_instruction.h"
+#include "util/ralloc.h"
/**
@@ -380,6 +381,10 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
_mesa_free_parameter_list(prog->Parameters);
}
+ if (prog->nir) {
+ ralloc_free(prog->nir);
+ }
+
free(prog);
}