1 /**************************************************************************
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
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:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
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.
25 **************************************************************************/
30 #include "VG/openvg.h"
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_format.h"
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
42 struct st_framebuffer;
44 struct pipe_fence_handle;
49 struct vg_context *st_create_context(struct pipe_context *pipe,
51 struct vg_context *share);
54 void st_destroy_context( struct vg_context *st );
57 void st_copy_context_state(struct vg_context *dst, struct vg_context *src,
61 struct st_framebuffer *st_create_framebuffer(const void *visual,
62 enum pipe_format colorFormat,
63 enum pipe_format depthFormat,
64 enum pipe_format stencilFormat,
65 uint width, uint height,
69 void st_resize_framebuffer(struct st_framebuffer *stfb,
70 uint width, uint height);
73 void st_set_framebuffer_surface(struct st_framebuffer *stfb,
74 uint surfIndex, struct pipe_surface *surf);
77 void st_get_framebuffer_dimensions( struct st_framebuffer *stfb,
78 uint *width, uint *height);
81 int st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
82 enum pipe_format format);
85 int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level);
88 int st_get_framebuffer_surface(struct st_framebuffer *stfb,
89 uint surfIndex, struct pipe_surface **surf);
92 int st_get_framebuffer_texture(struct st_framebuffer *stfb,
93 uint surfIndex, struct pipe_texture **tex);
96 void *st_framebuffer_private(struct st_framebuffer *stfb);
99 void st_unreference_framebuffer(struct st_framebuffer *stfb);
102 boolean st_make_current(struct vg_context *st,
103 struct st_framebuffer *draw,
104 struct st_framebuffer *read,
105 void *winsys_drawable_handle);
108 struct vg_context *st_get_current(void);
111 void st_flush(struct vg_context *st, uint pipeFlushFlags,
112 struct pipe_fence_handle **fence);
114 void st_finish(struct vg_context *st);
117 void st_notify_swapbuffers(struct st_framebuffer *stfb);
119 void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
122 /** Generic function type */
123 typedef void (*st_proc)();
126 st_proc st_get_proc_address(const char *procname);