00001 /************************************************************************** 00002 * 00003 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 00004 * All Rights Reserved. 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a 00007 * copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sub license, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice (including the 00015 * next paragraph) shall be included in all copies or substantial portions 00016 * of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 00021 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 00022 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00023 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00024 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 * 00026 **************************************************************************/ 00027 00028 #ifndef TR_TEXTURE_H_ 00029 #define TR_TEXTURE_H_ 00030 00031 00032 #include "pipe/p_compiler.h" 00033 #include "pipe/p_state.h" 00034 00035 #include "tr_screen.h" 00036 00037 00038 struct trace_texture 00039 { 00040 struct pipe_texture base; 00041 00042 struct pipe_texture *texture; 00043 }; 00044 00045 00046 struct trace_surface 00047 { 00048 struct pipe_surface base; 00049 00050 struct pipe_surface *surface; 00051 00052 void *map; 00053 }; 00054 00055 00056 static INLINE struct trace_texture * 00057 trace_texture(struct trace_screen *tr_scr, 00058 struct pipe_texture *texture) 00059 { 00060 if(!texture) 00061 return NULL; 00062 assert(texture->screen == &tr_scr->base); 00063 return (struct trace_texture *)texture; 00064 } 00065 00066 00067 static INLINE struct trace_surface * 00068 trace_surface(struct trace_texture *tr_tex, 00069 struct pipe_surface *surface) 00070 { 00071 if(!surface) 00072 return NULL; 00073 assert(surface->texture == &tr_tex->base); 00074 return (struct trace_surface *)surface; 00075 } 00076 00077 00078 struct pipe_texture * 00079 trace_texture_create(struct trace_screen *tr_scr, 00080 struct pipe_texture *texture); 00081 00082 void 00083 trace_texture_destroy(struct trace_screen *tr_scr, 00084 struct pipe_texture *texture); 00085 00086 struct pipe_surface * 00087 trace_surface_create(struct trace_texture *tr_tex, 00088 struct pipe_surface *surface); 00089 00090 void 00091 trace_surface_destroy(struct trace_texture *tr_tex, 00092 struct pipe_surface *surface); 00093 00094 00095 #endif /* TR_TEXTURE_H_ */