Merge branch 'gallium-vertex-linear' into gallium-tex-surfaces
[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 type one of PIPE_TEXTURE, PIPE_SURFACE
81 */
82 boolean (*is_format_supported)( struct pipe_screen *,
83 enum pipe_format format,
84 uint type );
85
86 /**
87 * Create a new texture object, using the given template info.
88 */
89 struct pipe_texture * (*texture_create)(struct pipe_screen *,
90 const struct pipe_texture *templat);
91
92 /**
93 * Create a new texture object, using the given template info, but on top of
94 * existing memory.
95 *
96 * It is assumed that the buffer data is layed out according to the expected
97 * by the hardware. NULL will be returned if any inconsistency is found.
98 */
99 struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
100 const struct pipe_texture *templat,
101 const unsigned *pitch,
102 struct pipe_buffer *buffer);
103
104 void (*texture_release)(struct pipe_screen *,
105 struct pipe_texture **pt);
106
107 /** Get a surface which is a "view" into a texture */
108 struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
109 struct pipe_texture *texture,
110 unsigned face, unsigned level,
111 unsigned zslice,
112 unsigned usage );
113
114 /* Surfaces allocated by the above must be released here:
115 */
116 void (*tex_surface_release)( struct pipe_screen *,
117 struct pipe_surface ** );
118
119
120 void *(*surface_map)( struct pipe_screen *,
121 struct pipe_surface *surface,
122 unsigned flags );
123
124 void (*surface_unmap)( struct pipe_screen *,
125 struct pipe_surface *surface );
126
127 };
128
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif /* P_SCREEN_H */