diff options
author | marha <marha@users.sourceforge.net> | 2012-09-27 15:15:06 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-09-27 15:15:06 +0200 |
commit | 24703f26d8ed55b1971aa2e94d33636e871bff0b (patch) | |
tree | 3e57b600f4446a1db1d8e73cb8a83519570eb678 /mesalib | |
parent | 94ef26cb962261d0b47daf7ef3c856510999bd4c (diff) | |
parent | 2cf1e3de4759264eac2fa8ac758ea750636542f8 (diff) | |
download | vcxsrv-24703f26d8ed55b1971aa2e94d33636e871bff0b.tar.gz vcxsrv-24703f26d8ed55b1971aa2e94d33636e871bff0b.tar.bz2 vcxsrv-24703f26d8ed55b1971aa2e94d33636e871bff0b.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa xserver pixman xkeyboard-config git update 27 sep 2012
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/configure.ac | 1 | ||||
-rw-r--r-- | mesalib/include/GL/glext.h | 294 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 47 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.h | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/blend.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/enable.c | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/main/enable.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ff_fragment_shader.cpp | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/main/glformats.c | 69 | ||||
-rw-r--r-- | mesalib/src/mesa/main/glformats.h | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/glheader.h | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.h | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/macros.h | 21 | ||||
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 697 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 5 |
17 files changed, 541 insertions, 683 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 4193496de..ef2455b09 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -898,6 +898,7 @@ GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" +AC_SUBST([X11_INCLUDES]) AC_SUBST([GL_LIB_DEPS]) AC_SUBST([GL_PC_REQ_PRIV]) AC_SUBST([GL_PC_LIB_PRIV]) diff --git a/mesalib/include/GL/glext.h b/mesalib/include/GL/glext.h index 6175ad450..44ab7c62e 100644 --- a/mesalib/include/GL/glext.h +++ b/mesalib/include/GL/glext.h @@ -29,9 +29,9 @@ extern "C" { */ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated $Date: 2012-08-06 02:01:01 -0700 (Mon, 06 Aug 2012) $ */ +/* glext.h last updated $Date: 2012-09-19 19:02:24 -0700 (Wed, 19 Sep 2012) $ */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 83 +#define GL_GLEXT_VERSION 85 /* Function declaration macros - to move into glplatform.h */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -88,9 +88,6 @@ extern "C" { #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED #define GL_RESCALE_NORMAL 0x803A #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 @@ -110,9 +107,6 @@ extern "C" { #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif - -#ifndef GL_ARB_imaging_DEPRECATED #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 @@ -239,9 +233,6 @@ extern "C" { #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 @@ -298,9 +289,6 @@ extern "C" { #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED #define GL_POINT_SIZE_MIN 0x8126 #define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_DISTANCE_ATTENUATION 0x8129 @@ -354,9 +342,7 @@ extern "C" { #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 -#endif - -#ifndef GL_VERSION_1_5_DEPRECATED +#define GL_SRC1_ALPHA 0x8589 #define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 @@ -378,7 +364,6 @@ extern "C" { #define GL_SRC1_RGB 0x8581 #define GL_SRC2_RGB 0x8582 #define GL_SRC0_ALPHA 0x8588 -#define GL_SRC1_ALPHA 0x8589 #define GL_SRC2_ALPHA 0x858A #endif @@ -463,9 +448,6 @@ extern "C" { #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_VERSION_2_0_DEPRECATED #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_POINT_SPRITE 0x8861 #define GL_COORD_REPLACE 0x8862 @@ -489,9 +471,6 @@ extern "C" { #define GL_SRGB8_ALPHA8 0x8C43 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#endif - -#ifndef GL_VERSION_2_1_DEPRECATED #define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_SLUMINANCE_ALPHA 0x8C44 #define GL_SLUMINANCE8_ALPHA8 0x8C45 @@ -726,9 +705,6 @@ extern "C" { /* reuse GL_RG32UI */ /* Reuse tokens from ARB_vertex_array_object */ /* reuse GL_VERTEX_ARRAY_BINDING */ -#endif - -#ifndef GL_VERSION_3_0_DEPRECATED #define GL_CLAMP_VERTEX_COLOR 0x891A #define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_ALPHA_INTEGER 0x8D97 @@ -749,7 +725,6 @@ extern "C" { #define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B #define GL_TEXTURE_BINDING_BUFFER 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 @@ -1015,6 +990,7 @@ extern "C" { /* reuse GL_MEDIUM_INT */ /* reuse GL_HIGH_INT */ /* reuse GL_SHADER_COMPILER */ +/* reuse GL_SHADER_BINARY_FORMATS */ /* reuse GL_NUM_SHADER_BINARY_FORMATS */ /* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ /* reuse GL_MAX_VARYING_VECTORS */ @@ -2030,9 +2006,6 @@ extern "C" { #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 -#endif - -#ifndef GL_ARB_framebuffer_object_DEPRECATED #define GL_INDEX 0x8222 #define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE 0x8C15 @@ -2264,6 +2237,7 @@ extern "C" { #ifndef GL_ARB_texture_gather #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F #endif #ifndef GL_ARB_texture_query_lod @@ -2441,6 +2415,7 @@ extern "C" { #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 #define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_MAX_VARYING_VECTORS 0x8DFC @@ -2744,6 +2719,7 @@ extern "C" { #define GL_PROGRAM_PIPELINE 0x82E4 #define GL_SAMPLER 0x82E6 #define GL_DISPLAY_LIST 0x82E7 +/* DISPLAY_LIST used in compatibility profile only */ #define GL_MAX_LABEL_LENGTH 0x82E8 #define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 @@ -2787,33 +2763,25 @@ extern "C" { #ifndef GL_ARB_copy_image #endif -#ifndef GL_ARB_debug_group -/* reuse GL_DEBUG_TYPE_MARKER */ -/* reuse GL_DEBUG_TYPE_PUSH_GROUP */ -/* reuse GL_DEBUG_TYPE_POP_GROUP */ -/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */ -/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */ -/* reuse GL_DEBUG_GROUP_STACK_DEPTH */ -/* reuse GL_STACK_UNDERFLOW */ -/* reuse GL_STACK_OVERFLOW */ +#ifndef GL_ARB_texture_view +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF #endif -#ifndef GL_ARB_debug_label -/* reuse GL_BUFFER */ -/* reuse GL_SHADER */ -/* reuse GL_PROGRAM */ -/* reuse GL_QUERY */ -/* reuse GL_PROGRAM_PIPELINE */ -/* reuse GL_SAMPLER */ -/* DISPLAY_LIST used in compatibility profile only */ -/* reuse GL_DISPLAY_LIST */ -/* reuse GL_MAX_LABEL_LENGTH */ -/* reuse GL_VERTEX_ARRAY */ +#ifndef GL_ARB_vertex_attrib_binding +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA #endif -#ifndef GL_ARB_debug_output2 -/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */ -/* reuse GL_DEBUG_OUTPUT */ +#ifndef GL_ARB_robustness_isolation #endif #ifndef GL_ARB_ES3_compatibility @@ -3050,7 +3018,7 @@ extern "C" { #define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE #define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF #define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 -#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS /* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ #endif @@ -3070,27 +3038,6 @@ extern "C" { #ifndef GL_ARB_texture_storage_multisample #endif -#ifndef GL_ARB_texture_view -#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#endif - -#ifndef GL_ARB_vertex_attrib_binding -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#endif - -#ifndef GL_ARB_robustness_isolation -#endif - #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -4947,6 +4894,8 @@ extern "C" { #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 #define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 #endif #ifndef GL_ATI_draw_buffers @@ -4970,7 +4919,7 @@ extern "C" { #endif #ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 #endif @@ -5430,7 +5379,7 @@ extern "C" { #define GL_PRIMITIVES_GENERATED_NV 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 #define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B #define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C #define GL_SEPARATE_ATTRIBS_NV 0x8C8D @@ -5947,6 +5896,7 @@ extern "C" { #endif #ifndef GL_AMD_debug_output +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 #define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 #define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 @@ -6176,6 +6126,18 @@ extern "C" { #define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 #endif +#ifndef GL_AMD_sparse_texture +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIN_LOD_WARNING_AMD 0x919C +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +#endif + /*************************************************************/ @@ -6292,18 +6254,6 @@ GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED -#define GL_VERSION_1_2_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); @@ -6337,6 +6287,12 @@ GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean si GLAPI void APIENTRY glResetHistogram (GLenum target); GLAPI void APIENTRY glResetMinmax (GLenum target); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); @@ -6383,21 +6339,6 @@ GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED -#define GL_VERSION_1_3_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glClientActiveTexture (GLenum texture); GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); @@ -6436,6 +6377,15 @@ GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); @@ -6485,19 +6435,6 @@ GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED -#define GL_VERSION_1_4_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFogCoordf (GLfloat coord); GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); GLAPI void APIENTRY glFogCoordd (GLdouble coord); @@ -6537,6 +6474,13 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *v); GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); @@ -7074,10 +7018,7 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, /* ARB_clear_buffer_object */ /* ARB_compute_shader */ /* ARB_copy_image */ -/* ARB_debug_group */ -/* ARB_debug_label */ -/* KHR_debug (ARB_debug_output promoted to KHR without suffixes) */ -/* ARB_debug_output2 (no entry points) */ +/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */ /* ARB_explicit_uniform_location (no entry points) */ /* ARB_framebuffer_no_attachments */ /* ARB_internalformat_query2 */ @@ -8621,7 +8562,6 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum ta #ifndef GL_KHR_debug #define GL_KHR_debug 1 -/* KHR_debug also reuses entry points from ARB_debug_group and ARB_debug_label */ #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); @@ -8682,18 +8622,46 @@ GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); #endif -#ifndef GL_ARB_debug_group -#define GL_ARB_debug_group 1 -/* ARB_debug_group reuses entry points from KHR_debug */ +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); #endif -#ifndef GL_ARB_debug_label -#define GL_ARB_debug_label 1 -/* ARB_debug_label reuses entry points from KHR_debug */ +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); #endif -#ifndef GL_ARB_debug_output2 -#define GL_ARB_debug_output2 1 +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 #endif #ifndef GL_ARB_ES3_compatibility @@ -8824,48 +8792,6 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); #endif -#ifndef GL_ARB_texture_view -#define GL_ARB_texture_view 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -#endif - -#ifndef GL_ARB_vertex_attrib_binding -#define GL_ARB_vertex_attrib_binding 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); -GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); -typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); -typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); -#endif - -#ifndef GL_ARB_robustness_isolation -#define GL_ARB_robustness_isolation 1 -#endif - #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -9607,11 +9533,15 @@ GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); #endif #ifndef GL_EXT_pixel_transform_color_table @@ -9963,11 +9893,11 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLen #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_NV_light_max_exponent @@ -12543,7 +12473,7 @@ typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress); GLAPI void APIENTRY glVDPAUFiniNV (void); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); @@ -12554,7 +12484,7 @@ GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSur #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress); typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); @@ -12792,6 +12722,16 @@ typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle) #define GL_AMD_query_buffer_object 1 #endif +#ifndef GL_AMD_sparse_texture +#define GL_AMD_sparse_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif + #ifdef __cplusplus } diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 28a79b0a0..6689337e3 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -187,6 +187,9 @@ struct save_state /** MESA_META_MULTISAMPLE */ GLboolean MultisampleEnabled; + /** MESA_META_FRAMEBUFFER_SRGB */ + GLboolean sRGBEnabled; + /** Miscellaneous (always disabled) */ GLboolean Lighting; GLboolean RasterDiscard; @@ -773,6 +776,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_multisample(ctx, GL_FALSE); } + if (state & MESA_META_FRAMEBUFFER_SRGB) { + save->sRGBEnabled = ctx->Color.sRGBEnabled; + if (ctx->Color.sRGBEnabled) + _mesa_set_framebuffer_srgb(ctx, GL_FALSE); + } + /* misc */ { save->Lighting = ctx->Light.Enabled; @@ -1075,6 +1084,11 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_set_multisample(ctx, save->MultisampleEnabled); } + if (state & MESA_META_FRAMEBUFFER_SRGB) { + if (ctx->Color.sRGBEnabled != save->sRGBEnabled) + _mesa_set_framebuffer_srgb(ctx, save->sRGBEnabled); + } + /* misc */ if (save->Lighting) { _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); @@ -1394,7 +1408,6 @@ blitframebuffer_texture(struct gl_context *ctx, const GLuint srcLevel = readAtt->TextureLevel; const GLint baseLevelSave = texObj->BaseLevel; const GLint maxLevelSave = texObj->MaxLevel; - const GLenum fbo_srgb_save = ctx->Color.sRGBEnabled; const GLenum target = texObj->Target; GLuint sampler, samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ? @@ -1433,15 +1446,14 @@ blitframebuffer_texture(struct gl_context *ctx, _mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); _mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - /* Always do our blits with no sRGB decode or encode.*/ + /* Always do our blits with no sRGB decode or encode. Note that + * GL_FRAMEBUFFER_SRGB has already been disabled by + * _mesa_meta_begin(). + */ if (ctx->Extensions.EXT_texture_sRGB_decode) { _mesa_SamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); } - if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB) - || _mesa_is_gles3(ctx)) { - _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE); - } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); _mesa_set_enable(ctx, target, GL_TRUE); @@ -1500,9 +1512,6 @@ blitframebuffer_texture(struct gl_context *ctx, _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave); _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); } - if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) { - _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE); - } _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave); _mesa_DeleteSamplers(1, &sampler); @@ -1713,7 +1722,8 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) GLbitfield metaSave = (MESA_META_ALL - MESA_META_SCISSOR - MESA_META_PIXEL_STORE - - MESA_META_CONDITIONAL_RENDER); + MESA_META_CONDITIONAL_RENDER - + MESA_META_FRAMEBUFFER_SRGB); const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; if (buffers & BUFFER_BITS_COLOR) { @@ -3236,7 +3246,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLuint maxLevel = texObj->MaxLevel; const GLint maxLevelSave = texObj->MaxLevel; const GLboolean genMipmapSave = texObj->GenerateMipmap; - const GLenum srgbBufferSave = ctx->Color.sRGBEnabled; const GLuint fboSave = ctx->DrawBuffer->Name; const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit; const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader && @@ -3330,12 +3339,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, else assert(!genMipmapSave); - if ((ctx->Extensions.EXT_framebuffer_sRGB && - _mesa_is_desktop_gl(ctx)) || - _mesa_is_gles3(ctx)) { - _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE); - } - /* Setup texture coordinates */ setup_texture_coords(faceTarget, slice, @@ -3452,10 +3455,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } - if (ctx->Extensions.EXT_framebuffer_sRGB && srgbBufferSave) { - _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE); - } - _mesa_lock_texture(ctx, texObj); /* relock */ _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave); @@ -3734,12 +3733,6 @@ decompress_texture_image(struct gl_context *ctx, _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, texImage->Level); } - /* No sRGB decode or encode.*/ - if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB) - || _mesa_is_gles3(ctx)) { - _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE); - } - /* render quad w/ texture into renderbuffer */ _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index d8dfb56f9..6ffc5b56a 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -56,6 +56,7 @@ #define MESA_META_CLIP 0x40000 #define MESA_META_SELECT_FEEDBACK 0x80000 #define MESA_META_MULTISAMPLE 0x100000 +#define MESA_META_FRAMEBUFFER_SRGB 0x200000 /**\}*/ extern void diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index de871a92a..5d553118c 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -858,6 +858,13 @@ void _mesa_init_color( struct gl_context * ctx ) ctx->Color._ClampFragmentColor = GL_TRUE; ctx->Color.ClampReadColor = GL_FIXED_ONLY_ARB; ctx->Color._ClampReadColor = GL_TRUE; + + if (ctx->API == API_OPENGLES2) { + /* GLES 3 behaves as though GL_FRAMEBUFFER_SRGB is always enabled. */ + ctx->Color.sRGBEnabled = GL_TRUE; + } else { + ctx->Color.sRGBEnabled = GL_FALSE; + } } /*@}*/ diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 3643cfb52..a607bdc10 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -264,6 +264,23 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state) } /** + * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the + * check for whether the API supports it (GLES doesn't). + */ +void +_mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state) +{ + if (ctx->Color.sRGBEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + ctx->Color.sRGBEnabled = state; + + if (ctx->Driver.Enable) { + ctx->Driver.Enable(ctx, GL_FRAMEBUFFER_SRGB, state); + } +} + +/** * Helper function to enable or disable state. * * \param ctx GL context. @@ -1044,12 +1061,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) /* GL3.0 - GL_framebuffer_sRGB */ case GL_FRAMEBUFFER_SRGB_EXT: - if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)) + if (!_mesa_is_desktop_gl(ctx)) goto invalid_enum_error; CHECK_EXTENSION(EXT_framebuffer_sRGB, cap); - FLUSH_VERTICES(ctx, _NEW_BUFFERS); - ctx->Color.sRGBEnabled = state; - break; + _mesa_set_framebuffer_srgb(ctx, state); + return; /* GL_OES_EGL_image_external */ case GL_TEXTURE_EXTERNAL_OES: @@ -1699,7 +1715,7 @@ _mesa_IsEnabled( GLenum cap ) /* GL3.0 - GL_framebuffer_sRGB */ case GL_FRAMEBUFFER_SRGB_EXT: - if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)) + if (!_mesa_is_desktop_gl(ctx)) goto invalid_enum_error; CHECK_EXTENSION(EXT_framebuffer_sRGB); return ctx->Color.sRGBEnabled; diff --git a/mesalib/src/mesa/main/enable.h b/mesalib/src/mesa/main/enable.h index c49b4948d..be7909459 100644 --- a/mesalib/src/mesa/main/enable.h +++ b/mesalib/src/mesa/main/enable.h @@ -70,6 +70,9 @@ _mesa_DisableClientState( GLenum cap ); extern void _mesa_set_multisample(struct gl_context *ctx, GLboolean state); +extern void +_mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state); + #endif diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index f21cf80ae..3a80ab7f3 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -539,7 +539,7 @@ public: }; static ir_rvalue * -get_current_attrib(struct texenv_fragment_program *p, GLuint attrib) +get_current_attrib(texenv_fragment_program *p, GLuint attrib) { ir_variable *current; ir_rvalue *val; @@ -552,7 +552,7 @@ get_current_attrib(struct texenv_fragment_program *p, GLuint attrib) } static ir_rvalue * -get_gl_Color(struct texenv_fragment_program *p) +get_gl_Color(texenv_fragment_program *p) { if (p->state->inputs_available & FRAG_BIT_COL0) { ir_variable *var = p->shader->symbols->get_variable("gl_Color"); @@ -564,7 +564,7 @@ get_gl_Color(struct texenv_fragment_program *p) } static ir_rvalue * -get_source(struct texenv_fragment_program *p, +get_source(texenv_fragment_program *p, GLuint src, GLuint unit) { ir_variable *var; @@ -615,7 +615,7 @@ get_source(struct texenv_fragment_program *p, } static ir_rvalue * -emit_combine_source(struct texenv_fragment_program *p, +emit_combine_source(texenv_fragment_program *p, GLuint unit, GLuint source, GLuint operand) @@ -690,7 +690,7 @@ static GLboolean args_match( const struct state_key *key, GLuint unit ) } static ir_rvalue * -smear(struct texenv_fragment_program *p, ir_rvalue *val) +smear(texenv_fragment_program *p, ir_rvalue *val) { if (!val->type->is_scalar()) return val; @@ -699,7 +699,7 @@ smear(struct texenv_fragment_program *p, ir_rvalue *val) } static ir_rvalue * -emit_combine(struct texenv_fragment_program *p, +emit_combine(texenv_fragment_program *p, GLuint unit, GLuint nr, GLuint mode, @@ -780,7 +780,7 @@ emit_combine(struct texenv_fragment_program *p, * Generate instructions for one texture unit's env/combiner mode. */ static ir_rvalue * -emit_texenv(struct texenv_fragment_program *p, GLuint unit) +emit_texenv(texenv_fragment_program *p, GLuint unit) { const struct state_key *key = p->state; GLboolean rgb_saturate, alpha_saturate; @@ -909,7 +909,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) /** * Generate instruction for getting a texture source term. */ -static void load_texture( struct texenv_fragment_program *p, GLuint unit ) +static void load_texture( texenv_fragment_program *p, GLuint unit ) { ir_dereference *deref; @@ -1039,7 +1039,7 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit ) } static void -load_texenv_source(struct texenv_fragment_program *p, +load_texenv_source(texenv_fragment_program *p, GLuint src, GLuint unit) { switch (src) { @@ -1069,7 +1069,7 @@ load_texenv_source(struct texenv_fragment_program *p, * Generate instructions for loading all texture source terms. */ static GLboolean -load_texunit_sources( struct texenv_fragment_program *p, GLuint unit ) +load_texunit_sources( texenv_fragment_program *p, GLuint unit ) { const struct state_key *key = p->state; GLuint i; @@ -1089,7 +1089,7 @@ load_texunit_sources( struct texenv_fragment_program *p, GLuint unit ) * Generate instructions for loading bump map textures. */ static void -load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit ) +load_texunit_bumpmap( texenv_fragment_program *p, GLuint unit ) { const struct state_key *key = p->state; GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0; @@ -1141,7 +1141,7 @@ load_texunit_bumpmap( struct texenv_fragment_program *p, GLuint unit ) * GL_FOG_COORDINATE_EXT is set to GL_FRAGMENT_DEPTH_EXT. */ static ir_rvalue * -emit_fog_instructions(struct texenv_fragment_program *p, +emit_fog_instructions(texenv_fragment_program *p, ir_rvalue *fragcolor) { struct state_key *key = p->state; @@ -1214,7 +1214,7 @@ emit_fog_instructions(struct texenv_fragment_program *p, } static void -emit_instructions(struct texenv_fragment_program *p) +emit_instructions(texenv_fragment_program *p) { struct state_key *key = p->state; GLuint unit; diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index 047a613a1..04029c07c 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -1372,3 +1372,72 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, } return GL_NO_ERROR; } + + +/** + * Do error checking of format/type combinations for OpenGL ES glReadPixels + * and glTex[Sub]Image. + * \return error code, or GL_NO_ERROR. + */ +GLenum +_mesa_es_error_check_format_and_type(GLenum format, GLenum type, + unsigned dimensions) +{ + GLboolean type_valid = GL_TRUE; + + switch (format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + type_valid = (type == GL_UNSIGNED_BYTE + || type == GL_FLOAT + || type == GL_HALF_FLOAT_OES); + break; + + case GL_RGB: + type_valid = (type == GL_UNSIGNED_BYTE + || type == GL_UNSIGNED_SHORT_5_6_5 + || type == GL_FLOAT + || type == GL_HALF_FLOAT_OES); + break; + + case GL_RGBA: + type_valid = (type == GL_UNSIGNED_BYTE + || type == GL_UNSIGNED_SHORT_4_4_4_4 + || type == GL_UNSIGNED_SHORT_5_5_5_1 + || type == GL_FLOAT + || type == GL_HALF_FLOAT_OES + || type == GL_UNSIGNED_INT_2_10_10_10_REV); + break; + + case GL_DEPTH_COMPONENT: + /* This format is filtered against invalid dimensionalities elsewhere. + */ + type_valid = (type == GL_UNSIGNED_SHORT + || type == GL_UNSIGNED_INT); + break; + + case GL_DEPTH_STENCIL: + /* This format is filtered against invalid dimensionalities elsewhere. + */ + type_valid = (type == GL_UNSIGNED_INT_24_8); + break; + + case GL_BGRA_EXT: + type_valid = (type == GL_UNSIGNED_BYTE); + + /* This feels like a bug in the EXT_texture_format_BGRA8888 spec, but + * the format does not appear to be allowed for 3D textures in OpenGL + * ES. + */ + if (dimensions != 2) + return GL_INVALID_VALUE; + + break; + + default: + return GL_INVALID_VALUE; + } + + return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION; +} diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h index 24fbda991..e5b63a963 100644 --- a/mesalib/src/mesa/main/glformats.h +++ b/mesalib/src/mesa/main/glformats.h @@ -98,6 +98,10 @@ extern GLenum _mesa_error_check_format_and_type(const struct gl_context *ctx, GLenum format, GLenum type); +extern GLenum +_mesa_es_error_check_format_and_type(GLenum format, GLenum type, + unsigned dimensions); + #ifdef __cplusplus } diff --git a/mesalib/src/mesa/main/glheader.h b/mesalib/src/mesa/main/glheader.h index 315232371..e93ca30e7 100644 --- a/mesalib/src/mesa/main/glheader.h +++ b/mesalib/src/mesa/main/glheader.h @@ -144,6 +144,13 @@ typedef void *GLeglImageOES; #endif +/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT. + */ +#ifndef GL_HALF_FLOAT_OES +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + + /** * Internal token to represent a GLSL shader program (a collection of * one or more shaders that get linked together). Note that GLSL diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 81da51047..a78d67966 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -145,6 +145,13 @@ static inline int isblank(int ch) { return ch == ' ' || ch == '\t'; } /*@}*/ +/* + * signbit() is a macro on Linux. Not available on Windows. + */ +#ifndef signbit +#define signbit(x) ((x) < 0.0f) +#endif + /** single-precision inverse square root */ static inline float diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 04d59d79c..7b7fd1b6d 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -693,31 +693,14 @@ NORMALIZE_3FV(GLfloat v[3]) static inline GLboolean IS_NEGATIVE(float x) { -#if defined(USE_IEEE) - fi_type fi; - fi.f = x; - return fi.i < 0; -#else - return x < 0.0F; -#endif + return signbit(x) != 0; } - /** Test two floats have opposite signs */ static inline GLboolean DIFFERENT_SIGNS(GLfloat x, GLfloat y) { -#if defined(USE_IEEE) - fi_type xfi, yfi; - xfi.f = x; - yfi.f = y; - return !!((xfi.i ^ yfi.i) & (1u << 31)); -#else - /* Could just use (x*y<0) except for the flatshading requirements. - * Maybe there's a better way? - */ - return ((x) * (y) <= 0.0F && (x) - (y) != 0.0F); -#endif + return signbit(x) != signbit(y); } diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index e10f921d2..f6680c91f 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -38,13 +38,7 @@ #include "state.h" #include "glformats.h" #include "fbobject.h" -#include "teximage.h" -/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT. - */ -#ifndef GL_HALF_FLOAT_OES -#define GL_HALF_FLOAT_OES 0x8D61 -#endif /** * Tries to implement glReadPixels() of GL_DEPTH_COMPONENT using memcpy of the diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 08af66893..afda0eaaf 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -50,12 +50,6 @@ #include "glformats.h" -/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT. - */ -#ifndef GL_HALF_FLOAT_OES -#define GL_HALF_FLOAT_OES 0x8D61 -#endif - /** * State changes which we care about for glCopyTex[Sub]Image() calls. * In particular, we care about pixel transfer state and buffer state @@ -1343,6 +1337,121 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, /** + * Do error checking of xoffset, yoffset, zoffset, width, height and depth + * for glTexSubImage, glCopyTexSubImage and glCompressedTexSubImage. + * \param destImage the destination texture image. + * \return GL_TRUE if error found, GL_FALSE otherwise. + */ +static GLboolean +error_check_subtexture_dimensions(struct gl_context *ctx, + const char *function, GLuint dims, + const struct gl_texture_image *destImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei subWidth, GLsizei subHeight, + GLsizei subDepth) +{ + const GLenum target = destImage->TexObject->Target; + GLuint bw, bh; + + /* Check size */ + if (subWidth < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s%dD(width=%d)", function, dims, subWidth); + return GL_TRUE; + } + + if (dims > 1 && subHeight < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s%dD(height=%d)", function, dims, subHeight); + return GL_TRUE; + } + + if (dims > 2 && subDepth < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s%dD(depth=%d)", function, dims, subDepth); + return GL_TRUE; + } + + /* check xoffset and width */ + if (xoffset < -destImage->Border) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset)", + function, dims); + return GL_TRUE; + } + + if (xoffset + subWidth > destImage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset+width)", + function, dims); + return GL_TRUE; + } + + /* check yoffset and height */ + if (dims > 1) { + GLint yBorder = (target == GL_TEXTURE_1D_ARRAY) ? 0 : destImage->Border; + if (yoffset < -yBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(yoffset)", + function, dims); + return GL_TRUE; + } + if (yoffset + subHeight > destImage->Height) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(yoffset+height)", + function, dims); + return GL_TRUE; + } + } + + /* check zoffset and depth */ + if (dims > 2) { + GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : destImage->Border; + if (zoffset < -zBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s3D(zoffset)", function); + return GL_TRUE; + } + if (zoffset + subDepth > (GLint) destImage->Depth) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s3D(zoffset+depth)", function); + return GL_TRUE; + } + } + + /* + * The OpenGL spec (and GL_ARB_texture_compression) says only whole + * compressed texture images can be updated. But, that restriction may be + * relaxed for particular compressed formats. At this time, all the + * compressed formats supported by Mesa allow sub-textures to be updated + * along compressed block boundaries. + */ + _mesa_get_format_block_size(destImage->TexFormat, &bw, &bh); + + if (bw != 1 || bh != 1) { + /* offset must be multiple of block size */ + if ((xoffset % bw != 0) || (yoffset % bh != 0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s%dD(xoffset = %d, yoffset = %d)", + function, dims, xoffset, yoffset); + return GL_TRUE; + } + + /* size must be multiple of bw by bh or equal to whole texture size */ + if ((subWidth % bw != 0) && subWidth != destImage->Width) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s%dD(width = %d)", function, dims, subWidth); + return GL_TRUE; + } + + if ((subHeight % bh != 0) && subHeight != destImage->Height) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s%dD(height = %d)", function, dims, subHeight); + return GL_TRUE; + } + } + + return GL_FALSE; +} + + + + +/** * This is the fallback for Driver.TestProxyTexImage() for doing device- * specific texture image size checks. * @@ -1572,71 +1681,6 @@ mutable_tex_object(struct gl_context *ctx, GLenum target) } -GLenum -_mesa_es_error_check_format_and_type(GLenum format, GLenum type, - unsigned dimensions) -{ - bool type_valid = true; - - switch (format) { - case GL_ALPHA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - type_valid = (type == GL_UNSIGNED_BYTE - || type == GL_FLOAT - || type == GL_HALF_FLOAT_OES); - break; - - case GL_RGB: - type_valid = (type == GL_UNSIGNED_BYTE - || type == GL_UNSIGNED_SHORT_5_6_5 - || type == GL_FLOAT - || type == GL_HALF_FLOAT_OES); - break; - - case GL_RGBA: - type_valid = (type == GL_UNSIGNED_BYTE - || type == GL_UNSIGNED_SHORT_4_4_4_4 - || type == GL_UNSIGNED_SHORT_5_5_5_1 - || type == GL_FLOAT - || type == GL_HALF_FLOAT_OES - || type == GL_UNSIGNED_INT_2_10_10_10_REV); - break; - - case GL_DEPTH_COMPONENT: - /* This format is filtered against invalid dimensionalities elsewhere. - */ - type_valid = (type == GL_UNSIGNED_SHORT - || type == GL_UNSIGNED_INT); - break; - - case GL_DEPTH_STENCIL: - /* This format is filtered against invalid dimensionalities elsewhere. - */ - type_valid = (type == GL_UNSIGNED_INT_24_8); - break; - - case GL_BGRA_EXT: - type_valid = (type == GL_UNSIGNED_BYTE); - - /* This feels like a bug in the EXT_texture_format_BGRA8888 spec, but - * the format does not appear to be allowed for 3D textures in OpenGL - * ES. - */ - if (dimensions != 2) - return GL_INVALID_VALUE; - - break; - - default: - return GL_INVALID_VALUE; - } - - return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION; -} - - - /** * Return expected size of a compressed texture. */ @@ -1649,17 +1693,6 @@ compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, } -/* - * Return compressed texture block size, in pixels. - */ -static void -get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh) -{ - gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat); - _mesa_get_format_block_size(mesaFormat, bw, bh); -} - - /** * Test the glTexImage[123]D() parameters for errors. * @@ -2081,34 +2114,27 @@ error: * to the OpenGL specification. */ static GLboolean -subtexture_error_check( struct gl_context *ctx, GLuint dimensions, +texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, - GLenum format, GLenum type ) + GLenum format, GLenum type) { + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; GLenum err; - /* level check */ - if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); + /* check target (proxies not allowed) */ + if (!legal_texsubimage_target(ctx, dimensions, target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)", + dimensions, _mesa_lookup_enum_by_nr(target)); return GL_TRUE; } - /* Check for negative sizes */ - if (width < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glTexSubImage%dD(width=%d)", dimensions, width); - return GL_TRUE; - } - if (height < 0 && dimensions > 1) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glTexSubImage%dD(height=%d)", dimensions, height); - return GL_TRUE; - } - if (depth < 0 && dimensions > 2) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glTexSubImage%dD(depth=%d)", dimensions, depth); + /* level check */ + if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(level=%d)", + dimensions, level); return GL_TRUE; } @@ -2137,98 +2163,39 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions, return GL_TRUE; } - return GL_FALSE; -} - - -/** - * Do second part of glTexSubImage which depends on the destination texture. - * \return GL_TRUE if error recorded, GL_FALSE otherwise - */ -static GLboolean -subtexture_error_check2( struct gl_context *ctx, GLuint dimensions, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint width, GLint height, GLint depth, - GLenum format, GLenum type, - const struct gl_texture_image *destTex ) -{ - if (!destTex) { - /* undefined image level */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions); + /* Get dest texture object / image pointers */ + texObj = _mesa_get_current_tex_object(ctx, target); + if (!texObj) { + /* must be out of memory */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage%dD()", dimensions); return GL_TRUE; } - if (xoffset < -((GLint)destTex->Border)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)", - dimensions); + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + /* non-existant texture level */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%dD(invalid texture image)", dimensions); return GL_TRUE; } - if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)", - dimensions); + + if (error_check_subtexture_dimensions(ctx, "glTexSubImage", dimensions, + texImage, xoffset, yoffset, 0, + width, height, 1)) { return GL_TRUE; } - if (dimensions > 1) { - GLint yBorder = (target == GL_TEXTURE_1D_ARRAY) ? 0 : destTex->Border; - if (yoffset < -yBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)", - dimensions); - return GL_TRUE; - } - if (yoffset + height > (GLint) destTex->Height + yBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)", - dimensions); - return GL_TRUE; - } - } - if (dimensions > 2) { - GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : destTex->Border; - if (zoffset < -zBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)"); - return GL_TRUE; - } - if (zoffset + depth > (GLint) destTex->Depth + zBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)"); - return GL_TRUE; - } - } - - if (_mesa_is_format_compressed(destTex->TexFormat)) { - GLuint bw, bh; - if (compressedteximage_only_format(ctx, destTex->InternalFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { + if (compressedteximage_only_format(ctx, texImage->InternalFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD(no compression for format)", dimensions); return GL_TRUE; } - - /* do tests which depend on compression block size */ - _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh); - - /* offset must be multiple of block size */ - if ((xoffset % bw != 0) || (yoffset % bh != 0)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%dD(xoffset = %d, yoffset = %d)", - dimensions, xoffset, yoffset); - return GL_TRUE; - } - /* size must be multiple of bw by bh or equal to whole texture size */ - if ((width % bw != 0) && (GLuint) width != destTex->Width) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%dD(width = %d)", dimensions, width); - return GL_TRUE; - } - if ((height % bh != 0) && (GLuint) height != destTex->Height) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%dD(height = %d)", dimensions, height); - return GL_TRUE; - } } if (ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) { /* both source and dest must be integer-valued, or neither */ - if (_mesa_is_format_integer_color(destTex->TexFormat) != + if (_mesa_is_format_integer_color(texImage->TexFormat) != _mesa_is_enum_format_integer(format)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD(integer/non-integer format mismatch)", @@ -2396,20 +2363,17 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, /** * Test glCopyTexSubImage[12]D() parameters for errors. - * Note that this is the first part of error checking. - * See also copytexsubimage_error_check2() below for the second part. - * - * \param ctx GL context. - * \param dimensions texture image dimensions (must be 1, 2 or 3). - * \param target texture target given by the user. - * \param level image level given by the user. - * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. */ static GLboolean -copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions, - GLenum target, GLint level) +copytexsubimage_error_check(struct gl_context *ctx, GLuint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height) { + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + /* Check that the source buffer is complete */ if (_mesa_is_user_fbo(ctx->ReadBuffer)) { if (ctx->ReadBuffer->_Status == 0) { @@ -2443,120 +2407,45 @@ copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions, return GL_TRUE; } - return GL_FALSE; -} - - -/** - * Second part of error checking for glCopyTexSubImage[12]D(). - * \param xoffset sub-image x offset given by the user. - * \param yoffset sub-image y offset given by the user. - * \param zoffset sub-image z offset given by the user. - * \param width image width given by the user. - * \param height image height given by the user. - */ -static GLboolean -copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, - const struct gl_texture_image *teximage ) -{ - /* check that dest tex image exists */ - if (!teximage) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage%dD(undefined texture level: %d)", - dimensions, level); + /* Get dest texture object / image pointers */ + texObj = _mesa_get_current_tex_object(ctx, target); + if (!texObj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%dD()", dimensions); return GL_TRUE; } - /* Check size */ - if (width < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(width=%d)", dimensions, width); - return GL_TRUE; - } - if (dimensions > 1 && height < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(height=%d)", dimensions, height); + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + /* destination image does not exist */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(invalid texture image)", dimensions); return GL_TRUE; } - /* check x/y offsets */ - if (xoffset < -((GLint)teximage->Border)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); - return GL_TRUE; - } - if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(xoffset+width)", dimensions); + if (error_check_subtexture_dimensions(ctx, "glCopyTexSubImage", + dimensions, texImage, + xoffset, yoffset, zoffset, + width, height, 1)) { return GL_TRUE; } - if (dimensions > 1) { - GLint yBorder = (target == GL_TEXTURE_1D_ARRAY) ? 0 : teximage->Border; - if (yoffset < -yBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); - return GL_TRUE; - } - /* NOTE: we're adding the border here, not subtracting! */ - if (yoffset + height > (GLint) teximage->Height + yBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(yoffset+height)", dimensions); - return GL_TRUE; - } - } - /* check z offset */ - if (dimensions > 2) { - GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : teximage->Border; - if (zoffset < -zBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(zoffset)", dimensions); - return GL_TRUE; - } - if (zoffset > (GLint) teximage->Depth + zBorder) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(zoffset+depth)", dimensions); - return GL_TRUE; - } - } - - if (_mesa_is_format_compressed(teximage->TexFormat)) { - if (compressedteximage_only_format(ctx, teximage->InternalFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { + if (compressedteximage_only_format(ctx, texImage->InternalFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%dD(no compression for format)", dimensions); return GL_TRUE; } - /* offset must be multiple of 4 */ - if ((xoffset & 3) || (yoffset & 3)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(xoffset or yoffset)", dimensions); - return GL_TRUE; - } - /* size must be multiple of 4 */ - if ((width & 3) != 0 && (GLuint) width != teximage->Width) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(width)", dimensions); - return GL_TRUE; - } - if ((height & 3) != 0 && (GLuint) height != teximage->Height) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%dD(height)", dimensions); - return GL_TRUE; - } } - if (teximage->InternalFormat == GL_YCBCR_MESA) { + if (texImage->InternalFormat == GL_YCBCR_MESA) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); return GL_TRUE; } - if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) { + if (!_mesa_source_buffer_exists(ctx, texImage->_BaseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%dD(missing readbuffer, format=0x%x)", - dimensions, teximage->_BaseFormat); + dimensions, texImage->_BaseFormat); return GL_TRUE; } @@ -2567,11 +2456,11 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions, * buffer is not an integer format, or if the internalformat is not an * integer format and the read color buffer is an integer format." */ - if (_mesa_is_color_format(teximage->InternalFormat)) { + if (_mesa_is_color_format(texImage->InternalFormat)) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; if (_mesa_is_format_integer_color(rb->Format) != - _mesa_is_format_integer_color(teximage->TexFormat)) { + _mesa_is_format_integer_color(texImage->TexFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(integer vs non-integer)", dimensions); return GL_TRUE; @@ -3157,8 +3046,9 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) _mesa_update_state(ctx); - if (subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset, - width, height, depth, format, type)) { + if (texsubimage_error_check(ctx, dims, target, level, + xoffset, yoffset, zoffset, + width, height, depth, format, type)) { return; /* error was detected */ } @@ -3168,13 +3058,7 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, { texImage = _mesa_select_tex_image(ctx, texObj, target, level); - if (subtexture_error_check2(ctx, dims, target, level, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, texImage)) { - /* error was recorded */ - } - else if (width > 0 && height > 0 && depth > 0) { + if (width > 0 && height > 0 && depth > 0) { /* If we have a border, offset=-1 is legal. Bias by border width. */ switch (dims) { case 3: @@ -3417,8 +3301,10 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); - if (copytexsubimage_error_check1(ctx, dims, target, level)) + if (copytexsubimage_error_check(ctx, dims, target, level, + xoffset, yoffset, zoffset, width, height)) { return; + } texObj = _mesa_get_current_tex_object(ctx, target); @@ -3426,38 +3312,32 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, { texImage = _mesa_select_tex_image(ctx, texObj, target, level); - if (copytexsubimage_error_check2(ctx, dims, target, level, xoffset, yoffset, - zoffset, width, height, texImage)) { - /* error was recored */ + /* If we have a border, offset=-1 is legal. Bias by border width. */ + switch (dims) { + case 3: + if (target != GL_TEXTURE_2D_ARRAY) + zoffset += texImage->Border; + /* fall-through */ + case 2: + if (target != GL_TEXTURE_1D_ARRAY) + yoffset += texImage->Border; + /* fall-through */ + case 1: + xoffset += texImage->Border; } - else { - /* If we have a border, offset=-1 is legal. Bias by border width. */ - switch (dims) { - case 3: - if (target != GL_TEXTURE_2D_ARRAY) - zoffset += texImage->Border; - /* fall-through */ - case 2: - if (target != GL_TEXTURE_1D_ARRAY) - yoffset += texImage->Border; - /* fall-through */ - case 1: - xoffset += texImage->Border; - } - if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y, - &width, &height)) { - struct gl_renderbuffer *srcRb = - get_copy_tex_image_source(ctx, texImage->TexFormat); + if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y, + &width, &height)) { + struct gl_renderbuffer *srcRb = + get_copy_tex_image_source(ctx, texImage->TexFormat); - ctx->Driver.CopyTexSubImage(ctx, dims, texImage, - xoffset, yoffset, zoffset, - srcRb, x, y, width, height); + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + srcRb, x, y, width, height); - check_gen_mipmap(ctx, target, texObj, level); + check_gen_mipmap(ctx, target, texObj, level); - ctx->NewState |= _NEW_TEXTURE; - } + ctx->NewState |= _NEW_TEXTURE; } } _mesa_unlock_texture(ctx, texObj); @@ -3506,100 +3386,80 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, /** * Error checking for glCompressedTexSubImage[123]D(). - * \warning There are some bad assumptions here about the size of compressed - * texture tiles (multiple of 4) used to test the validity of the - * offset and size parameters. * \return error code or GL_NO_ERROR. */ static GLenum -compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions, +compressed_subtexture_error_check(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize) { - GLint expectedSize, maxLevels = 0, maxTextureSize; - GLuint bw, bh; - (void) zoffset; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLint expectedSize; + GLboolean targetOK; - if (dimensions == 1) { - /* 1D compressed textures not allowed */ - return GL_INVALID_ENUM; - } - else if (dimensions == 2) { - if (target == GL_PROXY_TEXTURE_2D) { - maxLevels = ctx->Const.MaxTextureLevels; - } - else if (target == GL_TEXTURE_2D) { - maxLevels = ctx->Const.MaxTextureLevels; - } - else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { - if (!ctx->Extensions.ARB_texture_cube_map) - return GL_INVALID_ENUM; /*target*/ - maxLevels = ctx->Const.MaxCubeTextureLevels; - } - else if (_mesa_is_cube_face(target)) { - if (!ctx->Extensions.ARB_texture_cube_map) - return GL_INVALID_ENUM; /*target*/ - maxLevels = ctx->Const.MaxCubeTextureLevels; - } - else { - return GL_INVALID_ENUM; /*target*/ - } - } - else if (dimensions == 3) { - /* 3D compressed textures not allowed */ - return GL_INVALID_ENUM; + if (dims == 2) { + switch (target) { + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + targetOK = GL_TRUE; + break; + default: + targetOK = GL_FALSE; + } + } + else { + assert(dims == 1 || dims == 3); + /* no 1D or 3D compressed textures at this time */ + targetOK = GL_FALSE; + } + + if (!targetOK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target)", + dims); + return GL_TRUE; } - maxTextureSize = 1 << (maxLevels - 1); - /* this will catch any invalid compressed format token */ - if (!_mesa_is_compressed_format(ctx, format)) - return GL_INVALID_ENUM; - - if (width < 1 || width > maxTextureSize) - return GL_INVALID_VALUE; - - if ((height < 1 || height > maxTextureSize) - && dimensions > 1) - return GL_INVALID_VALUE; - - if (level < 0 || level >= maxLevels) - return GL_INVALID_VALUE; - - /* - * do checks which depend on compression block size - */ - get_compressed_block_size(format, &bw, &bh); - - if ((xoffset % bw != 0) || (yoffset % bh != 0)) - return GL_INVALID_VALUE; - - if ((width % bw != 0) && width != 2 && width != 1) - return GL_INVALID_VALUE; + if (!_mesa_is_compressed_format(ctx, format)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(format)", + dims); + return GL_TRUE; + } - if ((height % bh != 0) && height != 2 && height != 1) - return GL_INVALID_VALUE; + if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage%uD(level=%d)", + dims, level); + return GL_TRUE; + } expectedSize = compressed_tex_size(width, height, depth, format); - if (expectedSize != imageSize) - return GL_INVALID_VALUE; - - return GL_NO_ERROR; -} + if (expectedSize != imageSize) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage%uD(size=%d)", + dims, imageSize); + return GL_TRUE; + } + texObj = _mesa_get_current_tex_object(ctx, target); + if (!texObj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glCompressedTexSubImage%uD()", dims); + return GL_TRUE; + } -/** - * Do second part of glCompressedTexSubImage error checking. - * \return GL_TRUE if error found, GL_FALSE otherwise. - */ -static GLboolean -compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims, - GLsizei width, GLsizei height, - GLsizei depth, GLenum format, - struct gl_texture_image *texImage) -{ + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (!texImage) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage%uD(invalid texture image)", dims); + return GL_TRUE; + } if ((GLint) format != texImage->InternalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -3614,34 +3474,12 @@ compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims, return GL_TRUE; } - if (((width == 1 || width == 2) && - width != (GLsizei) texImage->Width) || - (width > (GLsizei) texImage->Width)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCompressedTexSubImage%uD(width=%d)", dims, width); + if (error_check_subtexture_dimensions(ctx, "glCompressedTexSubImage", dims, + texImage, xoffset, yoffset, zoffset, + width, height, depth)) { return GL_TRUE; } - if (dims >= 2) { - if (((height == 1 || height == 2) && - height != (GLsizei) texImage->Height) || - (height > (GLsizei) texImage->Height)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCompressedTexSubImage%uD(height=%d)", dims, height); - return GL_TRUE; - } - } - - if (dims >= 3) { - if (((depth == 1 || depth == 2) && - depth != (GLsizei) texImage->Depth) || - (depth > (GLsizei) texImage->Depth)) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCompressedTexSubImage%uD(depth=%d)", dims, depth); - return GL_TRUE; - } - } - return GL_FALSE; } @@ -3693,16 +3531,13 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, { struct gl_texture_object *texObj; struct gl_texture_image *texImage; - GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - error = compressed_subtexture_error_check(ctx, dims, target, level, - xoffset, 0, 0, /* pos */ - width, height, depth, /* size */ - format, imageSize); - if (error) { - _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims); + if (compressed_subtexture_error_check(ctx, dims, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize)) { return; } @@ -3713,11 +3548,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, texImage = _mesa_select_tex_image(ctx, texObj, target, level); assert(texImage); - if (compressed_subtexture_error_check2(ctx, dims, width, height, depth, - format, texImage)) { - /* error was recorded */ - } - else if (width > 0 && height > 0 && depth > 0) { + if (width > 0 && height > 0 && depth > 0) { ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, xoffset, yoffset, zoffset, width, height, depth, diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index c7c32d8ac..e1b15d252 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -138,9 +138,6 @@ _mesa_tex_target_to_face(GLenum target); extern GLint _mesa_get_texture_dimensions(GLenum target); -extern GLenum -_mesa_es_error_check_format_and_type(GLenum format, GLenum type, - unsigned dimensions); extern GLboolean _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 4f4fe77da..5634a3e6e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -1379,6 +1379,11 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; + if (width == 0 || height == 0 || depth == 0) { + /* zero-sized images are legal, and always fit! */ + return GL_TRUE; + } + if (pipe->screen->can_create_resource) { /* Ask the gallium driver if the texture is too large */ struct gl_texture_object *texObj = |