vl_idct.h revision 336c7735ae97ddc0a177562375136297c2de3d19
11320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci/**************************************************************************
21320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
31320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * Copyright 2010 Christian König
41320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * All Rights Reserved.
51320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * Permission is hereby granted, free of charge, to any person obtaining a
71320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * copy of this software and associated documentation files (the
81320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * "Software"), to deal in the Software without restriction, including
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * without limitation the rights to use, copy, modify, merge, publish,
101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * distribute, sub license, and/or sell copies of the Software, and to
111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * permit persons to whom the Software is furnished to do so, subject to
121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * the following conditions:
131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * The above copyright notice and this permission notice (including the
151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * next paragraph) shall be included in all copies or substantial portions
161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * of the Software.
171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci *
181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci * 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   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
87   struct
88   {
89      unsigned l_x, l_y, r_x, r_y;
90   } next_empty_block;
91
92   unsigned num_empty_blocks;
93
94   struct pipe_transfer *tex_transfer;
95   short *texels;
96
97   struct pipe_transfer *vec_transfer;
98   struct vertex2f *vectors;
99};
100
101struct pipe_resource *vl_idct_upload_matrix(struct pipe_context *pipe);
102
103bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, struct pipe_resource *dst, struct pipe_resource *matrix);
104
105void vl_idct_cleanup(struct vl_idct *idct);
106
107void vl_idct_add_block(struct vl_idct *idct, unsigned x, unsigned y, short *block);
108
109void vl_idct_flush(struct vl_idct *idct);
110
111#endif
112