Jakob Bornecrantz | d60b2c6 | 2009-06-24 02:42:41 +0200 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright 2009 VMware, Inc. |
| 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 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. |
| 25 | * |
| 26 | **************************************************************************/ |
| 27 | |
| 28 | #ifndef ID_OBJECTS_H |
| 29 | #define ID_OBJECTS_H |
| 30 | |
| 31 | |
| 32 | #include "pipe/p_compiler.h" |
| 33 | #include "pipe/p_state.h" |
Michal Krol | f56b95e | 2009-11-19 08:18:58 +0100 | [diff] [blame] | 34 | #include "pipe/p_video_state.h" |
Jakob Bornecrantz | d60b2c6 | 2009-06-24 02:42:41 +0200 | [diff] [blame] | 35 | |
| 36 | #include "id_screen.h" |
| 37 | |
| 38 | |
| 39 | struct identity_buffer |
| 40 | { |
| 41 | struct pipe_buffer base; |
| 42 | |
| 43 | struct pipe_buffer *buffer; |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | struct identity_texture |
| 48 | { |
| 49 | struct pipe_texture base; |
| 50 | |
| 51 | struct pipe_texture *texture; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | struct identity_surface |
| 56 | { |
| 57 | struct pipe_surface base; |
| 58 | |
| 59 | struct pipe_surface *surface; |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | struct identity_transfer |
| 64 | { |
| 65 | struct pipe_transfer base; |
| 66 | |
| 67 | struct pipe_transfer *transfer; |
| 68 | }; |
| 69 | |
| 70 | |
Michal Krol | f56b95e | 2009-11-19 08:18:58 +0100 | [diff] [blame] | 71 | struct identity_video_surface |
| 72 | { |
| 73 | struct pipe_video_surface base; |
| 74 | |
| 75 | struct pipe_video_surface *video_surface; |
| 76 | }; |
| 77 | |
| 78 | |
Jakob Bornecrantz | d60b2c6 | 2009-06-24 02:42:41 +0200 | [diff] [blame] | 79 | static INLINE struct identity_buffer * |
| 80 | identity_buffer(struct pipe_buffer *_buffer) |
| 81 | { |
| 82 | if(!_buffer) |
| 83 | return NULL; |
| 84 | (void)identity_screen(_buffer->screen); |
| 85 | return (struct identity_buffer *)_buffer; |
| 86 | } |
| 87 | |
| 88 | static INLINE struct identity_texture * |
| 89 | identity_texture(struct pipe_texture *_texture) |
| 90 | { |
| 91 | if(!_texture) |
| 92 | return NULL; |
| 93 | (void)identity_screen(_texture->screen); |
| 94 | return (struct identity_texture *)_texture; |
| 95 | } |
| 96 | |
| 97 | static INLINE struct identity_surface * |
| 98 | identity_surface(struct pipe_surface *_surface) |
| 99 | { |
| 100 | if(!_surface) |
| 101 | return NULL; |
| 102 | (void)identity_texture(_surface->texture); |
| 103 | return (struct identity_surface *)_surface; |
| 104 | } |
| 105 | |
| 106 | static INLINE struct identity_transfer * |
| 107 | identity_transfer(struct pipe_transfer *_transfer) |
| 108 | { |
| 109 | if(!_transfer) |
| 110 | return NULL; |
| 111 | (void)identity_texture(_transfer->texture); |
| 112 | return (struct identity_transfer *)_transfer; |
| 113 | } |
| 114 | |
Michal Krol | f56b95e | 2009-11-19 08:18:58 +0100 | [diff] [blame] | 115 | static INLINE struct identity_video_surface * |
| 116 | identity_video_surface(struct pipe_video_surface *_video_surface) |
| 117 | { |
| 118 | if (!_video_surface) { |
| 119 | return NULL; |
| 120 | } |
| 121 | (void)identity_screen(_video_surface->screen); |
| 122 | return (struct identity_video_surface *)_video_surface; |
| 123 | } |
Jakob Bornecrantz | d60b2c6 | 2009-06-24 02:42:41 +0200 | [diff] [blame] | 124 | |
| 125 | static INLINE struct pipe_buffer * |
| 126 | identity_buffer_unwrap(struct pipe_buffer *_buffer) |
| 127 | { |
| 128 | if(!_buffer) |
| 129 | return NULL; |
| 130 | return identity_buffer(_buffer)->buffer; |
| 131 | } |
| 132 | |
| 133 | static INLINE struct pipe_texture * |
| 134 | identity_texture_unwrap(struct pipe_texture *_texture) |
| 135 | { |
| 136 | if(!_texture) |
| 137 | return NULL; |
| 138 | return identity_texture(_texture)->texture; |
| 139 | } |
| 140 | |
| 141 | static INLINE struct pipe_surface * |
| 142 | identity_surface_unwrap(struct pipe_surface *_surface) |
| 143 | { |
| 144 | if(!_surface) |
| 145 | return NULL; |
| 146 | return identity_surface(_surface)->surface; |
| 147 | } |
| 148 | |
| 149 | static INLINE struct pipe_transfer * |
| 150 | identity_transfer_unwrap(struct pipe_transfer *_transfer) |
| 151 | { |
| 152 | if(!_transfer) |
| 153 | return NULL; |
| 154 | return identity_transfer(_transfer)->transfer; |
| 155 | } |
| 156 | |
| 157 | |
| 158 | struct pipe_buffer * |
| 159 | identity_buffer_create(struct identity_screen *id_screen, |
| 160 | struct pipe_buffer *buffer); |
| 161 | |
| 162 | void |
| 163 | identity_buffer_destroy(struct identity_buffer *id_buffer); |
| 164 | |
| 165 | struct pipe_texture * |
| 166 | identity_texture_create(struct identity_screen *id_screen, |
| 167 | struct pipe_texture *texture); |
| 168 | |
| 169 | void |
| 170 | identity_texture_destroy(struct identity_texture *id_texture); |
| 171 | |
| 172 | struct pipe_surface * |
| 173 | identity_surface_create(struct identity_texture *id_texture, |
| 174 | struct pipe_surface *surface); |
| 175 | |
| 176 | void |
| 177 | identity_surface_destroy(struct identity_surface *id_surface); |
| 178 | |
| 179 | struct pipe_transfer * |
| 180 | identity_transfer_create(struct identity_texture *id_texture, |
| 181 | struct pipe_transfer *transfer); |
| 182 | |
| 183 | void |
| 184 | identity_transfer_destroy(struct identity_transfer *id_transfer); |
| 185 | |
Michal Krol | f56b95e | 2009-11-19 08:18:58 +0100 | [diff] [blame] | 186 | struct pipe_video_surface * |
| 187 | identity_video_surface_create(struct identity_screen *id_screen, |
| 188 | struct pipe_video_surface *video_surface); |
| 189 | |
| 190 | void |
| 191 | identity_video_surface_destroy(struct identity_video_surface *id_video_surface); |
| 192 | |
Jakob Bornecrantz | d60b2c6 | 2009-06-24 02:42:41 +0200 | [diff] [blame] | 193 | |
| 194 | #endif /* ID_OBJECTS_H */ |