1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2011 Lauri Kasanen
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#ifndef PP_PRIVATE_H
29bf215546Sopenharmony_ci#define PP_PRIVATE_H
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci#include "postprocess.h"
33bf215546Sopenharmony_ci#include "cso_cache/cso_context.h"
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci/**
37bf215546Sopenharmony_ci * Internal control details.
38bf215546Sopenharmony_ci */
39bf215546Sopenharmony_cistruct pp_program
40bf215546Sopenharmony_ci{
41bf215546Sopenharmony_ci   struct pipe_screen *screen;
42bf215546Sopenharmony_ci   struct pipe_context *pipe;
43bf215546Sopenharmony_ci   struct cso_context *cso;
44bf215546Sopenharmony_ci   struct st_context_iface *st;
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci   struct pipe_blend_state blend;
47bf215546Sopenharmony_ci   struct pipe_depth_stencil_alpha_state depthstencil;
48bf215546Sopenharmony_ci   struct pipe_rasterizer_state rasterizer;
49bf215546Sopenharmony_ci   struct pipe_sampler_state sampler;   /* bilinear */
50bf215546Sopenharmony_ci   struct pipe_sampler_state sampler_point;     /* point */
51bf215546Sopenharmony_ci   struct pipe_viewport_state viewport;
52bf215546Sopenharmony_ci   struct pipe_framebuffer_state framebuffer;
53bf215546Sopenharmony_ci   struct cso_velems_state velem;
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_ci   union pipe_color_union clear_color;
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ci   void *passvs;
58bf215546Sopenharmony_ci
59bf215546Sopenharmony_ci   struct pipe_resource *vbuf;
60bf215546Sopenharmony_ci   struct pipe_surface surf;
61bf215546Sopenharmony_ci   struct pipe_sampler_view *view;
62bf215546Sopenharmony_ci};
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_ci/**
67bf215546Sopenharmony_ci * The main post-processing queue.
68bf215546Sopenharmony_ci */
69bf215546Sopenharmony_cistruct pp_queue_t
70bf215546Sopenharmony_ci{
71bf215546Sopenharmony_ci   pp_func *pp_queue;           /* An array of pp_funcs */
72bf215546Sopenharmony_ci   unsigned int n_filters;      /* Number of enabled filters */
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_ci   struct pipe_resource *tmp[2];        /* Two temp FBOs for the queue */
75bf215546Sopenharmony_ci   struct pipe_resource *inner_tmp[3];  /* Three for filter use */
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci   unsigned int n_tmp, n_inner_tmp;
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   struct pipe_resource *depth; /* depth of original input */
80bf215546Sopenharmony_ci   struct pipe_resource *stencil;       /* stencil shared by inner_tmps */
81bf215546Sopenharmony_ci   struct pipe_resource *areamaptex;    /* MLAA area map texture */
82bf215546Sopenharmony_ci
83bf215546Sopenharmony_ci   struct pipe_surface *tmps[2], *inner_tmps[3], *stencils;
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ci   void ***shaders;             /* Shaders in TGSI form */
86bf215546Sopenharmony_ci   unsigned int *filters;       /* Active filter to filters.h mapping. */
87bf215546Sopenharmony_ci   struct pp_program *p;
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci   bool fbos_init;
90bf215546Sopenharmony_ci};
91bf215546Sopenharmony_ci
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_civoid pp_free_fbos(struct pp_queue_t *);
94bf215546Sopenharmony_ci
95bf215546Sopenharmony_civoid pp_debug(const char *, ...);
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_cistruct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
98bf215546Sopenharmony_ci                                struct cso_context *, struct st_context_iface *st);
99bf215546Sopenharmony_ci
100bf215546Sopenharmony_civoid pp_blit(struct pipe_context *pipe,
101bf215546Sopenharmony_ci             struct pipe_resource *src_tex,
102bf215546Sopenharmony_ci             int srcX0, int srcY0,
103bf215546Sopenharmony_ci             int srcX1, int srcY1,
104bf215546Sopenharmony_ci             int srcZ0,
105bf215546Sopenharmony_ci             struct pipe_surface *dst,
106bf215546Sopenharmony_ci             int dstX0, int dstY0,
107bf215546Sopenharmony_ci             int dstX1, int dstY1);
108bf215546Sopenharmony_ci
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_ci#endif /* PP_PRIVATE_H */
111