• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PP_PRIVATE_H
29 #define PP_PRIVATE_H
30 
31 
32 #include "postprocess.h"
33 #include "cso_cache/cso_context.h"
34 
35 
36 /**
37  * Internal control details.
38  */
39 struct pp_program
40 {
41    struct pipe_screen *screen;
42    struct pipe_context *pipe;
43    struct cso_context *cso;
44    struct st_context_iface *st;
45 
46    struct pipe_blend_state blend;
47    struct pipe_depth_stencil_alpha_state depthstencil;
48    struct pipe_rasterizer_state rasterizer;
49    struct pipe_sampler_state sampler;   /* bilinear */
50    struct pipe_sampler_state sampler_point;     /* point */
51    struct pipe_viewport_state viewport;
52    struct pipe_framebuffer_state framebuffer;
53    struct cso_velems_state velem;
54 
55    union pipe_color_union clear_color;
56 
57    void *passvs;
58 
59    struct pipe_resource *vbuf;
60    struct pipe_surface surf;
61    struct pipe_sampler_view *view;
62 };
63 
64 
65 
66 /**
67  * The main post-processing queue.
68  */
69 struct pp_queue_t
70 {
71    pp_func *pp_queue;           /* An array of pp_funcs */
72    unsigned int n_filters;      /* Number of enabled filters */
73 
74    struct pipe_resource *tmp[2];        /* Two temp FBOs for the queue */
75    struct pipe_resource *inner_tmp[3];  /* Three for filter use */
76 
77    unsigned int n_tmp, n_inner_tmp;
78 
79    struct pipe_resource *depth; /* depth of original input */
80    struct pipe_resource *stencil;       /* stencil shared by inner_tmps */
81    struct pipe_resource *areamaptex;    /* MLAA area map texture */
82 
83    struct pipe_surface *tmps[2], *inner_tmps[3], *stencils;
84 
85    void ***shaders;             /* Shaders in TGSI form */
86    unsigned int *filters;       /* Active filter to filters.h mapping. */
87    struct pp_program *p;
88 
89    bool fbos_init;
90 };
91 
92 
93 void pp_free_fbos(struct pp_queue_t *);
94 
95 void pp_debug(const char *, ...);
96 
97 struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
98                                 struct cso_context *, struct st_context_iface *st);
99 
100 void pp_blit(struct pipe_context *pipe,
101              struct pipe_resource *src_tex,
102              int srcX0, int srcY0,
103              int srcX1, int srcY1,
104              int srcZ0,
105              struct pipe_surface *dst,
106              int dstX0, int dstY0,
107              int dstX1, int dstY1);
108 
109 
110 #endif /* PP_PRIVATE_H */
111