summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-09-25 11:56:12 +0100
committerJosé Fonseca <[email protected]>2011-09-25 12:18:55 +0100
commit4703f50e96fe3a9db039f59e154e15c06c3f8367 (patch)
treeb6d2e3e64d2f525440642d3b9f112f30bf9b4d3e /src/gallium
parent785b9e7c780d8e436ef557a22cf916f7869f7390 (diff)
postprocess: Portability fixes.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/postprocess/pp_init.c32
-rw-r--r--src/gallium/auxiliary/postprocess/pp_mlaa.c16
-rw-r--r--src/gallium/auxiliary/postprocess/pp_program.c3
3 files changed, 27 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c
index 75417999b7e..fd9eb22dc06 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -25,9 +25,7 @@
*
**************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
+#include "pipe/p_compiler.h"
#include "postprocess/filters.h"
@@ -35,6 +33,8 @@
#include "util/u_inlines.h"
#include "util/u_blit.h"
#include "util/u_math.h"
+#include "util/u_debug.h"
+#include "util/u_memory.h"
#include "cso_cache/cso_context.h"
/** Initialize the post-processing queue. */
@@ -56,10 +56,10 @@ pp_init(struct pipe_screen *pscreen, const unsigned int *enabled)
if (!curpos)
return NULL;
- ppq = calloc(1, sizeof(struct pp_queue_t));
- tmp_q = calloc(curpos, sizeof(pp_func));
- ppq->shaders = calloc(curpos, sizeof(void *));
- ppq->verts = calloc(curpos, sizeof(unsigned int));
+ ppq = CALLOC(1, sizeof(struct pp_queue_t));
+ tmp_q = CALLOC(curpos, sizeof(pp_func));
+ ppq->shaders = CALLOC(curpos, sizeof(void *));
+ ppq->verts = CALLOC(curpos, sizeof(unsigned int));
if (!tmp_q || !ppq || !ppq->shaders || !ppq->verts)
goto error;
@@ -78,7 +78,7 @@ pp_init(struct pipe_screen *pscreen, const unsigned int *enabled)
if (pp_filters[i].shaders) {
ppq->shaders[curpos] =
- calloc(pp_filters[i].shaders + 1, sizeof(void *));
+ CALLOC(pp_filters[i].shaders + 1, sizeof(void *));
ppq->verts[curpos] = pp_filters[i].verts;
if (!ppq->shaders[curpos])
goto error;
@@ -110,9 +110,9 @@ pp_init(struct pipe_screen *pscreen, const unsigned int *enabled)
pp_debug("Error setting up pp\n");
if (ppq)
- free(ppq->p);
- free(ppq);
- free(tmp_q);
+ FREE(ppq->p);
+ FREE(ppq);
+ FREE(tmp_q);
return NULL;
}
@@ -171,9 +171,9 @@ pp_free(struct pp_queue_t *ppq)
cso_destroy_context(ppq->p->cso);
ppq->p->pipe->destroy(ppq->p->pipe);
- free(ppq->p);
- free(ppq->pp_queue);
- free(ppq);
+ FREE(ppq->p);
+ FREE(ppq->pp_queue);
+ FREE(ppq);
pp_debug("Queue taken down.\n");
}
@@ -184,11 +184,11 @@ pp_debug(const char *fmt, ...)
{
va_list ap;
- if (!getenv("PP_DEBUG"))
+ if (!debug_get_bool_option("PP_DEBUG", FALSE))
return;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ _debug_vprintf(fmt, ap);
va_end(ap);
}
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index 5708687a1c2..f514e692985 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -38,8 +38,8 @@
* policies, either expressed or implied, of the copyright holders.
*/
-#include <stdio.h>
-#include <string.h>
+#include "pipe/p_compiler.h"
+
#include "postprocess/postprocess.h"
#include "postprocess/pp_mlaa.h"
#include "postprocess/pp_filters.h"
@@ -47,6 +47,8 @@
#include "util/u_box.h"
#include "util/u_sampler.h"
#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_string.h"
#include "pipe/p_screen.h"
#define IMM_SPACE 80
@@ -211,7 +213,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
struct pipe_box box;
struct pipe_resource res;
- char *tmp_text = calloc(sizeof(blend2fs_1) + sizeof(blend2fs_2) +
+ char *tmp_text = CALLOC(sizeof(blend2fs_1) + sizeof(blend2fs_2) +
IMM_SPACE, sizeof(char));
constbuf = pipe_buffer_create(ppq->p->screen, PIPE_BIND_CONSTANT_BUFFER,
@@ -228,9 +230,9 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
pp_debug("Failed to allocate shader space\n");
return;
}
- sprintf(tmp_text, "%s"
- "IMM FLT32 { %.8f, 0.0000, 0.0000, 0.0000}\n"
- "%s\n", blend2fs_1, (float) val, blend2fs_2);
+ util_sprintf(tmp_text, "%s"
+ "IMM FLT32 { %.8f, 0.0000, 0.0000, 0.0000}\n"
+ "%s\n", blend2fs_1, (float) val, blend2fs_2);
memset(&res, 0, sizeof(res));
@@ -267,7 +269,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
ppq->shaders[n][4] = pp_tgsi_to_state(ppq->p->pipe, neigh3fs, false,
"neigh3fs");
- free(tmp_text);
+ FREE(tmp_text);
}
/** Short wrapper to init the depth version. */
diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
index b92ac80a5db..c287af5cf00 100644
--- a/src/gallium/auxiliary/postprocess/pp_program.c
+++ b/src/gallium/auxiliary/postprocess/pp_program.c
@@ -34,13 +34,14 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
#include "util/u_simple_shaders.h"
+#include "util/u_memory.h"
/** Initialize the internal details */
struct program *
pp_init_prog(struct pp_queue_t *ppq, struct pipe_screen *pscreen)
{
- struct program *p = calloc(1, sizeof(struct program));
+ struct program *p = CALLOC(1, sizeof(struct program));
pp_debug("Initializing program\n");
if (!pscreen)