1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
30 * SWIG interface definion for Gallium types.
32 * @author Jose Fonseca <jrfonseca@tungstengraphics.com>
36 %nodefaultctor st_device;
37 %nodefaultdtor st_device;
43 %newobject st_device::texture_create;
44 %newobject st_device::context_create;
45 %newobject st_device::buffer_create;
49 st_device(int hardware = 1) {
50 return st_device_create(hardware ? TRUE : FALSE);
54 st_device_destroy($self);
57 const char * get_name( void ) {
58 return $self->screen->get_name($self->screen);
61 const char * get_vendor( void ) {
62 return $self->screen->get_vendor($self->screen);
66 * Query an integer-valued capability/parameter/limit
67 * \param param one of PIPE_CAP_x
69 int get_param( int param ) {
70 return $self->screen->get_param($self->screen, param);
74 * Query a float-valued capability/parameter/limit
75 * \param param one of PIPE_CAP_x
77 float get_paramf( int param ) {
78 return $self->screen->get_paramf($self->screen, param);
82 * Check if the given pipe_format is supported as a texture or
84 * \param type one of PIPE_TEXTURE, PIPE_SURFACE
86 int is_format_supported( enum pipe_format format,
87 enum pipe_texture_target target,
89 unsigned geom_flags ) {
90 return $self->screen->is_format_supported( $self->screen,
98 context_create(void) {
99 return st_context_create($self);
102 struct pipe_texture *
104 enum pipe_format format,
108 unsigned last_level = 0,
109 enum pipe_texture_target target = PIPE_TEXTURE_2D,
110 unsigned tex_usage = 0
112 struct pipe_texture templat;
113 memset(&templat, 0, sizeof(templat));
114 templat.format = format;
115 pf_get_block(templat.format, &templat.block);
116 templat.width0 = width;
117 templat.height0 = height;
118 templat.depth0 = depth;
119 templat.last_level = last_level;
120 templat.target = target;
121 templat.tex_usage = tex_usage;
122 return $self->screen->texture_create($self->screen, &templat);
126 buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
127 return pipe_buffer_create($self->screen, alignment, usage, size);