From c27d8cc0c9e605073f2d4b734a74f931d3a67195 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 16 Nov 2013 13:55:50 -0700 Subject: [PATCH] postprocess: refactor header files, etc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move private data structures and function prototypes out of the public postprocess.h header file. Create a pp_private.h for the shared, private data structures, functions. Remove pp_program.h header. Reviewed-by: Marek Olšák --- .../auxiliary/postprocess/postprocess.h | 45 ++------------ .../auxiliary/postprocess/pp_celshade.c | 1 + src/gallium/auxiliary/postprocess/pp_colors.c | 1 + src/gallium/auxiliary/postprocess/pp_init.c | 1 + src/gallium/auxiliary/postprocess/pp_mlaa.c | 2 + .../{pp_program.h => pp_private.h} | 61 ++++++++++++++++--- .../auxiliary/postprocess/pp_program.c | 2 + src/gallium/auxiliary/postprocess/pp_run.c | 4 +- 8 files changed, 70 insertions(+), 47 deletions(-) rename src/gallium/auxiliary/postprocess/{pp_program.h => pp_private.h} (56%) diff --git a/src/gallium/auxiliary/postprocess/postprocess.h b/src/gallium/auxiliary/postprocess/postprocess.h index e0ab43e320f..c4b20301c68 100644 --- a/src/gallium/auxiliary/postprocess/postprocess.h +++ b/src/gallium/auxiliary/postprocess/postprocess.h @@ -28,42 +28,19 @@ #ifndef POSTPROCESS_H #define POSTPROCESS_H -#include "postprocess/pp_program.h" +#include "pipe/p_state.h" #define PP_FILTERS 6 /* Increment this if you add filters */ #define PP_MAX_PASSES 6 +struct cso_context; + struct pp_queue_t; /* Forward definition */ +struct pp_program; /* Less typing later on */ typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *, struct pipe_resource *, unsigned int); -/** -* The main post-processing queue. -*/ -struct pp_queue_t -{ - pp_func *pp_queue; /* An array of pp_funcs */ - unsigned int n_filters; /* Number of enabled filters */ - - struct pipe_resource *tmp[2]; /* Two temp FBOs for the queue */ - struct pipe_resource *inner_tmp[3]; /* Three for filter use */ - - unsigned int n_tmp, n_inner_tmp; - - struct pipe_resource *depth; /* depth of original input */ - struct pipe_resource *stencil; /* stencil shared by inner_tmps */ - struct pipe_resource *constbuf; /* MLAA constant buffer */ - struct pipe_resource *areamaptex; /* MLAA area map texture */ - - struct pipe_surface *tmps[2], *inner_tmps[3], *stencils; - - void ***shaders; /* Shaders in TGSI form */ - unsigned int *filters; /* Active filter to filters.h mapping. */ - struct pp_program *p; - - bool fbos_init; -}; /* Main functions */ @@ -72,19 +49,9 @@ struct pp_queue_t *pp_init(struct pipe_context *pipe, const unsigned int *, void pp_run(struct pp_queue_t *, struct pipe_resource *, struct pipe_resource *, struct pipe_resource *); void pp_free(struct pp_queue_t *); -void pp_free_fbos(struct pp_queue_t *); -void pp_debug(const char *, ...); -struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe, - struct cso_context *); + void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int); -void pp_blit(struct pipe_context *pipe, - struct pipe_resource *src_tex, - int srcX0, int srcY0, - int srcX1, int srcY1, - int srcZ0, - struct pipe_surface *dst, - int dstX0, int dstY0, - int dstX1, int dstY1); + /* The filters */ diff --git a/src/gallium/auxiliary/postprocess/pp_celshade.c b/src/gallium/auxiliary/postprocess/pp_celshade.c index 471ec38f141..9b19fdd84da 100644 --- a/src/gallium/auxiliary/postprocess/pp_celshade.c +++ b/src/gallium/auxiliary/postprocess/pp_celshade.c @@ -28,6 +28,7 @@ #include "postprocess/postprocess.h" #include "postprocess/pp_celshade.h" #include "postprocess/pp_filters.h" +#include "postprocess/pp_private.h" /** Init function */ bool diff --git a/src/gallium/auxiliary/postprocess/pp_colors.c b/src/gallium/auxiliary/postprocess/pp_colors.c index a0b9d282c61..247e4df72a4 100644 --- a/src/gallium/auxiliary/postprocess/pp_colors.c +++ b/src/gallium/auxiliary/postprocess/pp_colors.c @@ -28,6 +28,7 @@ #include "postprocess/postprocess.h" #include "postprocess/pp_colors.h" #include "postprocess/pp_filters.h" +#include "postprocess/pp_private.h" /** The run function of the color filters */ void diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c index edd54ce2fa9..05a08304762 100644 --- a/src/gallium/auxiliary/postprocess/pp_init.c +++ b/src/gallium/auxiliary/postprocess/pp_init.c @@ -28,6 +28,7 @@ #include "pipe/p_compiler.h" #include "postprocess/filters.h" +#include "postprocess/pp_private.h" #include "pipe/p_screen.h" #include "util/u_inlines.h" diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index 656283fd9fc..92bd11c5980 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -43,6 +43,8 @@ #include "postprocess/postprocess.h" #include "postprocess/pp_mlaa.h" #include "postprocess/pp_filters.h" +#include "postprocess/pp_private.h" + #include "util/u_box.h" #include "util/u_sampler.h" #include "util/u_inlines.h" diff --git a/src/gallium/auxiliary/postprocess/pp_program.h b/src/gallium/auxiliary/postprocess/pp_private.h similarity index 56% rename from src/gallium/auxiliary/postprocess/pp_program.h rename to src/gallium/auxiliary/postprocess/pp_private.h index 6fecdc3fe5e..0d032124115 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.h +++ b/src/gallium/auxiliary/postprocess/pp_private.h @@ -1,6 +1,5 @@ /************************************************************************** * - * Copyright 2010 Jakob Bornecrantz * Copyright 2011 Lauri Kasanen * All Rights Reserved. * @@ -26,14 +25,16 @@ * **************************************************************************/ -#ifndef PP_PROGRAM_H -#define PP_PROGRAM_H +#ifndef PP_PRIVATE_H +#define PP_PRIVATE_H + + +#include "postprocess.h" -#include "pipe/p_state.h" /** -* Internal control details. -*/ + * Internal control details. + */ struct pp_program { struct pipe_screen *screen; @@ -59,4 +60,50 @@ struct pp_program }; -#endif + +/** + * The main post-processing queue. + */ +struct pp_queue_t +{ + pp_func *pp_queue; /* An array of pp_funcs */ + unsigned int n_filters; /* Number of enabled filters */ + + struct pipe_resource *tmp[2]; /* Two temp FBOs for the queue */ + struct pipe_resource *inner_tmp[3]; /* Three for filter use */ + + unsigned int n_tmp, n_inner_tmp; + + struct pipe_resource *depth; /* depth of original input */ + struct pipe_resource *stencil; /* stencil shared by inner_tmps */ + struct pipe_resource *constbuf; /* MLAA constant buffer */ + struct pipe_resource *areamaptex; /* MLAA area map texture */ + + struct pipe_surface *tmps[2], *inner_tmps[3], *stencils; + + void ***shaders; /* Shaders in TGSI form */ + unsigned int *filters; /* Active filter to filters.h mapping. */ + struct pp_program *p; + + bool fbos_init; +}; + + +void pp_free_fbos(struct pp_queue_t *); + +void pp_debug(const char *, ...); + +struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe, + struct cso_context *); + +void pp_blit(struct pipe_context *pipe, + struct pipe_resource *src_tex, + int srcX0, int srcY0, + int srcX1, int srcY1, + int srcZ0, + struct pipe_surface *dst, + int dstX0, int dstY0, + int dstX1, int dstY1); + + +#endif /* PP_PRIVATE_H */ diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index 916d6fceaac..19275d742e5 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -27,6 +27,8 @@ **************************************************************************/ #include "postprocess/postprocess.h" +#include "postprocess/pp_private.h" + #include "cso_cache/cso_context.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index c71dbe9adb6..5c6dfa11cde 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -26,13 +26,15 @@ **************************************************************************/ #include "postprocess.h" - #include "postprocess/pp_filters.h" +#include "postprocess/pp_private.h" + #include "util/u_inlines.h" #include "util/u_sampler.h" #include "tgsi/tgsi_parse.h" + void pp_blit(struct pipe_context *pipe, struct pipe_resource *src_tex, -- 2.30.2