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