7234382196febdb74642445a8cd72216aa8c21e5
[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 TUNGSTEN GRAPHICS 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 struct vl_idct
34 {
35 struct pipe_context *pipe;
36
37 unsigned max_blocks;
38
39 struct pipe_viewport_state viewport[2];
40 struct pipe_framebuffer_state fb_state[2];
41
42 struct pipe_resource *destination;
43
44 void *vertex_elems_state;
45
46 union
47 {
48 void *all[4];
49 void *stage[2][2];
50 struct {
51 void *matrix, *source;
52 void *transpose, *intermediate;
53 } individual;
54 } samplers;
55
56 union
57 {
58 struct pipe_sampler_view *all[4];
59 struct pipe_sampler_view *stage[2][2];
60 struct {
61 struct pipe_sampler_view *matrix, *source;
62 struct pipe_sampler_view *transpose, *intermediate;
63 } individual;
64 } sampler_views;
65
66 void *matrix_vs, *transpose_vs, *eb_vs;
67 void *matrix_fs, *transpose_fs, *eb_fs;
68
69 union
70 {
71 struct pipe_resource *all[4];
72 struct pipe_resource *stage[2][2];
73 struct {
74 struct pipe_resource *matrix, *source;
75 struct pipe_resource *transpose, *intermediate;
76 } individual;
77 } textures;
78
79 union
80 {
81 struct pipe_vertex_buffer all[2];
82 struct { struct pipe_vertex_buffer quad, pos; } individual;
83 } vertex_bufs;
84
85 unsigned num_blocks;
86 unsigned num_empty_blocks;
87
88 struct pipe_transfer *tex_transfer;
89 short *texels;
90
91 struct pipe_transfer *vec_transfer;
92 struct vertex2f *vectors;
93 };
94
95 struct pipe_resource *vl_idct_upload_matrix(struct pipe_context *pipe);
96
97 bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, struct pipe_resource *dst, struct pipe_resource *matrix);
98
99 void vl_idct_cleanup(struct vl_idct *idct);
100
101 void vl_idct_add_block(struct vl_idct *idct, unsigned x, unsigned y, short *block);
102
103 void vl_idct_flush(struct vl_idct *idct);
104
105 #endif