*
**************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
+#include "pipe/p_compiler.h"
#include "postprocess/filters.h"
#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. */
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;
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;
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;
}
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");
}
{
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);
}
* 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"
#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
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,
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));
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. */
#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)