00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ST_TEXTURE_H
00029 #define ST_TEXTURE_H
00030
00031
00032 #include "main/mtypes.h"
00033
00034 struct pipe_context;
00035 struct pipe_texture;
00036
00037
00038 struct st_texture_image
00039 {
00040 struct gl_texture_image base;
00041
00042
00043
00044 GLuint level;
00045 GLuint face;
00046
00047
00048
00049
00050
00051 struct pipe_texture *pt;
00052
00053 struct pipe_surface *surface;
00054 };
00055
00056
00057
00058 struct st_texture_object
00059 {
00060 struct gl_texture_object base;
00061
00062
00063
00064 GLuint lastLevel;
00065
00066
00067
00068
00069 struct pipe_texture *pt;
00070
00071 GLboolean teximage_realloc;
00072 };
00073
00074
00075 static INLINE struct st_texture_image *
00076 st_texture_image(struct gl_texture_image *img)
00077 {
00078 return (struct st_texture_image *) img;
00079 }
00080
00081 static INLINE struct st_texture_object *
00082 st_texture_object(struct gl_texture_object *obj)
00083 {
00084 return (struct st_texture_object *) obj;
00085 }
00086
00087
00088 static INLINE struct pipe_texture *
00089 st_get_texobj_texture(struct gl_texture_object *texObj)
00090 {
00091 struct st_texture_object *stObj = st_texture_object(texObj);
00092 return stObj ? stObj->pt : NULL;
00093 }
00094
00095
00096 static INLINE struct pipe_texture *
00097 st_get_stobj_texture(struct st_texture_object *stObj)
00098 {
00099 return stObj ? stObj->pt : NULL;
00100 }
00101
00102 static INLINE GLboolean pf_is_depth_stencil( enum pipe_format format )
00103 {
00104 return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
00105 pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
00106 }
00107
00108
00109 extern struct pipe_texture *
00110 st_texture_create(struct st_context *st,
00111 enum pipe_texture_target target,
00112 enum pipe_format format,
00113 GLuint last_level,
00114 GLuint width0,
00115 GLuint height0,
00116 GLuint depth0,
00117 GLuint compress_byte,
00118 GLuint tex_usage );
00119
00120
00121
00122
00123 extern GLboolean
00124 st_texture_match_image(const struct pipe_texture *pt,
00125 const struct gl_texture_image *image,
00126 GLuint face, GLuint level);
00127
00128
00129
00130
00131 extern GLubyte *
00132 st_texture_image_map(struct st_context *st,
00133 struct st_texture_image *stImage,
00134 GLuint zoffset,
00135 GLuint flags);
00136
00137 extern void
00138 st_texture_image_unmap(struct st_context *st,
00139 struct st_texture_image *stImage);
00140
00141
00142
00143
00144
00145 extern const GLuint *
00146 st_texture_depth_offsets(struct pipe_texture *pt, GLuint level);
00147
00148
00149
00150
00151 extern GLuint
00152 st_texture_image_offset(const struct pipe_texture *pt,
00153 GLuint face, GLuint level);
00154
00155 extern GLuint
00156 st_texture_texel_offset(const struct pipe_texture * pt,
00157 GLuint face, GLuint level,
00158 GLuint col, GLuint row, GLuint img);
00159
00160
00161
00162
00163 extern void
00164 st_texture_image_data(struct pipe_context *pipe,
00165 struct pipe_texture *dst,
00166 GLuint face, GLuint level, void *src,
00167 GLuint src_row_pitch, GLuint src_image_pitch);
00168
00169
00170
00171
00172 extern void
00173 st_texture_image_copy(struct pipe_context *pipe,
00174 struct pipe_texture *dst, GLuint dstLevel,
00175 struct pipe_texture *src,
00176 GLuint face);
00177
00178
00179 #endif