Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / gallium / auxiliary / vl / vl_zscan.h
1 /**************************************************************************
2 *
3 * Copyright 2011 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_zscan_h
29 #define vl_zscan_h
30
31 #include <pipe/p_compiler.h>
32 #include <pipe/p_state.h>
33
34 /*
35 * shader based zscan and quantification
36 * expect usage of vl_vertex_buffers as a todo list
37 */
38 struct vl_zscan
39 {
40 struct pipe_context *pipe;
41
42 unsigned buffer_width;
43 unsigned buffer_height;
44
45 unsigned num_channels;
46
47 unsigned blocks_per_line;
48 unsigned blocks_total;
49
50 void *rs_state;
51 void *blend;
52
53 void *samplers[3];
54
55 void *vs, *fs;
56
57 struct pipe_sampler_view *scan;
58 struct pipe_sampler_view *quant;
59 };
60
61 struct vl_zscan_buffer
62 {
63 struct vl_zscan *zscan;
64
65 struct pipe_viewport_state viewport;
66 struct pipe_framebuffer_state fb_state;
67
68 struct pipe_sampler_view *src, *scan, *quant;
69 struct pipe_surface *dst;
70 };
71
72 struct pipe_sampler_view *
73 vl_zscan_linear(struct pipe_context *pipe, unsigned blocks_per_line);
74
75 #if 0
76 struct pipe_sampler_view *
77 vl_zscan_normal(struct pipe_context *pipe, unsigned blocks_per_line);
78
79 struct pipe_sampler_view *
80 vl_zscan_alternate(struct pipe_context *pipe, unsigned blocks_per_line);
81 #endif
82
83 bool
84 vl_zscan_init(struct vl_zscan *zscan, struct pipe_context *pipe,
85 unsigned buffer_width, unsigned buffer_height,
86 unsigned blocks_per_line, unsigned blocks_total,
87 unsigned num_channels);
88
89 void
90 vl_zscan_set_layout(struct vl_zscan *zscan, struct pipe_sampler_view *layout);
91
92 void
93 vl_zscan_cleanup(struct vl_zscan *zscan);
94
95 #if 0
96 void
97 vl_zscan_upload_quant(struct vl_zscan *zscan, ...);
98 #endif
99
100 bool
101 vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
102 struct pipe_sampler_view *src, struct pipe_surface *dst);
103
104 void
105 vl_zscan_cleanup_buffer(struct vl_zscan_buffer *buffer);
106
107 void
108 vl_zscan_render(struct vl_zscan_buffer *buffer, unsigned num_instances);
109
110 #endif