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 */
57 struct pipe_surface
*tmps
[2], *inner_tmps
[3], *stencils
;
59 void ***shaders
; /* Shaders in TGSI form */
68 struct pp_queue_t
*pp_init(struct pipe_context
*pipe
, const unsigned int *,
69 struct cso_context
*);
70 void pp_run(struct pp_queue_t
*, struct pipe_resource
*,
71 struct pipe_resource
*, struct pipe_resource
*);
72 void pp_free(struct pp_queue_t
*);
73 void pp_free_fbos(struct pp_queue_t
*);
74 void pp_debug(const char *, ...);
75 struct program
*pp_init_prog(struct pp_queue_t
*, struct pipe_context
*pipe
,
76 struct cso_context
*);
77 void pp_init_fbos(struct pp_queue_t
*, unsigned int, unsigned int);
81 void pp_nocolor(struct pp_queue_t
*, struct pipe_resource
*,
82 struct pipe_resource
*, unsigned int);
84 void pp_jimenezmlaa(struct pp_queue_t
*, struct pipe_resource
*,
85 struct pipe_resource
*, unsigned int);
86 void pp_jimenezmlaa_color(struct pp_queue_t
*, struct pipe_resource
*,
87 struct pipe_resource
*, unsigned int);
89 /* The filter init functions */
91 void pp_celshade_init(struct pp_queue_t
*, unsigned int, unsigned int);
93 void pp_nored_init(struct pp_queue_t
*, unsigned int, unsigned int);
94 void pp_nogreen_init(struct pp_queue_t
*, unsigned int, unsigned int);
95 void pp_noblue_init(struct pp_queue_t
*, unsigned int, unsigned int);
97 void pp_jimenezmlaa_init(struct pp_queue_t
*, unsigned int, unsigned int);
98 void pp_jimenezmlaa_init_color(struct pp_queue_t
*, unsigned int,