1 /**************************************************************************
3 * Copyright 2010 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 **************************************************************************/
28 #ifndef RBUG_OBJECTS_H
29 #define RBUG_OBJECTS_H
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_state.h"
35 #include "rbug_screen.h"
42 struct pipe_resource base
;
44 struct pipe_resource
*resource
;
46 struct rbug_list list
;
52 struct rbug_list list
;
56 void *replaced_shader
;
57 void *replaced_tokens
;
63 struct rbug_sampler_view
65 struct pipe_sampler_view base
;
67 struct pipe_sampler_view
*sampler_view
;
73 struct pipe_surface base
;
75 struct pipe_surface
*surface
;
81 struct pipe_transfer base
;
83 struct pipe_context
*pipe
;
84 struct pipe_transfer
*transfer
;
88 static INLINE
struct rbug_resource
*
89 rbug_resource(struct pipe_resource
*_resource
)
93 (void)rbug_screen(_resource
->screen
);
94 return (struct rbug_resource
*)_resource
;
97 static INLINE
struct rbug_sampler_view
*
98 rbug_sampler_view(struct pipe_sampler_view
*_sampler_view
)
102 (void)rbug_resource(_sampler_view
->texture
);
103 return (struct rbug_sampler_view
*)_sampler_view
;
106 static INLINE
struct rbug_surface
*
107 rbug_surface(struct pipe_surface
*_surface
)
111 (void)rbug_resource(_surface
->texture
);
112 return (struct rbug_surface
*)_surface
;
115 static INLINE
struct rbug_transfer
*
116 rbug_transfer(struct pipe_transfer
*_transfer
)
120 (void)rbug_resource(_transfer
->resource
);
121 return (struct rbug_transfer
*)_transfer
;
124 static INLINE
struct rbug_shader
*
125 rbug_shader(void *_state
)
129 return (struct rbug_shader
*)_state
;
132 static INLINE
struct pipe_resource
*
133 rbug_resource_unwrap(struct pipe_resource
*_resource
)
137 return rbug_resource(_resource
)->resource
;
140 static INLINE
struct pipe_sampler_view
*
141 rbug_sampler_view_unwrap(struct pipe_sampler_view
*_sampler_view
)
145 return rbug_sampler_view(_sampler_view
)->sampler_view
;
148 static INLINE
struct pipe_surface
*
149 rbug_surface_unwrap(struct pipe_surface
*_surface
)
153 return rbug_surface(_surface
)->surface
;
156 static INLINE
struct pipe_transfer
*
157 rbug_transfer_unwrap(struct pipe_transfer
*_transfer
)
161 return rbug_transfer(_transfer
)->transfer
;
165 rbug_shader_unwrap(void *_state
)
167 struct rbug_shader
*shader
;
171 shader
= rbug_shader(_state
);
172 return shader
->replaced_shader
? shader
->replaced_shader
: shader
->shader
;
176 struct pipe_resource
*
177 rbug_resource_create(struct rbug_screen
*rb_screen
,
178 struct pipe_resource
*resource
);
181 rbug_resource_destroy(struct rbug_resource
*rb_resource
);
183 struct pipe_surface
*
184 rbug_surface_create(struct rbug_resource
*rb_resource
,
185 struct pipe_surface
*surface
);
188 rbug_surface_destroy(struct rbug_surface
*rb_surface
);
190 struct pipe_sampler_view
*
191 rbug_sampler_view_create(struct rbug_context
*rb_context
,
192 struct rbug_resource
*rb_resource
,
193 struct pipe_sampler_view
*view
);
196 rbug_sampler_view_destroy(struct rbug_context
*rb_context
,
197 struct rbug_sampler_view
*rb_sampler_view
);
199 struct pipe_transfer
*
200 rbug_transfer_create(struct rbug_context
*rb_context
,
201 struct rbug_resource
*rb_resource
,
202 struct pipe_transfer
*transfer
);
205 rbug_transfer_destroy(struct rbug_context
*rb_context
,
206 struct rbug_transfer
*rb_transfer
);
209 #endif /* RBUG_OBJECTS_H */