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