summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/postprocess/pp_celshade.c
diff options
context:
space:
mode:
authorMatthew McClure <[email protected]>2013-06-21 13:45:55 -0700
committerBrian Paul <[email protected]>2013-06-27 09:44:29 -0600
commite87fc11cac696881469a57955af2ac7b4929a2c7 (patch)
tree58731bbae06fc08d4878089b77055ade2c67538e /src/gallium/auxiliary/postprocess/pp_celshade.c
parent482c43a946a126a354bc30569ae8c41d3f50b06c (diff)
postprocess: handle partial intialization failures.
This patch fixes segfaults observed when enabling the post processing features. When the format is not supported, or a texture cannot be created, the code must gracefully handle failure and report the error to the calling code for proper failure handling. To accomplish this the following changes were made to the filters.h prototypes: - bool return for pp_init_func - Added pp_free_func for filter specific resource destruction Fixes segfaults from backtraces: * util_destroy_blit pp_free * u_transfer_inline_write_vtbl pp_jimenezmlaa_init_run pp_init This patch also uses tgsi_alloc_tokens to allocate temporary tokens in pp_tgsi_to_state, instead of allocating the array on the stack. This fixes the following stack corruption segfault in pp_run.c: * _int_free aaline_delete_fs_state pp_free Bug Number: 1021843 Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/postprocess/pp_celshade.c')
-rw-r--r--src/gallium/auxiliary/postprocess/pp_celshade.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/postprocess/pp_celshade.c b/src/gallium/auxiliary/postprocess/pp_celshade.c
index 447b4015be4..471ec38f141 100644
--- a/src/gallium/auxiliary/postprocess/pp_celshade.c
+++ b/src/gallium/auxiliary/postprocess/pp_celshade.c
@@ -30,9 +30,17 @@
#include "postprocess/pp_filters.h"
/** Init function */
-void
+bool
pp_celshade_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
{
ppq->shaders[n][1] =
pp_tgsi_to_state(ppq->p->pipe, celshade, false, "celshade");
+
+ return (ppq->shaders[n][1] != NULL) ? TRUE : FALSE;
+}
+
+/** Free function */
+void
+pp_celshade_free(struct pp_queue_t *ppq, unsigned int n)
+{
}