1 /**************************************************************************
3 * Copyright 2011 Lauri Kasanen
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "postprocess/pp_program.h"
33 #define PP_FILTERS 6 /* Increment this if you add filters */
34 #define PP_MAX_PASSES 6
36 struct pp_queue_t
; /* Forward definition */
38 /* Less typing later on */
39 typedef void (*pp_func
) (struct pp_queue_t
*, struct pipe_resource
*,
40 struct pipe_resource
*, unsigned int);
42 * The main post-processing queue.
46 pp_func
*pp_queue
; /* An array of pp_funcs */
47 unsigned int n_filters
; /* Number of enabled filters */
49 struct pipe_resource
*tmp
[2]; /* Two temp FBOs for the queue */
50 struct pipe_resource
*inner_tmp
[3]; /* Three for filter use */
52 unsigned int n_tmp
, n_inner_tmp
;
54 struct pipe_resource
*depth
; /* depth of original input */
55 struct pipe_resource
*stencil
; /* stencil shared by inner_tmps */
56 struct pipe_resource
*constbuf
; /* MLAA constant buffer */
57 struct pipe_resource
*areamaptex
; /* MLAA area map texture */
59 struct pipe_surface
*tmps
[2], *inner_tmps
[3], *stencils
;
61 void ***shaders
; /* Shaders in TGSI form */
62 unsigned int *filters
; /* Active filter to filters.h mapping. */
70 struct pp_queue_t
*pp_init(struct pipe_context
*pipe
, const unsigned int *,
71 struct cso_context
*);
72 void pp_run(struct pp_queue_t
*, struct pipe_resource
*,
73 struct pipe_resource
*, struct pipe_resource
*);
74 void pp_free(struct pp_queue_t
*);
75 void pp_free_fbos(struct pp_queue_t
*);
76 void pp_debug(const char *, ...);
77 struct program
*pp_init_prog(struct pp_queue_t
*, struct pipe_context
*pipe
,
78 struct cso_context
*);
79 void pp_init_fbos(struct pp_queue_t
*, unsigned int, unsigned int);
83 void pp_nocolor(struct pp_queue_t
*, struct pipe_resource
*,
84 struct pipe_resource
*, unsigned int);
86 void pp_jimenezmlaa(struct pp_queue_t
*, struct pipe_resource
*,
87 struct pipe_resource
*, unsigned int);
88 void pp_jimenezmlaa_color(struct pp_queue_t
*, struct pipe_resource
*,
89 struct pipe_resource
*, unsigned int);
91 /* The filter init functions */
93 bool pp_celshade_init(struct pp_queue_t
*, unsigned int, unsigned int);
95 bool pp_nored_init(struct pp_queue_t
*, unsigned int, unsigned int);
96 bool pp_nogreen_init(struct pp_queue_t
*, unsigned int, unsigned int);
97 bool pp_noblue_init(struct pp_queue_t
*, unsigned int, unsigned int);
99 bool pp_jimenezmlaa_init(struct pp_queue_t
*, unsigned int, unsigned int);
100 bool pp_jimenezmlaa_init_color(struct pp_queue_t
*, unsigned int,
103 /* The filter free functions */
105 void pp_celshade_free(struct pp_queue_t
*, unsigned int);
106 void pp_nocolor_free(struct pp_queue_t
*, unsigned int);
107 void pp_jimenezmlaa_free(struct pp_queue_t
*, unsigned int);