X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fpostprocess%2Fpp_mlaa.c;h=b61cbaafb5e9529582bd8703e23528ec2033e90a;hb=507337864fa80caf9f26602324d2c28dd0a75d61;hp=476502fca9322a7a3ec34d19abaf5fa2b0c95bfa;hpb=f8e6d19f3f40931be741b44d3edf210c38e13f0f;p=mesa.git diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index 476502fca93..b61cbaafb5e 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 -#include +#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 @@ -97,8 +99,8 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, dimensions[1] = p->framebuffer.height; } - p->pipe->set_constant_buffer(p->pipe, PIPE_SHADER_VERTEX, 0, constbuf); - p->pipe->set_constant_buffer(p->pipe, PIPE_SHADER_FRAGMENT, 0, constbuf); + pipe_set_constant_buffer(p->pipe, PIPE_SHADER_VERTEX, 0, constbuf); + pipe_set_constant_buffer(p->pipe, PIPE_SHADER_FRAGMENT, 0, constbuf); mstencil.stencil[0].enabled = 1; mstencil.stencil[0].valuemask = mstencil.stencil[0].writemask = ~0; @@ -121,7 +123,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, pp_filter_misc_state(p); cso_set_depth_stencil_alpha(p->cso, &mstencil); p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR, - p->clear_color, 0, 0); + &p->clear_color, 0, 0); cso_single_sampler(p->cso, 0, &p->sampler_point); cso_single_sampler_done(p->cso); @@ -210,9 +212,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) + - IMM_SPACE, sizeof(char)); + char *tmp_text; constbuf = pipe_buffer_create(ppq->p->screen, PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STATIC, sizeof(constants)); @@ -224,13 +224,16 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n, pp_debug("mlaa: using %u max search steps\n", val); + tmp_text = CALLOC(sizeof(blend2fs_1) + sizeof(blend2fs_2) + + IMM_SPACE, sizeof(char)); + if (!tmp_text) { 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 +270,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. */