Merge branch 'mesa_7_6_branch'
[mesa.git] / src / gallium / state_trackers / vega / vg_tracker.h
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27 #ifndef VG_TRACKER_H
28 #define VG_TRACKER_H
29
30 #include "VG/openvg.h"
31
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_format.h"
34
35 #define ST_SURFACE_FRONT_LEFT 0
36 #define ST_SURFACE_BACK_LEFT 1
37 #define ST_SURFACE_FRONT_RIGHT 2
38 #define ST_SURFACE_BACK_RIGHT 3
39 #define ST_SURFACE_DEPTH 8
40
41 struct vg_context;
42 struct st_framebuffer;
43 struct pipe_context;
44 struct pipe_fence_handle;
45 struct pipe_surface;
46
47
48 struct vg_context *st_create_context(struct pipe_context *pipe,
49 const void *visual,
50 struct vg_context *share);
51
52 void st_destroy_context( struct vg_context *st );
53
54 void st_copy_context_state(struct vg_context *dst, struct vg_context *src,
55 uint mask);
56
57 struct st_framebuffer *st_create_framebuffer(const void *visual,
58 enum pipe_format colorFormat,
59 enum pipe_format depthFormat,
60 enum pipe_format stencilFormat,
61 uint width, uint height,
62 void *privateData);
63
64 void st_resize_framebuffer(struct st_framebuffer *stfb,
65 uint width, uint height);
66
67 void st_set_framebuffer_surface(struct st_framebuffer *stfb,
68 uint surfIndex, struct pipe_surface *surf);
69
70 void st_get_framebuffer_dimensions( struct st_framebuffer *stfb,
71 uint *width, uint *height);
72
73 int st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
74 enum pipe_format format);
75
76 int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level);
77
78 int st_get_framebuffer_surface(struct st_framebuffer *stfb,
79 uint surfIndex, struct pipe_surface **surf);
80
81 int st_get_framebuffer_texture(struct st_framebuffer *stfb,
82 uint surfIndex, struct pipe_texture **tex);
83
84 void *st_framebuffer_private(struct st_framebuffer *stfb);
85
86 void st_unreference_framebuffer(struct st_framebuffer *stfb);
87
88 void st_make_current(struct vg_context *st,
89 struct st_framebuffer *draw,
90 struct st_framebuffer *read);
91
92 struct vg_context *st_get_current(void);
93
94 void st_flush(struct vg_context *st, uint pipeFlushFlags,
95 struct pipe_fence_handle **fence);
96 void st_finish(struct vg_context *st);
97
98 void st_notify_swapbuffers(struct st_framebuffer *stfb);
99 void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
100
101
102 /** Generic function type */
103 typedef void (*st_proc)();
104
105 st_proc st_get_proc_address(const char *procname);
106
107 #endif