X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fteximage.h;h=5f8a47776bc90551837dd1a34c73dbe1e524b8e0;hb=aac1415b66fafedc50c4346dae2d652723156ed9;hp=d4317c301b78b3a2a77624b61b7cd8b3b3ce2021;hpb=4926c5748028d33da4808f8a5473aa7b2f2bdc62;p=mesa.git diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index d4317c301b7..5f8a47776bc 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -5,7 +5,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * @@ -22,9 +21,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ @@ -33,14 +33,28 @@ #include "mtypes.h" +#include "formats.h" +#ifdef __cplusplus +extern "C" { +#endif -extern void * -_mesa_alloc_texmemory(GLsizei bytes); - -extern void -_mesa_free_texmemory(void *m); +/** Is the given value one of the 6 cube faces? */ +static inline GLboolean +_mesa_is_cube_face(GLenum target) +{ + return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB); +} +/** Is any of the dimensions of given texture equal to zero? */ +static inline GLboolean +_mesa_is_zero_size_texture(const struct gl_texture_image *texImage) +{ + return (texImage->Width == 0 || + texImage->Height == 0 || + texImage->Depth == 0); +} /** \name Internal functions */ /*@{*/ @@ -52,54 +66,46 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ); extern GLboolean _mesa_is_proxy_texture(GLenum target); - extern struct gl_texture_image * _mesa_new_texture_image( struct gl_context *ctx ); extern void -_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *teximage ); - -extern void -_mesa_free_texture_image_data( struct gl_context *ctx, - struct gl_texture_image *texImage ); +_mesa_delete_texture_image( struct gl_context *ctx, + struct gl_texture_image *teximage ); extern void -_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, +_mesa_init_teximage_fields(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, - GLint border, GLenum internalFormat); + GLint border, GLenum internalFormat, + mesa_format format); -extern void +extern mesa_format _mesa_choose_texture_format(struct gl_context *ctx, struct gl_texture_object *texObj, - struct gl_texture_image *texImage, GLenum target, GLint level, GLenum internalFormat, GLenum format, GLenum type); - extern void -_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage); - +_mesa_update_fbo_texture(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLuint face, GLuint level); extern void -_mesa_set_tex_image(struct gl_texture_object *tObj, - GLenum target, GLint level, - struct gl_texture_image *texImage); +_mesa_clear_texture_image(struct gl_context *ctx, + struct gl_texture_image *texImage); -extern struct gl_texture_object * -_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit, - GLenum target); - extern struct gl_texture_object * _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target); extern struct gl_texture_image * -_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj, +_mesa_select_tex_image(struct gl_context *ctx, + const struct gl_texture_object *texObj, GLenum target, GLint level); @@ -108,28 +114,53 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, GLint level); -extern struct gl_texture_image * -_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level); - - extern GLint _mesa_max_texture_levels(struct gl_context *ctx, GLenum target); extern GLboolean _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, - GLint internalFormat, GLenum format, GLenum type, - GLint width, GLint height, GLint depth, GLint border); + mesa_format format, + GLint width, GLint height, GLint depth, GLint border); extern GLuint _mesa_tex_target_to_face(GLenum target); +extern GLint +_mesa_get_texture_dimensions(GLenum target); + +extern GLboolean +_mesa_tex_target_is_layered(GLenum target); + +extern GLuint +_mesa_get_texture_layers(const struct gl_texture_object *texObj, GLint level); + +extern GLsizei +_mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height, + GLsizei depth); + +extern GLboolean +_mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, + GLint level, GLint width, GLint height, + GLint depth, GLint border); + +extern mesa_format +_mesa_validate_texbuffer_format(const struct gl_context *ctx, + GLenum internalFormat); + + +bool +_mesa_legal_texture_base_format_for_target(struct gl_context *ctx, + GLenum target, + GLenum internalFormat, + unsigned dimensions, + const char *caller); /** * Lock a texture for updating. See also _mesa_lock_context_textures(). */ -static INLINE void +static inline void _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj) { _glthread_LOCK_MUTEX(ctx->Shared->TexMutex); @@ -137,9 +168,10 @@ _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj) (void) texObj; } -static INLINE void +static inline void _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj) { + (void) texObj; _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); } @@ -229,45 +261,75 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, extern void GLAPIENTRY -_mesa_CompressedTexImage1DARB(GLenum target, GLint level, +_mesa_CompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY -_mesa_CompressedTexImage2DARB(GLenum target, GLint level, +_mesa_CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY -_mesa_CompressedTexImage3DARB(GLenum target, GLint level, +_mesa_CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -#ifdef VMS -#define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR -#define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR -#define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR -#endif extern void GLAPIENTRY -_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, +_mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY -_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, +_mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY -_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, +_mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); + +extern void GLAPIENTRY +_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer); + +extern void GLAPIENTRY +_mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, + GLintptr offset, GLsizeiptr size); + + +extern void GLAPIENTRY +_mesa_TexImage2DMultisample(GLenum target, GLsizei samples, + GLenum internalformat, GLsizei width, + GLsizei height, GLboolean fixedsamplelocations); + +extern void GLAPIENTRY +_mesa_TexImage3DMultisample(GLenum target, GLsizei samples, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, + GLboolean fixedsamplelocations); + +extern void GLAPIENTRY +_mesa_TexStorage2DMultisample(GLenum target, GLsizei samples, + GLenum internalformat, GLsizei width, + GLsizei height, GLboolean fixedsamplelocations); + +extern void GLAPIENTRY +_mesa_TexStorage3DMultisample(GLenum target, GLsizei samples, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, + GLboolean fixedsamplelocations); + /*@}*/ +#ifdef __cplusplus +} +#endif + #endif