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