Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4358 | Serge | 1 | /************************************************************************** |
2 | * |
||
3 | * Copyright 2011 Lauri Kasanen |
||
4 | * All Rights Reserved. |
||
5 | * |
||
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: |
||
13 | * |
||
14 | * The above copyright notice and this permission notice (including the |
||
15 | * next paragraph) shall be included in all copies or substantial portions |
||
16 | * of the Software. |
||
17 | * |
||
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. |
||
25 | * |
||
26 | **************************************************************************/ |
||
27 | |||
28 | #ifndef POSTPROCESS_H |
||
29 | #define POSTPROCESS_H |
||
30 | |||
31 | #include "postprocess/pp_program.h" |
||
32 | |||
33 | #define PP_FILTERS 6 /* Increment this if you add filters */ |
||
34 | #define PP_MAX_PASSES 6 |
||
35 | |||
36 | struct pp_queue_t; /* Forward definition */ |
||
37 | |||
38 | /* Less typing later on */ |
||
39 | typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *, |
||
40 | struct pipe_resource *, unsigned int); |
||
41 | /** |
||
42 | * The main post-processing queue. |
||
43 | */ |
||
44 | struct pp_queue_t |
||
45 | { |
||
46 | pp_func *pp_queue; /* An array of pp_funcs */ |
||
47 | unsigned int n_filters; /* Number of enabled filters */ |
||
48 | |||
49 | struct pipe_resource *tmp[2]; /* Two temp FBOs for the queue */ |
||
50 | struct pipe_resource *inner_tmp[3]; /* Three for filter use */ |
||
51 | |||
52 | unsigned int n_tmp, n_inner_tmp; |
||
53 | |||
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 */ |
||
58 | |||
59 | struct pipe_surface *tmps[2], *inner_tmps[3], *stencils; |
||
60 | |||
61 | void ***shaders; /* Shaders in TGSI form */ |
||
62 | unsigned int *filters; /* Active filter to filters.h mapping. */ |
||
63 | struct program *p; |
||
64 | |||
65 | bool fbos_init; |
||
66 | }; |
||
67 | |||
68 | /* Main functions */ |
||
69 | |||
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); |
||
80 | void pp_blit(struct pipe_context *pipe, |
||
81 | struct pipe_resource *src_tex, |
||
82 | int srcX0, int srcY0, |
||
83 | int srcX1, int srcY1, |
||
84 | int srcZ0, |
||
85 | struct pipe_surface *dst, |
||
86 | int dstX0, int dstY0, |
||
87 | int dstX1, int dstY1); |
||
88 | |||
89 | /* The filters */ |
||
90 | |||
91 | void pp_nocolor(struct pp_queue_t *, struct pipe_resource *, |
||
92 | struct pipe_resource *, unsigned int); |
||
93 | |||
94 | void pp_jimenezmlaa(struct pp_queue_t *, struct pipe_resource *, |
||
95 | struct pipe_resource *, unsigned int); |
||
96 | void pp_jimenezmlaa_color(struct pp_queue_t *, struct pipe_resource *, |
||
97 | struct pipe_resource *, unsigned int); |
||
98 | |||
99 | /* The filter init functions */ |
||
100 | |||
101 | bool pp_celshade_init(struct pp_queue_t *, unsigned int, unsigned int); |
||
102 | |||
103 | bool pp_nored_init(struct pp_queue_t *, unsigned int, unsigned int); |
||
104 | bool pp_nogreen_init(struct pp_queue_t *, unsigned int, unsigned int); |
||
105 | bool pp_noblue_init(struct pp_queue_t *, unsigned int, unsigned int); |
||
106 | |||
107 | bool pp_jimenezmlaa_init(struct pp_queue_t *, unsigned int, unsigned int); |
||
108 | bool pp_jimenezmlaa_init_color(struct pp_queue_t *, unsigned int, |
||
109 | unsigned int); |
||
110 | |||
111 | /* The filter free functions */ |
||
112 | |||
113 | void pp_celshade_free(struct pp_queue_t *, unsigned int); |
||
114 | void pp_nocolor_free(struct pp_queue_t *, unsigned int); |
||
115 | void pp_jimenezmlaa_free(struct pp_queue_t *, unsigned int); |
||
116 | |||
117 | #endif |