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 34 35 /** 36 * Internal control details. 37 */ 38 struct pp_program 39 { 40 struct pipe_screen *screen; 41 struct pipe_context *pipe; 42 struct cso_context *cso; 43 44 struct pipe_blend_state blend; 45 struct pipe_depth_stencil_alpha_state depthstencil; 46 struct pipe_rasterizer_state rasterizer; 47 struct pipe_sampler_state sampler; /* bilinear */ 48 struct pipe_sampler_state sampler_point; /* point */ 49 struct pipe_viewport_state viewport; 50 struct pipe_framebuffer_state framebuffer; 51 struct pipe_vertex_element velem[2]; 52 53 union pipe_color_union clear_color; 54 55 void *passvs; 56 57 struct pipe_resource *vbuf; 58 struct pipe_surface surf; 59 struct pipe_sampler_view *view; 60 }; 61 62 63 64 /** 65 * The main post-processing queue. 66 */ 67 struct pp_queue_t 68 { 69 pp_func *pp_queue; /* An array of pp_funcs */ 70 unsigned int n_filters; /* Number of enabled filters */ 71 72 struct pipe_resource *tmp[2]; /* Two temp FBOs for the queue */ 73 struct pipe_resource *inner_tmp[3]; /* Three for filter use */ 74 75 unsigned int n_tmp, n_inner_tmp; 76 77 struct pipe_resource *depth; /* depth of original input */ 78 struct pipe_resource *stencil; /* stencil shared by inner_tmps */ 79 struct pipe_resource *constbuf; /* MLAA constant buffer */ 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