diff options
Diffstat (limited to 'mesalib')
88 files changed, 3103 insertions, 2947 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index af1b0d1fa..c71fa2627 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -28,7 +28,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 -LIBDRM_RADEON_REQUIRED=2.4.50 +LIBDRM_RADEON_REQUIRED=2.4.53 LIBDRM_INTEL_REQUIRED=2.4.52 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" @@ -797,6 +797,13 @@ if test "x$have_libdrm" = xyes; then DEFINES="$DEFINES -DHAVE_LIBDRM" fi +case "$host_os" in +linux*) + need_libudev=yes ;; +*) + need_libudev=no ;; +esac + PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED], have_libudev=yes, have_libudev=no) @@ -1025,7 +1032,7 @@ if test "x$enable_dri" = xyes; then fi # Check for expat - PKG_CHECK_EXISTS([EXPAT], [have_expat=yes], [have_expat=no]) + PKG_CHECK_EXISTS([expat], [have_expat=yes], [have_expat=no]) if test "x$have_expat" = "xyes"; then PKG_CHECK_MODULES([EXPAT], [expat], [], AC_MSG_ERROR([Expat required for DRI.])) @@ -1049,12 +1056,9 @@ if test "x$enable_dri" = xyes; then # put all the necessary libs together DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS" - GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS" - fi AC_SUBST([DRI_LIB_DEPS]) -AC_SUBST([GALLIUM_DRI_LIB_DEPS]) DRI_DIRS='' dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block @@ -1160,7 +1164,7 @@ if test "x$enable_gbm" = xauto; then esac fi if test "x$enable_gbm" = xyes; then - if test x"$have_libudev" != xyes; then + if test "x$need_libudev$have_libudev" = xyesno; then AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED]) fi @@ -1172,7 +1176,11 @@ if test "x$enable_gbm" = xyes; then fi fi AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes) -GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED" +if test "x$need_libudev" = xyes; then + GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED" +else + GBM_PC_REQ_PRIV="" +fi GBM_PC_LIB_PRIV="$DLOPEN_LIBS" AC_SUBST([GBM_PC_REQ_PRIV]) AC_SUBST([GBM_PC_LIB_PRIV]) @@ -1457,8 +1465,8 @@ for plat in $egl_platforms; do ;; esac - case "$plat$have_libudev" in - waylandno|drmno) + case "$plat$need_libudev$have_libudev" in + waylandyesno|drmyesno) AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED]) ;; esac done @@ -1720,7 +1728,7 @@ gallium_require_llvm() { gallium_require_drm_loader() { if test "x$enable_gallium_loader" = xyes; then - if test "x$have_libudev" != xyes; then + if test "x$need_libudev$have_libudev" = xyesno; then AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED]) fi if test "x$have_libdrm" != xyes; then @@ -1992,9 +2000,14 @@ AC_SUBST([VDPAU_MINOR], 0) AC_SUBST([XVMC_MAJOR], 1) AC_SUBST([XVMC_MINOR], 0) -AC_SUBST([XA_MAJOR], 2) -AC_SUBST([XA_MINOR], 2) -AC_SUBST([XA_TINY], 0) +XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h" +XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'` +XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'` +XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'` + +AC_SUBST([XA_MAJOR], $XA_MAJOR) +AC_SUBST([XA_MINOR], $XA_MINOR) +AC_SUBST([XA_TINY], $XA_TINY) AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY") dnl Restore LDFLAGS and CPPFLAGS @@ -2014,8 +2027,6 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS" dnl Substitute the config AC_CONFIG_FILES([Makefile src/Makefile - src/egl/Makefile - src/egl/drivers/Makefile src/egl/drivers/dri2/Makefile src/egl/main/Makefile src/egl/main/egl.pc diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index b7e4c8764..0b663dd34 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -97,17 +97,28 @@ GL 3.3 --- all DONE: i965, nv50, nvc0, r600, radeonsi GL 4.0: GLSL 4.0 not started - GL_ARB_texture_query_lod DONE (i965) + GL_ARB_texture_query_lod DONE (i965, nv50, nvc0) GL_ARB_draw_buffers_blend DONE (i965, nv50, nvc0, r600, radeonsi, softpipe) GL_ARB_draw_indirect DONE (i965) GL_ARB_gpu_shader5 started + - 'precise' qualifier not started + - Dynamically uniform sampler array indices not started + - Dynamically uniform UBO array indices not started + - Implicit signed -> unsigned conversions not started + - Fused multiply-add DONE + - Packing/bitfield/conversion functions DONE + - Enhanced textureGather DONE + - Geometry shader instancing DONE + - Geometry shader multiple streams not started + - Enhanced per-sample shading DONE + - Interpolation functions started GL_ARB_gpu_shader_fp64 not started GL_ARB_sample_shading DONE (i965) GL_ARB_shader_subroutine not started GL_ARB_tessellation_shader not started GL_ARB_texture_buffer_object_rgb32 DONE (i965, nvc0, r600, radeonsi, softpipe) GL_ARB_texture_cube_map_array DONE (i965, nv50, nvc0, r600, softpipe) - GL_ARB_texture_gather DONE (i965, nv50) + GL_ARB_texture_gather DONE (i965, nv50, nvc0) GL_ARB_transform_feedback2 DONE (i965, nv50, nvc0, r600, radeonsi) GL_ARB_transform_feedback3 DONE (i965, nv50, nvc0, r600, radeonsi) @@ -162,7 +173,7 @@ GL 4.3: GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi) GL_ARB_texture_query_levels DONE (i965) GL_ARB_texture_storage_multisample DONE (all drivers that support GL_ARB_texture_multisample) - GL_ARB_texture_view started (Courtney Goeltzenleuchter, Chris Forbes) + GL_ARB_texture_view DONE (i965) GL_ARB_vertex_attrib_binding DONE (all drivers) diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html index d4a6dfb59..67c1f34bd 100644 --- a/mesalib/docs/devinfo.html +++ b/mesalib/docs/devinfo.html @@ -56,6 +56,11 @@ To add a new GL extension to Mesa you have to do at least the following. If the new extension adds new GL state, the functions in get.c, enable.c and attrib.c will most likely require new code. </li> +<li> + The dispatch tests check_table.cpp and dispatch_sanity.cpp + should be updated with details about the new extensions functions. These + tests are run using 'make check' +</li> </ul> diff --git a/mesalib/docs/relnotes/10.2.html b/mesalib/docs/relnotes/10.2.html index da79e7d80..d7d557bd0 100644 --- a/mesalib/docs/relnotes/10.2.html +++ b/mesalib/docs/relnotes/10.2.html @@ -44,8 +44,9 @@ Note: some of the new features are only available with certain drivers. </p> <ul> -<li>GL_ARB_buffer_storage on r300, r600, and radeonsi</li> +<li>GL_ARB_buffer_storage on i965, r300, r600, and radeonsi</li> <li>GL_ARB_stencil_texturing on i965/gen8+</li> +<li>GL_ARB_texture_view on i965/gen7</li> </ul> diff --git a/mesalib/include/GLES2/gl2ext.h b/mesalib/include/GLES2/gl2ext.h index 2a84c4d81..a5e3f47d6 100644 --- a/mesalib/include/GLES2/gl2ext.h +++ b/mesalib/include/GLES2/gl2ext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** Copyright (c) 2013-2014 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -33,14 +33,14 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 24614 $ on $Date: 2013-12-30 04:44:46 -0800 (Mon, 30 Dec 2013) $ +** Khronos $Revision: 25922 $ on $Date: 2014-03-17 03:54:32 -0700 (Mon, 17 Mar 2014) $ */ #ifndef GL_APIENTRYP #define GL_APIENTRYP GL_APIENTRY* #endif -/* Generated on date 20131230 */ +/* Generated on date 20140317 */ /* Generated C header for: * API: gles2 @@ -52,6 +52,30 @@ extern "C" { * Extensions removed: _nomatch_^ */ +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + #ifndef GL_KHR_debug #define GL_KHR_debug 1 typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); @@ -277,6 +301,31 @@ GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, #define GL_OES_rgb8_rgba8 1 #endif /* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 +typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); +#endif +#endif /* GL_OES_sample_shading */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 +#endif /* GL_OES_sample_variables */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 +#endif /* GL_OES_shader_image_atomic */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D +#endif /* GL_OES_shader_multisample_interpolation */ + #ifndef GL_OES_standard_derivatives #define GL_OES_standard_derivatives 1 #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B @@ -366,6 +415,25 @@ GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum att #define GL_OES_texture_npot 1 #endif /* GL_OES_texture_npot */ +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 +#define GL_STENCIL_INDEX_OES 0x1901 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif /* GL_OES_texture_stencil8 */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif +#endif /* GL_OES_texture_storage_multisample_2d_array */ + #ifndef GL_OES_vertex_array_object #define GL_OES_vertex_array_object 1 #define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 @@ -613,6 +681,16 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_ARM_rgba8 1 #endif /* GL_ARM_rgba8 */ +#ifndef GL_ARM_shader_framebuffer_fetch +#define GL_ARM_shader_framebuffer_fetch 1 +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 +#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 +#endif /* GL_ARM_shader_framebuffer_fetch */ + +#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil +#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 +#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ + #ifndef GL_DMP_shader_binary #define GL_DMP_shader_binary 1 #define GL_SHADER_BINARY_DMP 0x9250 @@ -990,6 +1068,13 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin #define GL_EXT_shader_integer_mix 1 #endif /* GL_EXT_shader_integer_mix */ +#ifndef GL_EXT_shader_pixel_local_storage +#define GL_EXT_shader_pixel_local_storage 1 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 +#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 +#endif /* GL_EXT_shader_pixel_local_storage */ + #ifndef GL_EXT_shader_texture_lod #define GL_EXT_shader_texture_lod 1 #endif /* GL_EXT_shader_texture_lod */ diff --git a/mesalib/include/GLES3/gl31.h b/mesalib/include/GLES3/gl31.h new file mode 100644 index 000000000..cb41e981b --- /dev/null +++ b/mesalib/include/GLES3/gl31.h @@ -0,0 +1,1184 @@ +#ifndef __gl31_h_ +#define __gl31_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2014 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE 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 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision$ on $Date$ +*/ + +#include <GLES3/gl3platform.h> + +/* Generated on date 20140317 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2.[0-9]|3.[01] + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 +#include <KHR/khrplatform.h> +typedef khronos_int8_t GLbyte; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef short GLshort; +typedef unsigned short GLushort; +typedef void GLvoid; +typedef struct __GLsync *GLsync; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef unsigned int GLenum; +typedef unsigned int GLuint; +typedef char GLchar; +typedef khronos_float_t GLfloat; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; +typedef unsigned int GLbitfield; +typedef int GLint; +typedef unsigned char GLboolean; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_NONE 0 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_ES_VERSION_2_0 */ + +#ifndef GL_ES_VERSION_3_0 +#define GL_ES_VERSION_3_0 1 +typedef unsigned short GLhalf; +#define GL_READ_BUFFER 0x0C02 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_RED 0x1903 +#define GL_RGB8 0x8051 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_RG8 0x822B +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_INT_2_10_10_10_REV 0x8D9F +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode); +GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQuery (GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); +GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array); +GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GL_APICALL void GL_APIENTRY glEndTransformFeedback (void); +GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index); +GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync); +GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync); +GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); +GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler); +GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id); +GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void); +GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void); +GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +#endif /* GL_ES_VERSION_3_0 */ + +#ifndef GL_ES_VERSION_3_1 +#define GL_ES_VERSION_3_1 1 +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_STENCIL_INDEX 0x1901 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#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_VERTEX_BINDING_BUFFER 0x8F4F +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect); +GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); +GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); +GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); +GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers); +GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); +GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +#endif /* GL_ES_VERSION_3_1 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GLES3/gl3platform.h b/mesalib/include/GLES3/gl3platform.h index 1bd1a850f..b1e869dd1 100644 --- a/mesalib/include/GLES3/gl3platform.h +++ b/mesalib/include/GLES3/gl3platform.h @@ -1,7 +1,7 @@ #ifndef __gl3platform_h_ #define __gl3platform_h_ -/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */ +/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ /* * This document is licensed under the SGI Free Software B License Version diff --git a/mesalib/install-gallium-links.mk b/mesalib/install-gallium-links.mk index 6ed8a24a7..757b28870 100644 --- a/mesalib/install-gallium-links.mk +++ b/mesalib/install-gallium-links.mk @@ -12,7 +12,7 @@ all-local : .libs/install-gallium-links link_dir=$(top_builddir)/$(LIB_DIR)/egl; \ fi; \ $(MKDIR_P) $$link_dir; \ - file_list=$(dri_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ + file_list=$(dri_LTLIBRARIES:%.la=.libs/%.so); \ file_list+=$(vdpau_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am index 5b2549d9d..9d1580f90 100644 --- a/mesalib/src/Makefile.am +++ b/mesalib/src/Makefile.am @@ -33,12 +33,16 @@ if HAVE_EGL_PLATFORM_WAYLAND SUBDIRS += egl/wayland endif +if HAVE_EGL_DRIVER_DRI2 +SUBDIRS += egl/drivers/dri2 +endif + if HAVE_GBM SUBDIRS += gbm endif if HAVE_EGL -SUBDIRS += egl +SUBDIRS += egl/main endif if HAVE_GALLIUM @@ -55,3 +59,5 @@ SUBDIRS += \ gallium/tests/unit endif endif + +EXTRA_DIST = getopt diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc index 56f1433a0..1f5d532e4 100644 --- a/mesalib/src/gallium/Automake.inc +++ b/mesalib/src/gallium/Automake.inc @@ -55,6 +55,7 @@ DRI_VERSION_SCRIPT ?= $(top_srcdir)/src/gallium/state_trackers/dri/dri.link GALLIUM_DRI_LINKER_FLAGS = \ -shared \ + -shrext .so \ -module \ -avoid-version \ $(GC_SECTIONS) \ @@ -67,7 +68,7 @@ GALLIUM_VDPAU_LINKER_FLAGS = \ -version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \ -export-symbols-regex $(VDPAU_EXPORTS) \ $(GC_SECTIONS) \ - -Wl,--no-undefined + $(LD_NO_UNDEFINED) GALLIUM_XVMC_LINKER_FLAGS = \ -shared \ @@ -76,7 +77,7 @@ GALLIUM_XVMC_LINKER_FLAGS = \ -version-number $(XVMC_MAJOR):$(XVMC_MINOR) \ -export-symbols-regex '^XvMC' \ $(GC_SECTIONS) \ - -Wl,--no-undefined + $(LD_NO_UNDEFINED) GALLIUM_OMX_LINKER_FLAGS = \ -shared \ @@ -84,29 +85,41 @@ GALLIUM_OMX_LINKER_FLAGS = \ -no-undefined \ -export-symbols-regex $(EXPORTS) \ $(GC_SECTIONS) \ - -Wl,--no-undefined + $(LD_NO_UNDEFINED) + +GALLIUM_COMMON_LIB_DEPS = \ + -lm \ + $(CLOCK_LIB) \ + $(PTHREAD_LIBS) \ + $(DLOPEN_LIBS) + +GALLIUM_DRI_LIB_DEPS = \ + $(top_builddir)/src/mesa/libmesagallium.la \ + $(top_builddir)/src/gallium/auxiliary/libgallium.la \ + $(SELINUX_LIBS) \ + $(LIBDRM_LIBS) \ + $(EXPAT_LIBS) \ + $(GALLIUM_COMMON_LIB_DEPS) GALLIUM_VDPAU_LIB_DEPS = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \ $(VDPAU_LIBS) \ $(LIBDRM_LIBS) \ - -lm \ - $(CLOCK_LIB) \ - $(PTHREAD_LIBS) \ - $(DLOPEN_LIBS) + $(GALLIUM_COMMON_LIB_DEPS) GALLIUM_XVMC_LIB_DEPS = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \ $(XVMC_LIBS) \ - $(LIBDRM_LIBS) + $(LIBDRM_LIBS) \ + $(GALLIUM_COMMON_LIB_DEPS) GALLIUM_OMX_LIB_DEPS = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \ - $(GALLIUM_DRI_LIB_DEPS) \ - $(OMX_LIBS) + $(OMX_LIBS) \ + $(GALLIUM_COMMON_LIB_DEPS) GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/include \ diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index 1e7f374ab..7b058fe22 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -688,7 +688,7 @@ static void set_texcoords_in_vertices(const float coord[4], static void blitter_set_texcoords(struct blitter_context_priv *ctx, struct pipe_sampler_view *src, unsigned src_width0, unsigned src_height0, - unsigned layer, unsigned sample, + float layer, unsigned sample, int x1, int y1, int x2, int y2) { unsigned i; @@ -700,11 +700,11 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, if (src->texture->target == PIPE_TEXTURE_CUBE || src->texture->target == PIPE_TEXTURE_CUBE_ARRAY) { set_texcoords_in_vertices(coord, &face_coord[0][0], 2); - util_map_texcoords2d_onto_cubemap(layer % 6, + util_map_texcoords2d_onto_cubemap((unsigned)layer % 6, /* pointer, stride in floats */ &face_coord[0][0], 2, &ctx->vertices[0][1][0], 8, - TRUE); + FALSE); } else { set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8); } @@ -734,7 +734,7 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, case PIPE_TEXTURE_CUBE_ARRAY: for (i = 0; i < 4; i++) - ctx->vertices[i][1][3] = (float) (layer / 6); /*w*/ + ctx->vertices[i][1][3] = (float) ((unsigned)layer / 6); /*w*/ break; case PIPE_TEXTURE_2D: @@ -1528,9 +1528,31 @@ void util_blitter_blit_generic(struct blitter_context *blitter, UTIL_BLITTER_ATTRIB_TEXCOORD, &coord); } else { /* Draw the quad with the generic codepath. */ - int z; - for (z = 0; z < dstbox->depth; z++) { + int dst_z; + for (dst_z = 0; dst_z < dstbox->depth; dst_z++) { struct pipe_surface *old; + float dst2src_scale = srcbox->depth / (float)dstbox->depth; + + /* Scale Z properly if the blit is scaled. + * + * When downscaling, we want the coordinates centered, so that + * mipmapping works for 3D textures. For example, when generating + * a 4x4x4 level, this wouldn't average the pixels: + * + * src Z: 0 1 2 3 4 5 6 7 + * dst Z: 0 1 2 3 + * + * Because the pixels are not centered below the pixels of the higher + * level. Therefore, we want this: + * src Z: 0 1 2 3 4 5 6 7 + * dst Z: 0 1 2 3 + * + * dst_offset defines the offset needed for centering the pixels and + * it works with any scaling (not just 2x). + */ + float dst_offset = ((srcbox->depth - 1) - + (dstbox->depth - 1) * dst2src_scale) * 0.5; + float src_z = (dst_z + dst_offset) * dst2src_scale; /* Set framebuffer state. */ if (blit_depth || blit_stencil) { @@ -1548,7 +1570,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, for (i = 0; i <= max_sample; i++) { pipe->set_sample_mask(pipe, 1 << i); blitter_set_texcoords(ctx, src, src_width0, src_height0, - srcbox->z + z, + srcbox->z + src_z, i, srcbox->x, srcbox->y, srcbox->x + srcbox->width, srcbox->y + srcbox->height); @@ -1560,7 +1582,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, /* Normal copy, MSAA upsampling, or MSAA resolve. */ pipe->set_sample_mask(pipe, ~0); blitter_set_texcoords(ctx, src, src_width0, src_height0, - srcbox->z + z, 0, + srcbox->z + src_z, 0, srcbox->x, srcbox->y, srcbox->x + srcbox->width, srcbox->y + srcbox->height); @@ -1572,10 +1594,10 @@ void util_blitter_blit_generic(struct blitter_context *blitter, /* Get the next surface or (if this is the last iteration) * just unreference the last one. */ old = dst; - if (z < dstbox->depth-1) { + if (dst_z < dstbox->depth-1) { dst = ctx->base.get_next_surface_layer(ctx->base.pipe, dst); } - if (z) { + if (dst_z) { pipe_surface_reference(&old, NULL); } } diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c index a2f42189f..aa8eaebb6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -3,6 +3,7 @@ * Copyright 2008 VMware, Inc. * All Rights Reserved. * Copyright 2008 VMware, Inc. All rights reserved. + * Copyright 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -30,509 +31,98 @@ * @file * Mipmap generation utility * - * @author Brian Paul + * @author Brian Paul, Marek Olšák */ -#include "pipe/p_context.h" -#include "util/u_debug.h" -#include "pipe/p_defines.h" -#include "util/u_inlines.h" -#include "pipe/p_shader_tokens.h" -#include "pipe/p_state.h" - -#include "util/u_format.h" -#include "util/u_memory.h" -#include "util/u_draw_quad.h" #include "util/u_gen_mipmap.h" -#include "util/u_simple_shaders.h" -#include "util/u_math.h" -#include "util/u_texture.h" -#include "util/u_half.h" -#include "util/u_surface.h" - -#include "cso_cache/cso_context.h" - - -struct gen_mipmap_state -{ - struct pipe_context *pipe; - struct cso_context *cso; - - struct pipe_blend_state blend_keep_color, blend_write_color; - struct pipe_depth_stencil_alpha_state dsa_keep_depth, dsa_write_depth; - struct pipe_rasterizer_state rasterizer; - struct pipe_sampler_state sampler; - struct pipe_vertex_element velem[2]; - - void *vs; - - /** Not all are used, but simplifies code */ - void *fs_color[TGSI_TEXTURE_COUNT]; - void *fs_depth[TGSI_TEXTURE_COUNT]; - - struct pipe_resource *vbuf; /**< quad vertices */ - unsigned vbuf_slot; - - float vertices[4][2][4]; /**< vertex/texcoords for quad */ -}; - - -/** - * Create a mipmap generation context. - * The idea is to create one of these and re-use it each time we need to - * generate a mipmap. - */ -struct gen_mipmap_state * -util_create_gen_mipmap(struct pipe_context *pipe, - struct cso_context *cso) -{ - struct gen_mipmap_state *ctx; - uint i; - - ctx = CALLOC_STRUCT(gen_mipmap_state); - if (!ctx) - return NULL; - - ctx->pipe = pipe; - ctx->cso = cso; - - /* disabled blending/masking */ - memset(&ctx->blend_keep_color, 0, sizeof(ctx->blend_keep_color)); - memset(&ctx->blend_write_color, 0, sizeof(ctx->blend_write_color)); - ctx->blend_write_color.rt[0].colormask = PIPE_MASK_RGBA; - - /* no-op depth/stencil/alpha */ - memset(&ctx->dsa_keep_depth, 0, sizeof(ctx->dsa_keep_depth)); - memset(&ctx->dsa_write_depth, 0, sizeof(ctx->dsa_write_depth)); - ctx->dsa_write_depth.depth.enabled = 1; - ctx->dsa_write_depth.depth.func = PIPE_FUNC_ALWAYS; - ctx->dsa_write_depth.depth.writemask = 1; - - /* rasterizer */ - memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer)); - ctx->rasterizer.cull_face = PIPE_FACE_NONE; - ctx->rasterizer.half_pixel_center = 1; - ctx->rasterizer.bottom_edge_rule = 1; - ctx->rasterizer.depth_clip = 1; - - /* sampler state */ - memset(&ctx->sampler, 0, sizeof(ctx->sampler)); - ctx->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - ctx->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - ctx->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; - ctx->sampler.normalized_coords = 1; - - /* vertex elements state */ - memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2); - for (i = 0; i < 2; i++) { - ctx->velem[i].src_offset = i * 4 * sizeof(float); - ctx->velem[i].instance_divisor = 0; - ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso); - ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - } - - /* vertex data that doesn't change */ - for (i = 0; i < 4; i++) { - ctx->vertices[i][0][2] = 0.0f; /* z */ - ctx->vertices[i][0][3] = 1.0f; /* w */ - ctx->vertices[i][1][3] = 1.0f; /* q */ - } - - /* Note: the actual vertex buffer is allocated as needed below */ - - return ctx; -} - - -/** - * Helper function to set the fragment shaders. - */ -static INLINE void -set_fragment_shader(struct gen_mipmap_state *ctx, uint type, - boolean output_depth) -{ - if (output_depth) { - if (!ctx->fs_depth[type]) - ctx->fs_depth[type] = - util_make_fragment_tex_shader_writedepth(ctx->pipe, type, - TGSI_INTERPOLATE_LINEAR); - - cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth[type]); - } - else { - if (!ctx->fs_color[type]) - ctx->fs_color[type] = - util_make_fragment_tex_shader(ctx->pipe, type, - TGSI_INTERPOLATE_LINEAR); - - cso_set_fragment_shader_handle(ctx->cso, ctx->fs_color[type]); - } -} - - -/** - * Helper function to set the vertex shader. - */ -static INLINE void -set_vertex_shader(struct gen_mipmap_state *ctx) -{ - /* vertex shader - still required to provide the linkage between - * fragment shader input semantics and vertex_element/buffers. - */ - if (!ctx->vs) - { - const uint semantic_names[] = { TGSI_SEMANTIC_POSITION, - TGSI_SEMANTIC_GENERIC }; - const uint semantic_indexes[] = { 0, 0 }; - ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2, - semantic_names, - semantic_indexes); - } - - cso_set_vertex_shader_handle(ctx->cso, ctx->vs); -} - - -/** - * Get next "slot" of vertex space in the vertex buffer. - * We're allocating one large vertex buffer and using it piece by piece. - */ -static unsigned -get_next_slot(struct gen_mipmap_state *ctx) -{ - const unsigned max_slots = 4096 / sizeof ctx->vertices; - - if (ctx->vbuf_slot >= max_slots) { - pipe_resource_reference(&ctx->vbuf, NULL); - ctx->vbuf_slot = 0; - } - - if (!ctx->vbuf) { - ctx->vbuf = pipe_buffer_create(ctx->pipe->screen, - PIPE_BIND_VERTEX_BUFFER, - PIPE_USAGE_STREAM, - max_slots * sizeof ctx->vertices); - } - - return ctx->vbuf_slot++ * sizeof ctx->vertices; -} - - -static unsigned -set_vertex_data(struct gen_mipmap_state *ctx, - enum pipe_texture_target tex_target, - uint face, float r) -{ - unsigned offset; - - /* vert[0].position */ - ctx->vertices[0][0][0] = -1.0f; /*x*/ - ctx->vertices[0][0][1] = -1.0f; /*y*/ - - /* vert[1].position */ - ctx->vertices[1][0][0] = 1.0f; - ctx->vertices[1][0][1] = -1.0f; - - /* vert[2].position */ - ctx->vertices[2][0][0] = 1.0f; - ctx->vertices[2][0][1] = 1.0f; - - /* vert[3].position */ - ctx->vertices[3][0][0] = -1.0f; - ctx->vertices[3][0][1] = 1.0f; - - /* Setup vertex texcoords. This is a little tricky for cube maps. */ - if (tex_target == PIPE_TEXTURE_CUBE || - tex_target == PIPE_TEXTURE_CUBE_ARRAY) { - static const float st[4][2] = { - {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} - }; - - util_map_texcoords2d_onto_cubemap(face, &st[0][0], 2, - &ctx->vertices[0][1][0], 8, - FALSE); - - /* set the layer for cube arrays */ - ctx->vertices[0][1][3] = r; - ctx->vertices[1][1][3] = r; - ctx->vertices[2][1][3] = r; - ctx->vertices[3][1][3] = r; - } - else if (tex_target == PIPE_TEXTURE_1D_ARRAY) { - /* 1D texture array */ - ctx->vertices[0][1][0] = 0.0f; /*s*/ - ctx->vertices[0][1][1] = r; /*t*/ - ctx->vertices[0][1][2] = 0.0f; /*r*/ - - ctx->vertices[1][1][0] = 1.0f; - ctx->vertices[1][1][1] = r; - ctx->vertices[1][1][2] = 0.0f; - - ctx->vertices[2][1][0] = 1.0f; - ctx->vertices[2][1][1] = r; - ctx->vertices[2][1][2] = 0.0f; - - ctx->vertices[3][1][0] = 0.0f; - ctx->vertices[3][1][1] = r; - ctx->vertices[3][1][2] = 0.0f; - } else { - /* 1D/2D/3D/2D array */ - ctx->vertices[0][1][0] = 0.0f; /*s*/ - ctx->vertices[0][1][1] = 0.0f; /*t*/ - ctx->vertices[0][1][2] = r; /*r*/ - - ctx->vertices[1][1][0] = 1.0f; - ctx->vertices[1][1][1] = 0.0f; - ctx->vertices[1][1][2] = r; - - ctx->vertices[2][1][0] = 1.0f; - ctx->vertices[2][1][1] = 1.0f; - ctx->vertices[2][1][2] = r; - - ctx->vertices[3][1][0] = 0.0f; - ctx->vertices[3][1][1] = 1.0f; - ctx->vertices[3][1][2] = r; - } - - offset = get_next_slot( ctx ); - - pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf, - offset, sizeof(ctx->vertices), ctx->vertices); - - return offset; -} - - - -/** - * Destroy a mipmap generation context - */ -void -util_destroy_gen_mipmap(struct gen_mipmap_state *ctx) -{ - struct pipe_context *pipe = ctx->pipe; - unsigned i; - - for (i = 0; i < Elements(ctx->fs_color); i++) - if (ctx->fs_color[i]) - pipe->delete_fs_state(pipe, ctx->fs_color[i]); - - for (i = 0; i < Elements(ctx->fs_depth); i++) - if (ctx->fs_depth[i]) - pipe->delete_fs_state(pipe, ctx->fs_depth[i]); - - if (ctx->vs) - pipe->delete_vs_state(pipe, ctx->vs); - - pipe_resource_reference(&ctx->vbuf, NULL); - - FREE(ctx); -} +#include "util/u_format.h" +#include "util/u_inlines.h" /** * Generate mipmap images. It's assumed all needed texture memory is * already allocated. * - * \param psv the sampler view to the texture to generate mipmap levels for - * \param face which cube face to generate mipmaps for (0 for non-cube maps) - * \param baseLevel the first mipmap level to use as a src - * \param lastLevel the last mipmap level to generate + * \param pt the texture to generate mipmap levels for + * \param format format of texture + * \param first_layer the first layer to generate mipmap levels for + * (ignored for 3D textures) + * \param last_layer the last layer to generate mipmap levels for + * (ignored for 3D textures) + * \param base_level the first mipmap level to use as a src + * \param last_level the last mipmap level to generate * \param filter the minification filter used to generate mipmap levels with - * \param filter one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST + * one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST */ -void -util_gen_mipmap(struct gen_mipmap_state *ctx, - struct pipe_sampler_view *psv, - uint face, uint baseLevel, uint lastLevel, uint filter) +boolean +util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt, + enum pipe_format format, uint base_level, uint last_level, + uint first_layer, uint last_layer, uint filter) { - struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_framebuffer_state fb; - struct pipe_resource *pt = psv->texture; + struct pipe_blit_info blit; uint dstLevel; - uint offset; - uint type; - boolean is_depth = util_format_is_depth_or_stencil(psv->format); + boolean is_zs = util_format_is_depth_or_stencil(format); + boolean has_depth = + util_format_has_depth(util_format_description(format)); + + /* nothing to do for stencil-only formats */ + if (is_zs && !has_depth) + return TRUE; + + /* nothing to do for integer formats */ + if (!is_zs && util_format_is_pure_integer(format)) + return TRUE; + + if (!screen->is_format_supported(screen, format, pt->target, + pt->nr_samples, + PIPE_BIND_SAMPLER_VIEW | + (is_zs ? PIPE_BIND_DEPTH_STENCIL : + PIPE_BIND_RENDER_TARGET))) { + return FALSE; + } /* The texture object should have room for the levels which we're * about to generate. */ - assert(lastLevel <= pt->last_level); + assert(last_level <= pt->last_level); /* If this fails, why are we here? */ - assert(lastLevel > baseLevel); - + assert(last_level > base_level); assert(filter == PIPE_TEX_FILTER_LINEAR || filter == PIPE_TEX_FILTER_NEAREST); - type = util_pipe_tex_to_tgsi_tex(pt->target, 1); - - /* check if we can render in the texture's format */ - if (!screen->is_format_supported(screen, psv->format, pt->target, - pt->nr_samples, - is_depth ? PIPE_BIND_DEPTH_STENCIL : - PIPE_BIND_RENDER_TARGET)) { - /* The caller should check if the format is renderable. */ - assert(0); - return; - } - - /* save state (restored below) */ - cso_save_blend(ctx->cso); - cso_save_depth_stencil_alpha(ctx->cso); - cso_save_rasterizer(ctx->cso); - cso_save_sample_mask(ctx->cso); - cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); - cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); - cso_save_stream_outputs(ctx->cso); - cso_save_framebuffer(ctx->cso); - cso_save_fragment_shader(ctx->cso); - cso_save_vertex_shader(ctx->cso); - cso_save_geometry_shader(ctx->cso); - cso_save_viewport(ctx->cso); - cso_save_vertex_elements(ctx->cso); - cso_save_aux_vertex_buffer_slot(ctx->cso); - cso_save_render_condition(ctx->cso); + memset(&blit, 0, sizeof(blit)); + blit.src.resource = blit.dst.resource = pt; + blit.src.format = blit.dst.format = format; + /* don't set the stencil mask, stencil shouldn't be changed */ + blit.mask = is_zs ? PIPE_MASK_Z : PIPE_MASK_RGBA; + blit.filter = filter; - /* bind our state */ - cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color : - &ctx->blend_write_color); - cso_set_depth_stencil_alpha(ctx->cso, is_depth ? &ctx->dsa_write_depth : - &ctx->dsa_keep_depth); - cso_set_rasterizer(ctx->cso, &ctx->rasterizer); - cso_set_sample_mask(ctx->cso, ~0); - cso_set_vertex_elements(ctx->cso, 2, ctx->velem); - cso_set_stream_outputs(ctx->cso, 0, NULL, NULL); - cso_set_render_condition(ctx->cso, NULL, FALSE, 0); + for (dstLevel = base_level + 1; dstLevel <= last_level; dstLevel++) { + blit.src.level = dstLevel - 1; + blit.dst.level = dstLevel; - set_fragment_shader(ctx, type, is_depth); - set_vertex_shader(ctx); - cso_set_geometry_shader_handle(ctx->cso, NULL); + blit.src.box.width = u_minify(pt->width0, blit.src.level); + blit.src.box.height = u_minify(pt->height0, blit.src.level); - /* init framebuffer state */ - memset(&fb, 0, sizeof(fb)); + blit.dst.box.width = u_minify(pt->width0, blit.dst.level); + blit.dst.box.height = u_minify(pt->height0, blit.dst.level); - /* set min/mag to same filter for faster sw speed */ - ctx->sampler.mag_img_filter = filter; - ctx->sampler.min_img_filter = filter; - - for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { - const uint srcLevel = dstLevel - 1; - struct pipe_viewport_state vp; - unsigned nr_layers, layer, i; - float rcoord = 0.0f; - - if (pt->target == PIPE_TEXTURE_3D) - nr_layers = u_minify(pt->depth0, dstLevel); - else if (pt->target == PIPE_TEXTURE_2D_ARRAY || - pt->target == PIPE_TEXTURE_1D_ARRAY || - pt->target == PIPE_TEXTURE_CUBE_ARRAY) - nr_layers = pt->array_size; - else - nr_layers = 1; - - for (i = 0; i < nr_layers; i++) { - struct pipe_surface *surf, surf_templ; - if (pt->target == PIPE_TEXTURE_3D) { - /* in theory with geom shaders and driver with full layer support - could do that in one go. */ - layer = i; - /* XXX hmm really? */ - rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2); - } else if (pt->target == PIPE_TEXTURE_2D_ARRAY || - pt->target == PIPE_TEXTURE_1D_ARRAY) { - layer = i; - rcoord = (float)layer; - } else if (pt->target == PIPE_TEXTURE_CUBE_ARRAY) { - layer = i; - face = layer % 6; - rcoord = layer / 6; - } else - layer = face; - - u_surface_default_template(&surf_templ, pt); - surf_templ.u.tex.level = dstLevel; - surf_templ.u.tex.first_layer = layer; - surf_templ.u.tex.last_layer = layer; - surf = pipe->create_surface(pipe, pt, &surf_templ); - - /* - * Setup framebuffer / dest surface - */ - if (is_depth) { - fb.nr_cbufs = 0; - fb.zsbuf = surf; - } - else { - fb.nr_cbufs = 1; - fb.cbufs[0] = surf; - } - fb.width = u_minify(pt->width0, dstLevel); - fb.height = u_minify(pt->height0, dstLevel); - cso_set_framebuffer(ctx->cso, &fb); - - /* viewport */ - vp.scale[0] = 0.5f * fb.width; - vp.scale[1] = 0.5f * fb.height; - vp.scale[2] = 1.0f; - vp.scale[3] = 1.0f; - vp.translate[0] = 0.5f * fb.width; - vp.translate[1] = 0.5f * fb.height; - vp.translate[2] = 0.0f; - vp.translate[3] = 0.0f; - cso_set_viewport(ctx->cso, &vp); - - /* - * Setup sampler state - * Note: we should only have to set the min/max LOD clamps to ensure - * we grab texels from the right mipmap level. But some hardware - * has trouble with min clamping so we also set the lod_bias to - * try to work around that. - */ - ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel; - ctx->sampler.lod_bias = (float) srcLevel; - cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); - cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT); - - cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv); - - /* quad coords in clip coords */ - offset = set_vertex_data(ctx, - pt->target, - face, - rcoord); - - util_draw_vertex_buffer(ctx->pipe, - ctx->cso, - ctx->vbuf, - cso_get_aux_vertex_buffer_slot(ctx->cso), - offset, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - 2); /* attribs/vert */ - - /* need to signal that the texture has changed _after_ rendering to it */ - pipe_surface_reference( &surf, NULL ); + if (pt->target == PIPE_TEXTURE_3D) { + /* generate all layers/slices at once */ + blit.src.box.z = blit.dst.box.z = 0; + blit.src.box.depth = util_max_layer(pt, blit.src.level)+1; + blit.dst.box.depth = util_max_layer(pt, blit.dst.level)+1; + } + else { + blit.src.box.z = blit.dst.box.z = first_layer; + blit.src.box.depth = blit.dst.box.depth = + (last_layer + 1 - first_layer); } - } - /* restore state we changed */ - cso_restore_blend(ctx->cso); - cso_restore_depth_stencil_alpha(ctx->cso); - cso_restore_rasterizer(ctx->cso); - cso_restore_sample_mask(ctx->cso); - cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); - cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); - cso_restore_framebuffer(ctx->cso); - cso_restore_fragment_shader(ctx->cso); - cso_restore_vertex_shader(ctx->cso); - cso_restore_geometry_shader(ctx->cso); - cso_restore_viewport(ctx->cso); - cso_restore_vertex_elements(ctx->cso); - cso_restore_stream_outputs(ctx->cso); - cso_restore_aux_vertex_buffer_slot(ctx->cso); - cso_restore_render_condition(ctx->cso); + pipe->blit(pipe, &blit); + } + return TRUE; } diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h index ffeff425e..99d017888 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h @@ -35,26 +35,13 @@ extern "C" { #endif - -struct pipe_context; -struct pipe_resource; -struct cso_context; - -struct gen_mipmap_state; - - -extern struct gen_mipmap_state * -util_create_gen_mipmap(struct pipe_context *pipe, struct cso_context *cso); - - -extern void -util_destroy_gen_mipmap(struct gen_mipmap_state *ctx); +struct pipe_context; -extern void -util_gen_mipmap(struct gen_mipmap_state *ctx, - struct pipe_sampler_view *psv, - uint layer, uint baseLevel, uint lastLevel, uint filter); +extern boolean +util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt, + enum pipe_format format, uint base_level, uint last_level, + uint first_layer, uint last_layer, uint filter); #ifdef __cplusplus diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index ae70b003c..6b136f518 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -217,6 +217,13 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ir_rvalue *do_hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool needs_rvalue); + virtual void print(void) const; enum ast_operators oper; @@ -287,6 +294,9 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + private: /** * Is this function call actually a constructor? @@ -359,6 +369,9 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); }; /** diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 8f6e90174..717dc68ea 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -56,6 +56,9 @@ #include "glsl_types.h" #include "program/hash_table.h" #include "ir.h" +#include "ir_builder.h" + +using namespace ir_builder; static void detect_conflicting_assignments(struct _mesa_glsl_parse_state *state, @@ -733,10 +736,12 @@ mark_whole_array_access(ir_rvalue *access) } } -ir_rvalue * +static bool do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, const char *non_lvalue_description, - ir_rvalue *lhs, ir_rvalue *rhs, bool is_initializer, + ir_rvalue *lhs, ir_rvalue *rhs, + ir_rvalue **out_rvalue, bool needs_rvalue, + bool is_initializer, YYLTYPE lhs_loc) { void *ctx = state; @@ -855,27 +860,33 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, * to handle things like: * * i = j += 1; - * - * So we always just store the computed value being assigned to a - * temporary and return a deref of that temporary. If the rvalue - * ends up not being used, the temp will get copy-propagated out. */ - ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp", - ir_var_temporary); - ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var); - instructions->push_tail(var); - instructions->push_tail(new(ctx) ir_assignment(deref_var, rhs)); - deref_var = new(ctx) ir_dereference_variable(var); + if (needs_rvalue) { + ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp", + ir_var_temporary); + instructions->push_tail(var); + instructions->push_tail(assign(var, rhs)); + + if (!error_emitted) { + ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var); + instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var)); + } + ir_rvalue *rvalue = new(ctx) ir_dereference_variable(var); - if (!error_emitted) - instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var)); + if (extract_channel) { + rvalue = new(ctx) ir_expression(ir_binop_vector_extract, + rvalue, + extract_channel->clone(ctx, NULL)); + } - if (extract_channel) { - return new(ctx) ir_expression(ir_binop_vector_extract, - new(ctx) ir_dereference_variable(var), - extract_channel->clone(ctx, NULL)); + *out_rvalue = rvalue; + } else { + if (!error_emitted) + instructions->push_tail(new(ctx) ir_assignment(lhs, rhs)); + *out_rvalue = NULL; } - return new(ctx) ir_dereference_variable(var); + + return error_emitted; } static ir_rvalue * @@ -906,6 +917,20 @@ ast_node::hir(exec_list *instructions, return NULL; } +void +ast_function_expression::hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + (void)hir(instructions, state); +} + +void +ast_aggregate_initializer::hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + (void)hir(instructions, state); +} + static ir_rvalue * do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1) { @@ -1075,6 +1100,21 @@ ir_rvalue * ast_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { + return do_hir(instructions, state, true); +} + +void +ast_expression::hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + do_hir(instructions, state, false); +} + +ir_rvalue * +ast_expression::do_hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool needs_rvalue) +{ void *ctx = state; static const int operations[AST_NUM_OPERATORS] = { -1, /* ast_assign doesn't convert to ir_expression. */ @@ -1148,11 +1188,11 @@ ast_expression::hir(exec_list *instructions, op[0] = this->subexpressions[0]->hir(instructions, state); op[1] = this->subexpressions[1]->hir(instructions, state); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0], op[1], false, - this->subexpressions[0]->get_location()); - error_emitted = result->type->is_error(); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0], op[1], &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); break; } @@ -1418,11 +1458,12 @@ ast_expression::hir(exec_list *instructions, ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); - error_emitted = (op[0]->type->is_error()); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); /* GLSL 1.10 does not allow array assignment. However, we don't have to * explicitly test for this because none of the binary expression @@ -1444,11 +1485,12 @@ ast_expression::hir(exec_list *instructions, temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); - error_emitted = type->is_error(); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); break; } @@ -1460,11 +1502,12 @@ ast_expression::hir(exec_list *instructions, &loc); ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); - error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); break; } @@ -1477,11 +1520,12 @@ ast_expression::hir(exec_list *instructions, state, &loc); ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); - error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); break; } @@ -1589,11 +1633,12 @@ ast_expression::hir(exec_list *instructions, temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); - result = do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); - error_emitted = op[0]->type->is_error(); + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &result, needs_rvalue, false, + this->subexpressions[0]->get_location()); break; } @@ -1617,12 +1662,14 @@ ast_expression::hir(exec_list *instructions, */ result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL)); - (void)do_assignment(instructions, state, - this->subexpressions[0]->non_lvalue_description, - op[0]->clone(ctx, NULL), temp_rhs, false, - this->subexpressions[0]->get_location()); + ir_rvalue *junk_rvalue; + error_emitted = + do_assignment(instructions, state, + this->subexpressions[0]->non_lvalue_description, + op[0]->clone(ctx, NULL), temp_rhs, + &junk_rvalue, false, false, + this->subexpressions[0]->get_location()); - error_emitted = op[0]->type->is_error(); break; } @@ -1744,9 +1791,9 @@ ast_expression::hir(exec_list *instructions, } } type = NULL; /* use result->type, not type. */ - assert(result != NULL); + assert(result != NULL || !needs_rvalue); - if (result->type->is_error() && !error_emitted) + if (result && result->type->is_error() && !error_emitted) _mesa_glsl_error(& loc, state, "type mismatch"); return result; @@ -1767,7 +1814,7 @@ ast_expression_statement::hir(exec_list *instructions, * anything in that case. */ if (expression != NULL) - expression->hir(instructions, state); + expression->hir_no_rvalue(instructions, state); /* Statements do not have r-values. */ @@ -2831,10 +2878,12 @@ process_initializer(ir_variable *var, ast_declaration *decl, */ const glsl_type *initializer_type; if (!type->qualifier.flags.q.uniform) { - result = do_assignment(initializer_instructions, state, - NULL, - lhs, rhs, true, - type->get_location()); + do_assignment(initializer_instructions, state, + NULL, + lhs, rhs, + &result, true, + true, + type->get_location()); initializer_type = result->type; } else initializer_type = rhs->type; @@ -5267,12 +5316,19 @@ ast_interface_block::hir(exec_list *instructions, earlier->reinit_interface_type(block_type); delete var; } else { + /* Propagate the "binding" keyword into this UBO's fields; + * the UBO declaration itself doesn't get an ir_variable unless it + * has an instance name. This is ugly. + */ + var->data.explicit_binding = this->layout.flags.q.explicit_binding; + var->data.binding = this->layout.binding; + state->symbols->add_variable(var); instructions->push_tail(var); } } else { /* In order to have an array size, the block must also be declared with - * an instane name. + * an instance name. */ assert(this->array_specifier == NULL); diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 61ae62150..03c2a972a 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -66,10 +66,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->translation_unit.make_empty(); this->symbols = new(mem_ctx) glsl_symbol_table; - this->num_uniform_blocks = 0; - this->uniform_block_array_size = 0; - this->uniform_blocks = NULL; - this->info_log = ralloc_strdup(mem_ctx, ""); this->error = false; this->loop_nesting_ast = NULL; @@ -1448,7 +1444,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times */ - while (do_common_optimization(shader->ir, false, false, 32, options)) + while (do_common_optimization(shader->ir, false, false, options, + ctx->Const.NativeIntegers)) ; validate_ir_tree(shader->ir); @@ -1464,12 +1461,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader->IsES = state->es_shader; shader->uses_builtin_functions = state->uses_builtin_functions; - if (shader->UniformBlocks) - ralloc_free(shader->UniformBlocks); - shader->NumUniformBlocks = state->num_uniform_blocks; - shader->UniformBlocks = state->uniform_blocks; - ralloc_steal(shader, shader->UniformBlocks); - if (!state->error) set_shader_inout_layout(shader, state); @@ -1501,8 +1492,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, - unsigned max_unroll_iterations, - const struct gl_shader_compiler_options *options) + const struct gl_shader_compiler_options *options, + bool native_integers) { GLboolean progress = GL_FALSE; @@ -1538,7 +1529,7 @@ do_common_optimization(exec_list *ir, bool linked, progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_cse(ir) || progress; - progress = do_algebraic(ir) || progress; + progress = do_algebraic(ir, native_integers) || progress; progress = do_lower_jumps(ir) || progress; progress = do_vec_index_to_swizzle(ir) || progress; progress = lower_vector_insert(ir, false) || progress; @@ -1551,7 +1542,7 @@ do_common_optimization(exec_list *ir, bool linked, loop_state *ls = analyze_loop_variables(ir); if (ls->loop_found) { progress = set_loop_controls(ir, ls) || progress; - progress = unroll_loops(ir, ls, max_unroll_iterations) || progress; + progress = unroll_loops(ir, ls, options) || progress; } delete ls; diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 300d90051..3ad205c07 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -175,10 +175,6 @@ struct _mesa_glsl_parse_state { exec_list translation_unit; glsl_symbol_table *symbols; - unsigned num_uniform_blocks; - unsigned uniform_block_array_size; - struct gl_uniform_block *uniform_blocks; - unsigned num_supported_versions; struct { unsigned ver; diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index a41eddfcb..1a18b47f7 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -1223,6 +1223,15 @@ ir_constant::is_basis() const return ones == 1; } +bool +ir_constant::is_uint16_constant() const +{ + if (!type->is_integer()) + return false; + + return value.u[0] < (1 << 16); +} + ir_loop::ir_loop() { this->ir_type = ir_type_loop; diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index ee276d2be..6c7c60a27 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -265,6 +265,13 @@ public: */ virtual bool is_basis() const; + /** + * Determine if an r-value is an unsigned integer constant which can be + * stored in 16 bits. + * + * \sa ir_constant::is_uint16_constant. + */ + virtual bool is_uint16_constant() const { return false; } /** * Return a generic value of error_type. @@ -2165,6 +2172,14 @@ public: virtual bool is_basis() const; /** + * Return true for constants that could be stored as 16-bit unsigned values. + * + * Note that this will return true even for signed integer ir_constants, as + * long as the value is non-negative and fits in 16-bits. + */ + virtual bool is_uint16_constant() const; + + /** * Value of the constant. * * The field used to back the values supplied by the constant is determined diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index 5f4a2f405..40bb61392 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -66,10 +66,10 @@ enum lower_packing_builtins_op { bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, - unsigned max_unroll_iterations, - const struct gl_shader_compiler_options *options); + const struct gl_shader_compiler_options *options, + bool native_integers); -bool do_algebraic(exec_list *instructions); +bool do_algebraic(exec_list *instructions, bool native_integers); bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 527acea4c..71defc815 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -381,6 +381,9 @@ ir_validate::visit_leave(ir_expression *ir) case ir_binop_min: case ir_binop_max: case ir_binop_pow: + assert(ir->operands[0]->type->base_type == + ir->operands[1]->type->base_type); + if (ir->operands[0]->type->is_scalar()) assert(ir->operands[1]->type == ir->type); else if (ir->operands[1]->type->is_scalar()) diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp index f2f46a211..d19ce20c7 100644 --- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp +++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp @@ -46,6 +46,14 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var) b->type = block_type; b->has_instance_name = var->is_interface_instance(); + if (var->data.explicit_binding) { + b->has_binding = true; + b->binding = var->data.binding; + } else { + b->has_binding = false; + b->binding = 0; + } + _mesa_hash_table_insert(ht, h, var->get_interface_type()->name, (void *) b); return b; diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.h b/mesalib/src/glsl/link_uniform_block_active_visitor.h index fba628a8f..d76dbcaf1 100644 --- a/mesalib/src/glsl/link_uniform_block_active_visitor.h +++ b/mesalib/src/glsl/link_uniform_block_active_visitor.h @@ -36,7 +36,10 @@ struct link_uniform_block_active { unsigned *array_elements; unsigned num_array_elements; + unsigned binding; + bool has_instance_name; + bool has_binding; }; class link_uniform_block_active_visitor : public ir_hierarchical_visitor { diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp index 72d6c5323..1a0e64318 100644 --- a/mesalib/src/glsl/link_uniform_blocks.cpp +++ b/mesalib/src/glsl/link_uniform_blocks.cpp @@ -251,7 +251,17 @@ link_uniform_blocks(void *mem_ctx, blocks[i].Name = ralloc_asprintf(blocks, "%s[%u]", name, b->array_elements[j]); blocks[i].Uniforms = &variables[parcel.index]; - blocks[i].Binding = 0; + + /* The GL_ARB_shading_language_420pack spec says: + * + * "If the binding identifier is used with a uniform block + * instanced as an array then the first element of the array + * takes the specified block binding and each subsequent + * element takes the next consecutive uniform block binding + * point." + */ + blocks[i].Binding = (b->has_binding) ? b->binding + j : 0; + blocks[i].UniformBufferSize = 0; blocks[i]._Packing = gl_uniform_block_packing(block_type->interface_packing); @@ -269,7 +279,7 @@ link_uniform_blocks(void *mem_ctx, } else { blocks[i].Name = ralloc_strdup(blocks, block_type->name); blocks[i].Uniforms = &variables[parcel.index]; - blocks[i].Binding = 0; + blocks[i].Binding = (b->has_binding) ? b->binding : 0; blocks[i].UniformBufferSize = 0; blocks[i]._Packing = gl_uniform_block_packing(block_type->interface_packing); diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp index 9d6977d57..e60bb64bc 100644 --- a/mesalib/src/glsl/link_uniform_initializers.cpp +++ b/mesalib/src/glsl/link_uniform_initializers.cpp @@ -46,6 +46,18 @@ get_storage(gl_uniform_storage *storage, unsigned num_storage, return NULL; } +static unsigned +get_uniform_block_index(const gl_shader_program *shProg, + const char *uniformBlockName) +{ + for (unsigned i = 0; i < shProg->NumUniformBlocks; i++) { + if (!strcmp(shProg->UniformBlocks[i].Name, uniformBlockName)) + return i; + } + + return GL_INVALID_INDEX; +} + void copy_constant_to_storage(union gl_constant_value *storage, const ir_constant *val, @@ -84,8 +96,7 @@ copy_constant_to_storage(union gl_constant_value *storage, } void -set_uniform_binding(void *mem_ctx, gl_shader_program *prog, - const char *name, const glsl_type *type, int binding) +set_sampler_binding(gl_shader_program *prog, const char *name, int binding) { struct gl_uniform_storage *const storage = get_storage(prog->UniformStorage, prog->NumUserUniformStorage, name); @@ -95,42 +106,53 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog, return; } - if (storage->type->is_sampler()) { - unsigned elements = MAX2(storage->array_elements, 1); + const unsigned elements = MAX2(storage->array_elements, 1); - /* From section 4.4.4 of the GLSL 4.20 specification: - * "If the binding identifier is used with an array, the first element - * of the array takes the specified unit and each subsequent element - * takes the next consecutive unit." - */ - for (unsigned int i = 0; i < elements; i++) { - storage->storage[i].i = binding + i; - } + /* Section 4.4.4 (Opaque-Uniform Layout Qualifiers) of the GLSL 4.20 spec + * says: + * + * "If the binding identifier is used with an array, the first element + * of the array takes the specified unit and each subsequent element + * takes the next consecutive unit." + */ + for (unsigned int i = 0; i < elements; i++) { + storage->storage[i].i = binding + i; + } - for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) { - gl_shader *shader = prog->_LinkedShaders[sh]; + for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) { + gl_shader *shader = prog->_LinkedShaders[sh]; - if (shader && storage->sampler[sh].active) { - for (unsigned i = 0; i < elements; i++) { - unsigned index = storage->sampler[sh].index + i; + if (shader && storage->sampler[sh].active) { + for (unsigned i = 0; i < elements; i++) { + unsigned index = storage->sampler[sh].index + i; - shader->SamplerUnits[index] = storage->storage[i].i; - } + shader->SamplerUnits[index] = storage->storage[i].i; } } - } else if (storage->block_index != -1) { + } + + storage->initialized = true; +} + +void +set_block_binding(gl_shader_program *prog, const char *block_name, int binding) +{ + const unsigned block_index = get_uniform_block_index(prog, block_name); + + if (block_index == GL_INVALID_INDEX) { + assert(block_index != GL_INVALID_INDEX); + return; + } + /* This is a field of a UBO. val is the binding index. */ for (int i = 0; i < MESA_SHADER_STAGES; i++) { - int stage_index = prog->UniformBlockStageIndex[i][storage->block_index]; + int stage_index = prog->UniformBlockStageIndex[i][block_index]; if (stage_index != -1) { struct gl_shader *sh = prog->_LinkedShaders[i]; sh->UniformBlocks[stage_index].Binding = binding; } } - } - - storage->initialized = true; } void @@ -232,8 +254,51 @@ link_set_uniform_initializers(struct gl_shader_program *prog) mem_ctx = ralloc_context(NULL); if (var->data.explicit_binding) { - linker::set_uniform_binding(mem_ctx, prog, var->name, - var->type, var->data.binding); + const glsl_type *const type = var->type; + + if (type->is_sampler() + || (type->is_array() && type->fields.array->is_sampler())) { + linker::set_sampler_binding(prog, var->name, var->data.binding); + } else if (var->is_in_uniform_block()) { + const glsl_type *const iface_type = var->get_interface_type(); + + /* If the variable is an array and it is an interface instance, + * we need to set the binding for each array element. Just + * checking that the variable is an array is not sufficient. + * The variable could be an array element of a uniform block + * that lacks an instance name. For example: + * + * uniform U { + * float f[4]; + * }; + * + * In this case "f" would pass is_in_uniform_block (above) and + * type->is_array(), but it will fail is_interface_instance(). + */ + if (var->is_interface_instance() && var->type->is_array()) { + for (unsigned i = 0; i < var->type->length; i++) { + const char *name = + ralloc_asprintf(mem_ctx, "%s[%u]", iface_type->name, i); + + /* Section 4.4.3 (Uniform Block Layout Qualifiers) of the + * GLSL 4.20 spec says: + * + * "If the binding identifier is used with a uniform + * block instanced as an array then the first element + * of the array takes the specified block binding and + * each subsequent element takes the next consecutive + * uniform block binding point." + */ + linker::set_block_binding(prog, name, + var->data.binding + i); + } + } else { + linker::set_block_binding(prog, iface_type->name, + var->data.binding); + } + } else { + assert(!"Explicit binding not on a sampler or UBO."); + } } else if (var->constant_value) { linker::set_uniform_initializer(mem_ctx, prog, var->name, var->type, var->constant_value); diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 3bf278965..c8dc0661d 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -2296,9 +2296,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) lower_clip_distance(prog->_LinkedShaders[i]); } - unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations; - - while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i])) + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, + &ctx->ShaderCompilerOptions[i], + ctx->Const.NativeIntegers)) ; } diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h index f841042f0..295dc797c 100644 --- a/mesalib/src/glsl/loop_analysis.h +++ b/mesalib/src/glsl/loop_analysis.h @@ -53,7 +53,8 @@ set_loop_controls(exec_list *instructions, loop_state *ls); extern bool -unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations); +unroll_loops(exec_list *instructions, loop_state *ls, + const struct gl_shader_compiler_options *options); ir_rvalue * find_initial_value(ir_loop *loop, ir_variable *var); diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp index 789655ebd..da532804a 100644 --- a/mesalib/src/glsl/loop_unroll.cpp +++ b/mesalib/src/glsl/loop_unroll.cpp @@ -25,15 +25,18 @@ #include "loop_analysis.h" #include "ir_hierarchical_visitor.h" +#include "main/mtypes.h" + namespace { class loop_unroll_visitor : public ir_hierarchical_visitor { public: - loop_unroll_visitor(loop_state *state, unsigned max_iterations) + loop_unroll_visitor(loop_state *state, + const struct gl_shader_compiler_options *options) { this->state = state; this->progress = false; - this->max_iterations = max_iterations; + this->options = options; } virtual ir_visitor_status visit_leave(ir_loop *ir); @@ -45,7 +48,7 @@ public: loop_state *state; bool progress; - unsigned max_iterations; + const struct gl_shader_compiler_options *options; }; } /* anonymous namespace */ @@ -60,12 +63,17 @@ is_break(ir_instruction *ir) class loop_unroll_count : public ir_hierarchical_visitor { public: int nodes; - bool fail; + bool unsupported_variable_indexing; + /* If there are nested loops, the node count will be inaccurate. */ + bool nested_loop; - loop_unroll_count(exec_list *list) + loop_unroll_count(exec_list *list, loop_variable_state *ls, + const struct gl_shader_compiler_options *options) + : ls(ls), options(options) { nodes = 0; - fail = false; + nested_loop = false; + unsupported_variable_indexing = false; run(list); } @@ -84,9 +92,57 @@ public: virtual ir_visitor_status visit_enter(ir_loop *) { - fail = true; + nested_loop = true; + return visit_continue; + } + + virtual ir_visitor_status visit_enter(ir_dereference_array *ir) + { + /* Check for arrays variably-indexed by a loop induction variable. + * Unrolling the loop may convert that access into constant-indexing. + * + * Many drivers don't support particular kinds of variable indexing, + * and have to resort to using lower_variable_index_to_cond_assign to + * handle it. This results in huge amounts of horrible code, so we'd + * like to avoid that if possible. Here, we just note that it will + * happen. + */ + if ((ir->array->type->is_array() || ir->array->type->is_matrix()) && + !ir->array_index->as_constant()) { + ir_variable *array = ir->array->variable_referenced(); + loop_variable *lv = ls->get(ir->array_index->variable_referenced()); + if (array && lv && lv->is_induction_var()) { + switch (array->data.mode) { + case ir_var_auto: + case ir_var_temporary: + case ir_var_const_in: + case ir_var_function_in: + case ir_var_function_out: + case ir_var_function_inout: + if (options->EmitNoIndirectTemp) + unsupported_variable_indexing = true; + break; + case ir_var_uniform: + if (options->EmitNoIndirectUniform) + unsupported_variable_indexing = true; + break; + case ir_var_shader_in: + if (options->EmitNoIndirectInput) + unsupported_variable_indexing = true; + break; + case ir_var_shader_out: + if (options->EmitNoIndirectOutput) + unsupported_variable_indexing = true; + break; + } + } + } return visit_continue; } + +private: + loop_variable_state *ls; + const struct gl_shader_compiler_options *options; }; @@ -244,16 +300,21 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) iterations = ls->limiting_terminator->iterations; + const int max_iterations = options->MaxUnrollIterations; + /* Don't try to unroll loops that have zillions of iterations either. */ - if (iterations > (int) max_iterations) + if (iterations > max_iterations) return visit_continue; /* Don't try to unroll nested loops and loops with a huge body. */ - loop_unroll_count count(&ir->body_instructions); + loop_unroll_count count(&ir->body_instructions, ls, options); + + bool loop_too_large = + count.nested_loop || count.nodes * iterations > max_iterations * 5; - if (count.fail || count.nodes * iterations > (int)max_iterations * 5) + if (loop_too_large && !count.unsupported_variable_indexing) return visit_continue; /* Note: the limiting terminator contributes 1 to ls->num_loop_jumps. @@ -338,9 +399,10 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) bool -unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations) +unroll_loops(exec_list *instructions, loop_state *ls, + const struct gl_shader_compiler_options *options) { - loop_unroll_visitor v(ls, max_iterations); + loop_unroll_visitor v(ls, options); v.run(instructions); diff --git a/mesalib/src/glsl/lower_ubo_reference.cpp b/mesalib/src/glsl/lower_ubo_reference.cpp index c73b148b0..90e65bd0e 100644 --- a/mesalib/src/glsl/lower_ubo_reference.cpp +++ b/mesalib/src/glsl/lower_ubo_reference.cpp @@ -194,12 +194,16 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) array_stride = glsl_align(array_stride, 16); } - ir_constant *const_index = deref_array->array_index->as_constant(); + ir_rvalue *array_index = deref_array->array_index; + if (array_index->type->base_type == GLSL_TYPE_INT) + array_index = i2u(array_index); + + ir_constant *const_index = array_index->as_constant(); if (const_index) { - const_offset += array_stride * const_index->value.i[0]; + const_offset += array_stride * const_index->value.u[0]; } else { offset = add(offset, - mul(deref_array->array_index, + mul(array_index, new(mem_ctx) ir_constant(array_stride))); } deref = deref_array->array->as_dereference(); diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 8494bd9ec..9d5539252 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -45,10 +45,11 @@ namespace { class ir_algebraic_visitor : public ir_rvalue_visitor { public: - ir_algebraic_visitor() + ir_algebraic_visitor(bool native_integers) { this->progress = false; this->mem_ctx = NULL; + this->native_integers = native_integers; } virtual ~ir_algebraic_visitor() @@ -70,6 +71,7 @@ public: void *mem_ctx; + bool native_integers; bool progress; }; @@ -445,6 +447,28 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } break; + case ir_binop_less: + case ir_binop_lequal: + case ir_binop_greater: + case ir_binop_gequal: + case ir_binop_equal: + case ir_binop_nequal: + for (int add_pos = 0; add_pos < 2; add_pos++) { + ir_expression *add = op_expr[add_pos]; + + if (!add || add->operation != ir_binop_add) + continue; + + ir_constant *zero = op_const[1 - add_pos]; + if (!is_vec_zero(zero)) + continue; + + return new(mem_ctx) ir_expression(ir->operation, + add->operands[0], + neg(add->operands[1])); + } + break; + case ir_binop_rshift: case ir_binop_lshift: /* 0 >> x == 0 */ @@ -623,9 +647,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue) } bool -do_algebraic(exec_list *instructions) +do_algebraic(exec_list *instructions, bool native_integers) { - ir_algebraic_visitor v; + ir_algebraic_visitor v(native_integers); visit_list_elements(&v, instructions); diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp index f3bd580af..d47613c21 100644 --- a/mesalib/src/glsl/opt_tree_grafting.cpp +++ b/mesalib/src/glsl/opt_tree_grafting.cpp @@ -127,12 +127,12 @@ ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue) return false; if (debug) { - printf("GRAFTING:\n"); - this->graft_assign->print(); - printf("\n"); - printf("TO:\n"); - (*rvalue)->print(); - printf("\n"); + fprintf(stderr, "GRAFTING:\n"); + this->graft_assign->fprint(stderr); + fprintf(stderr, "\n"); + fprintf(stderr, "TO:\n"); + (*rvalue)->fprint(stderr); + fprintf(stderr, "\n"); } this->graft_assign->remove(); @@ -164,9 +164,9 @@ ir_tree_grafting_visitor::check_graft(ir_instruction *ir, ir_variable *var) { if (dereferences_variable(this->graft_assign->rhs, var)) { if (debug) { - printf("graft killed by: "); - ir->print(); - printf("\n"); + fprintf(stderr, "graft killed by: "); + ir->fprint(stderr); + fprintf(stderr, "\n"); } return visit_stop; } @@ -316,9 +316,9 @@ try_tree_grafting(ir_assignment *start, ir_tree_grafting_visitor v(start, lhs_var); if (debug) { - printf("trying to graft: "); - lhs_var->print(); - printf("\n"); + fprintf(stderr, "trying to graft: "); + lhs_var->fprint(stderr); + fprintf(stderr, "\n"); } for (ir_instruction *ir = (ir_instruction *)start->next; @@ -326,9 +326,9 @@ try_tree_grafting(ir_assignment *start, ir = (ir_instruction *)ir->next) { if (debug) { - printf("- "); - ir->print(); - printf("\n"); + fprintf(stderr, "- "); + ir->fprint(stderr); + fprintf(stderr, "\n"); } ir_visitor_status s = ir->accept(&v); diff --git a/mesalib/src/glsl/opt_vectorize.cpp b/mesalib/src/glsl/opt_vectorize.cpp index 3306397fd..f9a3b6183 100644 --- a/mesalib/src/glsl/opt_vectorize.cpp +++ b/mesalib/src/glsl/opt_vectorize.cpp @@ -260,6 +260,7 @@ ir_vectorize_visitor::visit_enter(ir_assignment *ir) if (ir->condition || this->channels >= 4 || !single_channel_write_mask(ir->write_mask) || + this->assignment[write_mask_to_swizzle(ir->write_mask)] != NULL || (lhs && !ir->lhs->equals(lhs)) || (rhs && !ir->rhs->equals(rhs, ir_type_swizzle))) { try_vectorize(); diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp index f1b9579cd..db5cb2662 100644 --- a/mesalib/src/glsl/test_optpass.cpp +++ b/mesalib/src/glsl/test_optpass.cpp @@ -62,11 +62,10 @@ do_optimization(struct exec_list *ir, const char *optimization, int int_3; int int_4; - if (sscanf(optimization, "do_common_optimization ( %d , %d ) ", - &int_0, &int_1) == 2) { - return do_common_optimization(ir, int_0 != 0, false, int_1, options); + if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) { + return do_common_optimization(ir, int_0 != 0, false, options, true); } else if (strcmp(optimization, "do_algebraic") == 0) { - return do_algebraic(ir); + return do_algebraic(ir, true); } else if (strcmp(optimization, "do_constant_folding") == 0) { return do_constant_folding(ir); } else if (strcmp(optimization, "do_constant_variable") == 0) { diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c index e343f4a57..666d0158a 100644 --- a/mesalib/src/loader/loader.c +++ b/mesalib/src/loader/loader.c @@ -202,7 +202,7 @@ out: return (*chip_id >= 0); } -#elif defined(ANDROID) && !defined(__NOT_HAVE_DRM_H) +#elif !defined(__NOT_HAVE_DRM_H) /* for i915 */ #include <i915_drm.h> @@ -219,12 +219,12 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id) version = drmGetVersion(fd); if (!version) { log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd\n"); - return FALSE; + return 0; } if (!version->name) { log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name\n"); drmFreeVersion(version); - return FALSE; + return 0; } if (strcmp(version->name, "i915") == 0) { diff --git a/mesalib/src/mapi/Makefile.sources b/mesalib/src/mapi/Makefile.sources index aff465a60..37ca4842c 100644 --- a/mesalib/src/mapi/Makefile.sources +++ b/mesalib/src/mapi/Makefile.sources @@ -15,22 +15,37 @@ # this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined. MAPI_UTIL_FILES = \ + $(TOP)/src/mapi/u_compiler.h \ $(TOP)/src/mapi/u_current.c \ - $(TOP)/src/mapi/u_execmem.c + $(TOP)/src/mapi/u_current.h \ + $(TOP)/src/mapi/u_execmem.c \ + $(TOP)/src/mapi/u_execmem.h \ + $(TOP)/src/mapi/u_macros.h \ + $(TOP)/src/mapi/u_thread.h -MAPI_FILES = \ +MAPI_BRIDGE_FILES = \ $(TOP)/src/mapi/entry.c \ + $(TOP)/src/mapi/entry.h \ + $(TOP)/src/mapi/entry_x86-64_tls.h \ + $(TOP)/src/mapi/entry_x86_tls.h \ + $(TOP)/src/mapi/entry_x86_tsd.h \ + $(TOP)/src/mapi/mapi_tmp.h + +MAPI_FILES = \ $(TOP)/src/mapi/mapi.c \ + $(TOP)/src/mapi/mapi.h \ $(TOP)/src/mapi/stub.c \ + $(TOP)/src/mapi/stub.h \ $(TOP)/src/mapi/table.c \ + $(TOP)/src/mapi/table.h \ $(MAPI_UTIL_FILES) MAPI_GLAPI_FILES = \ $(TOP)/src/mapi/entry.c \ $(TOP)/src/mapi/mapi_glapi.c \ $(TOP)/src/mapi/stub.c \ + $(TOP)/src/mapi/stub.h \ $(TOP)/src/mapi/table.c \ + $(TOP)/src/mapi/table.h \ $(MAPI_UTIL_FILES) -MAPI_BRIDGE_FILES = \ - $(TOP)/src/mapi/entry.c diff --git a/mesalib/src/mapi/glapi/Makefile.sources b/mesalib/src/mapi/glapi/Makefile.sources index 100e6347e..04fef6c9e 100644 --- a/mesalib/src/mapi/glapi/Makefile.sources +++ b/mesalib/src/mapi/glapi/Makefile.sources @@ -6,7 +6,9 @@ GLAPI_SOURCES = \ glapi_gentable.c \ glapi_getproc.c \ glapi_nop.c \ - glapi.c + glapi.c \ + glapi.h \ + glapi_priv.h X86_API = \ glapi_x86.S diff --git a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml index 80234ea5e..d006917af 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml @@ -15,69 +15,69 @@ <enum name="ALL_SHADER_BITS" value="0xFFFFFFFF"/> <enum name="PROGRAM_SEPARABLE" value="0x8258"/> - <function name="UseProgramStages" offset="assign"> + <function name="UseProgramStages" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> <param name="stages" type="GLbitfield" /> <param name="program" type="GLuint" /> </function> - <function name="ActiveShaderProgram" offset="assign"> + <function name="ActiveShaderProgram" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> <param name="program" type="GLuint" /> </function> - <function name="CreateShaderProgramv" offset="assign"> + <function name="CreateShaderProgramv" offset="assign" static_dispatch="false"> <param name="type" type="GLenum" /> <param name="count" type="GLsizei" /> <param name="strings" type="const GLchar * const *" /> <return type="GLuint"/> </function> - <function name="BindProgramPipeline" offset="assign"> + <function name="BindProgramPipeline" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> </function> - <function name="DeleteProgramPipelines" offset="assign"> + <function name="DeleteProgramPipelines" offset="assign" static_dispatch="false"> <param name="n" type="GLsizei" /> <param name="pipelines" type="const GLuint *" /> </function> - <function name="GenProgramPipelines" offset="assign"> + <function name="GenProgramPipelines" offset="assign" static_dispatch="false"> <param name="n" type="GLsizei" /> <param name="pipelines" type="GLuint *" /> </function> - <function name="IsProgramPipeline" offset="assign"> + <function name="IsProgramPipeline" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> <return type="GLboolean"/> </function> <!-- Function already included on ARB_get_program_binary.xml. Keep a commented version here for completeness --> <!-- - <function name="ProgramParameteri" offset="assign" es2="3.0"> + <function name="ProgramParameteri" offset="assign" es2="3.0" static_dispatch="false"> <param name="program" type="GLuint"/> <param name="pname" type="GLenum"/> <param name="value" type="GLint"/> </function> --> - <function name="GetProgramPipelineiv" offset="assign"> + <function name="GetProgramPipelineiv" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> <param name="pname" type="GLenum" /> <param name="params" type="GLint *" /> </function> - <function name="ProgramUniform1i" offset="assign"> + <function name="ProgramUniform1i" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLint" /> </function> - <function name="ProgramUniform2i" offset="assign"> + <function name="ProgramUniform2i" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLint" /> <param name="y" type="GLint" /> </function> - <function name="ProgramUniform3i" offset="assign"> + <function name="ProgramUniform3i" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLint" /> <param name="y" type="GLint" /> <param name="z" type="GLint" /> </function> - <function name="ProgramUniform4i" offset="assign"> + <function name="ProgramUniform4i" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLint" /> @@ -85,25 +85,25 @@ <param name="z" type="GLint" /> <param name="w" type="GLint" /> </function> - <function name="ProgramUniform1ui" offset="assign"> + <function name="ProgramUniform1ui" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLuint" /> </function> - <function name="ProgramUniform2ui" offset="assign"> + <function name="ProgramUniform2ui" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLuint" /> <param name="y" type="GLuint" /> </function> - <function name="ProgramUniform3ui" offset="assign"> + <function name="ProgramUniform3ui" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLuint" /> <param name="y" type="GLuint" /> <param name="z" type="GLuint" /> </function> - <function name="ProgramUniform4ui" offset="assign"> + <function name="ProgramUniform4ui" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLuint" /> @@ -111,25 +111,25 @@ <param name="z" type="GLuint" /> <param name="w" type="GLuint" /> </function> - <function name="ProgramUniform1f" offset="assign"> + <function name="ProgramUniform1f" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLfloat" /> </function> - <function name="ProgramUniform2f" offset="assign"> + <function name="ProgramUniform2f" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLfloat" /> <param name="y" type="GLfloat" /> </function> - <function name="ProgramUniform3f" offset="assign"> + <function name="ProgramUniform3f" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLfloat" /> <param name="y" type="GLfloat" /> <param name="z" type="GLfloat" /> </function> - <function name="ProgramUniform4f" offset="assign"> + <function name="ProgramUniform4f" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLfloat" /> @@ -137,145 +137,145 @@ <param name="z" type="GLfloat" /> <param name="w" type="GLfloat" /> </function> - <function name="ProgramUniform1iv" offset="assign"> + <function name="ProgramUniform1iv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLint *" /> </function> - <function name="ProgramUniform2iv" offset="assign"> + <function name="ProgramUniform2iv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLint *" /> </function> - <function name="ProgramUniform3iv" offset="assign"> + <function name="ProgramUniform3iv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLint *" /> </function> - <function name="ProgramUniform4iv" offset="assign"> + <function name="ProgramUniform4iv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLint *" /> </function> - <function name="ProgramUniform1uiv" offset="assign"> + <function name="ProgramUniform1uiv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLuint *" /> </function> - <function name="ProgramUniform2uiv" offset="assign"> + <function name="ProgramUniform2uiv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLuint *" /> </function> - <function name="ProgramUniform3uiv" offset="assign"> + <function name="ProgramUniform3uiv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLuint *" /> </function> - <function name="ProgramUniform4uiv" offset="assign"> + <function name="ProgramUniform4uiv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLuint *" /> </function> - <function name="ProgramUniform1fv" offset="assign"> + <function name="ProgramUniform1fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniform2fv" offset="assign"> + <function name="ProgramUniform2fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniform3fv" offset="assign"> + <function name="ProgramUniform3fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniform4fv" offset="assign"> + <function name="ProgramUniform4fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix2fv" offset="assign"> + <function name="ProgramUniformMatrix2fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix3fv" offset="assign"> + <function name="ProgramUniformMatrix3fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix4fv" offset="assign"> + <function name="ProgramUniformMatrix4fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix2x3fv" offset="assign"> + <function name="ProgramUniformMatrix2x3fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix3x2fv" offset="assign"> + <function name="ProgramUniformMatrix3x2fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix2x4fv" offset="assign"> + <function name="ProgramUniformMatrix2x4fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix4x2fv" offset="assign"> + <function name="ProgramUniformMatrix4x2fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix3x4fv" offset="assign"> + <function name="ProgramUniformMatrix3x4fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ProgramUniformMatrix4x3fv" offset="assign"> + <function name="ProgramUniformMatrix4x3fv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLfloat *" /> </function> - <function name="ValidateProgramPipeline" offset="assign"> + <function name="ValidateProgramPipeline" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> </function> - <function name="GetProgramPipelineInfoLog" offset="assign"> + <function name="GetProgramPipelineInfoLog" offset="assign" static_dispatch="false"> <param name="pipeline" type="GLuint" /> <param name="bufSize" type="GLsizei" /> <param name="length" type="GLsizei *" /> @@ -283,25 +283,25 @@ </function> <!-- depends on GL_ARB_gpu_shader_fp64 - <function name="ProgramUniform1d" offset="assign"> + <function name="ProgramUniform1d" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLdouble" /> </function> - <function name="ProgramUniform2d" offset="assign"> + <function name="ProgramUniform2d" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLdouble" /> <param name="y" type="GLdouble" /> </function> - <function name="ProgramUniform3d" offset="assign"> + <function name="ProgramUniform3d" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLdouble" /> <param name="y" type="GLdouble" /> <param name="z" type="GLdouble" /> </function> - <function name="ProgramUniform4d" offset="assign"> + <function name="ProgramUniform4d" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="x" type="GLdouble" /> @@ -309,88 +309,88 @@ <param name="z" type="GLdouble" /> <param name="w" type="GLdouble" /> </function> - <function name="ProgramUniformMatrix2x3dv" offset="assign"> + <function name="ProgramUniformMatrix2x3dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix3x2dv" offset="assign"> + <function name="ProgramUniformMatrix3x2dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix2x4dv" offset="assign"> + <function name="ProgramUniformMatrix2x4dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix4x2dv" offset="assign"> + <function name="ProgramUniformMatrix4x2dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix3x4dv" offset="assign"> + <function name="ProgramUniformMatrix3x4dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix4x3dv" offset="assign"> + <function name="ProgramUniformMatrix4x3dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix2dv" offset="assign"> + <function name="ProgramUniformMatrix2dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix3dv" offset="assign"> + <function name="ProgramUniformMatrix3dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniformMatrix4dv" offset="assign"> + <function name="ProgramUniformMatrix4dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="transpose" type="GLboolean" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniform1dv" offset="assign"> + <function name="ProgramUniform1dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniform2dv" offset="assign"> + <function name="ProgramUniform2dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniform3dv" offset="assign"> + <function name="ProgramUniform3dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> <param name="value" type="const GLdouble *" /> </function> - <function name="ProgramUniform4dv" offset="assign"> + <function name="ProgramUniform4dv" offset="assign" static_dispatch="false"> <param name="program" type="GLuint" /> <param name="location" type="GLint" /> <param name="count" type="GLsizei" /> diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 7b3c118f0..6b932e73f 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -59,7 +59,26 @@ EXTRA_DIST= \ $(BUILT_SOURCES) \ $(MESA_GLAPI_DIR)/glapi_x86.S \ $(MESA_GLAPI_DIR)/glapi_x86-64.S \ - $(MESA_GLAPI_DIR)/glapi_sparc.S + $(MESA_GLAPI_DIR)/glapi_sparc.S \ + $(COMMON_GLX) \ + extension_helper.py \ + gl_apitemp.py \ + gl_enums.py \ + gl_genexec.py \ + gl_gentable.py \ + gl_offsets.py \ + gl_procs.py \ + gl_SPARC_asm.py \ + gl_table.py \ + gl_x86-64_asm.py \ + gl_x86_asm.py \ + glX_proto_recv.py \ + glX_proto_send.py \ + glX_proto_size.py \ + glX_server_table.py \ + mesadef.py \ + remap_helper.py \ + gl_API.dtd ###################################################################### @@ -88,8 +107,11 @@ XORG_OUTPUTS = \ API_XML = \ gl_API.xml \ + es_EXT.xml \ + gl_and_es_API.xml \ ARB_base_instance.xml \ ARB_blend_func_extended.xml \ + ARB_clear_buffer_object.xml \ ARB_color_buffer_float.xml \ ARB_compute_shader.xml \ ARB_copy_buffer.xml \ @@ -105,6 +127,8 @@ API_XML = \ ARB_ES3_compatibility.xml \ ARB_framebuffer_object.xml \ ARB_geometry_shader4.xml \ + ARB_get_program_binary.xml \ + ARB_gpu_shader5.xml \ ARB_instanced_arrays.xml \ ARB_internalformat_query.xml \ ARB_invalidate_subdata.xml \ @@ -129,6 +153,7 @@ API_XML = \ ARB_texture_storage_multisample.xml \ ARB_texture_storage.xml \ ARB_texture_view.xml \ + ARB_uniform_buffer_object.xml \ ARB_vertex_array_object.xml \ ARB_vertex_attrib_binding.xml \ ARB_viewport_array.xml \ @@ -137,7 +162,6 @@ API_XML = \ ARB_vertex_type_2_10_10_10_rev.xml \ APPLE_object_purgeable.xml \ APPLE_vertex_array_object.xml \ - ARB_uniform_buffer_object.xml \ EXT_draw_buffers2.xml \ EXT_framebuffer_object.xml \ EXT_gpu_shader4.xml \ @@ -147,28 +171,22 @@ API_XML = \ EXT_texture_array.xml \ EXT_texture_integer.xml \ EXT_transform_feedback.xml \ + KHR_debug.xml \ NV_conditional_render.xml \ NV_primitive_restart.xml \ NV_texture_barrier.xml \ NV_vdpau_interop.xml \ OES_EGL_image.xml \ + OES_fixed_point.xml \ + OES_single_precision.xml \ GL3x.xml \ GL4x.xml - - COMMON = $(API_XML) \ gl_XML.py \ glX_XML.py \ license.py \ - typeexpr.py \ - gl_and_es_API.xml \ - es_EXT.xml \ - ARB_ES2_compatibility.xml \ - ARB_ES3_compatibility.xml \ - ARB_get_program_binary.xml \ - OES_fixed_point.xml \ - OES_single_precision.xml + typeexpr.py COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py @@ -208,7 +226,7 @@ $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON) --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ + $(PYTHON_GEN) $< -c -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/SConscript b/mesalib/src/mapi/glapi/gen/SConscript index e4abe906a..b9cdbbf36 100644 --- a/mesalib/src/mapi/glapi/gen/SConscript +++ b/mesalib/src/mapi/glapi/gen/SConscript @@ -38,7 +38,7 @@ env.CodeGenerate( target = '../../../mapi/glapi/glprocs.h', script = 'gl_procs.py', source = sources, - command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + command = python_cmd + ' $SCRIPT -c -f $SOURCE > $TARGET' ) env.CodeGenerate( diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml index f412333df..e2dc39021 100644 --- a/mesalib/src/mapi/glapi/gen/es_EXT.xml +++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml @@ -343,7 +343,7 @@ <enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/> <function name="PointSizePointerOES" offset="assign" - static_dispatch="false" es1="1.0" desktop="false"> + static_dispatch="true" es1="1.0" desktop="false"> <param name="type" type="GLenum"/> <param name="stride" type="GLsizei"/> <param name="pointer" type="const GLvoid *"/> diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 9129d5790..9200cd68d 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -5403,13 +5403,11 @@ <param name="index" type="GLuint"/> <param name="name" type="const GLchar *"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="CompileShader" es2="2.0" offset="assign"> <param name="shader" type="GLuint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="CreateProgram" offset="assign" es2="2.0"> @@ -5461,7 +5459,6 @@ <param name="type" type="GLenum *" output="true"/> <param name="name" type="GLchar *" output="true"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetActiveUniform" es2="2.0" offset="assign"> @@ -5473,7 +5470,6 @@ <param name="type" type="GLenum *" output="true"/> <param name="name" type="GLchar *" output="true"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetAttachedShaders" offset="assign" es2="2.0"> @@ -5489,7 +5485,6 @@ <param name="name" type="const GLchar *"/> <return type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetProgramiv" offset="assign" es2="2.0"> @@ -5528,7 +5523,6 @@ <param name="length" type="GLsizei *" output="true"/> <param name="source" type="GLchar *" output="true"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetUniformLocation" @@ -5537,7 +5531,6 @@ <param name="name" type="const GLchar *"/> <return type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetUniformfv" es2="2.0" offset="assign"> @@ -5545,7 +5538,6 @@ <param name="location" type="GLint"/> <param name="params" type="GLfloat *" output="true"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetUniformiv" es2="2.0" offset="assign"> @@ -5553,7 +5545,6 @@ <param name="location" type="GLint"/> <param name="params" type="GLint *" output="true"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="GetVertexAttribdv" offset="assign"> @@ -5604,7 +5595,6 @@ <function name="LinkProgram" es2="2.0" offset="assign"> <param name="program" type="GLuint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="ShaderSource" es2="2.0" offset="assign"> @@ -5613,27 +5603,23 @@ <param name="string" type="const GLchar * const *"/> <param name="length" type="const GLint *"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="UseProgram" es2="2.0" offset="assign"> <param name="program" type="GLuint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform1f" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="v0" type="GLfloat"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform2f" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="v0" type="GLfloat"/> <param name="v1" type="GLfloat"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform3f" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5641,7 +5627,6 @@ <param name="v1" type="GLfloat"/> <param name="v2" type="GLfloat"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform4f" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5650,21 +5635,18 @@ <param name="v2" type="GLfloat"/> <param name="v3" type="GLfloat"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform1i" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="v0" type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform2i" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="v0" type="GLint"/> <param name="v1" type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform3i" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5672,7 +5654,6 @@ <param name="v1" type="GLint"/> <param name="v2" type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform4i" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5681,7 +5662,6 @@ <param name="v2" type="GLint"/> <param name="v3" type="GLint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform1fv" es2="2.0" offset="assign"> @@ -5689,28 +5669,24 @@ <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLfloat *" count="count"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform2fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLfloat *" count="count" count_scale="2"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform3fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLfloat *" count="count" count_scale="3"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform4fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLfloat *" count="count" count_scale="4"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform1iv" es2="2.0" offset="assign"> @@ -5718,28 +5694,24 @@ <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLint *" count="count"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform2iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLint *" count="count" count_scale="2"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform3iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLint *" count="count" count_scale="3"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="Uniform4iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> <param name="count" type="GLsizei" counter="true"/> <param name="value" type="const GLint *" count="count" count_scale="4"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="UniformMatrix2fv" es2="2.0" offset="assign"> @@ -5748,7 +5720,6 @@ <param name="transpose" type="GLboolean"/> <param name="value" type="const GLfloat *" count="count" count_scale="4"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="UniformMatrix3fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5756,7 +5727,6 @@ <param name="transpose" type="GLboolean"/> <param name="value" type="const GLfloat *" count="count" count_scale="9"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="UniformMatrix4fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> @@ -5764,13 +5734,11 @@ <param name="transpose" type="GLboolean"/> <param name="value" type="const GLfloat *" count="count" count_scale="16"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="ValidateProgram" es2="2.0" offset="assign"> <param name="program" type="GLuint"/> <glx ignore="true"/> - <glx ignore="true"/> </function> <function name="VertexAttrib1d" offset="assign"> diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml index 18b0eb4ec..d158a6b31 100644 --- a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml @@ -18,53 +18,45 @@ <type name="fixed" size="4" /> <type name="clampx" size="4" /> - <function name="AlphaFuncx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="AlphaFuncx" es1="1.0" desktop="false" offset="assign"> <param name="func" type="GLenum"/> <param name="ref" type="GLclampx"/> </function> - <function name="ClearColorx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="ClearColorx" es1="1.0" desktop="false" offset="assign"> <param name="red" type="GLclampx"/> <param name="green" type="GLclampx"/> <param name="blue" type="GLclampx"/> <param name="alpha" type="GLclampx"/> </function> - <function name="ClearDepthx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="ClearDepthx" es1="1.0" desktop="false" offset="assign"> <param name="depth" type="GLclampx"/> </function> - <function name="Color4x" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Color4x" es1="1.0" desktop="false" offset="assign"> <param name="red" type="GLfixed"/> <param name="green" type="GLfixed"/> <param name="blue" type="GLfixed"/> <param name="alpha" type="GLfixed"/> </function> - <function name="DepthRangex" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="DepthRangex" es1="1.0" desktop="false" offset="assign"> <param name="zNear" type="GLclampx"/> <param name="zFar" type="GLclampx"/> </function> - <function name="Fogx" static_dispatch="false" es1="1.0" - desktop="false" offset="assign"> + <function name="Fogx" es1="1.0" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="Fogxv" static_dispatch="false" es1="1.0" - desktop="false" offset="assign"> + <function name="Fogxv" es1="1.0" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> - <function name="Frustumx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Frustumx" es1="1.0" desktop="false" offset="assign"> <param name="left" type="GLfixed"/> <param name="right" type="GLfixed"/> <param name="bottom" type="GLfixed"/> @@ -73,63 +65,53 @@ <param name="zFar" type="GLfixed"/> </function> - <function name="LightModelx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="LightModelx" es1="1.0" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="LightModelxv" - static_dispatch="false" es1="1.0" desktop="false" offset="assign"> + <function name="LightModelxv" es1="1.0" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> - <function name="Lightx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Lightx" es1="1.0" desktop="false" offset="assign"> <param name="light" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="Lightxv" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Lightxv" es1="1.0" desktop="false" offset="assign"> <param name="light" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> - <function name="LineWidthx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="LineWidthx" es1="1.0" desktop="false" offset="assign"> <param name="width" type="GLfixed"/> </function> - <function name="LoadMatrixx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="LoadMatrixx" es1="1.0" desktop="false" offset="assign"> <param name="m" type="const GLfixed *" count="16"/> </function> - <function name="Materialx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Materialx" es1="1.0" desktop="false" offset="assign"> <param name="face" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="Materialxv" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Materialxv" es1="1.0" desktop="false" offset="assign"> <param name="face" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> - <function name="MultMatrixx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="MultMatrixx" es1="1.0" desktop="false" offset="assign"> <param name="m" type="const GLfixed *" count="16"/> </function> - <function name="MultiTexCoord4x" - static_dispatch="false" es1="1.0" desktop="false" offset="assign"> + <function name="MultiTexCoord4x" es1="1.0" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="s" type="GLfixed"/> <param name="t" type="GLfixed"/> @@ -137,15 +119,13 @@ <param name="q" type="GLfixed"/> </function> - <function name="Normal3x" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Normal3x" es1="1.0" desktop="false" offset="assign"> <param name="nx" type="GLfixed"/> <param name="ny" type="GLfixed"/> <param name="nz" type="GLfixed"/> </function> - <function name="Orthox" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Orthox" es1="1.0" desktop="false" offset="assign"> <param name="left" type="GLfixed"/> <param name="right" type="GLfixed"/> <param name="bottom" type="GLfixed"/> @@ -154,69 +134,59 @@ <param name="zFar" type="GLfixed"/> </function> - <function name="PointSizex" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="PointSizex" es1="1.0" desktop="false" offset="assign"> <param name="size" type="GLfixed"/> </function> - <function name="PolygonOffsetx" - static_dispatch="false" es1="1.0" desktop="false" offset="assign"> + <function name="PolygonOffsetx" es1="1.0" desktop="false" offset="assign"> <param name="factor" type="GLfixed"/> <param name="units" type="GLfixed"/> </function> - <function name="Rotatex" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Rotatex" es1="1.0" desktop="false" offset="assign"> <param name="angle" type="GLfixed"/> <param name="x" type="GLfixed"/> <param name="y" type="GLfixed"/> <param name="z" type="GLfixed"/> </function> - <function name="SampleCoveragex" - static_dispatch="false" es1="1.0" desktop="false" offset="assign"> + <function name="SampleCoveragex" es1="1.0" desktop="false" offset="assign"> <param name="value" type="GLclampx"/> <param name="invert" type="GLboolean"/> </function> - <function name="Scalex" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Scalex" es1="1.0" desktop="false" offset="assign"> <param name="x" type="GLfixed"/> <param name="y" type="GLfixed"/> <param name="z" type="GLfixed"/> </function> - <function name="TexEnvx" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="TexEnvx" es1="1.0" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="TexEnvxv" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="TexEnvxv" es1="1.0" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> - <function name="TexParameterx" - static_dispatch="false" es1="1.0" desktop="false" offset="assign"> + <function name="TexParameterx" es1="1.0" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="Translatex" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Translatex" es1="1.0" desktop="false" offset="assign"> <param name="x" type="GLfixed"/> <param name="y" type="GLfixed"/> <param name="z" type="GLfixed"/> </function> <!-- from GL_OES_single_precision --> - <function name="Frustumf" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Frustumf" es1="1.0" desktop="false" offset="assign"> <param name="left" type="GLfloat"/> <param name="right" type="GLfloat"/> <param name="bottom" type="GLfloat"/> @@ -225,8 +195,7 @@ <param name="zFar" type="GLfloat"/> </function> - <function name="Orthof" static_dispatch="false" - es1="1.0" desktop="false" offset="assign"> + <function name="Orthof" es1="1.0" desktop="false" offset="assign"> <param name="left" type="GLfloat"/> <param name="right" type="GLfloat"/> <param name="bottom" type="GLfloat"/> @@ -238,80 +207,68 @@ <category name="es1.1"> <!-- from GL_OES_fixed_point --> - <function name="ClipPlanex" static_dispatch="false" - es1="1.1" desktop="false" offset="assign"> + <function name="ClipPlanex" es1="1.1" desktop="false" offset="assign"> <param name="plane" type="GLenum"/> <param name="equation" type="const GLfixed *" count="4"/> </function> - <function name="GetClipPlanex" - static_dispatch="false" es1="1.1" offset="assign"> + <function name="GetClipPlanex" es1="1.1" offset="assign"> <param name="plane" type="GLenum"/> <param name="equation" type="GLfixed *" output="true" count="4"/> </function> - <function name="GetFixedv" static_dispatch="false" - es1="1.1" desktop="false" offset="assign"> + <function name="GetFixedv" es1="1.1" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="params" type="GLfixed *" output="true" variable_param="pname"/> </function> - <function name="GetLightxv" static_dispatch="false" - es1="1.1" desktop="false" offset="assign"> + <function name="GetLightxv" es1="1.1" desktop="false" offset="assign"> <param name="light" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="GLfixed *" output="true" variable_param="pname"/> </function> - <function name="GetMaterialxv" - static_dispatch="false" es1="1.1" desktop="false" offset="assign"> + <function name="GetMaterialxv" es1="1.1" desktop="false" offset="assign"> <param name="face" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="GLfixed *" output="true" variable_param="pname"/> </function> - <function name="GetTexEnvxv" static_dispatch="false" - es1="1.1" desktop="false" offset="assign"> + <function name="GetTexEnvxv" es1="1.1" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="GLfixed *" output="true" variable_param="pname"/> </function> - <function name="GetTexParameterxv" - static_dispatch="false" es1="1.1" desktop="false" offset="assign"> + <function name="GetTexParameterxv" es1="1.1" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="GLfixed *" output="true" variable_param="pname"/> </function> - <function name="PointParameterx" - static_dispatch="false" es1="1.1" desktop="false" offset="assign"> + <function name="PointParameterx" es1="1.1" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="param" type="GLfixed"/> </function> - <function name="PointParameterxv" - static_dispatch="false" es1="1.1" desktop="false" offset="assign"> + <function name="PointParameterxv" es1="1.1" desktop="false" offset="assign"> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *"/> </function> - <function name="TexParameterxv" - static_dispatch="false" es1="1.1" desktop="false" offset="assign"> + <function name="TexParameterxv" es1="1.1" desktop="false" offset="assign"> <param name="target" type="GLenum"/> <param name="pname" type="GLenum"/> <param name="params" type="const GLfixed *" variable_param="pname"/> </function> <!-- from GL_OES_single_precision --> - <function name="ClipPlanef" static_dispatch="false" - es1="1.1" desktop="false" offset="assign"> + <function name="ClipPlanef" es1="1.1" desktop="false" offset="assign"> <param name="plane" type="GLenum"/> <param name="equation" type="const GLfloat *" count="4"/> </function> - <function name="GetClipPlanef" - static_dispatch="false" es1="1.1" offset="assign"> + <function name="GetClipPlanef" es1="1.1" offset="assign"> <param name="plane" type="GLenum"/> <param name="equation" type="GLfloat *" output="true" count="4"/> </function> diff --git a/mesalib/src/mapi/glapi/gen/gl_procs.py b/mesalib/src/mapi/glapi/gen/gl_procs.py index f139c58ea..b1fffc4ca 100644 --- a/mesalib/src/mapi/glapi/gen/gl_procs.py +++ b/mesalib/src/mapi/glapi/gen/gl_procs.py @@ -30,11 +30,10 @@ import gl_XML, glX_XML import sys, getopt class PrintGlProcs(gl_XML.gl_print_base): - def __init__(self, long_strings, es=False): + def __init__(self, es=False): gl_XML.gl_print_base.__init__(self) self.es = es - self.long_strings = long_strings self.name = "gl_procs.py (from Mesa)" self.license = license.bsd_license_template % ( \ """Copyright (C) 1999-2001 Brian Paul All Rights Reserved. @@ -74,22 +73,11 @@ typedef struct { return def printFunctionString(self, name): - if self.long_strings: - print ' "gl%s\\0"' % (name) - else: - print " 'g','l',", - for c in name: - print "'%s'," % (c), - - print "'\\0'," - + print ' "gl%s\\0"' % (name) def printBody(self, api): print '' - if self.long_strings: - print 'static const char gl_string_table[] =' - else: - print 'static const char gl_string_table[] = {' + print 'static const char gl_string_table[] =' base_offset = 0 table = [] @@ -119,11 +107,7 @@ typedef struct { base_offset += len(n) + 3 - if self.long_strings: - print ' ;' - else: - print '};' - + print ' ;' print '' print '' print "#ifdef USE_MGL_NAMESPACE" @@ -178,38 +162,25 @@ typedef struct { def show_usage(): - print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0] + print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0] print "-c Enable compatibility with OpenGL ES." - print "-m mode mode can be one of:" - print " long - Create code for compilers that can handle very" - print " long string constants. (default)" - print " short - Create code for compilers that can only handle" - print " ANSI C89 string constants." sys.exit(1) if __name__ == '__main__': file_name = "gl_API.xml" try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c") + (args, trail) = getopt.getopt(sys.argv[1:], "f:c") except Exception,e: show_usage() - long_string = 1 es = False for (arg,val) in args: if arg == "-f": file_name = val - elif arg == "-m": - if val == "short": - long_string = 0 - elif val == "long": - long_string = 1 - else: - show_usage() elif arg == "-c": es = True api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) - printer = PrintGlProcs(long_string, es) + printer = PrintGlProcs(es) printer.Print(api) diff --git a/mesalib/src/mapi/mapi_abi.py b/mesalib/src/mapi/mapi_abi.py index f5ff8d843..d783ed32f 100644 --- a/mesalib/src/mapi/mapi_abi.py +++ b/mesalib/src/mapi/mapi_abi.py @@ -744,8 +744,9 @@ class ES1APIPrinter(GLAPIPrinter): def _override_for_api(self, ent): if ent.xml_data is None: raise Exception('ES2 API printer requires XML input') - ent.hidden = ent.name not in \ - ent.xml_data.entry_points_for_api_version('es1') + ent.hidden = (ent.name not in \ + ent.xml_data.entry_points_for_api_version('es1')) \ + or ent.hidden ent.handcode = False def _get_c_header(self): @@ -767,8 +768,17 @@ class ES2APIPrinter(GLAPIPrinter): def _override_for_api(self, ent): if ent.xml_data is None: raise Exception('ES2 API printer requires XML input') - ent.hidden = ent.name not in \ - ent.xml_data.entry_points_for_api_version('es2') + ent.hidden = (ent.name not in \ + ent.xml_data.entry_points_for_api_version('es2')) \ + or ent.hidden + + # This is hella ugly. The same-named function in desktop OpenGL is + # hidden, but it needs to be exposed by libGLESv2 for OpenGL ES 3.0. + # There's no way to express in the XML that a function should be be + # hidden in one API but exposed in another. + if ent.name == 'GetInternalformativ': + ent.hidden = False + ent.handcode = False def _get_c_header(self): diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index f1fee122c..e8076120d 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -9,37 +9,37 @@ SUBDIRS+=common if HAVE_I915_DRI SUBDIRS += i915 MEGADRIVERS_DEPS += i915/libi915_dri.la -MEGADRIVERS += i915_dri.@LIB_EXT@ +MEGADRIVERS += i915_dri.so endif if HAVE_I965_DRI SUBDIRS += i965 MEGADRIVERS_DEPS += i965/libi965_dri.la -MEGADRIVERS += i965_dri.@LIB_EXT@ +MEGADRIVERS += i965_dri.so endif if HAVE_NOUVEAU_DRI SUBDIRS += nouveau MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la -MEGADRIVERS += nouveau_vieux_dri.@LIB_EXT@ +MEGADRIVERS += nouveau_vieux_dri.so endif if HAVE_R200_DRI SUBDIRS += r200 MEGADRIVERS_DEPS += r200/libr200_dri.la -MEGADRIVERS += r200_dri.@LIB_EXT@ +MEGADRIVERS += r200_dri.so endif if HAVE_RADEON_DRI SUBDIRS += radeon MEGADRIVERS_DEPS += radeon/libradeon_dri.la -MEGADRIVERS += radeon_dri.@LIB_EXT@ +MEGADRIVERS += radeon_dri.so endif if HAVE_SWRAST_DRI SUBDIRS += swrast MEGADRIVERS_DEPS += swrast/libswrast_dri.la -MEGADRIVERS += swrast_dri.@LIB_EXT@ +MEGADRIVERS += swrast_dri.so endif pkgconfigdir = $(libdir)/pkgconfig @@ -51,7 +51,7 @@ driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp mesa_dri_drivers_la_SOURCES = mesa_dri_drivers_la_LDFLAGS = \ - -module -avoid-version -shared \ + -module -avoid-version -shared -shrext .so \ -Wl,-Bsymbolic \ $(GC_SECTIONS) \ $() @@ -70,22 +70,22 @@ if HAVE_COMPAT_SYMLINKS # Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree. all-local: mesa_dri_drivers.la $(AM_V_at)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); - $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.@LIB_EXT@ \ - $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@; + $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \ + $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so; $(AM_V_GEN)for i in $(MEGADRIVERS); do \ - ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@ \ + ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \ $(top_builddir)/$(LIB_DIR)/$$i; \ done; endif # hardlink each megadriver instance, but don't actually have -# mesa_dri_drivers.@LIB_EXT@ in the set of final installed files. +# mesa_dri_drivers.so in the set of final installed files. install-data-hook: for i in $(MEGADRIVERS); do \ - ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ \ + ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ + $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la endif diff --git a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c index a8217703d..7b6d13450 100644 --- a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c +++ b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c @@ -31,7 +31,7 @@ * Dl_info, and RTLD_DEFAULT are only defined when _GNU_SOURCE is * defined.) */ -#ifdef _GNU_SOURCE +#ifdef RTLD_DEFAULT #define MEGADRIVER_STUB_MAX_EXTENSIONS 10 #define LIB_PATH_SUFFIX "_dri.so" @@ -148,7 +148,7 @@ megadriver_stub_init(void) } } -#endif /* _GNU_SOURCE */ +#endif /* RTLD_DEFAULT */ static const __DRIconfig **stub_error_init_screen(__DRIscreen *psp) diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 5a626f2f4..c656845df 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -217,7 +217,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head, { void *attribute; - attribute = MALLOC(attr_size); + attribute = malloc(attr_size); if (attribute == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib"); return false; @@ -227,7 +227,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head, memcpy(attribute, attr_data, attr_size); } else { - FREE(attribute); + free(attribute); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib"); return false; } @@ -277,7 +277,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i]; } else { - FREE(attr); + free(attr); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib"); goto end; } @@ -374,7 +374,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->FragmentProgram = ctx->FragmentProgram.Enabled; if (!save_attrib_data(&head, GL_ENABLE_BIT, attr)) { - FREE(attr); + free(attr); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib"); goto end; } @@ -440,7 +440,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->ReadBuffer = ctx->ReadBuffer->ColorReadBuffer; } else { - FREE(attr); + free(attr); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib"); goto end; } @@ -491,7 +491,7 @@ _mesa_PushAttrib(GLbitfield mask) } if (!save_attrib_data(&head, GL_TEXTURE_BIT, texstate)) { - FREE(texstate); + free(texstate); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)"); goto end; } @@ -1626,7 +1626,7 @@ _mesa_PushClientAttrib(GLbitfield mask) } else { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" ); - FREE(attr); + free(attr); goto end; } @@ -1642,7 +1642,7 @@ _mesa_PushClientAttrib(GLbitfield mask) } else { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" ); - FREE(attr); + free(attr); goto end; } } @@ -1656,7 +1656,7 @@ _mesa_PushClientAttrib(GLbitfield mask) } if (!init_array_attrib_data(ctx, attr)) { - FREE(attr); + free(attr); goto end; } @@ -1666,7 +1666,7 @@ _mesa_PushClientAttrib(GLbitfield mask) else { free_array_attrib_data(ctx, attr); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib"); - FREE(attr); + free(attr); /* goto to keep safe from possible later changes */ goto end; } diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 2e9e05918..36acd64ce 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset, * \sa glClearBufferSubData, glClearBufferData and * dd_function_table::ClearBufferSubData. */ -static void +void _mesa_buffer_clear_subdata(struct gl_context *ctx, GLintptr offset, GLsizeiptr size, const GLvoid *clearValue, @@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, if (data == NULL) { /* clear to zeros, per the spec */ ctx->Driver.ClearBufferSubData(ctx, 0, bufObj->Size, - NULL, 0, bufObj); + NULL, clearValueSize, bufObj); return; } @@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat, /* clear to zeros, per the spec */ if (size > 0) { ctx->Driver.ClearBufferSubData(ctx, offset, size, - NULL, 0, bufObj); + NULL, clearValueSize, bufObj); } return; } diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index 9814552eb..c08c4fdf2 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -115,6 +115,13 @@ extern void _mesa_buffer_unmap_all_mappings(struct gl_context *ctx, struct gl_buffer_object *bufObj); +extern void +_mesa_buffer_clear_subdata(struct gl_context *ctx, + GLintptr offset, GLsizeiptr size, + const GLvoid *clearValue, + GLsizeiptr clearValueSize, + struct gl_buffer_object *bufObj); + /* * API functions */ diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c index 63e5870e6..1865a66b9 100644 --- a/mesalib/src/mesa/main/drawpix.c +++ b/mesalib/src/mesa/main/drawpix.c @@ -109,7 +109,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, /* these buffers must exist */ if (!_mesa_dest_buffer_exists(ctx, format)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(missing deest buffer)"); + "glDrawPixels(missing dest buffer)"); goto end; } break; diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 9151718ea..d80fda0db 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -980,7 +980,7 @@ _mesa_free_errors_data(struct gl_context *ctx) for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) { free_errors_data(ctx, i); } - FREE(ctx->Debug); + free(ctx->Debug); /* set to NULL just in case it is used before context is completely gone. */ ctx->Debug = NULL; } diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 1d2ad604b..66c18fa16 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -1344,7 +1344,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key) const struct gl_shader_compiler_options *options = &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; - while (do_common_optimization(p.shader->ir, false, false, 32, options)) + while (do_common_optimization(p.shader->ir, false, false, options, + ctx->Const.NativeIntegers)) ; reparent_ir(p.shader->ir, p.shader->ir); diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 2ef2e31d6..cf96609ea 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -645,7 +645,7 @@ unpack_R10G10B10A2_UINT(const void *src, GLfloat dst[][4], GLuint n) static void -unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n) +unpack_S8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -662,7 +662,7 @@ unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z24_UNORM_S8_UINT(const void *src, GLfloat dst[][4], GLuint n) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -679,7 +679,7 @@ unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_Z16(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -692,19 +692,19 @@ unpack_Z16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_X8_Z24(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z24_UNORM_X8_UINT(const void *src, GLfloat dst[][4], GLuint n) { - unpack_S8_Z24(src, dst, n); + unpack_Z24_UNORM_S8_UINT(src, dst, n); } static void -unpack_Z24_X8(const void *src, GLfloat dst[][4], GLuint n) +unpack_X8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n) { - unpack_Z24_S8(src, dst, n); + unpack_S8_UINT_Z24_UNORM(src, dst, n); } static void -unpack_Z32(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z_UNORM32(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -717,7 +717,7 @@ unpack_Z32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z32_FLOAT_S8X24_UINT(const void *src, GLfloat dst[][4], GLuint n) { const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; GLuint i; @@ -730,7 +730,7 @@ unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = ((const GLfloat *) src); GLuint i; @@ -2391,12 +2391,12 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_B10G10R10A2_UNORM; table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_B10G10R10A2_UINT; table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_R10G10B10A2_UINT; - table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8; - table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24; - table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; - table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24; - table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_Z24_X8; - table[MESA_FORMAT_Z_UNORM32] = unpack_Z32; + table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_S8_UINT_Z24_UNORM; + table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_Z24_UNORM_S8_UINT; + table[MESA_FORMAT_Z_UNORM16] = unpack_Z_UNORM16; + table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_Z24_UNORM_X8_UINT; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_X8_UINT_Z24_UNORM; + table[MESA_FORMAT_Z_UNORM32] = unpack_Z_UNORM32; table[MESA_FORMAT_S_UINT8] = unpack_S8; table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8; table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB; @@ -2533,8 +2533,8 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_R9G9B9E5_FLOAT; table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11G11B10_FLOAT; - table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT; - table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8; + table[MESA_FORMAT_Z_FLOAT32] = unpack_Z_FLOAT32; + table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_S8X24_UINT; table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM; table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM; @@ -3935,7 +3935,7 @@ _mesa_unpack_rgba_block(mesa_format format, typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst); static void -unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst) +unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -3949,7 +3949,7 @@ unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst) } static void -unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst) +unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -3983,7 +3983,7 @@ unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst) } static void -unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_FLOAT32(GLuint n, const void *src, GLfloat *dst) { memcpy(dst, src, n * sizeof(float)); } @@ -4013,11 +4013,11 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: - unpack = unpack_float_z_Z24_X8; + unpack = unpack_float_z_X8_UINT_Z24_UNORM; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: - unpack = unpack_float_z_X8_Z24; + unpack = unpack_float_z_Z24_UNORM_X8_UINT; break; case MESA_FORMAT_Z_UNORM16: unpack = unpack_float_Z_UNORM16; @@ -4026,7 +4026,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, unpack = unpack_float_Z_UNORM32; break; case MESA_FORMAT_Z_FLOAT32: - unpack = unpack_float_z_Z32F; + unpack = unpack_float_Z_FLOAT32; break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: unpack = unpack_float_z_Z32X24S8; @@ -4045,7 +4045,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n); static void -unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n) +unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, GLuint *dst, GLuint n) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -4056,7 +4056,7 @@ unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n) } static void -unpack_uint_z_X8_Z24(const void *src, GLuint *dst, GLuint n) +unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, GLuint *dst, GLuint n) { /* only return Z, not stencil data */ const GLuint *s = ((const GLuint *) src); @@ -4118,11 +4118,11 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: - unpack = unpack_uint_z_Z24_X8; + unpack = unpack_uint_z_X8_UINT_Z24_UNORM; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: - unpack = unpack_uint_z_X8_Z24; + unpack = unpack_uint_z_Z24_UNORM_X8_UINT; break; case MESA_FORMAT_Z_UNORM16: unpack = unpack_uint_Z_UNORM16; @@ -4147,13 +4147,13 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, static void -unpack_ubyte_s_S8(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_S_UINT8(const void *src, GLubyte *dst, GLuint n) { memcpy(dst, src, n); } static void -unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, GLubyte *dst, GLuint n) { GLuint i; const GLuint *src32 = src; @@ -4163,7 +4163,7 @@ unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n) } static void -unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, GLubyte *dst, GLuint n) { GLuint i; const GLuint *src32 = src; @@ -4173,7 +4173,7 @@ unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n) } static void -unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n) { GLuint i; const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; @@ -4188,16 +4188,16 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S_UINT8: - unpack_ubyte_s_S8(src, dst, n); + unpack_ubyte_s_S_UINT8(src, dst, n); break; case MESA_FORMAT_S8_UINT_Z24_UNORM: - unpack_ubyte_s_Z24_S8(src, dst, n); + unpack_ubyte_s_S8_UINT_Z24_UNORM(src, dst, n); break; case MESA_FORMAT_Z24_UNORM_S8_UINT: - unpack_ubyte_s_S8_Z24(src, dst, n); + unpack_ubyte_s_Z24_UNORM_S8_UINT(src, dst, n); break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: - unpack_ubyte_s_Z32_FLOAT_X24S8(src, dst, n); + unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(src, dst, n); break; default: _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row", @@ -4207,7 +4207,7 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, } static void -unpack_uint_24_8_depth_stencil_S8_Z24(const GLuint *src, GLuint *dst, GLuint n) +unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const GLuint *src, GLuint *dst, GLuint n) { GLuint i; @@ -4233,7 +4233,7 @@ unpack_uint_24_8_depth_stencil_Z32_S8X24(const GLuint *src, } static void -unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint *src, GLuint *dst, GLuint n) +unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, GLuint n) { memcpy(dst, src, n * 4); } @@ -4248,10 +4248,10 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - unpack_uint_24_8_depth_stencil_Z24_S8(src, dst, n); + unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(src, dst, n); break; case MESA_FORMAT_Z24_UNORM_S8_UINT: - unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n); + unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(src, dst, n); break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: unpack_uint_24_8_depth_stencil_Z32_S8X24(src, dst, n); diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 9e221cccb..17a9bd099 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -49,16 +49,10 @@ extern "C" { /** Memory macros */ /*@{*/ -/** Allocate \p BYTES bytes */ -#define MALLOC(BYTES) malloc(BYTES) -/** Allocate and zero \p BYTES bytes */ -#define CALLOC(BYTES) calloc(1, BYTES) /** Allocate a structure of type \p T */ #define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T)) /** Allocate and zero a structure of type \p T */ #define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T)) -/** Free memory */ -#define FREE(PTR) free(PTR) /*@}*/ diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index dafeaa372..5228c3a8f 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -685,6 +685,17 @@ minify(unsigned value, unsigned levels) } /** + * Return true if the given value is a power of two. + * + * Note that this considers 0 a power of two. + */ +static inline bool +is_power_of_two(unsigned value) +{ + return (value & (value - 1)) == 0; +} + +/** * Align a value up to an alignment value * * If \c value is not already aligned to the requested alignment value, it diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 33cb88881..4d014d1ee 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2421,8 +2421,7 @@ struct gl_shader /** * This shader's uniform block information. * - * The offsets of the variables are assigned only for shaders in a program's - * _LinkedShaders[]. + * These fields are only set post-linking. */ struct gl_uniform_block *UniformBlocks; unsigned NumUniformBlocks; @@ -3472,6 +3471,8 @@ struct gl_constants /** GL_ARB_gpu_shader5 */ GLfloat MinFragmentInterpolationOffset; GLfloat MaxFragmentInterpolationOffset; + + GLboolean FakeSWMSAA; }; diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index d976e5aae..1df656832 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -1489,72 +1489,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], switch (dstFormat) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(luminance[i]); + dst[i] = FLOAT_TO_BYTE_TEX(luminance[i]); break; case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*2+0] = FLOAT_TO_BYTE_TEX(luminance[i]); + dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]); } break; case GL_RG: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); + dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); } break; case GL_RED_INTEGER_EXT: @@ -1631,8 +1631,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], case GL_DUDV_ATI: case GL_DU8DV8_ATI: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]); + dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]); } break; default: @@ -1803,72 +1803,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], switch (dstFormat) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(luminance[i]); + dst[i] = FLOAT_TO_SHORT_TEX(luminance[i]); break; case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*2+0] = FLOAT_TO_SHORT_TEX(luminance[i]); + dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]); } break; case GL_RG: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); + dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); } break; case GL_RED_INTEGER_EXT: @@ -1945,8 +1945,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], case GL_DUDV_ATI: case GL_DU8DV8_ATI: for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]); + dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]); } break; default: diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp index e1afe5315..f66c11733 100644 --- a/mesalib/src/mesa/main/shader_query.cpp +++ b/mesalib/src/mesa/main/shader_query.cpp @@ -76,6 +76,30 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index, */ } +static bool +is_active_attrib(const ir_variable *var) +{ + if (!var) + return false; + + switch (var->data.mode) { + case ir_var_shader_in: + return var->data.location != -1; + + case ir_var_system_value: + /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes): + * "For GetActiveAttrib, all active vertex shader input variables + * are enumerated, including the special built-in inputs gl_VertexID + * and gl_InstanceID." + */ + return !strcmp(var->name, "gl_VertexID") || + !strcmp(var->name, "gl_InstanceID"); + + default: + return false; + } +} + void GLAPIENTRY _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index, GLsizei maxLength, GLsizei * length, GLint * size, @@ -105,10 +129,8 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index, foreach_list(node, ir) { const ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if (var == NULL - || var->data.mode != ir_var_shader_in - || var->data.location == -1) - continue; + if (!is_active_attrib(var)) + continue; if (current_index == desired_index) { _mesa_copy_string(name, maxLength, length, var->name); @@ -196,10 +218,8 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg) foreach_list(node, ir) { const ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if (var == NULL - || var->data.mode != ir_var_shader_in - || var->data.location == -1) - continue; + if (!is_active_attrib(var)) + continue; i++; } diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c index cbda68940..ae973b001 100644 --- a/mesalib/src/mesa/main/texcompress_etc.c +++ b/mesalib/src/mesa/main/texcompress_etc.c @@ -678,14 +678,25 @@ etc2_unpack_rgb8(uint8_t *dst_row, for (y = 0; y < height; y += bh) { const uint8_t *src = src_row; + /* + * Destination texture may not be a multiple of four texels in + * height. Compute a safe height to avoid writing outside the texture. + */ + const unsigned h = MIN2(bh, height - y); for (x = 0; x < width; x+= bw) { + /* + * Destination texture may not be a multiple of four texels in + * width. Compute a safe width to avoid writing outside the texture. + */ + const unsigned w = MIN2(bw, width - x); + etc2_rgb8_parse_block(&block, src, false /* punchthrough_alpha */); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, false /* punchthrough_alpha */); dst[3] = 255; @@ -715,14 +726,17 @@ etc2_unpack_srgb8(uint8_t *dst_row, for (y = 0; y < height; y += bh) { const uint8_t *src = src_row; + const unsigned h = MIN2(bh, height - y); for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_rgb8_parse_block(&block, src, false /* punchthrough_alpha */); - for (j = 0; j < bh; j++) { + + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, false /* punchthrough_alpha */); /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ @@ -759,13 +773,15 @@ etc2_unpack_rgba8(uint8_t *dst_row, for (y = 0; y < height; y += bh) { const uint8_t *src = src_row; + const unsigned h = MIN2(bh, height - y); for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_rgba8_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgba8_fetch_texel(&block, i, j, dst); dst += comps; } @@ -795,14 +811,16 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row, uint8_t tmp; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_rgba8_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgba8_fetch_texel(&block, i, j, dst); /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ @@ -837,14 +855,16 @@ etc2_unpack_r11(uint8_t *dst_row, unsigned x, y, i, j; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_r11_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_r11_fetch_texel(&block, i, j, dst); dst += comps * comp_size; } @@ -872,16 +892,18 @@ etc2_unpack_rg11(uint8_t *dst_row, unsigned x, y, i, j; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); /* red component */ etc2_r11_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_r11_fetch_texel(&block, i, j, dst); dst += comps * comp_size; } @@ -889,10 +911,10 @@ etc2_unpack_rg11(uint8_t *dst_row, /* green component */ etc2_r11_parse_block(&block, src + 8); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_r11_fetch_texel(&block, i, j, dst + comp_size); dst += comps * comp_size; } @@ -920,15 +942,17 @@ etc2_unpack_signed_r11(uint8_t *dst_row, unsigned x, y, i, j; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_r11_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_signed_r11_fetch_texel(&block, i, j, dst); dst += comps * comp_size; } @@ -956,16 +980,18 @@ etc2_unpack_signed_rg11(uint8_t *dst_row, unsigned x, y, i, j; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); /* red component */ etc2_r11_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_signed_r11_fetch_texel(&block, i, j, dst); dst += comps * comp_size; } @@ -973,10 +999,10 @@ etc2_unpack_signed_rg11(uint8_t *dst_row, /* green component */ etc2_r11_parse_block(&block, src + 8); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_signed_r11_fetch_texel(&block, i, j, dst + comp_size); dst += comps * comp_size; } @@ -1001,14 +1027,16 @@ etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row, unsigned x, y, i, j; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_rgb8_parse_block(&block, src, true /* punchthrough_alpha */); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, true /* punchthrough_alpha */); dst += comps; @@ -1036,14 +1064,16 @@ etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row, uint8_t tmp; for (y = 0; y < height; y += bh) { + const unsigned h = MIN2(bh, height - y); const uint8_t *src = src_row; for (x = 0; x < width; x+= bw) { + const unsigned w = MIN2(bw, width - x); etc2_rgb8_parse_block(&block, src, true /* punchthrough_alpha */); - for (j = 0; j < bh; j++) { + for (j = 0; j < h; j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < w; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, true /* punchthrough_alpha */); /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 004e7ebac..d43480482 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -76,11 +76,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, } else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM); } - RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); - RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); - break; + /* fallthrough */ case GL_RGBA8: + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -97,6 +96,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, /* deep RGBA formats */ case GL_RGB10_A2: + RETURN_IF_SUPPORTED(MESA_FORMAT_R10G10B10A2_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -116,6 +116,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, } /* fallthrough */ case GL_RGB8: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); @@ -451,10 +455,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_RGB_SNORM: case GL_RGB8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SNORM); - /* FALLTHROUGH */ + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + break; case GL_RGBA_SNORM: case GL_RGBA8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; @@ -522,11 +530,17 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_SRGB_EXT: case GL_SRGB8_EXT: + /* there is no MESA_FORMAT_RGB_SRGB8 */ + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 8bdbb08c8..918dd59ed 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -559,6 +559,13 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, /* 'q' in the GL spec */ maxLevels - 1); + if (t->Immutable) { + /* Adjust max level for views: the data store may have more levels than + * the view exposes. + */ + t->_MaxLevel = MIN2(t->_MaxLevel, t->NumLevels - 1); + } + /* Compute _MaxLambda = q - p in the spec used during mipmapping */ t->_MaxLambda = (GLfloat) (t->_MaxLevel - baseLevel); diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index bfb2e1b9f..40790ff0e 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -352,7 +352,8 @@ set_tex_parameteri(struct gl_context *ctx, if (texObj->MaxLevel == params[0]) return GL_FALSE; - if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) { + if (params[0] < 0 || + (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] > 0)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param=%d)", params[0]); return GL_FALSE; diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index fe3b07256..d9096abf3 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -3263,20 +3263,7 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_R8G8B8X8_SRGB || dstFormat == MESA_FORMAT_R8G8B8A8_SRGB); - /* reuse normal rgba texstore code */ - if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) { - newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM; - } - else if (dstFormat == MESA_FORMAT_R8G8B8A8_SRGB) { - newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM; - } - else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) { - newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM; - } - else { - ASSERT(0); - return GL_TRUE; - } + newDstFormat = _mesa_get_srgb_format_linear(dstFormat); k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, @@ -3294,17 +3281,10 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) mesa_format newDstFormat; GLboolean k; - switch (dstFormat) { - case MESA_FORMAT_B8G8R8A8_SRGB: - newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM; - break; - case MESA_FORMAT_B8G8R8X8_SRGB: - newDstFormat = MESA_FORMAT_B8G8R8X8_UNORM; - break; - default: - ASSERT(0); - return GL_FALSE; - } + assert(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB || + dstFormat == MESA_FORMAT_B8G8R8X8_SRGB); + + newDstFormat = _mesa_get_srgb_format_linear(dstFormat); k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, newDstFormat, diff --git a/mesalib/src/mesa/main/vdpau.c b/mesalib/src/mesa/main/vdpau.c index c2cf20664..d97459393 100644 --- a/mesalib/src/mesa/main/vdpau.c +++ b/mesalib/src/mesa/main/vdpau.c @@ -88,7 +88,7 @@ unregister_surface(struct set_entry *entry) } _mesa_set_remove(ctx->vdpSurfaces, entry); - FREE(surf); + free(surf); } void GLAPIENTRY @@ -145,7 +145,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, if (tex->Immutable) { _mesa_unlock_texture(ctx, tex); - FREE(surf); + free(surf); _mesa_error(ctx, GL_INVALID_OPERATION, "VDPAURegisterSurfaceNV(texture is immutable)"); return (GLintptr)NULL; @@ -155,7 +155,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, tex->Target = target; else if (tex->Target != target) { _mesa_unlock_texture(ctx, tex); - FREE(surf); + free(surf); _mesa_error(ctx, GL_INVALID_OPERATION, "VDPAURegisterSurfaceNV(target mismatch)"); return (GLintptr)NULL; @@ -254,7 +254,7 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface) } _mesa_set_remove(ctx->vdpSurfaces, entry); - FREE(surf); + free(surf); } void GLAPIENTRY diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 1c0bedf4b..b7cc50fc1 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -228,7 +228,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.EXT_texture_sRGB); const GLboolean ver_3_0 = (ver_2_1 && ctx->Const.GLSLVersion >= 130 && - ctx->Const.MaxSamples >= 4 && + (ctx->Const.MaxSamples >= 4 || ctx->Const.FakeSWMSAA) && (ctx->API == API_OPENGL_CORE || ctx->Extensions.ARB_color_buffer_float) && ctx->Extensions.ARB_depth_buffer_float && diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 0923357b1..59cf1232a 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -3007,8 +3007,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; progress = do_common_optimization(ir, true, true, - options->MaxUnrollIterations, - options) + options, ctx->Const.NativeIntegers) || progress; progress = lower_quadop_vector(ir, true) || progress; diff --git a/mesalib/src/mesa/program/prog_noise.c b/mesalib/src/mesa/program/prog_noise.c index c258c5e2e..ac920c23f 100644 --- a/mesalib/src/mesa/program/prog_noise.c +++ b/mesalib/src/mesa/program/prog_noise.c @@ -257,12 +257,12 @@ _mesa_noise2(GLfloat x, GLfloat y) float y0 = y - Y0; float x1, y1, x2, y2; - int ii, jj; + unsigned int ii, jj; float t0, t1, t2; /* For the 2D case, the simplex shape is an equilateral triangle. */ /* Determine which simplex we are in. */ - int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */ + unsigned int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */ if (x0 > y0) { i1 = 1; j1 = 0; @@ -282,8 +282,8 @@ _mesa_noise2(GLfloat x, GLfloat y) y2 = y0 - 1.0f + 2.0f * G2; /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; + ii = i & 0xff; + jj = j & 0xff; /* Calculate the contribution from the three corners */ t0 = 0.5f - x0 * x0 - y0 * y0; @@ -344,13 +344,13 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z) float z0 = z - Z0; float x1, y1, z1, x2, y2, z2, x3, y3, z3; - int ii, jj, kk; + unsigned int ii, jj, kk; float t0, t1, t2, t3; /* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */ /* Determine which simplex we are in. */ - int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */ - int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */ + unsigned int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */ + unsigned int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */ /* This code would benefit from a backport from the GLSL version! */ if (x0 >= y0) { @@ -423,9 +423,9 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z) z3 = z0 - 1.0f + 3.0f * G3; /* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; - kk = k % 256; + ii = i & 0xff; + jj = j & 0xff; + kk = k & 0xff; /* Calculate the contribution from the four corners */ t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0; @@ -522,12 +522,12 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w) int c6 = (z0 > w0) ? 1 : 0; int c = c1 + c2 + c3 + c4 + c5 + c6; - int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */ - int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */ - int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */ + unsigned int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */ + unsigned int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */ + unsigned int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */ float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4; - int ii, jj, kk, ll; + unsigned int ii, jj, kk, ll; float t0, t1, t2, t3, t4; /* @@ -573,10 +573,10 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w) w4 = w0 - 1.0f + 4.0f * G4; /* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */ - ii = i % 256; - jj = j % 256; - kk = k % 256; - ll = l % 256; + ii = i & 0xff; + jj = j & 0xff; + kk = k & 0xff; + ll = l & 0xff; /* Calculate the contribution from the five corners */ t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index 6dde69d53..1664740b4 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -2749,6 +2749,11 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st */ state->prog->Instructions = _mesa_alloc_instructions(state->prog->NumInstructions + 1); + + if (state->prog->Instructions == NULL) { + goto error; + } + inst = state->inst_head; for (i = 0; i < state->prog->NumInstructions; i++) { struct asm_instruction *const temp = inst->next; diff --git a/mesalib/src/mesa/program/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c index 2f41322f6..9462978ee 100644 --- a/mesalib/src/mesa/program/symbol_table.c +++ b/mesalib/src/mesa/program/symbol_table.c @@ -115,7 +115,7 @@ struct _mesa_symbol_table { static void check_symbol_table(struct _mesa_symbol_table *table) { -#if 1 +#if !defined(NDEBUG) struct scope_level *scope; for (scope = table->current_scope; scope != NULL; scope = scope->next) { @@ -134,7 +134,9 @@ check_symbol_table(struct _mesa_symbol_table *table) } } } -#endif +#else + (void) table; +#endif /* !defined(NDEBUG) */ } void diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c index ec2bab20b..3929251f8 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c +++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c @@ -182,15 +182,27 @@ convert_sampler(struct st_context *st, msamp->BorderColor.ui[3]) { const struct st_texture_object *stobj = st_texture_object_const(texobj); const GLboolean is_integer = texobj->_IsIntegerFormat; + const struct pipe_sampler_view *sv = NULL; union pipe_color_union border_color; + GLuint i; + + /* Just search for the first used view. We can do this because the + swizzle is per-texture, not per context. */ + /* XXX: clean that up to not use the sampler view at all */ + for (i = 0; i < stobj->num_sampler_views; ++i) { + if (stobj->sampler_views[i]) { + sv = stobj->sampler_views[i]; + break; + } + } - if (st->apply_texture_swizzle_to_border_color && stobj->sampler_view) { + if (st->apply_texture_swizzle_to_border_color && sv) { const unsigned char swz[4] = { - stobj->sampler_view->swizzle_r, - stobj->sampler_view->swizzle_g, - stobj->sampler_view->swizzle_b, - stobj->sampler_view->swizzle_a, + sv->swizzle_r, + sv->swizzle_g, + sv->swizzle_b, + sv->swizzle_a, }; st_translate_color(&msamp->BorderColor, diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index c9bffce4f..afc6d9dab 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -200,9 +200,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj) * \param stObj the st texture object, */ static boolean -check_sampler_swizzle(const struct st_texture_object *stObj) +check_sampler_swizzle(const struct st_texture_object *stObj, + struct pipe_sampler_view *sv) { - const struct pipe_sampler_view *sv = stObj->sampler_view; unsigned swizzle = get_texture_format_swizzle(stObj); return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || @@ -258,40 +258,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, static struct pipe_sampler_view * -st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, - struct pipe_context *pipe, +st_get_texture_sampler_view_from_stobj(struct st_context *st, + struct st_texture_object *stObj, const struct gl_sampler_object *samp, enum pipe_format format) { + struct pipe_sampler_view **sv; + if (!stObj || !stObj->pt) { return NULL; } - if (!stObj->sampler_view) { - stObj->sampler_view = - st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); + sv = st_texture_get_sampler_view(st, stObj); + + /* if sampler view has changed dereference it */ + if (*sv) { + if (check_sampler_swizzle(stObj, *sv) || + (format != (*sv)->format) || + stObj->base.BaseLevel != (*sv)->u.tex.first_level) { + pipe_sampler_view_reference(sv, NULL); + } + } + + if (!*sv) { + *sv = st_create_texture_sampler_view_from_stobj(st->pipe, stObj, samp, format); - } else if (stObj->sampler_view->context != pipe) { + } else if ((*sv)->context != st->pipe) { /* Recreate view in correct context, use existing view as template */ - /* XXX: This isn't optimal, we should try to use more than one view. - Otherwise we create/destroy the view all the time - */ - struct pipe_sampler_view *sv = - pipe->create_sampler_view(pipe, stObj->pt, stObj->sampler_view); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); - stObj->sampler_view = sv; + struct pipe_sampler_view *new_sv = + st->pipe->create_sampler_view(st->pipe, stObj->pt, *sv); + pipe_sampler_view_reference(sv, NULL); + *sv = new_sv; } - return stObj->sampler_view; + return *sv; } - static GLboolean update_single_texture(struct st_context *st, struct pipe_sampler_view **sampler_view, GLuint texUnit) { - struct pipe_context *pipe = st->pipe; struct gl_context *ctx = st->ctx; const struct gl_sampler_object *samp; struct gl_texture_object *texObj; @@ -330,17 +337,7 @@ update_single_texture(struct st_context *st, } } - /* if sampler view has changed dereference it */ - if (stObj->sampler_view) { - if (check_sampler_swizzle(stObj) || - (view_format != stObj->sampler_view->format) || - stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) { - pipe_sampler_view_release(pipe, &stObj->sampler_view); - } - } - - *sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, - samp, + *sampler_view = st_get_texture_sampler_view_from_stobj(st, stObj, samp, view_format); return GL_TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c index 49c4b903e..02624617b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx, srcObj->buffer, 0, &box); } +/** + * Called via glClearBufferSubData(). + */ +static void +st_clear_buffer_subdata(struct gl_context *ctx, + GLintptr offset, GLsizeiptr size, + const GLvoid *clearValue, + GLsizeiptr clearValueSize, + struct gl_buffer_object *bufObj) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct st_buffer_object *buf = st_buffer_object(bufObj); + static const char zeros[16] = {0}; + + if (!pipe->clear_buffer) { + _mesa_buffer_clear_subdata(ctx, offset, size, + clearValue, clearValueSize, bufObj); + return; + } + + if (!clearValue) + clearValue = zeros; + + pipe->clear_buffer(pipe, buf->buffer, offset, size, + clearValue, clearValueSize); +} + /* TODO: if buffer wasn't created with appropriate usage flags, need * to recreate it now and copy contents -- or possibly create a @@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions->UnmapBuffer = st_bufferobj_unmap; functions->CopyBufferSubData = st_copy_buffer_subdata; + functions->ClearBufferSubData = st_clear_buffer_subdata; /* For GL_APPLE_vertex_array_object */ functions->NewArrayObject = _mesa_new_vao; diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c index 561967d6c..34eb80959 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c @@ -124,7 +124,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target, /* FIXME create a non-default sampler view from the pipe_surface? */ pipe_resource_reference(&stObj->pt, ps->texture); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + st_texture_release_all_sampler_views(stObj); pipe_resource_reference(&stImage->pt, stObj->pt); stObj->width0 = ps->width; diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index f0bf3745b..97bba8b7d 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -151,13 +151,11 @@ static void st_DeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { - struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(texObj); - if (stObj->pt) - pipe_resource_reference(&stObj->pt, NULL); - if (stObj->sampler_view) { - pipe_sampler_view_release(st->pipe, &stObj->sampler_view); - } + + pipe_resource_reference(&stObj->pt, NULL); + st_texture_release_all_sampler_views(stObj); + st_texture_free_sampler_views(stObj); _mesa_delete_texture_object(ctx, texObj); } @@ -177,6 +175,10 @@ st_FreeTextureImageBuffer(struct gl_context *ctx, _mesa_align_free(stImage->TexData); stImage->TexData = NULL; + + free(stImage->transfer); + stImage->transfer = NULL; + stImage->num_transfers = 0; } @@ -192,6 +194,7 @@ st_MapTextureImage(struct gl_context *ctx, struct st_texture_image *stImage = st_texture_image(texImage); unsigned pipeMode; GLubyte *map; + struct pipe_transfer *transfer; pipeMode = 0x0; if (mode & GL_MAP_READ_BIT) @@ -201,10 +204,11 @@ st_MapTextureImage(struct gl_context *ctx, if (mode & GL_MAP_INVALIDATE_RANGE_BIT) pipeMode |= PIPE_TRANSFER_DISCARD_RANGE; - map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1); + map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1, + &transfer); if (map) { *mapOut = map; - *rowStrideOut = stImage->transfer->stride; + *rowStrideOut = transfer->stride; } else { *mapOut = NULL; @@ -221,7 +225,7 @@ st_UnmapTextureImage(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct st_texture_image *stImage = st_texture_image(texImage); - st_texture_image_unmap(st, stImage); + st_texture_image_unmap(st, stImage, slice); } @@ -454,7 +458,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, /* The parent texture object does not have space for this image */ pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_release(st->pipe, &stObj->sampler_view); + st_texture_release_all_sampler_views(stObj); if (!guess_and_alloc_texture(st, stObj, stImage)) { /* Probably out of memory. @@ -1146,6 +1150,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, unsigned dst_width = width; unsigned dst_height = height; unsigned dst_depth = 1; + struct pipe_transfer *transfer; if (ST_DEBUG & DEBUG_FALLBACK) debug_printf("%s: fallback processing\n", __FUNCTION__); @@ -1171,7 +1176,8 @@ fallback_copy_texsubimage(struct gl_context *ctx, texDest = st_texture_image_map(st, stImage, transfer_usage, destX, destY, slice, - dst_width, dst_height, dst_depth); + dst_width, dst_height, dst_depth, + &transfer); if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL) { @@ -1201,13 +1207,11 @@ fallback_copy_texsubimage(struct gl_context *ctx, } if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) { - pipe_put_tile_z(stImage->transfer, - texDest + row*stImage->transfer->layer_stride, + pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride, 0, 0, width, 1, data); } else { - pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1, - data); + pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data); } } } @@ -1233,10 +1237,10 @@ fallback_copy_texsubimage(struct gl_context *ctx, } if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) { - dstRowStride = stImage->transfer->layer_stride; + dstRowStride = transfer->layer_stride; } else { - dstRowStride = stImage->transfer->stride; + dstRowStride = transfer->stride; } /* get float/RGBA image from framebuffer */ @@ -1269,7 +1273,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, free(tempSrc); } - st_texture_image_unmap(st, stImage); + st_texture_image_unmap(st, stImage, slice); pipe->transfer_unmap(pipe, src_trans); } @@ -1487,13 +1491,13 @@ st_finalize_texture(struct gl_context *ctx, if (!st_obj) { pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + st_texture_release_all_sampler_views(stObj); return GL_TRUE; } if (st_obj->buffer != stObj->pt) { pipe_resource_reference(&stObj->pt, st_obj->buffer); - pipe_sampler_view_release(st->pipe, &stObj->sampler_view); + st_texture_release_all_sampler_views(stObj); stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat); stObj->height0 = 1; stObj->depth0 = 1; @@ -1514,7 +1518,7 @@ st_finalize_texture(struct gl_context *ctx, firstImage->pt != stObj->pt && (!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) { pipe_resource_reference(&stObj->pt, firstImage->pt); - pipe_sampler_view_release(st->pipe, &stObj->sampler_view); + st_texture_release_all_sampler_views(stObj); } /* If this texture comes from a window system, there is nothing else to do. */ @@ -1561,7 +1565,7 @@ st_finalize_texture(struct gl_context *ctx, * gallium texture now. We'll make a new one below. */ pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_release(st->pipe, &stObj->sampler_view); + st_texture_release_all_sampler_views(stObj); st->dirty.st |= ST_NEW_FRAMEBUFFER; } } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 807a86fdf..c7f3ec6be 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -152,7 +152,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st_init_bitmap(st); st_init_clear(st); st_init_draw( st ); - st_init_generate_mipmap(st); /* Choose texture target for glDrawPixels, glBitmap, renderbuffers */ if (pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES)) @@ -254,7 +253,6 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_atoms( st ); st_destroy_draw( st ); - st_destroy_generate_mipmap(st); st_destroy_clear(st); st_destroy_bitmap(st); st_destroy_drawpix(st); diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 0e00dd4fa..361a24b1d 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -188,7 +188,6 @@ struct st_context void *passthrough_fs; /**< simple pass-through frag shader */ enum pipe_texture_target internal_target; - struct gen_mipmap_state *gen_mipmap; struct cso_context *cso_context; diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 18ddd4e47..059989342 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -275,6 +275,9 @@ void st_init_limits(struct st_context *st) c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET); c->MaxProgramTextureGatherComponents = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS); + c->MinProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET); + c->MaxProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET); + c->UniformBooleanTrue = ~0; c->MaxTransformFeedbackBuffers = @@ -421,7 +424,8 @@ void st_init_extensions(struct st_context *st) { o(OES_standard_derivatives), PIPE_CAP_SM3 }, { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY }, - { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE } + { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }, + { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD } }; /* Required: render target and sampler support */ @@ -728,6 +732,13 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE; } + if (ctx->Const.MaxSamples == 0 && screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) { + ctx->Const.FakeSWMSAA = GL_TRUE; + ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; + ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE; + ctx->Extensions.ARB_texture_multisample = GL_TRUE; + } + if (ctx->Const.MaxDualSourceDrawBuffers > 0 && !st->options.disable_blend_func_extended) ctx->Extensions.ARB_blend_func_extended = GL_TRUE; diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c index b615575b5..18cf504a7 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c @@ -44,64 +44,6 @@ /** - * one-time init for generate mipmap - * XXX Note: there may be other times we need no-op/simple state like this. - * In that case, some code refactoring would be good. - */ -void -st_init_generate_mipmap(struct st_context *st) -{ - st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context); -} - - -void -st_destroy_generate_mipmap(struct st_context *st) -{ - util_destroy_gen_mipmap(st->gen_mipmap); - st->gen_mipmap = NULL; -} - - -/** - * Generate mipmap levels using hardware rendering. - * \return TRUE if successful, FALSE if not possible - */ -static boolean -st_render_mipmap(struct st_context *st, - GLenum target, - struct st_texture_object *stObj, - uint baseLevel, uint lastLevel) -{ - struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; - struct pipe_sampler_view *psv; - const uint face = _mesa_tex_target_to_face(target); - -#if 0 - assert(target != GL_TEXTURE_3D); /* implemented but untested */ -#endif - - /* check if we can render in the texture's format */ - /* XXX should probably kill this and always use util_gen_mipmap - since this implements a sw fallback as well */ - if (!screen->is_format_supported(screen, stObj->pt->format, - stObj->pt->target, - 0, PIPE_BIND_RENDER_TARGET)) { - return FALSE; - } - - psv = st_create_texture_sampler_view(pipe, stObj->pt); - - util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel, - PIPE_TEX_FILTER_LINEAR); - - pipe_sampler_view_reference(&psv, NULL); - - return TRUE; -} - -/** * Compute the expected number of mipmap levels in the texture given * the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/ * GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap @@ -136,7 +78,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, struct st_texture_object *stObj = st_texture_object(texObj); struct pipe_resource *pt = st_get_texobj_resource(texObj); const uint baseLevel = texObj->BaseLevel; - uint lastLevel; + uint lastLevel, first_layer, last_layer; uint dstLevel; if (!pt) @@ -182,7 +124,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, /* release the old tex (will likely be freed too) */ pipe_resource_reference(&oldTex, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + st_texture_release_all_sampler_views(stObj); } else { /* Make sure that the base texture image data is present in the @@ -195,12 +137,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, assert(pt->last_level >= lastLevel); + if (pt->target == PIPE_TEXTURE_CUBE) { + first_layer = last_layer = _mesa_tex_target_to_face(target); + } + else { + first_layer = 0; + last_layer = util_max_layer(pt, baseLevel); + } + /* Try to generate the mipmap by rendering/texturing. If that fails, * use the software fallback. */ - if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) { - /* since the util code actually also has a fallback, should - probably make it never fail and kill this */ + if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel, + first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) { _mesa_generate_mipmap(ctx, target, texObj); } diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h index 64eb39723..4cc208951 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h @@ -34,14 +34,6 @@ struct gl_context; struct gl_texture_object; -struct st_context; - -extern void -st_init_generate_mipmap(struct st_context *st); - - -extern void -st_destroy_generate_mipmap(struct st_context *st); extern void diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index f019a55c2..edd0aa765 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2793,7 +2793,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) } break; case ir_lod: - assert(!"Unexpected ir_lod opcode"); + opcode = TGSI_OPCODE_LODQ; break; case ir_query_levels: assert(!"Unexpected ir_query_levels opcode"); @@ -4513,6 +4513,7 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_TXB2: case TGSI_OPCODE_TXL2: case TGSI_OPCODE_TG4: + case TGSI_OPCODE_LODQ: src[num_src++] = t->samplers[inst->sampler]; for (i = 0; i < inst->tex_offset_num_offset; i++) { texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i], i); @@ -5356,8 +5357,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; - progress = do_common_optimization(ir, true, true, - options->MaxUnrollIterations, options) + progress = do_common_optimization(ir, true, true, options, + ctx->Const.NativeIntegers) || progress; progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress; diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index a3b345356..f664ef5f1 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -40,6 +40,7 @@ #include "util/u_format.h" #include "util/u_rect.h" #include "util/u_math.h" +#include "util/u_memory.h" #define DBG if(0) printf @@ -240,11 +241,13 @@ GLubyte * st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, enum pipe_transfer_usage usage, GLuint x, GLuint y, GLuint z, - GLuint w, GLuint h, GLuint d) + GLuint w, GLuint h, GLuint d, + struct pipe_transfer **transfer) { struct st_texture_object *stObj = st_texture_object(stImage->base.TexObject); GLuint level; + void *map; DBG("%s \n", __FUNCTION__); @@ -256,22 +259,41 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, else level = stImage->base.Level; - return pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage, - x, y, z + stImage->base.Face, - w, h, d, &stImage->transfer); + z += stImage->base.Face; + + map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage, + x, y, z, w, h, d, transfer); + if (map) { + /* Enlarge the transfer array if it's not large enough. */ + if (z >= stImage->num_transfers) { + unsigned new_size = z + 1; + + stImage->transfer = realloc(stImage->transfer, + new_size * sizeof(void*)); + memset(&stImage->transfer[stImage->num_transfers], 0, + (new_size - stImage->num_transfers) * sizeof(void*)); + stImage->num_transfers = new_size; + } + + assert(!stImage->transfer[z]); + stImage->transfer[z] = *transfer; + } + return map; } void st_texture_image_unmap(struct st_context *st, - struct st_texture_image *stImage) + struct st_texture_image *stImage, unsigned slice) { struct pipe_context *pipe = st->pipe; + struct pipe_transfer **transfer = + &stImage->transfer[slice + stImage->base.Face]; DBG("%s\n", __FUNCTION__); - pipe_transfer_unmap(pipe, stImage->transfer); - stImage->transfer = NULL; + pipe_transfer_unmap(pipe, *transfer); + *transfer = NULL; } @@ -412,10 +434,85 @@ st_create_color_map_texture(struct gl_context *ctx) return pt; } +/** + * Try to find a matching sampler view for the given context. + * If none is found an empty slot is initialized with a + * template and returned instead. + */ +struct pipe_sampler_view ** +st_texture_get_sampler_view(struct st_context *st, + struct st_texture_object *stObj) +{ + struct pipe_sampler_view **used = NULL, **free = NULL; + GLuint i; + + for (i = 0; i < stObj->num_sampler_views; ++i) { + struct pipe_sampler_view **sv = &stObj->sampler_views[i]; + /* Is the array entry used ? */ + if (*sv) { + /* Yes, check if it's the right one */ + if ((*sv)->context == st->pipe) + return sv; + + /* Wasn't the right one, but remember it as template */ + used = sv; + } else { + /* Found a free slot, remember that */ + free = sv; + } + } + + /* Couldn't find a slot for our context, create a new one */ + + if (!free) { + /* Haven't even found a free one, resize the array */ + GLuint old_size = stObj->num_sampler_views * sizeof(void *); + GLuint new_size = old_size + sizeof(void *); + stObj->sampler_views = REALLOC(stObj->sampler_views, old_size, new_size); + free = &stObj->sampler_views[stObj->num_sampler_views++]; + *free = NULL; + } + + /* Add just any sampler view to be used as a template */ + if (used) + pipe_sampler_view_reference(free, *used); + + return free; +} + void st_texture_release_sampler_view(struct st_context *st, struct st_texture_object *stObj) { - if (stObj->sampler_view && stObj->sampler_view->context == st->pipe) - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + GLuint i; + + for (i = 0; i < stObj->num_sampler_views; ++i) { + struct pipe_sampler_view **sv = &stObj->sampler_views[i]; + + if (*sv && (*sv)->context == st->pipe) { + pipe_sampler_view_reference(sv, NULL); + break; + } + } +} + +void +st_texture_release_all_sampler_views(struct st_texture_object *stObj) +{ + GLuint i; + + for (i = 0; i < stObj->num_sampler_views; ++i) + pipe_sampler_view_reference(&stObj->sampler_views[i], NULL); +} + + +void +st_texture_free_sampler_views(struct st_texture_object *stObj) +{ + /* NOTE: + * We use FREE() here to match REALLOC() above. Both come from + * u_memory.h, not imports.h. If we mis-match MALLOC/FREE from + * those two headers we can trash the heap. + */ + FREE(stObj->sampler_views); } diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h index b4a27a00a..affb56812 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.h +++ b/mesalib/src/mesa/state_tracker/st_texture.h @@ -56,7 +56,11 @@ struct st_texture_image */ struct pipe_resource *pt; - struct pipe_transfer *transfer; + /* List of transfers, allocated on demand. + * transfer[layer] is a mapping for that layer. + */ + struct pipe_transfer **transfer; + unsigned num_transfers; }; @@ -82,10 +86,13 @@ struct st_texture_object */ struct pipe_resource *pt; - /* Default sampler view attached to this texture object. Created lazily - * on first binding. + /* Number of views in sampler_views array */ + GLuint num_sampler_views; + + /* Array of sampler views (one per context) attached to this texture + * object. Created lazily on first binding in context. */ - struct pipe_sampler_view *sampler_view; + struct pipe_sampler_view **sampler_views; /* True if this texture comes from the window system. Such a texture * cannot be reallocated and the format can only be changed with a sampler @@ -192,11 +199,12 @@ extern GLubyte * st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, enum pipe_transfer_usage usage, GLuint x, GLuint y, GLuint z, - GLuint w, GLuint h, GLuint d); + GLuint w, GLuint h, GLuint d, + struct pipe_transfer **transfer); extern void st_texture_image_unmap(struct st_context *st, - struct st_texture_image *stImage); + struct st_texture_image *stImage, unsigned slice); /* Return pointers to each 2d slice within an image. Indexed by depth @@ -227,8 +235,18 @@ st_texture_image_copy(struct pipe_context *pipe, extern struct pipe_resource * st_create_color_map_texture(struct gl_context *ctx); +extern struct pipe_sampler_view ** +st_texture_get_sampler_view(struct st_context *st, + struct st_texture_object *stObj); + extern void st_texture_release_sampler_view(struct st_context *st, struct st_texture_object *stObj); +extern void +st_texture_release_all_sampler_views(struct st_texture_object *stObj); + +void +st_texture_free_sampler_views(struct st_texture_object *stObj); + #endif diff --git a/mesalib/src/mesa/state_tracker/st_vdpau.c b/mesalib/src/mesa/state_tracker/st_vdpau.c index c5b4780ce..8c10cdaf3 100644 --- a/mesalib/src/mesa/state_tracker/st_vdpau.c +++ b/mesalib/src/mesa/state_tracker/st_vdpau.c @@ -63,7 +63,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, struct st_texture_image *stImage = st_texture_image(texImage); struct pipe_resource *res; - struct pipe_sampler_view *sv, templ; + struct pipe_sampler_view templ, **sampler_view; mesa_format texFormat; getProcAddr = ctx->vdpGetProcAddress; @@ -83,6 +83,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, } } else { + struct pipe_sampler_view *sv; VdpVideoSurfaceGallium *f; struct pipe_video_buffer *buffer; @@ -138,7 +139,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, texFormat); pipe_resource_reference(&stObj->pt, res); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + st_texture_release_all_sampler_views(stObj); pipe_resource_reference(&stImage->pt, res); u_sampler_view_default_template(&templ, res, res->format); @@ -148,7 +149,9 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, templ.swizzle_g = GET_SWZ(stObj->base._Swizzle, 1); templ.swizzle_b = GET_SWZ(stObj->base._Swizzle, 2); templ.swizzle_a = GET_SWZ(stObj->base._Swizzle, 3); - stObj->sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ); + + sampler_view = st_texture_get_sampler_view(st, stObj); + *sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ); stObj->width0 = res->width0; stObj->height0 = res->height0; @@ -169,7 +172,7 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access, struct st_texture_image *stImage = st_texture_image(texImage); pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + st_texture_release_all_sampler_views(stObj); pipe_resource_reference(&stImage->pt, NULL); _mesa_dirty_texobj(ctx, texObj); diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c index cd0982705..90a514c16 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.c +++ b/mesalib/src/mesa/swrast/s_texfetch.c @@ -129,9 +129,24 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage, } +#define FETCH_FUNCS(NAME) \ + { \ + MESA_FORMAT_ ## NAME, \ + fetch_texel_1d_ ## NAME, \ + fetch_texel_2d_ ## NAME, \ + fetch_texel_3d_ ## NAME, \ + } + +#define FETCH_NULL(NAME) \ + { \ + MESA_FORMAT_ ## NAME, \ + NULL, \ + NULL, \ + NULL \ + } + /** * Table to map MESA_FORMAT_ to texel fetch/store funcs. - * XXX this is somewhat temporary. */ static struct { mesa_format Name; @@ -149,978 +164,198 @@ texfetch_funcs[] = }, /* Packed unorm formats */ - { - MESA_FORMAT_A8B8G8R8_UNORM, - fetch_texel_1d_f_rgba8888, - fetch_texel_2d_f_rgba8888, - fetch_texel_3d_f_rgba8888 - }, - { - MESA_FORMAT_X8B8G8R8_UNORM, - fetch_texel_1d_f_rgbx8888, - fetch_texel_2d_f_rgbx8888, - fetch_texel_3d_f_rgbx8888 - }, - { - MESA_FORMAT_R8G8B8A8_UNORM, - fetch_texel_1d_f_rgba8888_rev, - fetch_texel_2d_f_rgba8888_rev, - fetch_texel_3d_f_rgba8888_rev - }, - { - MESA_FORMAT_R8G8B8X8_UNORM, - fetch_texel_1d_f_rgbx8888_rev, - fetch_texel_2d_f_rgbx8888_rev, - fetch_texel_3d_f_rgbx8888_rev - }, - { - MESA_FORMAT_B8G8R8A8_UNORM, - fetch_texel_1d_f_argb8888, - fetch_texel_2d_f_argb8888, - fetch_texel_3d_f_argb8888 - }, - { - MESA_FORMAT_B8G8R8X8_UNORM, - fetch_texel_1d_f_xrgb8888, - fetch_texel_2d_f_xrgb8888, - fetch_texel_3d_f_xrgb8888 - }, - { - MESA_FORMAT_A8R8G8B8_UNORM, - fetch_texel_1d_f_argb8888_rev, - fetch_texel_2d_f_argb8888_rev, - fetch_texel_3d_f_argb8888_rev - }, - { - MESA_FORMAT_X8R8G8B8_UNORM, - fetch_texel_1d_f_xrgb8888_rev, - fetch_texel_2d_f_xrgb8888_rev, - fetch_texel_3d_f_xrgb8888_rev - }, - { - MESA_FORMAT_L16A16_UNORM, - fetch_texel_1d_f_al1616, - fetch_texel_2d_f_al1616, - fetch_texel_3d_f_al1616 - }, - { - MESA_FORMAT_A16L16_UNORM, - fetch_texel_1d_f_al1616_rev, - fetch_texel_2d_f_al1616_rev, - fetch_texel_3d_f_al1616_rev - }, - { - MESA_FORMAT_B5G6R5_UNORM, - fetch_texel_1d_f_rgb565, - fetch_texel_2d_f_rgb565, - fetch_texel_3d_f_rgb565 - }, - { - MESA_FORMAT_R5G6B5_UNORM, - fetch_texel_1d_f_rgb565_rev, - fetch_texel_2d_f_rgb565_rev, - fetch_texel_3d_f_rgb565_rev - }, - { - MESA_FORMAT_B4G4R4A4_UNORM, - fetch_texel_1d_f_argb4444, - fetch_texel_2d_f_argb4444, - fetch_texel_3d_f_argb4444 - }, - { - MESA_FORMAT_B4G4R4X4_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A4R4G4B4_UNORM, - fetch_texel_1d_f_argb4444_rev, - fetch_texel_2d_f_argb4444_rev, - fetch_texel_3d_f_argb4444_rev - }, - { - MESA_FORMAT_A1B5G5R5_UNORM, - fetch_texel_1d_f_rgba5551, - fetch_texel_2d_f_rgba5551, - fetch_texel_3d_f_rgba5551 - }, - { - MESA_FORMAT_B5G5R5A1_UNORM, - fetch_texel_1d_f_argb1555, - fetch_texel_2d_f_argb1555, - fetch_texel_3d_f_argb1555 - }, - { - MESA_FORMAT_B5G5R5X1_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A1R5G5B5_UNORM, - fetch_texel_1d_f_argb1555_rev, - fetch_texel_2d_f_argb1555_rev, - fetch_texel_3d_f_argb1555_rev - }, - { - MESA_FORMAT_L8A8_UNORM, - fetch_texel_1d_f_al88, - fetch_texel_2d_f_al88, - fetch_texel_3d_f_al88 - }, - { - MESA_FORMAT_A8L8_UNORM, - fetch_texel_1d_f_al88_rev, - fetch_texel_2d_f_al88_rev, - fetch_texel_3d_f_al88_rev - }, - { - MESA_FORMAT_R8G8_UNORM, - fetch_texel_1d_f_gr88, - fetch_texel_2d_f_gr88, - fetch_texel_3d_f_gr88 - }, - { - MESA_FORMAT_G8R8_UNORM, - fetch_texel_1d_f_rg88, - fetch_texel_2d_f_rg88, - fetch_texel_3d_f_rg88 - }, - { - MESA_FORMAT_L4A4_UNORM, - fetch_texel_1d_f_al44, - fetch_texel_2d_f_al44, - fetch_texel_3d_f_al44 - }, - { - MESA_FORMAT_B2G3R3_UNORM, - fetch_texel_1d_f_rgb332, - fetch_texel_2d_f_rgb332, - fetch_texel_3d_f_rgb332 - }, - { - MESA_FORMAT_R16G16_UNORM, - fetch_texel_1d_f_rg1616, - fetch_texel_2d_f_rg1616, - fetch_texel_3d_f_rg1616 - }, - { - MESA_FORMAT_G16R16_UNORM, - fetch_texel_1d_f_rg1616_rev, - fetch_texel_2d_f_rg1616_rev, - fetch_texel_3d_f_rg1616_rev - }, - { - MESA_FORMAT_B10G10R10A2_UNORM, - fetch_texel_1d_f_argb2101010, - fetch_texel_2d_f_argb2101010, - fetch_texel_3d_f_argb2101010 - }, - { - MESA_FORMAT_B10G10R10X2_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_S8_UINT_Z24_UNORM, - fetch_texel_1d_f_z24_s8, - fetch_texel_2d_f_z24_s8, - fetch_texel_3d_f_z24_s8 - }, + FETCH_FUNCS(A8B8G8R8_UNORM), + FETCH_FUNCS(X8B8G8R8_UNORM), + FETCH_FUNCS(R8G8B8A8_UNORM), + FETCH_FUNCS(R8G8B8X8_UNORM), + FETCH_FUNCS(B8G8R8A8_UNORM), + FETCH_FUNCS(B8G8R8X8_UNORM), + FETCH_FUNCS(A8R8G8B8_UNORM), + FETCH_FUNCS(X8R8G8B8_UNORM), + FETCH_FUNCS(L16A16_UNORM), + FETCH_FUNCS(A16L16_UNORM), + FETCH_FUNCS(B5G6R5_UNORM), + FETCH_FUNCS(R5G6B5_UNORM), + FETCH_FUNCS(B4G4R4A4_UNORM), + FETCH_NULL(B4G4R4X4_UNORM), + FETCH_FUNCS(A4R4G4B4_UNORM), + FETCH_FUNCS(A1B5G5R5_UNORM), + FETCH_FUNCS(B5G5R5A1_UNORM), + FETCH_NULL(B5G5R5X1_UNORM), + FETCH_FUNCS(A1R5G5B5_UNORM), + FETCH_FUNCS(L8A8_UNORM), + FETCH_FUNCS(A8L8_UNORM), + FETCH_FUNCS(R8G8_UNORM), + FETCH_FUNCS(G8R8_UNORM), + FETCH_FUNCS(L4A4_UNORM), + FETCH_FUNCS(B2G3R3_UNORM), + FETCH_FUNCS(R16G16_UNORM), + FETCH_FUNCS(G16R16_UNORM), + FETCH_FUNCS(B10G10R10A2_UNORM), + FETCH_NULL(B10G10R10X2_UNORM), + FETCH_FUNCS(R10G10B10A2_UNORM), + FETCH_FUNCS(S8_UINT_Z24_UNORM), { MESA_FORMAT_X8_UINT_Z24_UNORM, - fetch_texel_1d_f_z24_s8, - fetch_texel_2d_f_z24_s8, - fetch_texel_3d_f_z24_s8 - }, - { - MESA_FORMAT_Z24_UNORM_S8_UINT, - fetch_texel_1d_f_s8_z24, - fetch_texel_2d_f_s8_z24, - fetch_texel_3d_f_s8_z24 + fetch_texel_1d_S8_UINT_Z24_UNORM, + fetch_texel_2d_S8_UINT_Z24_UNORM, + fetch_texel_3d_S8_UINT_Z24_UNORM }, + FETCH_FUNCS(Z24_UNORM_S8_UINT), { MESA_FORMAT_Z24_UNORM_X8_UINT, - fetch_texel_1d_f_s8_z24, - fetch_texel_2d_f_s8_z24, - fetch_texel_3d_f_s8_z24 - }, - { - MESA_FORMAT_YCBCR, - fetch_texel_1d_f_ycbcr, - fetch_texel_2d_f_ycbcr, - fetch_texel_3d_f_ycbcr - }, - { - MESA_FORMAT_YCBCR_REV, - fetch_texel_1d_f_ycbcr_rev, - fetch_texel_2d_f_ycbcr_rev, - fetch_texel_3d_f_ycbcr_rev - }, - { - MESA_FORMAT_DUDV8, - fetch_texel_1d_dudv8, - fetch_texel_2d_dudv8, - fetch_texel_3d_dudv8 + fetch_texel_1d_Z24_UNORM_S8_UINT, + fetch_texel_2d_Z24_UNORM_S8_UINT, + fetch_texel_3d_Z24_UNORM_S8_UINT }, + FETCH_FUNCS(YCBCR), + FETCH_FUNCS(YCBCR_REV), + FETCH_FUNCS(DUDV8), /* Array unorm formats */ - { - MESA_FORMAT_A_UNORM8, - fetch_texel_1d_f_a8, - fetch_texel_2d_f_a8, - fetch_texel_3d_f_a8 - }, - { - MESA_FORMAT_A_UNORM16, - fetch_texel_1d_f_a16, - fetch_texel_2d_f_a16, - fetch_texel_3d_f_a16 - }, - { - MESA_FORMAT_L_UNORM8, - fetch_texel_1d_f_l8, - fetch_texel_2d_f_l8, - fetch_texel_3d_f_l8 - }, - { - MESA_FORMAT_L_UNORM16, - fetch_texel_1d_f_l16, - fetch_texel_2d_f_l16, - fetch_texel_3d_f_l16 - }, - { - MESA_FORMAT_I_UNORM8, - fetch_texel_1d_f_i8, - fetch_texel_2d_f_i8, - fetch_texel_3d_f_i8 - }, - { - MESA_FORMAT_I_UNORM16, - fetch_texel_1d_f_i16, - fetch_texel_2d_f_i16, - fetch_texel_3d_f_i16 - }, - { - MESA_FORMAT_R_UNORM8, - fetch_texel_1d_f_r8, - fetch_texel_2d_f_r8, - fetch_texel_3d_f_r8 - }, - { - MESA_FORMAT_R_UNORM16, - fetch_texel_1d_f_r16, - fetch_texel_2d_f_r16, - fetch_texel_3d_f_r16 - }, - { - MESA_FORMAT_BGR_UNORM8, - fetch_texel_1d_f_rgb888, - fetch_texel_2d_f_rgb888, - fetch_texel_3d_f_rgb888 - }, - { - MESA_FORMAT_RGB_UNORM8, - fetch_texel_1d_f_bgr888, - fetch_texel_2d_f_bgr888, - fetch_texel_3d_f_bgr888 - }, - { - MESA_FORMAT_RGBA_UNORM16, - fetch_texel_1d_rgba_16, - fetch_texel_2d_rgba_16, - fetch_texel_3d_rgba_16 - }, - { - MESA_FORMAT_RGBX_UNORM16, - fetch_texel_1d_xbgr16161616_unorm, - fetch_texel_2d_xbgr16161616_unorm, - fetch_texel_3d_xbgr16161616_unorm - }, - { - MESA_FORMAT_Z_UNORM16, - fetch_texel_1d_f_z16, - fetch_texel_2d_f_z16, - fetch_texel_3d_f_z16 - }, - { - MESA_FORMAT_Z_UNORM32, - fetch_texel_1d_f_z32, - fetch_texel_2d_f_z32, - fetch_texel_3d_f_z32 - }, - { - MESA_FORMAT_S_UINT8, - NULL, - NULL, - NULL - }, + FETCH_FUNCS(A_UNORM8), + FETCH_FUNCS(A_UNORM16), + FETCH_FUNCS(L_UNORM8), + FETCH_FUNCS(L_UNORM16), + FETCH_FUNCS(I_UNORM8), + FETCH_FUNCS(I_UNORM16), + FETCH_FUNCS(R_UNORM8), + FETCH_FUNCS(R_UNORM16), + FETCH_FUNCS(BGR_UNORM8), + FETCH_FUNCS(RGB_UNORM8), + FETCH_FUNCS(RGBA_UNORM16), + FETCH_FUNCS(RGBX_UNORM16), + FETCH_FUNCS(Z_UNORM16), + FETCH_FUNCS(Z_UNORM32), + FETCH_NULL(S_UINT8), /* Packed signed/normalized formats */ - { - MESA_FORMAT_A8B8G8R8_SNORM, - fetch_texel_1d_signed_rgba8888, - fetch_texel_2d_signed_rgba8888, - fetch_texel_3d_signed_rgba8888 - }, - { - MESA_FORMAT_X8B8G8R8_SNORM, - fetch_texel_1d_signed_rgbx8888, - fetch_texel_2d_signed_rgbx8888, - fetch_texel_3d_signed_rgbx8888 - }, - { - MESA_FORMAT_R8G8B8A8_SNORM, - fetch_texel_1d_signed_rgba8888_rev, - fetch_texel_2d_signed_rgba8888_rev, - fetch_texel_3d_signed_rgba8888_rev - }, - { - MESA_FORMAT_R8G8B8X8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R16G16_SNORM, - fetch_texel_1d_signed_rg1616, - fetch_texel_2d_signed_rg1616, - fetch_texel_3d_signed_rg1616 - }, - { - MESA_FORMAT_G16R16_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8_SNORM, - fetch_texel_1d_signed_rg88_rev, - fetch_texel_2d_signed_rg88_rev, - fetch_texel_3d_signed_rg88_rev - }, - { - MESA_FORMAT_G8R8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L8A8_SNORM, - fetch_texel_1d_signed_al88, - fetch_texel_2d_signed_al88, - fetch_texel_3d_signed_al88 - }, + FETCH_FUNCS(A8B8G8R8_SNORM), + FETCH_FUNCS(X8B8G8R8_SNORM), + FETCH_FUNCS(R8G8B8A8_SNORM), + FETCH_NULL(R8G8B8X8_SNORM), + FETCH_FUNCS(R16G16_SNORM), + FETCH_NULL(G16R16_SNORM), + FETCH_FUNCS(R8G8_SNORM), + FETCH_NULL(G8R8_SNORM), + FETCH_FUNCS(L8A8_SNORM), /* Array signed/normalized formats */ - { - MESA_FORMAT_A_SNORM8, - fetch_texel_1d_signed_a8, - fetch_texel_2d_signed_a8, - fetch_texel_3d_signed_a8 - }, - { - MESA_FORMAT_A_SNORM16, - fetch_texel_1d_signed_a16, - fetch_texel_2d_signed_a16, - fetch_texel_3d_signed_a16 - }, - { - MESA_FORMAT_L_SNORM8, - fetch_texel_1d_signed_l8, - fetch_texel_2d_signed_l8, - fetch_texel_3d_signed_l8 - }, - { - MESA_FORMAT_L_SNORM16, - fetch_texel_1d_signed_l16, - fetch_texel_2d_signed_l16, - fetch_texel_3d_signed_l16 - }, - { - MESA_FORMAT_I_SNORM8, - fetch_texel_1d_signed_i8, - fetch_texel_2d_signed_i8, - fetch_texel_3d_signed_i8 - }, - { - MESA_FORMAT_I_SNORM16, - fetch_texel_1d_signed_i16, - fetch_texel_2d_signed_i16, - fetch_texel_3d_signed_i16 - }, - { - MESA_FORMAT_R_SNORM8, - fetch_texel_1d_signed_r8, - fetch_texel_2d_signed_r8, - fetch_texel_3d_signed_r8 - }, - { - MESA_FORMAT_R_SNORM16, - fetch_texel_1d_signed_r16, - fetch_texel_2d_signed_r16, - fetch_texel_3d_signed_r16 - }, - { - MESA_FORMAT_LA_SNORM16, - fetch_texel_1d_signed_al1616, - fetch_texel_2d_signed_al1616, - fetch_texel_3d_signed_al1616 - }, - { - MESA_FORMAT_RGB_SNORM16, - fetch_texel_1d_signed_rgb_16, - fetch_texel_2d_signed_rgb_16, - fetch_texel_3d_signed_rgb_16 - }, - { - MESA_FORMAT_RGBA_SNORM16, - fetch_texel_1d_signed_rgba_16, - fetch_texel_2d_signed_rgba_16, - fetch_texel_3d_signed_rgba_16 - }, - { - MESA_FORMAT_RGBX_SNORM16, - NULL, - NULL, - NULL - }, + FETCH_FUNCS(A_SNORM8), + FETCH_FUNCS(A_SNORM16), + FETCH_FUNCS(L_SNORM8), + FETCH_FUNCS(L_SNORM16), + FETCH_FUNCS(I_SNORM8), + FETCH_FUNCS(I_SNORM16), + FETCH_FUNCS(R_SNORM8), + FETCH_FUNCS(R_SNORM16), + FETCH_FUNCS(LA_SNORM16), + FETCH_FUNCS(RGB_SNORM16), + FETCH_FUNCS(RGBA_SNORM16), + FETCH_NULL(RGBX_SNORM16), /* Packed sRGB formats */ - { - MESA_FORMAT_A8B8G8R8_SRGB, - fetch_texel_1d_srgba8, - fetch_texel_2d_srgba8, - fetch_texel_3d_srgba8 - }, - { - MESA_FORMAT_B8G8R8A8_SRGB, - fetch_texel_1d_sargb8, - fetch_texel_2d_sargb8, - fetch_texel_3d_sargb8 - }, - { - MESA_FORMAT_B8G8R8X8_SRGB, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8B8A8_SRGB, - fetch_texel_1d_sabgr8, - fetch_texel_2d_sabgr8, - fetch_texel_3d_sabgr8 - }, - { - MESA_FORMAT_R8G8B8X8_SRGB, - fetch_texel_1d_sxbgr8, - fetch_texel_2d_sxbgr8, - fetch_texel_3d_sxbgr8 - }, - { - MESA_FORMAT_L8A8_SRGB, - fetch_texel_1d_sla8, - fetch_texel_2d_sla8, - fetch_texel_3d_sla8 - }, + FETCH_FUNCS(A8B8G8R8_SRGB), + FETCH_FUNCS(B8G8R8A8_SRGB), + FETCH_NULL(B8G8R8X8_SRGB), + FETCH_FUNCS(R8G8B8A8_SRGB), + FETCH_FUNCS(R8G8B8X8_SRGB), + FETCH_FUNCS(L8A8_SRGB), /* Array sRGB formats */ - { - MESA_FORMAT_L_SRGB8, - fetch_texel_1d_sl8, - fetch_texel_2d_sl8, - fetch_texel_3d_sl8 - }, - { - MESA_FORMAT_BGR_SRGB8, - fetch_texel_1d_srgb8, - fetch_texel_2d_srgb8, - fetch_texel_3d_srgb8 - }, + FETCH_FUNCS(L_SRGB8), + FETCH_FUNCS(BGR_SRGB8), /* Packed float formats */ - { - MESA_FORMAT_R9G9B9E5_FLOAT, - fetch_texel_1d_rgb9_e5, - fetch_texel_2d_rgb9_e5, - fetch_texel_3d_rgb9_e5 - }, - { - MESA_FORMAT_R11G11B10_FLOAT, - fetch_texel_1d_r11_g11_b10f, - fetch_texel_2d_r11_g11_b10f, - fetch_texel_3d_r11_g11_b10f - }, - { - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, - fetch_texel_1d_z32f_x24s8, - fetch_texel_2d_z32f_x24s8, - fetch_texel_3d_z32f_x24s8 - }, + FETCH_FUNCS(R9G9B9E5_FLOAT), + FETCH_FUNCS(R11G11B10_FLOAT), + FETCH_FUNCS(Z32_FLOAT_S8X24_UINT), /* Array float formats */ - { - MESA_FORMAT_A_FLOAT16, - fetch_texel_1d_f_alpha_f16, - fetch_texel_2d_f_alpha_f16, - fetch_texel_3d_f_alpha_f16 - }, - { - MESA_FORMAT_A_FLOAT32, - fetch_texel_1d_f_alpha_f32, - fetch_texel_2d_f_alpha_f32, - fetch_texel_3d_f_alpha_f32 - }, - { - MESA_FORMAT_L_FLOAT16, - fetch_texel_1d_f_luminance_f16, - fetch_texel_2d_f_luminance_f16, - fetch_texel_3d_f_luminance_f16 - }, - { - MESA_FORMAT_L_FLOAT32, - fetch_texel_1d_f_luminance_f32, - fetch_texel_2d_f_luminance_f32, - fetch_texel_3d_f_luminance_f32 - }, - { - MESA_FORMAT_LA_FLOAT16, - fetch_texel_1d_f_luminance_alpha_f16, - fetch_texel_2d_f_luminance_alpha_f16, - fetch_texel_3d_f_luminance_alpha_f16 - }, - { - MESA_FORMAT_LA_FLOAT32, - fetch_texel_1d_f_luminance_alpha_f32, - fetch_texel_2d_f_luminance_alpha_f32, - fetch_texel_3d_f_luminance_alpha_f32 - }, - { - MESA_FORMAT_I_FLOAT16, - fetch_texel_1d_f_intensity_f16, - fetch_texel_2d_f_intensity_f16, - fetch_texel_3d_f_intensity_f16 - }, - { - MESA_FORMAT_I_FLOAT32, - fetch_texel_1d_f_intensity_f32, - fetch_texel_2d_f_intensity_f32, - fetch_texel_3d_f_intensity_f32 - }, - { - MESA_FORMAT_R_FLOAT16, - fetch_texel_1d_f_r_f16, - fetch_texel_2d_f_r_f16, - fetch_texel_3d_f_r_f16 - }, - { - MESA_FORMAT_R_FLOAT32, - fetch_texel_1d_f_r_f32, - fetch_texel_2d_f_r_f32, - fetch_texel_3d_f_r_f32 - }, - { - MESA_FORMAT_RG_FLOAT16, - fetch_texel_1d_f_rg_f16, - fetch_texel_2d_f_rg_f16, - fetch_texel_3d_f_rg_f16 - }, - { - MESA_FORMAT_RG_FLOAT32, - fetch_texel_1d_f_rg_f32, - fetch_texel_2d_f_rg_f32, - fetch_texel_3d_f_rg_f32 - }, - { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_f_rgb_f16, - fetch_texel_2d_f_rgb_f16, - fetch_texel_3d_f_rgb_f16 - }, - { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_f_rgb_f32, - fetch_texel_2d_f_rgb_f32, - fetch_texel_3d_f_rgb_f32 - }, - { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_f_rgba_f16, - fetch_texel_2d_f_rgba_f16, - fetch_texel_3d_f_rgba_f16 - }, - { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_f_rgba_f32, - fetch_texel_2d_f_rgba_f32, - fetch_texel_3d_f_rgba_f32 - }, - { - MESA_FORMAT_RGBX_FLOAT16, - fetch_texel_1d_xbgr16161616_float, - fetch_texel_2d_xbgr16161616_float, - fetch_texel_3d_xbgr16161616_float - }, - { - MESA_FORMAT_RGBX_FLOAT32, - fetch_texel_1d_xbgr32323232_float, - fetch_texel_2d_xbgr32323232_float, - fetch_texel_3d_xbgr32323232_float - }, + FETCH_FUNCS(A_FLOAT16), + FETCH_FUNCS(A_FLOAT32), + FETCH_FUNCS(L_FLOAT16), + FETCH_FUNCS(L_FLOAT32), + FETCH_FUNCS(LA_FLOAT16), + FETCH_FUNCS(LA_FLOAT32), + FETCH_FUNCS(I_FLOAT16), + FETCH_FUNCS(I_FLOAT32), + FETCH_FUNCS(R_FLOAT16), + FETCH_FUNCS(R_FLOAT32), + FETCH_FUNCS(RG_FLOAT16), + FETCH_FUNCS(RG_FLOAT32), + FETCH_FUNCS(RGB_FLOAT16), + FETCH_FUNCS(RGB_FLOAT32), + FETCH_FUNCS(RGBA_FLOAT16), + FETCH_FUNCS(RGBA_FLOAT32), + FETCH_FUNCS(RGBX_FLOAT16), + FETCH_FUNCS(RGBX_FLOAT32), { MESA_FORMAT_Z_FLOAT32, - fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */ - fetch_texel_2d_f_r_f32, - fetch_texel_3d_f_r_f32 + fetch_texel_1d_R_FLOAT32, /* Reuse the R32F functions. */ + fetch_texel_2d_R_FLOAT32, + fetch_texel_3d_R_FLOAT32 }, /* Packed signed/unsigned non-normalized integer formats */ - { - MESA_FORMAT_B10G10R10A2_UINT, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UINT, - NULL, - NULL, - NULL - }, + FETCH_NULL(B10G10R10A2_UINT), + FETCH_NULL(R10G10B10A2_UINT), /* Array signed/unsigned non-normalized integer formats */ - { - MESA_FORMAT_A_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_UINT8, - fetch_texel_1d_rgba_uint8, - fetch_texel_2d_rgba_uint8, - fetch_texel_3d_rgba_uint8 - }, - { - MESA_FORMAT_RGBA_UINT16, - fetch_texel_1d_rgba_uint16, - fetch_texel_2d_rgba_uint16, - fetch_texel_3d_rgba_uint16 - }, - { - MESA_FORMAT_RGBA_UINT32, - fetch_texel_1d_rgba_uint32, - fetch_texel_2d_rgba_uint32, - fetch_texel_3d_rgba_uint32 - }, - { - MESA_FORMAT_RGBA_SINT8, - fetch_texel_1d_rgba_int8, - fetch_texel_2d_rgba_int8, - fetch_texel_3d_rgba_int8 - }, - { - MESA_FORMAT_RGBA_SINT16, - fetch_texel_1d_rgba_int16, - fetch_texel_2d_rgba_int16, - fetch_texel_3d_rgba_int16 - }, - { - MESA_FORMAT_RGBA_SINT32, - fetch_texel_1d_rgba_int32, - fetch_texel_2d_rgba_int32, - fetch_texel_3d_rgba_int32 - }, - { - MESA_FORMAT_RGBX_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT32, - NULL, - NULL, - NULL - }, + FETCH_NULL(A_UINT8), + FETCH_NULL(A_UINT16), + FETCH_NULL(A_UINT32), + FETCH_NULL(A_SINT8), + FETCH_NULL(A_SINT16), + FETCH_NULL(A_SINT32), + FETCH_NULL(I_UINT8), + FETCH_NULL(I_UINT16), + FETCH_NULL(I_UINT32), + FETCH_NULL(I_SINT8), + FETCH_NULL(I_SINT16), + FETCH_NULL(I_SINT32), + FETCH_NULL(L_UINT8), + FETCH_NULL(L_UINT16), + FETCH_NULL(L_UINT32), + FETCH_NULL(L_SINT8), + FETCH_NULL(L_SINT16), + FETCH_NULL(L_SINT32), + FETCH_NULL(LA_UINT8), + FETCH_NULL(LA_UINT16), + FETCH_NULL(LA_UINT32), + FETCH_NULL(LA_SINT8), + FETCH_NULL(LA_SINT16), + FETCH_NULL(LA_SINT32), + FETCH_NULL(R_UINT8), + FETCH_NULL(R_UINT16), + FETCH_NULL(R_UINT32), + FETCH_NULL(R_SINT8), + FETCH_NULL(R_SINT16), + FETCH_NULL(R_SINT32), + FETCH_NULL(RG_UINT8), + FETCH_NULL(RG_UINT16), + FETCH_NULL(RG_UINT32), + FETCH_NULL(RG_SINT8), + FETCH_NULL(RG_SINT16), + FETCH_NULL(RG_SINT32), + FETCH_NULL(RGB_UINT8), + FETCH_NULL(RGB_UINT16), + FETCH_NULL(RGB_UINT32), + FETCH_NULL(RGB_SINT8), + FETCH_NULL(RGB_SINT16), + FETCH_NULL(RGB_SINT32), + FETCH_FUNCS(RGBA_UINT8), + FETCH_FUNCS(RGBA_UINT16), + FETCH_FUNCS(RGBA_UINT32), + FETCH_FUNCS(RGBA_SINT8), + FETCH_FUNCS(RGBA_SINT16), + FETCH_FUNCS(RGBA_SINT32), + FETCH_NULL(RGBX_UINT8), + FETCH_NULL(RGBX_UINT16), + FETCH_NULL(RGBX_UINT32), + FETCH_NULL(RGBX_SINT8), + FETCH_NULL(RGBX_SINT16), + FETCH_NULL(RGBX_SINT32), /* DXT compressed formats */ { diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h index f749b491f..d48e39bfd 100644 --- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h +++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h @@ -27,14 +27,14 @@ /** * \file texfetch_tmp.h * Texel fetch functions template. - * + * * This template file is used by texfetch.c to generate texel fetch functions - * for 1-D, 2-D and 3-D texture images. + * for 1-D, 2-D and 3-D texture images. * * It should be expanded by defining \p DIM as the number texture dimensions * (1, 2 or 3). According to the value of \p DIM a series of macros is defined * for the texel lookup in the gl_texture_image::Data. - * + * * \author Gareth Hughes * \author Brian Paul */ @@ -69,41 +69,27 @@ #endif -/* MESA_FORMAT_Z_UNORM32 ***********************************************************/ - -/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, - * returning 1 GLfloat. - * Note: no GLchan version of this function. - */ -static void FETCH(f_z32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(Z_UNORM32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[0] = src[0] * (1.0F / 0xffffffff); } -/* MESA_FORMAT_Z_UNORM16 ***********************************************************/ - -/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture, - * returning 1 GLfloat. - * Note: no GLchan version of this function. - */ -static void FETCH(f_z16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(Z_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[0] = src[0] * (1.0F / 65535.0F); } - -/* MESA_FORMAT_RGBA_F32 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats. - */ -static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RGBA_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); texel[RCOMP] = src[0]; @@ -113,15 +99,9 @@ static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_F16 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RGBA_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); texel[RCOMP] = _mesa_half_to_float(src[0]); @@ -131,14 +111,9 @@ static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage, } - -/* MESA_FORMAT_RGB_F32 *******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RGB_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); texel[RCOMP] = src[0]; @@ -148,15 +123,9 @@ static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGB_F16 *******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RGB_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); texel[RCOMP] = _mesa_half_to_float(src[0]); @@ -166,15 +135,9 @@ static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_ALPHA_F32 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); texel[RCOMP] = @@ -184,15 +147,9 @@ static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_ALPHA_F32 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); texel[RCOMP] = @@ -202,15 +159,9 @@ static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_LUMINANCE_F32 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); texel[RCOMP] = @@ -220,15 +171,9 @@ static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_LUMINANCE_F16 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); texel[RCOMP] = @@ -238,15 +183,9 @@ static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(LA_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); texel[RCOMP] = @@ -256,15 +195,9 @@ static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *tex } - - -/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(LA_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); texel[RCOMP] = @@ -274,15 +207,9 @@ static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *tex } - - -/* MESA_FORMAT_INTENSITY_F32 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(I_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); texel[RCOMP] = @@ -292,15 +219,9 @@ static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_INTENSITY_F16 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(I_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); texel[RCOMP] = @@ -310,15 +231,9 @@ static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R_FLOAT32 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D R_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); texel[RCOMP] = src[0]; @@ -328,15 +243,9 @@ static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R_FLOAT16 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D R_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); texel[RCOMP] = _mesa_half_to_float(src[0]); @@ -346,15 +255,9 @@ static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RG_FLOAT32 ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RG_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); texel[RCOMP] = src[0]; @@ -364,15 +267,9 @@ static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RG_FLOAT16 ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RG_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); texel[RCOMP] = _mesa_half_to_float(src[0]); @@ -382,17 +279,9 @@ static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage, } - - -/* - * Begin Hardware formats - */ - -/* MESA_FORMAT_A8B8G8R8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */ -static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A8B8G8R8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); @@ -402,15 +291,9 @@ static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage, } - - - - -/* MESA_FORMAT_RGBA888_REV ***************************************************/ - -/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */ -static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8B8A8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); @@ -420,13 +303,9 @@ static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_B8G8R8A8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ -static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B8G8R8A8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); @@ -436,13 +315,9 @@ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A8R8G8B8_UNORM **************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */ -static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A8R8G8B8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); @@ -452,13 +327,9 @@ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_X8B8G8R8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */ -static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(X8B8G8R8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); @@ -468,13 +339,9 @@ static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBX888_REV ***************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */ -static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8B8X8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); @@ -484,13 +351,9 @@ static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_B8G8R8X8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */ -static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B8G8R8X8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); @@ -500,13 +363,9 @@ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_X8R8G8B8_UNORM **************************************************/ - -/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */ -static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(X8R8G8B8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); @@ -516,13 +375,9 @@ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_BGR_UNORM8 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ -static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(BGR_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); texel[RCOMP] = UBYTE_TO_FLOAT( src[2] ); @@ -532,13 +387,9 @@ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGB_UNORM8 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ -static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(RGB_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); texel[RCOMP] = UBYTE_TO_FLOAT( src[0] ); @@ -548,16 +399,9 @@ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage, } - - -/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding) - instead of slow (g << 2) * 255 / 252 (always rounds down) */ - -/* MESA_FORMAT_B5G6R5_UNORM ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ -static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B5G6R5_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; @@ -568,13 +412,9 @@ static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R5G6B5_UNORM ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ -static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R5G6B5_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ @@ -585,13 +425,9 @@ static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_B4G4R4A4_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ -static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B4G4R4A4_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; @@ -602,13 +438,9 @@ static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A4R4G4B4_UNORM **************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ -static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A4R4G4B4_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); @@ -618,12 +450,9 @@ static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage, } - -/* MESA_FORMAT_A1B5G5R5_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A1B5G5R5_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; @@ -634,12 +463,9 @@ static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage, } - -/* MESA_FORMAT_B5G5R5A1_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B5G5R5A1_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = *src; @@ -650,13 +476,9 @@ static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A1R5G5B5_UNORM **************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ -static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A1R5G5B5_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ @@ -667,13 +489,9 @@ static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_B10G10R10A2_UNORM ***************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */ -static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B10G10R10A2_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLuint s = *src; @@ -684,13 +502,22 @@ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage, } +static void +FETCH(R10G10B10A2_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLuint s = *src; + texel[RCOMP] = ((s >> 0) & 0x3ff) * (1.0F / 1023.0F); + texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F); + texel[BCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F); + texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F); +} -/* MESA_FORMAT_R8G8_UNORM **********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ -static void FETCH(f_gr88)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff ); @@ -700,13 +527,9 @@ static void FETCH(f_gr88)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_G8R8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */ -static void FETCH(f_rg88)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(G8R8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT( s >> 8 ); @@ -716,13 +539,9 @@ static void FETCH(f_rg88)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L4A4_UNORM **********************************************************/ - -/* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */ -static void FETCH(f_al44)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L4A4_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -732,29 +551,21 @@ static void FETCH(f_al44)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L8A8_UNORM **********************************************************/ - -/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ -static void FETCH(f_al88)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L8A8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = + texel[RCOMP] = + texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff ); texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 ); } - - -/* MESA_FORMAT_R_UNORM8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ -static void FETCH(f_r8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +FETCH(R_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = UBYTE_TO_FLOAT(s); @@ -764,13 +575,9 @@ static void FETCH(f_r8)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R_UNORM16 ***********************************************************/ - -/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */ -static void FETCH(f_r16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +FETCH(R_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = USHORT_TO_FLOAT(s); @@ -780,29 +587,21 @@ static void FETCH(f_r16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A8L8_UNORM ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ -static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A8L8_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = + texel[RCOMP] = + texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 ); texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); } - - -/* MESA_FORMAT_R16G16_UNORM ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */ -static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R16G16_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = USHORT_TO_FLOAT( s & 0xffff ); @@ -812,13 +611,9 @@ static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_G16R16_UNORM ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */ -static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(G16R16_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = USHORT_TO_FLOAT( s >> 16 ); @@ -828,13 +623,9 @@ static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L16A16_UNORM ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */ -static void FETCH(f_al1616)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L16A16_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = @@ -844,13 +635,9 @@ static void FETCH(f_al1616)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A16L16_UNORM ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */ -static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A16L16_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = @@ -860,13 +647,9 @@ static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_B2G3R3_UNORM ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ -static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B2G3R3_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); const GLubyte s = *src; @@ -877,13 +660,9 @@ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A_UNORM8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ -static void FETCH(f_a8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -893,13 +672,9 @@ static void FETCH(f_a8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A_UNORM16 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ -static void FETCH(f_a16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = @@ -909,13 +684,9 @@ static void FETCH(f_a16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L_UNORM8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ -static void FETCH(f_l8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -925,13 +696,9 @@ static void FETCH(f_l8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L_UNORM16 ***********************************************************/ - -/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */ -static void FETCH(f_l16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = @@ -941,13 +708,9 @@ static void FETCH(f_l16)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_I_UNORM8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ -static void FETCH(f_i8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(I_UNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -957,13 +720,9 @@ static void FETCH(f_i8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_I_UNORM16 ***********************************************************/ - -/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */ -static void FETCH(f_i16)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(I_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); texel[RCOMP] = @@ -973,12 +732,9 @@ static void FETCH(f_i16)( const struct swrast_texture_image *texImage, } - - -/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ -/* Note: component order is same as for MESA_FORMAT_BGR_UNORM8 */ -static void FETCH(srgb8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(BGR_SRGB8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); texel[RCOMP] = nonlinear_to_linear(src[2]); @@ -988,10 +744,9 @@ static void FETCH(srgb8)(const struct swrast_texture_image *texImage, } - -/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */ -static void FETCH(srgba8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A8B8G8R8_SRGB)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = nonlinear_to_linear( (s >> 24) ); @@ -1001,10 +756,9 @@ static void FETCH(srgba8)(const struct swrast_texture_image *texImage, } - -/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */ -static void FETCH(sargb8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(B8G8R8A8_SRGB)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); @@ -1014,10 +768,9 @@ static void FETCH(sargb8)(const struct swrast_texture_image *texImage, } - -/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */ -static void FETCH(sabgr8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff ); @@ -1027,9 +780,9 @@ static void FETCH(sabgr8)(const struct swrast_texture_image *texImage, } -/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */ -static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff ); @@ -1039,22 +792,21 @@ static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage, } -/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */ -static void FETCH(sl8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_SRGB8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = + texel[RCOMP] = + texel[GCOMP] = texel[BCOMP] = nonlinear_to_linear(src[0]); texel[ACOMP] = 1.0F; } - -/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */ -static void FETCH(sla8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2); texel[RCOMP] = @@ -1064,13 +816,9 @@ static void FETCH(sla8)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_SINT8 **************************************************/ - static void -FETCH(rgba_int8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_SINT8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1080,13 +828,9 @@ FETCH(rgba_int8)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_SINT16 **************************************************/ - static void -FETCH(rgba_int16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_SINT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1096,13 +840,9 @@ FETCH(rgba_int16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_SINT32 **************************************************/ - static void -FETCH(rgba_int32)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_SINT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1112,13 +852,9 @@ FETCH(rgba_int32)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_UINT8 **************************************************/ - static void -FETCH(rgba_uint8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_UINT8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1128,13 +864,9 @@ FETCH(rgba_uint8)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_UINT16 **************************************************/ - static void -FETCH(rgba_uint16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_UINT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1144,13 +876,9 @@ FETCH(rgba_uint16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_UINT32 **************************************************/ - static void -FETCH(rgba_uint32)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +FETCH(RGBA_UINT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4); texel[RCOMP] = (GLfloat) src[0]; @@ -1160,14 +888,13 @@ FETCH(rgba_uint32)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_DUDV8 ********************************************************/ - -/* this format by definition produces 0,0,0,1 as rgba values, - however we'll return the dudv values as rg and fix up elsewhere */ -static void FETCH(dudv8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +/** + * This format by definition produces 0,0,0,1 as rgba values, + * however we'll return the dudv values as rg and fix up elsewhere. + */ +static void +FETCH(DUDV8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2); texel[RCOMP] = BYTE_TO_FLOAT(src[0]); @@ -1177,10 +904,9 @@ static void FETCH(dudv8)(const struct swrast_texture_image *texImage, } -/* MESA_FORMAT_R_SNORM8 ***********************************************/ - -static void FETCH(signed_r8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R_SNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX( s ); @@ -1190,12 +916,9 @@ static void FETCH(signed_r8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A_SNORM8 ***********************************************/ - -static void FETCH(signed_a8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A_SNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); texel[RCOMP] = 0.0F; @@ -1205,12 +928,9 @@ static void FETCH(signed_a8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L_SNORM8 ***********************************************/ - -static void FETCH(signed_l8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L_SNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -1220,12 +940,9 @@ static void FETCH(signed_l8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_I_SNORM8 ***********************************************/ - -static void FETCH(signed_i8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(I_SNORM8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); texel[RCOMP] = @@ -1235,12 +952,9 @@ static void FETCH(signed_i8)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R8G8_SNORM ***********************************************/ - -static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8_SNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) ); @@ -1250,12 +964,9 @@ static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L8A8_SNORM ***********************************************/ - -static void FETCH(signed_al88)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(L8A8_SNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = @@ -1265,12 +976,9 @@ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_X8B8G8R8_SNORM ***********************************************/ - -static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(X8B8G8R8_SNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); @@ -1280,12 +988,9 @@ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A8B8G8R8_SNORM ***********************************************/ - -static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(A8B8G8R8_SNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); @@ -1295,9 +1000,9 @@ static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage, } - -static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R8G8B8A8_SNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) ); @@ -1307,14 +1012,9 @@ static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texIm } - - - -/* MESA_FORMAT_R_SNORM16 ***********************************************/ - static void -FETCH(signed_r16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(R_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = SHORT_TO_FLOAT_TEX( s ); @@ -1324,13 +1024,9 @@ FETCH(signed_r16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_A_SNORM16 ***********************************************/ - static void -FETCH(signed_a16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(A_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = 0.0F; @@ -1340,13 +1036,9 @@ FETCH(signed_a16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_L_SNORM16 ***********************************************/ - static void -FETCH(signed_l16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(L_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = @@ -1356,13 +1048,9 @@ FETCH(signed_l16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_I_SNORM16 ***********************************************/ - static void -FETCH(signed_i16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(I_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); texel[RCOMP] = @@ -1372,12 +1060,8 @@ FETCH(signed_i16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_G16R16_SNORM ***********************************************/ - static void -FETCH(signed_rg1616)(const struct swrast_texture_image *texImage, +FETCH(R16G16_SNORM)(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2); @@ -1388,13 +1072,9 @@ FETCH(signed_rg1616)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_LA_SNORM16 ***********************************************/ - static void -FETCH(signed_al1616)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(LA_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2); texel[RCOMP] = @@ -1404,13 +1084,10 @@ FETCH(signed_al1616)(const struct swrast_texture_image *texImage, } +static void - -/* MESA_FORMAT_RGB_SNORM16 ***********************************************/ - -static void -FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGB_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3); texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] ); @@ -1420,13 +1097,9 @@ FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGBA_SNORM16 ***********************************************/ - static void -FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGBA_SNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] ); @@ -1436,14 +1109,9 @@ FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage, } - - - -/* MESA_FORMAT_RGBA_UNORM16 ***********************************************/ - static void -FETCH(rgba_16)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGBA_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); texel[RCOMP] = USHORT_TO_FLOAT( s[0] ); @@ -1453,12 +1121,9 @@ FETCH(rgba_16)(const struct swrast_texture_image *texImage, } - -/* MESA_FORMAT_XBGR.... **********************************************/ - static void -FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGBX_UNORM16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); texel[RCOMP] = USHORT_TO_FLOAT(s[0]); @@ -1467,9 +1132,10 @@ FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage, texel[ACOMP] = 1.0f; } + static void -FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGBX_FLOAT16)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLhalfARB *s = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); texel[RCOMP] = _mesa_half_to_float(s[0]); @@ -1478,9 +1144,10 @@ FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage, texel[ACOMP] = 1.0f; } + static void -FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +FETCH(RGBX_FLOAT32)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *s = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); texel[RCOMP] = s[0]; @@ -1489,17 +1156,13 @@ FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage, texel[ACOMP] = 1.0f; } -/* XXX other XBGR formats need to be implemented here */ - - -/* MESA_FORMAT_YCBCR *********************************************************/ - -/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats. - * We convert YCbCr to RGB here. +/** + * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA. */ -static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(YCBCR)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ const GLushort *src1 = src0 + 1; /* odd */ @@ -1521,15 +1184,12 @@ static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_YCBCR_REV *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats. - * We convert YCbCr to RGB here. +/** + * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA. */ -static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(YCBCR_REV)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ const GLushort *src1 = src0 + 1; /* odd */ @@ -1551,12 +1211,9 @@ static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage, } - - -/* MESA_TEXFORMAT_Z24_S8 ***************************************************/ - -static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(S8_UINT_Z24_UNORM)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* only return Z, not stencil data */ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); @@ -1569,12 +1226,9 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage, } - - -/* MESA_TEXFORMAT_S8_Z24 ***************************************************/ - -static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(Z24_UNORM_S8_UINT)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* only return Z, not stencil data */ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); @@ -1587,12 +1241,9 @@ static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_RGB9_E5 ******************************************************/ - -static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R9G9B9E5_FLOAT)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); rgb9e5_to_float3(*src, texel); @@ -1600,12 +1251,9 @@ static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_R11G11B10_FLOAT *********************************************/ - -static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +static void +FETCH(R11G11B10_FLOAT)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); r11g11b10f_to_float3(*src, texel); @@ -1613,12 +1261,9 @@ static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage, } - - -/* MESA_FORMAT_Z32_FLOAT_S8X24_UINT ***********************************************/ - -static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +FETCH(Z32_FLOAT_S8X24_UINT)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); texel[RCOMP] = src[0]; diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c index 134f699be..eb5bae41d 100644 --- a/mesalib/src/mesa/tnl/t_context.c +++ b/mesalib/src/mesa/tnl/t_context.c @@ -93,7 +93,7 @@ _tnl_CreateContext( struct gl_context *ctx ) } /* plug in the VBO drawing function */ - vbo_set_draw_func(ctx, _tnl_vbo_draw_prims); + vbo_set_draw_func(ctx, _tnl_draw_prims); _math_init_transformation(); _math_init_translate(); diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c index 2755ae62d..be3f059bb 100644 --- a/mesalib/src/mesa/tnl/t_draw.c +++ b/mesalib/src/mesa/tnl/t_draw.c @@ -411,7 +411,11 @@ static void unmap_vbos( struct gl_context *ctx, } -void _tnl_vbo_draw_prims(struct gl_context *ctx, +/* This is the main entrypoint into the slimmed-down software tnl + * module. In a regular swtnl driver, this can be plugged straight + * into the vbo->Driver.DrawPrims() callback. + */ +void _tnl_draw_prims(struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -421,32 +425,16 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx, struct gl_transform_feedback_object *tfb_vertcount, struct gl_buffer_object *indirect) { - const struct gl_client_array **arrays = ctx->Array._DrawArrays; - - if (!index_bounds_valid) - vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims); - - _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); -} - -/* This is the main entrypoint into the slimmed-down software tnl - * module. In a regular swtnl driver, this can be plugged straight - * into the vbo->Driver.DrawPrims() callback. - */ -void _tnl_draw_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index) -{ TNLcontext *tnl = TNL_CONTEXT(ctx); + const struct gl_client_array **arrays = ctx->Array._DrawArrays; const GLuint TEST_SPLIT = 0; const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES; GLint max_basevertex = prim->basevertex; GLuint i; + if (!index_bounds_valid) + vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims); + /* Mesa core state should have been validated already */ assert(ctx->NewState == 0x0); @@ -471,7 +459,7 @@ void _tnl_draw_prims( struct gl_context *ctx, */ vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, - _tnl_vbo_draw_prims ); + _tnl_draw_prims ); return; } else if ((GLint)max_index + max_basevertex > max) { @@ -489,7 +477,7 @@ void _tnl_draw_prims( struct gl_context *ctx, */ vbo_split_prims( ctx, arrays, prim, nr_prims, ib, 0, max_index + prim->basevertex, - _tnl_vbo_draw_prims, + _tnl_draw_prims, &limits ); } else { diff --git a/mesalib/src/mesa/tnl/tnl.h b/mesalib/src/mesa/tnl/tnl.h index 59a0ac380..8c59ff9e5 100644 --- a/mesalib/src/mesa/tnl/tnl.h +++ b/mesalib/src/mesa/tnl/tnl.h @@ -77,15 +77,6 @@ struct _mesa_index_buffer; void _tnl_draw_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index); - -void -_tnl_vbo_draw_prims( struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, |