From c27d8cc0c9e605073f2d4b734a74f931d3a67195 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 16 Nov 2013 13:55:50 -0700 Subject: postprocess: refactor header files, etc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 --- src/gallium/auxiliary/postprocess/postprocess.h | 45 ++-------- src/gallium/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 + src/gallium/auxiliary/postprocess/pp_private.h | 109 ++++++++++++++++++++++++ src/gallium/auxiliary/postprocess/pp_program.c | 2 + src/gallium/auxiliary/postprocess/pp_program.h | 62 -------------- src/gallium/auxiliary/postprocess/pp_run.c | 4 +- 9 files changed, 125 insertions(+), 102 deletions(-) create mode 100644 src/gallium/auxiliary/postprocess/pp_private.h delete mode 100644 src/gallium/auxiliary/postprocess/pp_program.h (limited to 'src/gallium/auxiliary/postprocess') 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_private.h b/src/gallium/auxiliary/postprocess/pp_private.h new file mode 100644 index 00000000000..0d032124115 --- /dev/null +++ b/src/gallium/auxiliary/postprocess/pp_private.h @@ -0,0 +1,109 @@ +/************************************************************************** + * + * Copyright 2011 Lauri Kasanen + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef PP_PRIVATE_H +#define PP_PRIVATE_H + + +#include "postprocess.h" + + +/** + * Internal control details. + */ +struct pp_program +{ + struct pipe_screen *screen; + struct pipe_context *pipe; + struct cso_context *cso; + + struct pipe_blend_state blend; + struct pipe_depth_stencil_alpha_state depthstencil; + struct pipe_rasterizer_state rasterizer; + struct pipe_sampler_state sampler; /* bilinear */ + struct pipe_sampler_state sampler_point; /* point */ + struct pipe_viewport_state viewport; + struct pipe_framebuffer_state framebuffer; + struct pipe_vertex_element velem[2]; + + union pipe_color_union clear_color; + + void *passvs; + + struct pipe_resource *vbuf; + struct pipe_surface surf; + struct pipe_sampler_view *view; +}; + + + +/** + * 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_program.h b/src/gallium/auxiliary/postprocess/pp_program.h deleted file mode 100644 index 6fecdc3fe5e..00000000000 --- a/src/gallium/auxiliary/postprocess/pp_program.h +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Jakob Bornecrantz - * Copyright 2011 Lauri Kasanen - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef PP_PROGRAM_H -#define PP_PROGRAM_H - -#include "pipe/p_state.h" - -/** -* Internal control details. -*/ -struct pp_program -{ - struct pipe_screen *screen; - struct pipe_context *pipe; - struct cso_context *cso; - - struct pipe_blend_state blend; - struct pipe_depth_stencil_alpha_state depthstencil; - struct pipe_rasterizer_state rasterizer; - struct pipe_sampler_state sampler; /* bilinear */ - struct pipe_sampler_state sampler_point; /* point */ - struct pipe_viewport_state viewport; - struct pipe_framebuffer_state framebuffer; - struct pipe_vertex_element velem[2]; - - union pipe_color_union clear_color; - - void *passvs; - - struct pipe_resource *vbuf; - struct pipe_surface surf; - struct pipe_sampler_view *view; -}; - - -#endif 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, -- cgit v1.2.3