Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa into gallium-0.2
[mesa.git] / src / gallium / include / pipe / p_screen.h
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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 /**
29 * Screen, Adapter or GPU
30 *
31 * These are driver functions/facilities that are context independent.
32 */
33
34
35 #ifndef P_SCREEN_H
36 #define P_SCREEN_H
37
38
39 #include "pipe/p_compiler.h"
40 #include "pipe/p_state.h"
41
42
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48
49
50 /**
51 * Gallium screen/adapter context. Basically everything
52 * hardware-specific that doesn't actually require a rendering
53 * context.
54 */
55 struct pipe_screen {
56 struct pipe_winsys *winsys;
57
58 void (*destroy)( struct pipe_screen * );
59
60
61 const char *(*get_name)( struct pipe_screen * );
62
63 const char *(*get_vendor)( struct pipe_screen * );
64
65 /**
66 * Query an integer-valued capability/parameter/limit
67 * \param param one of PIPE_CAP_x
68 */
69 int (*get_param)( struct pipe_screen *, int param );
70
71 /**
72 * Query a float-valued capability/parameter/limit
73 * \param param one of PIPE_CAP_x
74 */
75 float (*get_paramf)( struct pipe_screen *, int param );
76
77 /**
78 * Check if the given pipe_format is supported as a texture or
79 * drawing surface.
80 * \param tex_usage bitmask of PIPE_TEXTURE_USAGE_*
81 * \param flags bitmask of PIPE_TEXTURE_GEOM_*
82 */
83 boolean (*is_format_supported)( struct pipe_screen *,
84 enum pipe_format format,
85 enum pipe_texture_target target,
86 unsigned tex_usage,
87 unsigned geom_flags );
88
89 /**
90 * Create a new texture object, using the given template info.
91 */
92 struct pipe_texture * (*texture_create)(struct pipe_screen *,
93 const struct pipe_texture *templat);
94
95 /**
96 * Create a new texture object, using the given template info, but on top of
97 * existing memory.
98 *
99 * It is assumed that the buffer data is layed out according to the expected
100 * by the hardware. NULL will be returned if any inconsistency is found.
101 */
102 struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
103 const struct pipe_texture *templat,
104 const unsigned *pitch,
105 struct pipe_buffer *buffer);
106
107 void (*texture_release)(struct pipe_screen *,
108 struct pipe_texture **pt);
109
110 /** Get a surface which is a "view" into a texture */
111 struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
112 struct pipe_texture *texture,
113 unsigned face, unsigned level,
114 unsigned zslice,
115 unsigned usage );
116
117 /* Surfaces allocated by the above must be released here:
118 */
119 void (*tex_surface_release)( struct pipe_screen *,
120 struct pipe_surface ** );
121
122
123 void *(*surface_map)( struct pipe_screen *,
124 struct pipe_surface *surface,
125 unsigned flags );
126
127 void (*surface_unmap)( struct pipe_screen *,
128 struct pipe_surface *surface );
129
130 };
131
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif /* P_SCREEN_H */