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"
35 #include "id_screen.h"
37 struct identity_context
;
40 struct identity_resource
42 struct pipe_resource base
;
44 struct pipe_resource
*resource
;
48 struct identity_sampler_view
50 struct pipe_sampler_view base
;
52 struct pipe_sampler_view
*sampler_view
;
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_context
*pipe
;
69 struct pipe_transfer
*transfer
;
73 static INLINE
struct identity_resource
*
74 identity_resource(struct pipe_resource
*_resource
)
78 (void)identity_screen(_resource
->screen
);
79 return (struct identity_resource
*)_resource
;
82 static INLINE
struct identity_sampler_view
*
83 identity_sampler_view(struct pipe_sampler_view
*_sampler_view
)
88 return (struct identity_sampler_view
*)_sampler_view
;
91 static INLINE
struct identity_surface
*
92 identity_surface(struct pipe_surface
*_surface
)
96 (void)identity_resource(_surface
->texture
);
97 return (struct identity_surface
*)_surface
;
100 static INLINE
struct identity_transfer
*
101 identity_transfer(struct pipe_transfer
*_transfer
)
105 (void)identity_resource(_transfer
->resource
);
106 return (struct identity_transfer
*)_transfer
;
109 static INLINE
struct pipe_resource
*
110 identity_resource_unwrap(struct pipe_resource
*_resource
)
114 return identity_resource(_resource
)->resource
;
117 static INLINE
struct pipe_sampler_view
*
118 identity_sampler_view_unwrap(struct pipe_sampler_view
*_sampler_view
)
120 if (!_sampler_view
) {
123 return identity_sampler_view(_sampler_view
)->sampler_view
;
126 static INLINE
struct pipe_surface
*
127 identity_surface_unwrap(struct pipe_surface
*_surface
)
131 return identity_surface(_surface
)->surface
;
134 static INLINE
struct pipe_transfer
*
135 identity_transfer_unwrap(struct pipe_transfer
*_transfer
)
139 return identity_transfer(_transfer
)->transfer
;
143 struct pipe_resource
*
144 identity_resource_create(struct identity_screen
*id_screen
,
145 struct pipe_resource
*resource
);
148 identity_resource_destroy(struct identity_resource
*id_resource
);
150 struct pipe_surface
*
151 identity_surface_create(struct identity_resource
*id_resource
,
152 struct pipe_surface
*surface
);
155 identity_surface_destroy(struct identity_surface
*id_surface
);
157 struct pipe_sampler_view
*
158 identity_sampler_view_create(struct identity_context
*id_context
,
159 struct identity_resource
*id_resource
,
160 struct pipe_sampler_view
*view
);
163 identity_sampler_view_destroy(struct identity_context
*id_context
,
164 struct identity_sampler_view
*id_sampler_view
);
166 struct pipe_transfer
*
167 identity_transfer_create(struct identity_context
*id_context
,
168 struct identity_resource
*id_resource
,
169 struct pipe_transfer
*transfer
);
172 identity_transfer_destroy(struct identity_context
*id_context
,
173 struct identity_transfer
*id_transfer
);
176 #endif /* ID_OBJECTS_H */