summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_gs.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2014-04-23 17:06:13 -0400
committerZack Rusin <zackr@vmware.com>2014-04-24 13:59:24 -0400
commit1c73e919a4b4dd79166d0633075990056f27fd28 (patch)
tree0a8295b69c5cba74760fa28bea7abab4bb7a618c /src/gallium/auxiliary/draw/draw_gs.c
parent552a8e44a92937a6ec6db05f4bea583245431b71 (diff)
downloadexternal_mesa3d-1c73e919a4b4dd79166d0633075990056f27fd28.zip
external_mesa3d-1c73e919a4b4dd79166d0633075990056f27fd28.tar.gz
external_mesa3d-1c73e919a4b4dd79166d0633075990056f27fd28.tar.bz2
draw/llvm: reduce memory usage
Lets make draw_get_option_use_llvm function available unconditionally and use it to avoid useless allocations when LLVM paths are active. TGSI machine is never used when we're using LLVM. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_gs.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 7de5e03..5e503ff 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -674,11 +674,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
struct draw_context *draw)
{
-#ifdef HAVE_LLVM
boolean use_llvm = draw_get_option_use_llvm();
-#else
- boolean use_llvm = FALSE;
-#endif
if (!use_llvm && shader && shader->machine->Tokens != shader->state.tokens) {
tgsi_exec_machine_bind_shader(shader->machine,
shader->state.tokens,
@@ -690,16 +686,18 @@ void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
boolean
draw_gs_init( struct draw_context *draw )
{
- draw->gs.tgsi.machine = tgsi_exec_machine_create();
- if (!draw->gs.tgsi.machine)
- return FALSE;
-
- draw->gs.tgsi.machine->Primitives = align_malloc(
- MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector), 16);
- if (!draw->gs.tgsi.machine->Primitives)
- return FALSE;
- memset(draw->gs.tgsi.machine->Primitives, 0,
- MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector));
+ if (!draw_get_option_use_llvm()) {
+ draw->gs.tgsi.machine = tgsi_exec_machine_create();
+ if (!draw->gs.tgsi.machine)
+ return FALSE;
+
+ draw->gs.tgsi.machine->Primitives = align_malloc(
+ MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector), 16);
+ if (!draw->gs.tgsi.machine->Primitives)
+ return FALSE;
+ memset(draw->gs.tgsi.machine->Primitives, 0,
+ MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector));
+ }
return TRUE;
}