gallium/auxiliary/vl: Fix duplicate symbol build errors.
[mesa.git] / src / gallium / auxiliary / vl / vl_idct.h
1 /**************************************************************************
2 *
3 * Copyright 2010 Christian König
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 VMWARE AND/OR ITS SUPPLIERS 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 vl_idct_h
29 #define vl_idct_h
30
31 #include "pipe/p_state.h"
32
33 #include "tgsi/tgsi_ureg.h"
34
35 /* shader based inverse distinct cosinus transformation
36 * expect usage of vl_vertex_buffers as a todo list
37 */
38 struct vl_idct
39 {
40 struct pipe_context *pipe;
41
42 unsigned buffer_width;
43 unsigned buffer_height;
44 unsigned nr_of_render_targets;
45
46 void *rs_state;
47 void *blend;
48
49 void *samplers[2];
50
51 void *vs_mismatch, *fs_mismatch;
52 void *vs, *fs;
53
54 struct pipe_sampler_view *matrix;
55 struct pipe_sampler_view *transpose;
56 };
57
58 /* a set of buffers to work with */
59 struct vl_idct_buffer
60 {
61 struct pipe_viewport_state viewport_mismatch;
62 struct pipe_viewport_state viewport;
63
64 struct pipe_framebuffer_state fb_state_mismatch;
65 struct pipe_framebuffer_state fb_state;
66
67 union
68 {
69 struct pipe_sampler_view *all[4];
70 struct pipe_sampler_view *stage[2][2];
71 struct {
72 struct pipe_sampler_view *source, *matrix;
73 struct pipe_sampler_view *intermediate, *transpose;
74 } individual;
75 } sampler_views;
76 };
77
78 /* upload the idct matrix, which can be shared by all idct instances of a pipe */
79 struct pipe_sampler_view *
80 vl_idct_upload_matrix(struct pipe_context *pipe, float scale);
81
82 void
83 vl_idct_stage2_vert_shader(struct vl_idct *idct, struct ureg_program *shader,
84 unsigned first_output, struct ureg_dst tex);
85
86 void
87 vl_idct_stage2_frag_shader(struct vl_idct *idct, struct ureg_program *shader,
88 unsigned first_input, struct ureg_dst fragment);
89
90 /* init an idct instance */
91 bool
92 vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe,
93 unsigned buffer_width, unsigned buffer_height,
94 unsigned nr_of_render_targets,
95 struct pipe_sampler_view *matrix,
96 struct pipe_sampler_view *transpose);
97
98 /* destroy an idct instance */
99 void
100 vl_idct_cleanup(struct vl_idct *idct);
101
102 /* init a buffer assosiated with agiven idct instance */
103 bool
104 vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
105 struct pipe_sampler_view *source,
106 struct pipe_sampler_view *intermediate);
107
108 /* cleanup a buffer of an idct instance */
109 void
110 vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer);
111
112 /* flush the buffer and start rendering, vertex buffers needs to be setup before calling this */
113 void
114 vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_verts);
115
116 void
117 vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer);
118
119 #endif