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