1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
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 VMWARE 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 **************************************************************************/
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_state.h"
34 #include "pipe/p_video_state.h"
36 #include "id_screen.h"
38 struct identity_context
;
40 struct identity_buffer
42 struct pipe_buffer base
;
44 struct pipe_buffer
*buffer
;
48 struct identity_texture
50 struct pipe_texture base
;
52 struct pipe_texture
*texture
;
56 struct identity_surface
58 struct pipe_surface base
;
60 struct pipe_surface
*surface
;
64 struct identity_transfer
66 struct pipe_transfer base
;
68 struct pipe_transfer
*transfer
;
72 struct identity_video_surface
74 struct pipe_video_surface base
;
76 struct pipe_video_surface
*video_surface
;
80 static INLINE
struct identity_buffer
*
81 identity_buffer(struct pipe_buffer
*_buffer
)
85 (void)identity_screen(_buffer
->screen
);
86 return (struct identity_buffer
*)_buffer
;
89 static INLINE
struct identity_texture
*
90 identity_texture(struct pipe_texture
*_texture
)
94 (void)identity_screen(_texture
->screen
);
95 return (struct identity_texture
*)_texture
;
98 static INLINE
struct identity_surface
*
99 identity_surface(struct pipe_surface
*_surface
)
103 (void)identity_texture(_surface
->texture
);
104 return (struct identity_surface
*)_surface
;
107 static INLINE
struct identity_transfer
*
108 identity_transfer(struct pipe_transfer
*_transfer
)
112 (void)identity_texture(_transfer
->texture
);
113 return (struct identity_transfer
*)_transfer
;
116 static INLINE
struct identity_video_surface
*
117 identity_video_surface(struct pipe_video_surface
*_video_surface
)
119 if (!_video_surface
) {
122 (void)identity_screen(_video_surface
->screen
);
123 return (struct identity_video_surface
*)_video_surface
;
126 static INLINE
struct pipe_buffer
*
127 identity_buffer_unwrap(struct pipe_buffer
*_buffer
)
131 return identity_buffer(_buffer
)->buffer
;
134 static INLINE
struct pipe_texture
*
135 identity_texture_unwrap(struct pipe_texture
*_texture
)
139 return identity_texture(_texture
)->texture
;
142 static INLINE
struct pipe_surface
*
143 identity_surface_unwrap(struct pipe_surface
*_surface
)
147 return identity_surface(_surface
)->surface
;
150 static INLINE
struct pipe_transfer
*
151 identity_transfer_unwrap(struct pipe_transfer
*_transfer
)
155 return identity_transfer(_transfer
)->transfer
;
160 identity_buffer_create(struct identity_screen
*id_screen
,
161 struct pipe_buffer
*buffer
);
164 identity_buffer_destroy(struct identity_buffer
*id_buffer
);
166 struct pipe_texture
*
167 identity_texture_create(struct identity_screen
*id_screen
,
168 struct pipe_texture
*texture
);
171 identity_texture_destroy(struct identity_texture
*id_texture
);
173 struct pipe_surface
*
174 identity_surface_create(struct identity_texture
*id_texture
,
175 struct pipe_surface
*surface
);
178 identity_surface_destroy(struct identity_surface
*id_surface
);
180 struct pipe_transfer
*
181 identity_transfer_create(struct identity_context
*id_context
,
182 struct identity_texture
*id_texture
,
183 struct pipe_transfer
*transfer
);
186 identity_transfer_destroy(struct identity_transfer
*id_transfer
);
188 struct pipe_video_surface
*
189 identity_video_surface_create(struct identity_screen
*id_screen
,
190 struct pipe_video_surface
*video_surface
);
193 identity_video_surface_destroy(struct identity_video_surface
*id_video_surface
);
196 #endif /* ID_OBJECTS_H */