diff options
author | marha <marha@users.sourceforge.net> | 2012-08-16 14:48:54 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-16 14:48:54 +0200 |
commit | 4aac32998c2b173b84aec0b020aa086fef4b1423 (patch) | |
tree | 3ffcb971bcc2f01929f60f8f704996544b69b2e1 /mesalib | |
parent | 9ddf44af81782451cee798e06749ce3067a14a41 (diff) | |
download | vcxsrv-4aac32998c2b173b84aec0b020aa086fef4b1423.tar.gz vcxsrv-4aac32998c2b173b84aec0b020aa086fef4b1423.tar.bz2 vcxsrv-4aac32998c2b173b84aec0b020aa086fef4b1423.zip |
libxcb xserver mesa git update 16 Aug 2012
Diffstat (limited to 'mesalib')
55 files changed, 3182 insertions, 513 deletions
diff --git a/mesalib/autogen.sh b/mesalib/autogen.sh index b5f6ec4a9..626d21334 100644 --- a/mesalib/autogen.sh +++ b/mesalib/autogen.sh @@ -3,17 +3,11 @@ srcdir=`dirname "$0"` test -z "$srcdir" && srcdir=. -SRCDIR=`(cd "$srcdir" && pwd)` ORIGDIR=`pwd` - -if test "x$SRCDIR" != "x$ORIGDIR"; then - echo "Mesa cannot be built when srcdir != builddir" 1>&2 - exit 1 -fi - -MAKEFLAGS="" +cd "$srcdir" autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? if test -z "$NOCONFIGURE"; then "$srcdir"/configure "$@" diff --git a/mesalib/common.py b/mesalib/common.py index 6121a4114..6ff9608c4 100644 --- a/mesalib/common.py +++ b/mesalib/common.py @@ -98,5 +98,6 @@ def AddOptions(opts): opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes')) opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no')) opts.Add(BoolOption('quiet', 'DEPRECATED: profile build', 'yes')) + opts.Add(BoolOption('texture_float', 'enable floating-point textures and renderbuffers', 'no')) if host_platform == 'windows': opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 2ecedaf0b..0329bad80 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -28,7 +28,7 @@ LT_INIT([disable-static]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.24 -LIBDRM_RADEON_REQUIRED=2.4.31 +LIBDRM_RADEON_REQUIRED=2.4.38 LIBDRM_INTEL_REQUIRED=2.4.37 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED=2.4.33 diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index d41c052c2..246eb30a9 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -78,7 +78,7 @@ GL_ARB_explicit_attrib_location DONE (i915, i965, r300, r6 GL_ARB_occlusion_query2 DONE (r300, r600, swrast) GL_ARB_sampler_objects DONE (i965, r300, r600) GL_ARB_shader_bit_encoding DONE -GL_ARB_texture_rgb10_a2ui DONE (r600) +GL_ARB_texture_rgb10_a2ui DONE (i965, r600) GL_ARB_texture_swizzle DONE (same as EXT version) (i965, r300, r600, swrast) GL_ARB_timer_query DONE GL_ARB_instanced_arrays DONE (i965, r300, r600) diff --git a/mesalib/docs/relnotes-8.1.html b/mesalib/docs/relnotes-8.1.html index 4c4d48715..8d27c6663 100644 --- a/mesalib/docs/relnotes-8.1.html +++ b/mesalib/docs/relnotes-8.1.html @@ -35,6 +35,8 @@ Note: some of the new features are only available with certain drivers. <li>GL_ARB_base_instance</li> <li>GL_ARB_blend_func_extended</li> <li>GL_ARB_debug_output</li> +<li>GL_ARB_invalidate_subdate - Currently a "no-op" implementation. This +extension is always enabled in all drivers.</li> <li>GL_ARB_shader_bit_encoding</li> <li>GL_ARB_timer_query</li> <li>GL_ARB_transform_feedback3</li> @@ -43,6 +45,11 @@ Note: some of the new features are only available with certain drivers. <li>GL_EXT_read_format_bgra for ES 1.1 and 2.0</li> <li>GL_EXT_texture_rg for ES 2.x</li> <li>GL_NV_read_buffer for ES 2.0</li> +<li>EGL_KHR_create_context</li> +<li>EGL_KHR_surfaceless_context - This replaces the +EGL_KHR_surfaceless_{gles1,gles2,opengl} extensions that were never approved +by Khronos.</li> +<li>EGL_EXT_create_context_robustness</li> </ul> diff --git a/mesalib/include/GL/glext.h b/mesalib/include/GL/glext.h index 8fce0f6f0..6175ad450 100644 --- a/mesalib/include/GL/glext.h +++ b/mesalib/include/GL/glext.h @@ -29,9 +29,9 @@ extern "C" { */ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated $Date: 2012-04-26 00:59:42 -0700 (Thu, 26 Apr 2012) $ */ +/* glext.h last updated $Date: 2012-08-06 02:01:01 -0700 (Mon, 06 Aug 2012) $ */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 81 +#define GL_GLEXT_VERSION 83 /* Function declaration macros - to move into glplatform.h */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -1164,6 +1164,290 @@ extern "C" { /* reuse GL_TEXTURE_IMMUTABLE_FORMAT */ #endif +#ifndef GL_VERSION_4_3 +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +/* Reuse tokens from ARB_arrays_of_arrays (none, GLSL only) */ +/* Reuse tokens from ARB_fragment_layer_viewport (none, GLSL only) */ +/* Reuse tokens from ARB_shader_image_size (none, GLSL only) */ +/* Reuse tokens from ARB_ES3_compatibility */ +/* reuse GL_COMPRESSED_RGB8_ETC2 */ +/* reuse GL_COMPRESSED_SRGB8_ETC2 */ +/* reuse GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ +/* reuse GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ +/* reuse GL_COMPRESSED_RGBA8_ETC2_EAC */ +/* reuse GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */ +/* reuse GL_COMPRESSED_R11_EAC */ +/* reuse GL_COMPRESSED_SIGNED_R11_EAC */ +/* reuse GL_COMPRESSED_RG11_EAC */ +/* reuse GL_COMPRESSED_SIGNED_RG11_EAC */ +/* reuse GL_PRIMITIVE_RESTART_FIXED_INDEX */ +/* reuse GL_ANY_SAMPLES_PASSED_CONSERVATIVE */ +/* reuse GL_MAX_ELEMENT_INDEX */ +/* Reuse tokens from ARB_clear_buffer_object (none) */ +/* Reuse tokens from ARB_compute_shader */ +/* reuse GL_COMPUTE_SHADER */ +/* reuse GL_MAX_COMPUTE_UNIFORM_BLOCKS */ +/* reuse GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS */ +/* reuse GL_MAX_COMPUTE_IMAGE_UNIFORMS */ +/* reuse GL_MAX_COMPUTE_SHARED_MEMORY_SIZE */ +/* reuse GL_MAX_COMPUTE_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTERS */ +/* reuse GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMPUTE_LOCAL_INVOCATIONS */ +/* reuse GL_MAX_COMPUTE_WORK_GROUP_COUNT */ +/* reuse GL_MAX_COMPUTE_WORK_GROUP_SIZE */ +/* reuse GL_COMPUTE_LOCAL_WORK_SIZE */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_DISPATCH_INDIRECT_BUFFER */ +/* reuse GL_DISPATCH_INDIRECT_BUFFER_BINDING */ +/* Reuse tokens from ARB_copy_image (none) */ +/* Reuse tokens from KHR_debug */ +/* reuse GL_DEBUG_OUTPUT_SYNCHRONOUS */ +/* reuse GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH */ +/* reuse GL_DEBUG_CALLBACK_FUNCTION */ +/* reuse GL_DEBUG_CALLBACK_USER_PARAM */ +/* reuse GL_DEBUG_SOURCE_API */ +/* reuse GL_DEBUG_SOURCE_WINDOW_SYSTEM */ +/* reuse GL_DEBUG_SOURCE_SHADER_COMPILER */ +/* reuse GL_DEBUG_SOURCE_THIRD_PARTY */ +/* reuse GL_DEBUG_SOURCE_APPLICATION */ +/* reuse GL_DEBUG_SOURCE_OTHER */ +/* reuse GL_DEBUG_TYPE_ERROR */ +/* reuse GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR */ +/* reuse GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR */ +/* reuse GL_DEBUG_TYPE_PORTABILITY */ +/* reuse GL_DEBUG_TYPE_PERFORMANCE */ +/* reuse GL_DEBUG_TYPE_OTHER */ +/* reuse GL_MAX_DEBUG_MESSAGE_LENGTH */ +/* reuse GL_MAX_DEBUG_LOGGED_MESSAGES */ +/* reuse GL_DEBUG_LOGGED_MESSAGES */ +/* reuse GL_DEBUG_SEVERITY_HIGH */ +/* reuse GL_DEBUG_SEVERITY_MEDIUM */ +/* reuse GL_DEBUG_SEVERITY_LOW */ +/* reuse GL_DEBUG_TYPE_MARKER */ +/* reuse GL_DEBUG_TYPE_PUSH_GROUP */ +/* reuse GL_DEBUG_TYPE_POP_GROUP */ +/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */ +/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_BUFFER */ +/* reuse GL_SHADER */ +/* reuse GL_PROGRAM */ +/* reuse GL_QUERY */ +/* reuse GL_PROGRAM_PIPELINE */ +/* reuse GL_SAMPLER */ +/* reuse GL_DISPLAY_LIST */ +/* reuse GL_MAX_LABEL_LENGTH */ +/* reuse GL_DEBUG_OUTPUT */ +/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */ +/* reuse GL_STACK_UNDERFLOW */ +/* reuse GL_STACK_OVERFLOW */ +/* Reuse tokens from ARB_explicit_uniform_location */ +/* reuse GL_MAX_UNIFORM_LOCATIONS */ +/* Reuse tokens from ARB_framebuffer_no_attachments */ +/* reuse GL_FRAMEBUFFER_DEFAULT_WIDTH */ +/* reuse GL_FRAMEBUFFER_DEFAULT_HEIGHT */ +/* reuse GL_FRAMEBUFFER_DEFAULT_LAYERS */ +/* reuse GL_FRAMEBUFFER_DEFAULT_SAMPLES */ +/* reuse GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS */ +/* reuse GL_MAX_FRAMEBUFFER_WIDTH */ +/* reuse GL_MAX_FRAMEBUFFER_HEIGHT */ +/* reuse GL_MAX_FRAMEBUFFER_LAYERS */ +/* reuse GL_MAX_FRAMEBUFFER_SAMPLES */ +/* Reuse tokens from ARB_internalformat_query2 */ +/* reuse GL_INTERNALFORMAT_SUPPORTED */ +/* reuse GL_INTERNALFORMAT_PREFERRED */ +/* reuse GL_INTERNALFORMAT_RED_SIZE */ +/* reuse GL_INTERNALFORMAT_GREEN_SIZE */ +/* reuse GL_INTERNALFORMAT_BLUE_SIZE */ +/* reuse GL_INTERNALFORMAT_ALPHA_SIZE */ +/* reuse GL_INTERNALFORMAT_DEPTH_SIZE */ +/* reuse GL_INTERNALFORMAT_STENCIL_SIZE */ +/* reuse GL_INTERNALFORMAT_SHARED_SIZE */ +/* reuse GL_INTERNALFORMAT_RED_TYPE */ +/* reuse GL_INTERNALFORMAT_GREEN_TYPE */ +/* reuse GL_INTERNALFORMAT_BLUE_TYPE */ +/* reuse GL_INTERNALFORMAT_ALPHA_TYPE */ +/* reuse GL_INTERNALFORMAT_DEPTH_TYPE */ +/* reuse GL_INTERNALFORMAT_STENCIL_TYPE */ +/* reuse GL_MAX_WIDTH */ +/* reuse GL_MAX_HEIGHT */ +/* reuse GL_MAX_DEPTH */ +/* reuse GL_MAX_LAYERS */ +/* reuse GL_MAX_COMBINED_DIMENSIONS */ +/* reuse GL_COLOR_COMPONENTS */ +/* reuse GL_DEPTH_COMPONENTS */ +/* reuse GL_STENCIL_COMPONENTS */ +/* reuse GL_COLOR_RENDERABLE */ +/* reuse GL_DEPTH_RENDERABLE */ +/* reuse GL_STENCIL_RENDERABLE */ +/* reuse GL_FRAMEBUFFER_RENDERABLE */ +/* reuse GL_FRAMEBUFFER_RENDERABLE_LAYERED */ +/* reuse GL_FRAMEBUFFER_BLEND */ +/* reuse GL_READ_PIXELS */ +/* reuse GL_READ_PIXELS_FORMAT */ +/* reuse GL_READ_PIXELS_TYPE */ +/* reuse GL_TEXTURE_IMAGE_FORMAT */ +/* reuse GL_TEXTURE_IMAGE_TYPE */ +/* reuse GL_GET_TEXTURE_IMAGE_FORMAT */ +/* reuse GL_GET_TEXTURE_IMAGE_TYPE */ +/* reuse GL_MIPMAP */ +/* reuse GL_MANUAL_GENERATE_MIPMAP */ +/* reuse GL_AUTO_GENERATE_MIPMAP */ +/* reuse GL_COLOR_ENCODING */ +/* reuse GL_SRGB_READ */ +/* reuse GL_SRGB_WRITE */ +/* reuse GL_FILTER */ +/* reuse GL_VERTEX_TEXTURE */ +/* reuse GL_TESS_CONTROL_TEXTURE */ +/* reuse GL_TESS_EVALUATION_TEXTURE */ +/* reuse GL_GEOMETRY_TEXTURE */ +/* reuse GL_FRAGMENT_TEXTURE */ +/* reuse GL_COMPUTE_TEXTURE */ +/* reuse GL_TEXTURE_SHADOW */ +/* reuse GL_TEXTURE_GATHER */ +/* reuse GL_TEXTURE_GATHER_SHADOW */ +/* reuse GL_SHADER_IMAGE_LOAD */ +/* reuse GL_SHADER_IMAGE_STORE */ +/* reuse GL_SHADER_IMAGE_ATOMIC */ +/* reuse GL_IMAGE_TEXEL_SIZE */ +/* reuse GL_IMAGE_COMPATIBILITY_CLASS */ +/* reuse GL_IMAGE_PIXEL_FORMAT */ +/* reuse GL_IMAGE_PIXEL_TYPE */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_WIDTH */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_SIZE */ +/* reuse GL_CLEAR_BUFFER */ +/* reuse GL_TEXTURE_VIEW */ +/* reuse GL_VIEW_COMPATIBILITY_CLASS */ +/* reuse GL_FULL_SUPPORT */ +/* reuse GL_CAVEAT_SUPPORT */ +/* reuse GL_IMAGE_CLASS_4_X_32 */ +/* reuse GL_IMAGE_CLASS_2_X_32 */ +/* reuse GL_IMAGE_CLASS_1_X_32 */ +/* reuse GL_IMAGE_CLASS_4_X_16 */ +/* reuse GL_IMAGE_CLASS_2_X_16 */ +/* reuse GL_IMAGE_CLASS_1_X_16 */ +/* reuse GL_IMAGE_CLASS_4_X_8 */ +/* reuse GL_IMAGE_CLASS_2_X_8 */ +/* reuse GL_IMAGE_CLASS_1_X_8 */ +/* reuse GL_IMAGE_CLASS_11_11_10 */ +/* reuse GL_IMAGE_CLASS_10_10_10_2 */ +/* reuse GL_VIEW_CLASS_128_BITS */ +/* reuse GL_VIEW_CLASS_96_BITS */ +/* reuse GL_VIEW_CLASS_64_BITS */ +/* reuse GL_VIEW_CLASS_48_BITS */ +/* reuse GL_VIEW_CLASS_32_BITS */ +/* reuse GL_VIEW_CLASS_24_BITS */ +/* reuse GL_VIEW_CLASS_16_BITS */ +/* reuse GL_VIEW_CLASS_8_BITS */ +/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGB */ +/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGBA */ +/* reuse GL_VIEW_CLASS_S3TC_DXT3_RGBA */ +/* reuse GL_VIEW_CLASS_S3TC_DXT5_RGBA */ +/* reuse GL_VIEW_CLASS_RGTC1_RED */ +/* reuse GL_VIEW_CLASS_RGTC2_RG */ +/* reuse GL_VIEW_CLASS_BPTC_UNORM */ +/* reuse GL_VIEW_CLASS_BPTC_FLOAT */ +/* Reuse tokens from ARB_invalidate_subdata (none) */ +/* Reuse tokens from ARB_multi_draw_indirect (none) */ +/* Reuse tokens from ARB_program_interface_query */ +/* reuse GL_UNIFORM */ +/* reuse GL_UNIFORM_BLOCK */ +/* reuse GL_PROGRAM_INPUT */ +/* reuse GL_PROGRAM_OUTPUT */ +/* reuse GL_BUFFER_VARIABLE */ +/* reuse GL_SHADER_STORAGE_BLOCK */ +/* reuse GL_VERTEX_SUBROUTINE */ +/* reuse GL_TESS_CONTROL_SUBROUTINE */ +/* reuse GL_TESS_EVALUATION_SUBROUTINE */ +/* reuse GL_GEOMETRY_SUBROUTINE */ +/* reuse GL_FRAGMENT_SUBROUTINE */ +/* reuse GL_COMPUTE_SUBROUTINE */ +/* reuse GL_VERTEX_SUBROUTINE_UNIFORM */ +/* reuse GL_TESS_CONTROL_SUBROUTINE_UNIFORM */ +/* reuse GL_TESS_EVALUATION_SUBROUTINE_UNIFORM */ +/* reuse GL_GEOMETRY_SUBROUTINE_UNIFORM */ +/* reuse GL_FRAGMENT_SUBROUTINE_UNIFORM */ +/* reuse GL_COMPUTE_SUBROUTINE_UNIFORM */ +/* reuse GL_TRANSFORM_FEEDBACK_VARYING */ +/* reuse GL_ACTIVE_RESOURCES */ +/* reuse GL_MAX_NAME_LENGTH */ +/* reuse GL_MAX_NUM_ACTIVE_VARIABLES */ +/* reuse GL_MAX_NUM_COMPATIBLE_SUBROUTINES */ +/* reuse GL_NAME_LENGTH */ +/* reuse GL_TYPE */ +/* reuse GL_ARRAY_SIZE */ +/* reuse GL_OFFSET */ +/* reuse GL_BLOCK_INDEX */ +/* reuse GL_ARRAY_STRIDE */ +/* reuse GL_MATRIX_STRIDE */ +/* reuse GL_IS_ROW_MAJOR */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_INDEX */ +/* reuse GL_BUFFER_BINDING */ +/* reuse GL_BUFFER_DATA_SIZE */ +/* reuse GL_NUM_ACTIVE_VARIABLES */ +/* reuse GL_ACTIVE_VARIABLES */ +/* reuse GL_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_REFERENCED_BY_TESS_CONTROL_SHADER */ +/* reuse GL_REFERENCED_BY_TESS_EVALUATION_SHADER */ +/* reuse GL_REFERENCED_BY_GEOMETRY_SHADER */ +/* reuse GL_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_TOP_LEVEL_ARRAY_SIZE */ +/* reuse GL_TOP_LEVEL_ARRAY_STRIDE */ +/* reuse GL_LOCATION */ +/* reuse GL_LOCATION_INDEX */ +/* reuse GL_IS_PER_PATCH */ +/* Reuse tokens from ARB_robust_buffer_access_behavior (none) */ +/* Reuse tokens from ARB_shader_storage_buffer_object */ +/* reuse GL_SHADER_STORAGE_BUFFER */ +/* reuse GL_SHADER_STORAGE_BUFFER_BINDING */ +/* reuse GL_SHADER_STORAGE_BUFFER_START */ +/* reuse GL_SHADER_STORAGE_BUFFER_SIZE */ +/* reuse GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS */ +/* reuse GL_MAX_SHADER_STORAGE_BLOCK_SIZE */ +/* reuse GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT */ +/* reuse GL_SHADER_STORAGE_BARRIER_BIT */ +/* reuse GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES */ +/* Reuse tokens from ARB_stencil_texturing */ +/* reuse GL_DEPTH_STENCIL_TEXTURE_MODE */ +/* Reuse tokens from ARB_texture_buffer_range */ +/* reuse GL_TEXTURE_BUFFER_OFFSET */ +/* reuse GL_TEXTURE_BUFFER_SIZE */ +/* reuse GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT */ +/* Reuse tokens from ARB_texture_query_levels (none) */ +/* Reuse tokens from ARB_texture_storage_multisample (none) */ +/* Reuse tokens from ARB_texture_view */ +/* reuse GL_TEXTURE_VIEW_MIN_LEVEL */ +/* reuse GL_TEXTURE_VIEW_NUM_LEVELS */ +/* reuse GL_TEXTURE_VIEW_MIN_LAYER */ +/* reuse GL_TEXTURE_VIEW_NUM_LAYERS */ +/* reuse GL_TEXTURE_IMMUTABLE_LEVELS */ +/* Reuse tokens from ARB_vertex_attrib_binding */ +/* reuse GL_VERTEX_ATTRIB_BINDING */ +/* reuse GL_VERTEX_ATTRIB_RELATIVE_OFFSET */ +/* reuse GL_VERTEX_BINDING_DIVISOR */ +/* reuse GL_VERTEX_BINDING_OFFSET */ +/* reuse GL_VERTEX_BINDING_STRIDE */ +/* reuse GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET */ +/* reuse GL_MAX_VERTEX_ATTRIB_BINDINGS */ +#endif + #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 @@ -2399,6 +2683,414 @@ extern "C" { #define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F #endif +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif + +#ifndef GL_KHR_debug +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_DISPLAY_LIST 0x82E7 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +/* reuse GL_STACK_UNDERFLOW */ +/* reuse GL_STACK_OVERFLOW */ +#endif + +#ifndef GL_ARB_arrays_of_arrays +#endif + +#ifndef GL_ARB_clear_buffer_object +#endif + +#ifndef GL_ARB_compute_shader +#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_LOCAL_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#endif + +#ifndef GL_ARB_copy_image +#endif + +#ifndef GL_ARB_debug_group +/* reuse GL_DEBUG_TYPE_MARKER */ +/* reuse GL_DEBUG_TYPE_PUSH_GROUP */ +/* reuse GL_DEBUG_TYPE_POP_GROUP */ +/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */ +/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_STACK_UNDERFLOW */ +/* reuse GL_STACK_OVERFLOW */ +#endif + +#ifndef GL_ARB_debug_label +/* reuse GL_BUFFER */ +/* reuse GL_SHADER */ +/* reuse GL_PROGRAM */ +/* reuse GL_QUERY */ +/* reuse GL_PROGRAM_PIPELINE */ +/* reuse GL_SAMPLER */ +/* DISPLAY_LIST used in compatibility profile only */ +/* reuse GL_DISPLAY_LIST */ +/* reuse GL_MAX_LABEL_LENGTH */ +/* reuse GL_VERTEX_ARRAY */ +#endif + +#ifndef GL_ARB_debug_output2 +/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */ +/* reuse GL_DEBUG_OUTPUT */ +#endif + +#ifndef GL_ARB_ES3_compatibility +#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_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_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#endif + +#ifndef GL_ARB_explicit_uniform_location +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#endif + +#ifndef GL_ARB_fragment_layer_viewport +#endif + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#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_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#endif + +#ifndef GL_ARB_internalformat_query2 +/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */ +/* reuse GL_NUM_SAMPLE_COUNTS */ +/* reuse GL_RENDERBUFFER */ +/* reuse GL_SAMPLES */ +/* reuse GL_TEXTURE_1D */ +/* reuse GL_TEXTURE_1D_ARRAY */ +/* reuse GL_TEXTURE_2D */ +/* reuse GL_TEXTURE_2D_ARRAY */ +/* reuse GL_TEXTURE_3D */ +/* reuse GL_TEXTURE_CUBE_MAP */ +/* reuse GL_TEXTURE_CUBE_MAP_ARRAY */ +/* reuse GL_TEXTURE_RECTANGLE */ +/* reuse GL_TEXTURE_BUFFER */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_COMPRESSED */ +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_SRGB_DECODE_ARB 0x8299 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#endif + +#ifndef GL_ARB_invalidate_subdata +#endif + +#ifndef GL_ARB_multi_draw_indirect +#endif + +#ifndef GL_ARB_program_interface_query +#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 +/* reuse GL_ATOMIC_COUNTER_BUFFER */ +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#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_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#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_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#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_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ +/* reuse GL_COMPATIBLE_SUBROUTINES */ +#endif + +#ifndef GL_ARB_robust_buffer_access_behavior +#endif + +#ifndef GL_ARB_shader_image_size +#endif + +#ifndef GL_ARB_shader_storage_buffer_object +#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_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#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 0x2000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS +/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ +#endif + +#ifndef GL_ARB_stencil_texturing +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#endif + +#ifndef GL_ARB_texture_buffer_range +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#endif + +#ifndef GL_ARB_texture_query_levels +#endif + +#ifndef GL_ARB_texture_storage_multisample +#endif + +#ifndef GL_ARB_texture_view +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#endif + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#endif + +#ifndef GL_ARB_robustness_isolation +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -5478,6 +6170,12 @@ extern "C" { #ifndef GL_NV_shader_atomic_float #endif +#ifndef GL_AMD_query_buffer_object +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 +#endif + /*************************************************************/ @@ -5577,6 +6275,10 @@ typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLen typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); #endif +#ifndef GL_KHR_debug +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + #ifndef GL_NV_vdpau_interop typedef GLintptr GLvdpauSurfaceNV; #endif @@ -5777,16 +6479,16 @@ typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); #define GL_VERSION_1_4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); @@ -6261,13 +6963,13 @@ typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint ind /* ARB_copy_buffer */ /* ARB_uniform_buffer_object */ #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); #endif @@ -6362,6 +7064,36 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, /* ARB_texture_storage */ #endif +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +/* OpenGL 4.3 reuses entry points from these extensions: */ +/* ARB_arrays_of_arrays (no entry points, GLSL only) */ +/* ARB_fragment_layer_viewport (no entry points, GLSL only) */ +/* ARB_shader_image_size (no entry points, GLSL only) */ +/* ARB_ES3_compatibility (no entry points) */ +/* ARB_clear_buffer_object */ +/* ARB_compute_shader */ +/* ARB_copy_image */ +/* ARB_debug_group */ +/* ARB_debug_label */ +/* KHR_debug (ARB_debug_output promoted to KHR without suffixes) */ +/* ARB_debug_output2 (no entry points) */ +/* ARB_explicit_uniform_location (no entry points) */ +/* ARB_framebuffer_no_attachments */ +/* ARB_internalformat_query2 */ +/* ARB_invalidate_subdata */ +/* ARB_multi_draw_indirect */ +/* ARB_program_interface_query */ +/* ARB_robust_buffer_access_behavior (no entry points) */ +/* ARB_shader_storage_buffer_object */ +/* ARB_stencil_texturing (no entry points) */ +/* ARB_texture_buffer_range */ +/* ARB_texture_query_levels (no entry points) */ +/* ARB_texture_storage_multisample */ +/* ARB_texture_view */ +/* ARB_vertex_attrib_binding */ +#endif + #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifdef GL_GLEXT_PROTOTYPES @@ -7116,13 +7848,13 @@ typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum w #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); #endif #ifndef GL_ARB_fragment_coord_conventions @@ -7800,13 +8532,13 @@ typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint locati #ifndef GL_ARB_base_instance #define GL_ARB_base_instance 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); #endif #ifndef GL_ARB_shading_language_420pack @@ -7816,11 +8548,11 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (G #ifndef GL_ARB_transform_feedback_instanced #define GL_ARB_transform_feedback_instanced 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei primcount); -GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); #endif #ifndef GL_ARB_compressed_texture_pixel_storage @@ -7883,6 +8615,257 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum ta typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #endif +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +/* KHR_debug also reuses entry points from ARB_debug_group and ARB_debug_label */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +#endif + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +#endif + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif + +#ifndef GL_ARB_debug_group +#define GL_ARB_debug_group 1 +/* ARB_debug_group reuses entry points from KHR_debug */ +#endif + +#ifndef GL_ARB_debug_label +#define GL_ARB_debug_label 1 +/* ARB_debug_label reuses entry points from KHR_debug */ +#endif + +#ifndef GL_ARB_debug_output2 +#define GL_ARB_debug_output2 1 +#endif + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +#endif + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +#endif + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +#endif + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 +#endif + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +#endif + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 +#endif + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 +#endif + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#endif + +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -10048,10 +11031,10 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, c #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const GLvoid *pointer); GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const GLvoid *pointer); typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); #endif @@ -11805,6 +12788,10 @@ typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle) #define GL_NV_shader_atomic_float 1 #endif +#ifndef GL_AMD_query_buffer_object +#define GL_AMD_query_buffer_object 1 +#endif + #ifdef __cplusplus } diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h index d3a66c52d..97e1a1a44 100644 --- a/mesalib/include/GL/internal/dri_interface.h +++ b/mesalib/include/GL/internal/dri_interface.h @@ -800,8 +800,8 @@ struct __DRIdri2LoaderExtensionRec { #define __DRI_DRI2_VERSION 3 #define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */ -#define __DRI_API_GLES 1 -#define __DRI_API_GLES2 2 +#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */ +#define __DRI_API_GLES2 2 /**< OpenGL ES 2.0 or 3.0 */ #define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */ #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0 diff --git a/mesalib/scons/custom.py b/mesalib/scons/custom.py index cc953bd99..43e7727aa 100644 --- a/mesalib/scons/custom.py +++ b/mesalib/scons/custom.py @@ -235,6 +235,10 @@ def parse_source_list(env, filename, names=None): # parse the source list file parser = source_list.SourceListParser() src = env.File(filename).srcnode() + + parser.add_symbol('top_srcdir', env.Dir('#').abspath) + parser.add_symbol('top_builddir', env['build_dir']) + sym_table = parser.parse(src.abspath) if names: diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py index f4776d83d..8fc17b3fa 100644 --- a/mesalib/scons/gallium.py +++ b/mesalib/scons/gallium.py @@ -298,6 +298,10 @@ def generate(env): cppdefines += ['BEOS_THREADS'] if env['embedded']: cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED'] + if env['texture_float']: + print 'warning: Floating-point textures enabled.' + print 'warning: Please consult docs/patents.txt with your lawyer before building Mesa.' + cppdefines += ['TEXTURE_FLOAT_ENABLED'] env.Append(CPPDEFINES = cppdefines) # C compiler options diff --git a/mesalib/scons/source_list.py b/mesalib/scons/source_list.py index 8111f4318..e16d1f9b6 100644 --- a/mesalib/scons/source_list.py +++ b/mesalib/scons/source_list.py @@ -13,6 +13,7 @@ The goal is to allow Makefile's and SConscript's to share source listing. class SourceListParser(object): def __init__(self): + self.symbol_table = {} self._reset() def _reset(self, filename=None): @@ -20,7 +21,6 @@ class SourceListParser(object): self.line_no = 1 self.line_cont = '' - self.symbol_table = {} def _error(self, msg): raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg)) @@ -125,3 +125,6 @@ class SourceListParser(object): raise return self.symbol_table + + def add_symbol(self, name, value): + self.symbol_table[name] = value diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index 3887e65fb..bf1c392cd 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -203,7 +203,7 @@ set_fragment_shader(struct blit_state *ctx, uint writemask, enum pipe_texture_target pipe_tex) { if (!ctx->fs[pipe_tex][writemask]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex); + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0); ctx->fs[pipe_tex][writemask] = util_make_fragment_tex_shader_writemask(ctx->pipe, tgsi_tex, @@ -223,7 +223,7 @@ set_depthstencil_fragment_shader(struct blit_state *ctx, enum pipe_texture_target pipe_tex) { if (!ctx->fs_depthstencil[pipe_tex]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex); + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0); ctx->fs_depthstencil[pipe_tex] = util_make_fragment_tex_shader_writedepthstencil(ctx->pipe, tgsi_tex, @@ -242,7 +242,7 @@ set_depth_fragment_shader(struct blit_state *ctx, enum pipe_texture_target pipe_tex) { if (!ctx->fs_depth[pipe_tex]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex); + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0); ctx->fs_depth[pipe_tex] = util_make_fragment_tex_shader_writedepth(ctx->pipe, tgsi_tex, @@ -261,7 +261,7 @@ set_stencil_fragment_shader(struct blit_state *ctx, enum pipe_texture_target pipe_tex) { if (!ctx->fs_stencil[pipe_tex]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex); + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0); ctx->fs_stencil[pipe_tex] = util_make_fragment_tex_shader_writestencil(ctx->pipe, tgsi_tex, @@ -464,7 +464,7 @@ util_blit_pixels(struct blit_state *ctx, dstX0, dstY0, dstX1, dstY1); src_format = util_format_linear(src_tex->format); - dst_format = util_format_linear(dst->format); + dst_format = util_format_linear(dst->texture->format); /* See whether we will blit depth or stencil. */ is_depth = util_format_has_depth(src_desc); diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index fa71f25ea..a95e1b535 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -81,6 +81,12 @@ struct blitter_context_priv void *fs_texfetch_depthstencil[PIPE_MAX_TEXTURE_TYPES]; void *fs_texfetch_stencil[PIPE_MAX_TEXTURE_TYPES]; + /* FS which outputs one sample from a multisample texture. */ + void *fs_texfetch_col_msaa[PIPE_MAX_TEXTURE_TYPES]; + void *fs_texfetch_depth_msaa[PIPE_MAX_TEXTURE_TYPES]; + void *fs_texfetch_depthstencil_msaa[PIPE_MAX_TEXTURE_TYPES]; + void *fs_texfetch_stencil_msaa[PIPE_MAX_TEXTURE_TYPES]; + /* Blend state. */ void *blend_write_color; /**< blend state with writemask of RGBA */ void *blend_keep_color; /**< blend state with writemask of 0 */ @@ -559,7 +565,8 @@ static void get_texcoords(struct pipe_sampler_view *src, { struct pipe_resource *tex = src->texture; unsigned level = src->u.tex.first_level; - boolean normalized = tex->target != PIPE_TEXTURE_RECT; + boolean normalized = tex->target != PIPE_TEXTURE_RECT && + tex->nr_samples <= 1; if (normalized) { out[0] = x1 / (float)u_minify(src_width0, level); @@ -593,7 +600,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 layer, unsigned sample, unsigned x1, unsigned y1, unsigned x2, unsigned y2) { @@ -630,8 +637,16 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, break; case PIPE_TEXTURE_2D_ARRAY: - for (i = 0; i < 4; i++) - ctx->vertices[i][1][2] = layer; /*r*/ + for (i = 0; i < 4; i++) { + ctx->vertices[i][1][2] = layer; /*r*/ + ctx->vertices[i][1][3] = sample; /*q*/ + } + break; + + case PIPE_TEXTURE_2D: + for (i = 0; i < 4; i++) { + ctx->vertices[i][1][2] = sample; /*r*/ + } break; default:; @@ -672,81 +687,149 @@ void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs, static INLINE void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx, - unsigned tex_target) + struct pipe_resource *tex) { struct pipe_context *pipe = ctx->base.pipe; - assert(tex_target < PIPE_MAX_TEXTURE_TYPES); + assert(tex->target < PIPE_MAX_TEXTURE_TYPES); - /* Create the fragment shader on-demand. */ - if (!ctx->fs_texfetch_col[tex_target]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target); + if (tex->nr_samples > 1) { + void **shader = &ctx->fs_texfetch_col_msaa[tex->target]; - ctx->fs_texfetch_col[tex_target] = - util_make_fragment_tex_shader(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR); - } + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, + tex->nr_samples); + + *shader = util_make_fs_blit_msaa_color(pipe, tgsi_tex); + } - return ctx->fs_texfetch_col[tex_target]; + return *shader; + } else { + void **shader = &ctx->fs_texfetch_col[tex->target]; + + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0); + + *shader = + util_make_fragment_tex_shader(pipe, tgsi_tex, + TGSI_INTERPOLATE_LINEAR); + } + + return *shader; + } } static INLINE void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx, - unsigned tex_target) + struct pipe_resource *tex) { struct pipe_context *pipe = ctx->base.pipe; - assert(tex_target < PIPE_MAX_TEXTURE_TYPES); + assert(tex->target < PIPE_MAX_TEXTURE_TYPES); - /* Create the fragment shader on-demand. */ - if (!ctx->fs_texfetch_depth[tex_target]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target); + if (tex->nr_samples > 1) { + void **shader = &ctx->fs_texfetch_depth_msaa[tex->target]; - ctx->fs_texfetch_depth[tex_target] = - util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex, - TGSI_INTERPOLATE_LINEAR); - } + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, + tex->nr_samples); + + *shader = + util_make_fs_blit_msaa_depth(pipe, tgsi_tex); + } + + return *shader; + } else { + void **shader = &ctx->fs_texfetch_depth[tex->target]; + + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0); + + *shader = + util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex, + TGSI_INTERPOLATE_LINEAR); + } - return ctx->fs_texfetch_depth[tex_target]; + return *shader; + } } static INLINE void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx, - unsigned tex_target) + struct pipe_resource *tex) { struct pipe_context *pipe = ctx->base.pipe; - assert(tex_target < PIPE_MAX_TEXTURE_TYPES); + assert(tex->target < PIPE_MAX_TEXTURE_TYPES); - /* Create the fragment shader on-demand. */ - if (!ctx->fs_texfetch_depthstencil[tex_target]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target); + if (tex->nr_samples > 1) { + void **shader = &ctx->fs_texfetch_depthstencil_msaa[tex->target]; - ctx->fs_texfetch_depthstencil[tex_target] = - util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex, - TGSI_INTERPOLATE_LINEAR); - } + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, + tex->nr_samples); + + *shader = + util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex); + } + + return *shader; + } else { + void **shader = &ctx->fs_texfetch_depthstencil[tex->target]; + + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0); - return ctx->fs_texfetch_depthstencil[tex_target]; + *shader = + util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex, + TGSI_INTERPOLATE_LINEAR); + } + + return *shader; + } } static INLINE void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx, - unsigned tex_target) + struct pipe_resource *tex) { struct pipe_context *pipe = ctx->base.pipe; - assert(tex_target < PIPE_MAX_TEXTURE_TYPES); + assert(tex->target < PIPE_MAX_TEXTURE_TYPES); - /* Create the fragment shader on-demand. */ - if (!ctx->fs_texfetch_stencil[tex_target]) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target); + if (tex->nr_samples > 1) { + void **shader = &ctx->fs_texfetch_stencil_msaa[tex->target]; - ctx->fs_texfetch_stencil[tex_target] = - util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex, - TGSI_INTERPOLATE_LINEAR); - } + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, + tex->nr_samples); + + *shader = + util_make_fs_blit_msaa_stencil(pipe, tgsi_tex); + } + + return *shader; + } else { + void **shader = &ctx->fs_texfetch_stencil[tex->target]; + + /* Create the fragment shader on-demand. */ + if (!*shader) { + unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0); + + *shader = + util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex, + TGSI_INTERPOLATE_LINEAR); + } - return ctx->fs_texfetch_stencil[tex_target]; + return *shader; + } } static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx) @@ -879,7 +962,7 @@ void util_blitter_clear(struct blitter_context *blitter, NULL, NULL); } -void util_blitter_clear_depth_custom(struct blitter_context *blitter, +void util_blitter_custom_clear_depth(struct blitter_context *blitter, unsigned width, unsigned height, double depth, void *custom_dsa) { @@ -889,10 +972,26 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter, } static -boolean is_overlap(unsigned sx1, unsigned sx2, unsigned sy1, unsigned sy2, - unsigned dx1, unsigned dx2, unsigned dy1, unsigned dy2) +boolean is_overlap(unsigned dstx, unsigned dsty, unsigned dstz, + const struct pipe_box *srcbox) { - return sx1 < dx2 && sx2 > dx1 && sy1 < dy2 && sy2 > dy1; + struct pipe_box src = *srcbox; + + if (src.width < 0) { + src.x += src.width; + src.width = -src.width; + } + if (src.height < 0) { + src.y += src.height; + src.height = -src.height; + } + if (src.depth < 0) { + src.z += src.depth; + src.depth = -src.depth; + } + return src.x < dstx+src.width && src.x+src.width > dstx && + src.y < dsty+src.height && src.y+src.height > dsty && + src.z < dstz+src.depth && src.z+src.depth > dstz; } void util_blitter_default_dst_texture(struct pipe_surface *dst_templ, @@ -989,10 +1088,10 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter, void util_blitter_copy_texture(struct blitter_context *blitter, struct pipe_resource *dst, - unsigned dst_level, + unsigned dst_level, unsigned dst_sample_mask, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - unsigned src_level, + unsigned src_level, unsigned src_sample, const struct pipe_box *srcbox) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; @@ -1012,9 +1111,9 @@ void util_blitter_copy_texture(struct blitter_context *blitter, src_view = pipe->create_sampler_view(pipe, src, &src_templ); /* Copy. */ - util_blitter_copy_texture_view(blitter, dst_view, dstx, dsty, src_view, - srcbox, src->width0, src->height0, - PIPE_MASK_RGBAZS); + util_blitter_copy_texture_view(blitter, dst_view, dst_sample_mask, dstx, + dsty, src_view, src_sample, srcbox, + src->width0, src->height0, PIPE_MASK_RGBAZS); pipe_surface_reference(&dst_view, NULL); pipe_sampler_view_reference(&src_view, NULL); @@ -1022,8 +1121,10 @@ void util_blitter_copy_texture(struct blitter_context *blitter, void util_blitter_copy_texture_view(struct blitter_context *blitter, struct pipe_surface *dst, + unsigned dst_sample_mask, unsigned dstx, unsigned dsty, struct pipe_sampler_view *src, + unsigned src_sample, const struct pipe_box *srcbox, unsigned src_width0, unsigned src_height0, unsigned mask) @@ -1032,8 +1133,8 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, struct pipe_context *pipe = ctx->base.pipe; struct pipe_framebuffer_state fb_state; enum pipe_texture_target src_target = src->texture->target; - unsigned width = srcbox->width; - unsigned height = srcbox->height; + int abs_width = abs(srcbox->width); + int abs_height = abs(srcbox->height); boolean blit_stencil, blit_depth; const struct util_format_description *src_desc = util_format_description(src->format); @@ -1053,8 +1154,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, /* Sanity checks. */ if (dst->texture == src->texture && dst->u.tex.level == src->u.tex.first_level) { - assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height, - dstx, dstx + width, dsty, dsty + height)); + assert(!is_overlap(dstx, dsty, 0, srcbox)); } /* XXX should handle 3d regions */ assert(srcbox->depth == 1); @@ -1077,17 +1177,17 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_write_depth_stencil); pipe->bind_fs_state(pipe, - blitter_get_fs_texfetch_depthstencil(ctx, src_target)); + blitter_get_fs_texfetch_depthstencil(ctx, src->texture)); } else if (blit_depth) { pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_write_depth_keep_stencil); pipe->bind_fs_state(pipe, - blitter_get_fs_texfetch_depth(ctx, src_target)); + blitter_get_fs_texfetch_depth(ctx, src->texture)); } else { /* is_stencil */ pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_write_stencil); pipe->bind_fs_state(pipe, - blitter_get_fs_texfetch_stencil(ctx, src_target)); + blitter_get_fs_texfetch_stencil(ctx, src->texture)); } fb_state.nr_cbufs = 0; @@ -1096,7 +1196,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, pipe->bind_blend_state(pipe, ctx->blend_write_color); pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); pipe->bind_fs_state(pipe, - blitter_get_fs_texfetch_col(ctx, src_target)); + blitter_get_fs_texfetch_col(ctx, src->texture)); fb_state.nr_cbufs = 1; fb_state.cbufs[0] = dst; @@ -1127,51 +1227,36 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->set_framebuffer_state(pipe, &fb_state); - pipe->set_sample_mask(pipe, ~0); + pipe->set_sample_mask(pipe, dst_sample_mask); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, dst->width, dst->height); - switch (src_target) { + if ((src_target == PIPE_TEXTURE_1D || + src_target == PIPE_TEXTURE_2D || + src_target == PIPE_TEXTURE_RECT) && + src->texture->nr_samples <= 1) { /* Draw the quad with the draw_rectangle callback. */ - case PIPE_TEXTURE_1D: - case PIPE_TEXTURE_2D: - case PIPE_TEXTURE_RECT: - { - /* Set texture coordinates. - use a pipe color union - * for interface purposes. - * XXX pipe_color_union is a wrong name since we use that to set - * texture coordinates too. - */ - union pipe_color_union coord; - get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y, - srcbox->x+width, srcbox->y+height, coord.f); - - /* Draw. */ - blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0, - UTIL_BLITTER_ATTRIB_TEXCOORD, &coord); - } - break; + /* Set texture coordinates. - use a pipe color union + * for interface purposes. + * XXX pipe_color_union is a wrong name since we use that to set + * texture coordinates too. + */ + union pipe_color_union coord; + get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y, + srcbox->x+srcbox->width, srcbox->y+srcbox->height, coord.f); + + /* Draw. */ + blitter->draw_rectangle(blitter, dstx, dsty, dstx+abs_width, dsty+abs_height, 0, + UTIL_BLITTER_ATTRIB_TEXCOORD, &coord); + } else { /* Draw the quad with the generic codepath. */ - default: - /* Set texture coordinates. */ - switch (src_target) { - case PIPE_TEXTURE_1D_ARRAY: - case PIPE_TEXTURE_2D_ARRAY: - case PIPE_TEXTURE_3D: - case PIPE_TEXTURE_CUBE: - blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z, - srcbox->y, srcbox->x, - srcbox->x + width, srcbox->y + height); - break; - - default: - assert(0); - } - - blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, 0); - break; + blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z, + src_sample, + srcbox->x, srcbox->y, + srcbox->x + srcbox->width, srcbox->y + srcbox->height); + blitter_draw(ctx, dstx, dsty, dstx+abs_width, dsty+abs_height, 0); } blitter_restore_vertex_states(ctx); @@ -1298,6 +1383,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, void util_blitter_custom_depth_stencil(struct blitter_context *blitter, struct pipe_surface *zsurf, struct pipe_surface *cbsurf, + unsigned sample_mask, void *dsa_stage, float depth) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; @@ -1333,6 +1419,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, } fb_state.zsbuf = zsurf; pipe->set_framebuffer_state(pipe, &fb_state); + pipe->set_sample_mask(pipe, sample_mask); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height); @@ -1404,3 +1491,64 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, blitter_unset_running_flag(ctx); pipe_so_target_reference(&so_target, NULL); } + +/* probably radeon specific */ +void util_blitter_custom_resolve_color(struct blitter_context *blitter, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_layer, + struct pipe_resource *src, + unsigned src_layer, + void *custom_blend) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_context *pipe = ctx->base.pipe; + struct pipe_framebuffer_state fb_state; + struct pipe_surface *srcsurf, *dstsurf, surf_tmpl; + + blitter_set_running_flag(ctx); + blitter_check_saved_vertex_states(ctx); + blitter_check_saved_fragment_states(ctx); + + /* bind states */ + pipe->bind_blend_state(pipe, custom_blend); + pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state); + pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE)); + + memset(&surf_tmpl, 0, sizeof(surf_tmpl)); + surf_tmpl.format = dst->format; + surf_tmpl.u.tex.level = dst_level; + surf_tmpl.u.tex.first_layer = dst_layer; + surf_tmpl.u.tex.last_layer = dst_layer; + surf_tmpl.usage = PIPE_BIND_RENDER_TARGET; + + dstsurf = pipe->create_surface(pipe, dst, &surf_tmpl); + + surf_tmpl.u.tex.level = 0; + surf_tmpl.u.tex.first_layer = src_layer; + surf_tmpl.u.tex.last_layer = src_layer; + + srcsurf = pipe->create_surface(pipe, src, &surf_tmpl); + + /* set a framebuffer state */ + fb_state.width = src->width0; + fb_state.height = src->height0; + fb_state.nr_cbufs = 2; + fb_state.cbufs[0] = srcsurf; + fb_state.cbufs[1] = dstsurf; + fb_state.zsbuf = NULL; + pipe->set_framebuffer_state(pipe, &fb_state); + + blitter_set_common_draw_rect_state(ctx); + blitter_set_dst_dimensions(ctx, src->width0, src->height0); + blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0, + 0, 0, NULL); + blitter_restore_fb_state(ctx); + blitter_restore_vertex_states(ctx); + blitter_restore_fragment_states(ctx); + blitter_unset_running_flag(ctx); + + pipe_surface_reference(&srcsurf, NULL); + pipe_surface_reference(&dstsurf, NULL); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h index 7600391c5..f227902c1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.h +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h @@ -156,10 +156,6 @@ void util_blitter_clear(struct blitter_context *blitter, const union pipe_color_union *color, double depth, unsigned stencil); -void util_blitter_clear_depth_custom(struct blitter_context *blitter, - unsigned width, unsigned height, - double depth, void *custom_dsa); - /** * Check if the blitter (with the help of the driver) can blit between * the two resources. @@ -178,6 +174,10 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter, * a software fallback path is taken and both surfaces must be of the same * format. * + * Only one sample of a multisample texture can be copied and is specified by + * src_sample. If the destination is a multisample resource, dst_sample_mask + * specifies the sample mask. For single-sample resources, set dst_sample_mask + * to ~0. * * These states must be saved in the blitter in addition to the state objects * already required to be saved: @@ -190,10 +190,10 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter, */ void util_blitter_copy_texture(struct blitter_context *blitter, struct pipe_resource *dst, - unsigned dst_level, + unsigned dst_level, unsigned dst_sample_mask, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - unsigned src_level, + unsigned src_level, unsigned src_sample, const struct pipe_box *srcbox); /** @@ -218,8 +218,10 @@ void util_blitter_copy_texture(struct blitter_context *blitter, */ void util_blitter_copy_texture_view(struct blitter_context *blitter, struct pipe_surface *dst, + unsigned dst_sample_mask, unsigned dstx, unsigned dsty, struct pipe_sampler_view *src, + unsigned src_sample, const struct pipe_box *srcbox, unsigned src_width0, unsigned src_height0, unsigned mask); @@ -288,11 +290,33 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, unsigned dstx, unsigned dsty, unsigned width, unsigned height); +/* The following functions are customized variants of the clear functions. + * Some drivers use them internally to do things like MSAA resolve + * and resource decompression. It usually consists of rendering a full-screen + * quad with a special blend or DSA state. + */ + +/* Used by r300g for depth decompression. */ +void util_blitter_custom_clear_depth(struct blitter_context *blitter, + unsigned width, unsigned height, + double depth, void *custom_dsa); + +/* Used by r600g for depth decompression. */ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, struct pipe_surface *zsurf, struct pipe_surface *cbsurf, + unsigned sample_mask, void *dsa_stage, float depth); +/* Used by r600g for MSAA color resolve. */ +void util_blitter_custom_resolve_color(struct blitter_context *blitter, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_layer, + struct pipe_resource *src, + unsigned src_layer, + void *custom_blend); + /* The functions below should be used to save currently bound constant state * objects inside a driver. The objects are automatically restored at the end * of the util_blitter_{clear, copy_region, fill_region} functions and then diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 2d603e4dd..a1ece415f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -548,23 +548,37 @@ util_query_clear_result(union pipe_query_result *result, unsigned type) /** Convert PIPE_TEXTURE_x to TGSI_TEXTURE_x */ static INLINE unsigned -util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target) +util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target, + unsigned nr_samples) { switch (pipe_tex_target) { case PIPE_TEXTURE_1D: + assert(nr_samples <= 1); return TGSI_TEXTURE_1D; + case PIPE_TEXTURE_2D: - return TGSI_TEXTURE_2D; + return nr_samples > 1 ? TGSI_TEXTURE_2D_MSAA : TGSI_TEXTURE_2D; + case PIPE_TEXTURE_RECT: + assert(nr_samples <= 1); return TGSI_TEXTURE_RECT; + case PIPE_TEXTURE_3D: + assert(nr_samples <= 1); return TGSI_TEXTURE_3D; + case PIPE_TEXTURE_CUBE: + assert(nr_samples <= 1); return TGSI_TEXTURE_CUBE; + case PIPE_TEXTURE_1D_ARRAY: + assert(nr_samples <= 1); return TGSI_TEXTURE_1D_ARRAY; + case PIPE_TEXTURE_2D_ARRAY: - return TGSI_TEXTURE_2D_ARRAY; + return nr_samples > 1 ? TGSI_TEXTURE_2D_ARRAY_MSAA : + TGSI_TEXTURE_2D_ARRAY; + default: assert(0 && "unexpected texture target"); return TGSI_TEXTURE_UNKNOWN; diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c index 3476b6ce0..5f0134d70 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c @@ -40,7 +40,12 @@ #include "pipe/p_state.h" #include "util/u_simple_shaders.h" #include "util/u_debug.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_strings.h" #include "tgsi/tgsi_ureg.h" +#include "tgsi/tgsi_text.h" +#include <stdio.h> /* include last */ @@ -353,3 +358,131 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs, return ureg_create_shader_and_destroy( ureg, pipe ); } + + +static void * +util_make_fs_blit_msaa_gen(struct pipe_context *pipe, + unsigned tgsi_tex, + const char *output_semantic, + const char *output_mask) +{ + static const char shader_templ[] = + "FRAG\n" + "DCL IN[0], GENERIC[0], LINEAR\n" + "DCL SAMP[0]\n" + "DCL OUT[0], %s\n" + "DCL TEMP[0]\n" + + "F2U TEMP[0], IN[0]\n" + "TXF OUT[0]%s, TEMP[0].xyzz, SAMP[0], %s\n" + "END\n"; + + const char *type = tgsi_texture_names[tgsi_tex]; + char text[sizeof(shader_templ)+100]; + struct tgsi_token tokens[1000]; + struct pipe_shader_state state = {tokens}; + + assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA || + tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA); + + sprintf(text, shader_templ, output_semantic, output_mask, type); + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) { + puts(text); + assert(0); + return NULL; + } +#if 0 + tgsi_dump(state.tokens, 0); +#endif + + return pipe->create_fs_state(pipe, &state); +} + + +/** + * Make a fragment shader that sets the output color to a color + * fetched from a multisample texture. + * \param tex_target one of PIPE_TEXTURE_x + */ +void * +util_make_fs_blit_msaa_color(struct pipe_context *pipe, + unsigned tgsi_tex) +{ + return util_make_fs_blit_msaa_gen(pipe, tgsi_tex, + "COLOR[0]", ""); +} + + +/** + * Make a fragment shader that sets the output depth to a depth value + * fetched from a multisample texture. + * \param tex_target one of PIPE_TEXTURE_x + */ +void * +util_make_fs_blit_msaa_depth(struct pipe_context *pipe, + unsigned tgsi_tex) +{ + return util_make_fs_blit_msaa_gen(pipe, tgsi_tex, + "POSITION", ".z"); +} + + +/** + * Make a fragment shader that sets the output stencil to a stencil value + * fetched from a multisample texture. + * \param tex_target one of PIPE_TEXTURE_x + */ +void * +util_make_fs_blit_msaa_stencil(struct pipe_context *pipe, + unsigned tgsi_tex) +{ + return util_make_fs_blit_msaa_gen(pipe, tgsi_tex, + "STENCIL", ".y"); +} + + +/** + * Make a fragment shader that sets the output depth and stencil to depth + * and stencil values fetched from two multisample textures / samplers. + * The sizes of both textures should match (it should be one depth-stencil + * texture). + * \param tex_target one of PIPE_TEXTURE_x + */ +void * +util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe, + unsigned tgsi_tex) +{ + static const char shader_templ[] = + "FRAG\n" + "DCL IN[0], GENERIC[0], LINEAR\n" + "DCL SAMP[0..1]\n" + "DCL OUT[0], POSITION\n" + "DCL OUT[1], STENCIL\n" + "DCL TEMP[0]\n" + + "F2U TEMP[0], IN[0]\n" + "TXF OUT[0].z, TEMP[0], SAMP[0], %s\n" + "TXF OUT[1].y, TEMP[0], SAMP[1], %s\n" + "END\n"; + + const char *type = tgsi_texture_names[tgsi_tex]; + char text[sizeof(shader_templ)+100]; + struct tgsi_token tokens[1000]; + struct pipe_shader_state state = {tokens}; + + assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA || + tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA); + + sprintf(text, shader_templ, type, type); + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) { + assert(0); + return NULL; + } +#if 0 + tgsi_dump(state.tokens, 0); +#endif + + return pipe->create_fs_state(pipe, &state); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h index 0764998a3..e4ffde652 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h +++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h @@ -95,6 +95,26 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs, int input_semantic, int input_interpolate); + +extern void * +util_make_fs_blit_msaa_color(struct pipe_context *pipe, + unsigned tgsi_tex); + + +extern void * +util_make_fs_blit_msaa_depth(struct pipe_context *pipe, + unsigned tgsi_tex); + + +extern void * +util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe, + unsigned tgsi_tex); + + +void * +util_make_fs_blit_msaa_stencil(struct pipe_context *pipe, + unsigned tgsi_tex); + #ifdef __cplusplus } #endif diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index d86153c48..20639c93d 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -23,9 +23,6 @@ # builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl. # For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used. -# Hack to make some of the non-automake variables work. -TOP=$(top_builddir) - AM_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ @@ -39,7 +36,6 @@ AM_CXXFLAGS = $(AM_CFLAGS) AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c -GLSL_SRCDIR=$(top_srcdir)/src/glsl include Makefile.sources noinst_LTLIBRARIES = libglslcommon.la libglsl.la @@ -96,8 +92,8 @@ glsl_parser.cc glsl_parser.h: glsl_parser.yy BUILT_SOURCES = glsl_parser.h builtin_function.cpp CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) -builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT) - $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp +builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT) + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp glcpp/libglcpp.la: cd glcpp ; $(MAKE) $(AM_MAKEFLAGS) diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 765f06a27..aafb53eae 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -1,6 +1,7 @@ # shared source lists for Makefile, SConscript, and Android.mk -GLSL_SRCDIR ?= . +GLSL_SRCDIR = $(top_srcdir)/src/glsl +GLSL_BUILDDIR = $(top_builddir)/src/glsl # libglcpp @@ -8,8 +9,8 @@ LIBGLCPP_FILES = \ $(GLSL_SRCDIR)/glcpp/pp.c LIBGLCPP_GENERATED_FILES = \ - $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \ - $(GLSL_SRCDIR)/glcpp/glcpp-parse.c + $(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \ + $(GLSL_BUILDDIR)/glcpp/glcpp-parse.c # libglsl @@ -102,10 +103,10 @@ BUILTIN_COMPILER_CXX_FILES = \ $(GLSL_SRCDIR)/builtin_stubs.cpp BUILTIN_COMPILER_GENERATED_CXX_FILES = \ - $(GLSL_SRCDIR)/glsl_lexer.cc \ - $(GLSL_SRCDIR)/glsl_parser.cc + $(GLSL_BUILDDIR)/glsl_lexer.cc \ + $(GLSL_BUILDDIR)/glsl_parser.cc # libglsl generated sources LIBGLSL_GENERATED_CXX_FILES = \ - $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ - $(GLSL_SRCDIR)/builtin_function.cpp + $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ + $(GLSL_BUILDDIR)/builtin_function.cpp diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am index e7d5d2ca3..7a95b6848 100644 --- a/mesalib/src/glsl/glcpp/Makefile.am +++ b/mesalib/src/glsl/glcpp/Makefile.am @@ -20,10 +20,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -# Hack to make some of the non-automake variables work. -TOP=$(top_builddir) - -GLSL_SRCDIR=$(top_srcdir)/src/glsl include ../Makefile.sources AM_CFLAGS = \ diff --git a/mesalib/src/mapi/glapi/Makefile.am b/mesalib/src/mapi/glapi/Makefile.am index 668d7faa9..181a28a7c 100644 --- a/mesalib/src/mapi/glapi/Makefile.am +++ b/mesalib/src/mapi/glapi/Makefile.am @@ -27,6 +27,7 @@ AM_CPPFLAGS = \ $(DEFINES) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ + -I$(top_builddir)/src/mapi \ -I$(top_srcdir)/src/mesa if HAVE_X86_ASM diff --git a/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml b/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml new file mode 100644 index 000000000..3e4ffc300 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> +<category name="GL_ARB_invalidate_subdata" number="666"> + <function name="InvalidateTexSubImage" offset="assign"> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + </function> + + <function name="InvalidateTexImage" offset="assign"> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + + <function name="InvalidateBufferSubData" offset="assign"> + <param name="buffer" type="GLuint"/> + <param name="offset" type="GLintptr"/> + <param name="length" type="GLsizeiptr"/> + </function> + + <function name="InvalidateBufferData" offset="assign"> + <param name="buffer" type="GLuint"/> + </function> + + <function name="InvalidateSubFramebuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="numAttachments" type="GLsizei" counter="true"/> + <param name="attachments" type="const GLenum *" count="numAttachments"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> + + <function name="InvalidateFramebuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="numAttachments" type="GLsizei" counter="true"/> + <param name="attachments" type="const GLenum *" count="numAttachments"/> + </function> +</category> +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 52aeb3a6d..499ec09a8 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -176,7 +176,7 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) $(PYTHON_GEN) $< \ - --printer glapi --mode lib gl_and_es_API.xml > $@ + --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 4c8969803..751a18f5d 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8067,6 +8067,8 @@ <xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="ARB_invalidate_subdata.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- Non-ARB extensions sorted by extension number. --> <category name="GL_EXT_blend_color" number="2"> diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk index 1b05a405b..eab8eb40c 100644 --- a/mesalib/src/mapi/glapi/gen/glapi_gen.mk +++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk @@ -1,14 +1,14 @@ # Helpers for glapi header generation -ifndef TOP -$(error TOP must be defined.) +ifndef top_srcdir +$(error top_srcdir must be defined.) endif glapi_gen_common_deps := \ - $(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \ - $(wildcard $(TOP)/src/mapi/glapi/gen/*.py) + $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \ + $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py) -glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py +glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py glapi_gen_mapi_deps := \ $(glapi_gen_mapi_script) \ $(glapi_gen_common_deps) @@ -21,7 +21,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \ --mode lib --printer $(2) $(1) > $@ endef -glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py +glapi_gen_dispatch_script := $(top_srcdir)/src/mapi/glapi/gen/gl_table.py glapi_gen_dispatch_deps := $(glapi_gen_common_deps) # $(1): path to an XML file @@ -32,7 +32,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \ -f $(1) -m remap_table $(if $(2),-c $(2),) > $@ endef -glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py +glapi_gen_remap_script := $(top_srcdir)/src/mapi/glapi/gen/remap_helper.py glapi_gen_remap_deps := $(glapi_gen_common_deps) # $(1): path to an XML file diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index bb70ed6ea..f1cd6d67c 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -42,8 +42,7 @@ main/git_sha1.h: main/git_sha1.h.tmp fi # include glapi_gen.mk for generating glapi headers for GLES -TOP = $(top_srcdir) -GLAPI = $(TOP)/src/mapi/glapi/gen +GLAPI = $(top_srcdir)/src/mapi/glapi/gen include $(GLAPI)/glapi_gen.mk BUILT_SOURCES = \ @@ -78,24 +77,25 @@ main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_d main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \ + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \ -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@ main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \ + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \ -S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@ program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y - mkdir -p program - $(YACC) -v -d --output=program/program_parse.tab.c $< + $(MKDIR_P) program + $(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $< program/lex.yy.c: program/program_lexer.l - mkdir -p program - $(LEX) --never-interactive --outfile=$@ $< + $(MKDIR_P) program + $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $< noinst_LTLIBRARIES = libmesa.la libmesagallium.la SRCDIR = $(top_srcdir)/src/mesa/ +BUILDDIR = $(top_builddir)/src/mesa/ include sources.mak AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) @@ -107,12 +107,21 @@ MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM MESA_ASM_FILES_FOR_ARCH += $(X86_FILES) +AM_CPPFLAGS += \ + -I$(top_builddir)/src/mesa/x86 \ + -I$(top_srcdir)/src/mesa/x86 endif if HAVE_X86_64_ASM MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES) +AM_CPPFLAGS += \ + -I$(top_builddir)/src/mesa/x86-64 \ + -I$(top_srcdir)/src/mesa/x86-64 endif if HAVE_SPARC_ASM MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES) +AM_CPPFLAGS += \ + -I$(top_builddir)/src/mesa/sparc \ + -I$(top_srcdir)/src/mesa/sparc endif libmesa_la_SOURCES = \ diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index d36b1a3b8..ca01a3301 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -74,6 +74,8 @@ #include "program/program.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" +#include "main/enums.h" +#include "main/glformats.h" /** Return offset in bytes of the field within a vertex struct */ @@ -3158,8 +3160,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, * ReadPixels() and passed to Tex[Sub]Image(). */ static GLenum -get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) +get_temp_image_type(struct gl_context *ctx, gl_format format) { + GLenum baseFormat, type; + + baseFormat = _mesa_get_format_base_format(format); + switch (baseFormat) { case GL_RGBA: case GL_RGB: @@ -3174,7 +3180,7 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) else if (ctx->DrawBuffer->Visual.redBits <= 16) return GL_UNSIGNED_SHORT; else - return GL_FLOAT; + return _mesa_get_format_datatype(format); case GL_DEPTH_COMPONENT: return GL_UNSIGNED_INT; case GL_DEPTH_STENCIL: @@ -3216,12 +3222,10 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, format = GL_RGBA; } + type = get_temp_image_type(ctx, texImage->TexFormat); if (_mesa_is_format_integer_color(texImage->TexFormat)) { - _mesa_problem(ctx, "unsupported integer color copyteximage"); - return; + format = _mesa_base_format_to_integer_format(format); } - - type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { _mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()"); diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 91ae186fe..86409dd06 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, mesa_api = API_OPENGLES2; break; case __DRI_API_OPENGL_CORE: + mesa_api = API_OPENGL_CORE; + break; default: *error = __DRI_CTX_ERROR_BAD_API; return NULL; @@ -218,6 +220,20 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, } } + /* Mesa does not support the GL_ARB_compatibilty extension or the + * compatibility profile. This means that we treat a API_OPENGL 3.1 as + * API_OPENGL_CORE and reject API_OPENGL 3.2+. + */ + if (mesa_api == API_OPENGL && major_version == 3 && minor_version == 1) + mesa_api = API_OPENGL_CORE; + + if (mesa_api == API_OPENGL + && ((major_version > 3) + || (major_version == 3 && minor_version >= 2))) { + *error = __DRI_CTX_ERROR_BAD_API; + return NULL; + } + /* The EGL_KHR_create_context spec says: * * "Flags are only defined for OpenGL context creation, and specifying @@ -228,8 +244,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api, * anything specific about this case. However, none of the known flags * have any meaning in an ES context, so this seems safe. */ - if (mesa_api != __DRI_API_OPENGL - && mesa_api != __DRI_API_OPENGL_CORE + if (mesa_api != API_OPENGL + && mesa_api != API_OPENGL_CORE && flags != 0) { *error = __DRI_CTX_ERROR_BAD_FLAG; return NULL; diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index ca6bda027..7773fd905 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -719,11 +719,20 @@ dri_create_context(gl_api api, */ (void) flags; - if (api == API_OPENGL - && (major_version > 2 - || (major_version == 2 && minor_version > 1))) { - *error = __DRI_CTX_ERROR_BAD_VERSION; - goto context_fail; + switch (api) { + case API_OPENGL: + if (major_version > 2 + || (major_version == 2 && minor_version > 1)) { + *error = __DRI_CTX_ERROR_BAD_VERSION; + return GL_FALSE; + } + break; + case API_OPENGLES: + case API_OPENGLES2: + break; + case API_OPENGL_CORE: + *error = __DRI_CTX_ERROR_BAD_API; + return GL_FALSE; } ctx = CALLOC_STRUCT(dri_context); diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c index 81be46d5f..6b1499f4f 100644 --- a/mesalib/src/mesa/main/api_exec.c +++ b/mesalib/src/mesa/main/api_exec.c @@ -158,7 +158,7 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_GetError(exec, _mesa_GetError); SET_GetFloatv(exec, _mesa_GetFloatv); SET_GetString(exec, _mesa_GetString); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_LineStipple(exec, _mesa_LineStipple); } SET_LineWidth(exec, _mesa_LineWidth); @@ -197,13 +197,13 @@ _mesa_create_exec_table(struct gl_context *ctx) } SET_Viewport(exec, _mesa_Viewport); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { _mesa_init_accum_dispatch(exec); _mesa_init_dlist_dispatch(exec); } SET_ClearDepth(exec, _mesa_ClearDepth); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); SET_ColorMaterial(exec, _mesa_ColorMaterial); @@ -213,9 +213,11 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_DepthRange(exec, _mesa_DepthRange); _mesa_init_drawpix_dispatch(exec); - _mesa_init_feedback_dispatch(exec); + if (ctx->API == API_OPENGL) { + _mesa_init_feedback_dispatch(exec); + } - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_Fogf(exec, _mesa_Fogf); SET_Fogfv(exec, _mesa_Fogfv); @@ -241,7 +243,7 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); SET_GetTexImage(exec, _mesa_GetTexImage); SET_Hint(exec, _mesa_Hint); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_IndexMask(exec, _mesa_IndexMask); } SET_IsEnabled(exec, _mesa_IsEnabled); @@ -257,24 +259,22 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_LoadMatrixd(exec, _mesa_LoadMatrixd); } - _mesa_init_eval_dispatch(exec); - - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { + _mesa_init_eval_dispatch(exec); SET_MultMatrixd(exec, _mesa_MultMatrixd); + _mesa_init_pixel_dispatch(exec); } - _mesa_init_pixel_dispatch(exec); - SET_PixelStoref(exec, _mesa_PixelStoref); SET_PointSize(exec, _mesa_PointSize); SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonOffset(exec, _mesa_PolygonOffset); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_PolygonStipple(exec, _mesa_PolygonStipple); - } - _mesa_init_attrib_dispatch(exec); - _mesa_init_rastpos_dispatch(exec); + _mesa_init_attrib_dispatch(exec); + _mesa_init_rastpos_dispatch(exec); + } SET_ReadPixels(exec, _mesa_ReadPixels); if (ctx->API != API_OPENGL_CORE) { @@ -285,13 +285,15 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_TexEnviv(exec, _mesa_TexEnviv); } - _mesa_init_texgen_dispatch(exec); + if (ctx->API != API_OPENGL_CORE) { + _mesa_init_texgen_dispatch(exec); + } SET_TexImage1D(exec, _mesa_TexImage1D); SET_TexParameterf(exec, _mesa_TexParameterf); SET_TexParameterfv(exec, _mesa_TexParameterfv); SET_TexParameteriv(exec, _mesa_TexParameteriv); - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_Translated(exec, _mesa_Translated); } @@ -300,7 +302,7 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_DeleteTextures(exec, _mesa_DeleteTextures); SET_GenTextures(exec, _mesa_GenTextures); #if _HAVE_FULL_GL - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_AreTexturesResident(exec, _mesa_AreTexturesResident); SET_ColorPointer(exec, _mesa_ColorPointer); } @@ -341,9 +343,11 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); - _mesa_init_colortable_dispatch(exec); - _mesa_init_convolve_dispatch(exec); - _mesa_init_histogram_dispatch(exec); + if (ctx->API == API_OPENGL) { + _mesa_init_colortable_dispatch(exec); + _mesa_init_convolve_dispatch(exec); + _mesa_init_histogram_dispatch(exec); + } /* OpenGL 2.0 */ SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); @@ -362,7 +366,9 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 3. GL_EXT_polygon_offset */ #if _HAVE_FULL_GL - SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); + if (ctx->API == API_OPENGL) { + SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); + } #endif /* 6. GL_EXT_texture3d */ @@ -374,7 +380,7 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 11. GL_EXT_histogram */ #if 0 - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_GetHistogramEXT(exec, _mesa_GetHistogram); SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); @@ -397,7 +403,7 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 30. GL_EXT_vertex_array */ #if _HAVE_FULL_GL - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); @@ -424,8 +430,10 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 97. GL_EXT_compiled_vertex_array */ #if _HAVE_FULL_GL - SET_LockArraysEXT(exec, _mesa_LockArraysEXT); - SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); + if (ctx->API == API_OPENGL) { + SET_LockArraysEXT(exec, _mesa_LockArraysEXT); + SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); + } #endif /* 148. GL_EXT_multi_draw_arrays */ @@ -454,54 +462,61 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 233. GL_NV_vertex_program */ #if FEATURE_NV_vertex_program - SET_BindProgramNV(exec, _mesa_BindProgram); - SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); - SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); - SET_GenProgramsNV(exec, _mesa_GenPrograms); - SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); - SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); - SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); - SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); - SET_GetProgramivNV(exec, _mesa_GetProgramivNV); - SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); - SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); - SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); - SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); - SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); - SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); - SET_IsProgramNV(exec, _mesa_IsProgramARB); - SET_LoadProgramNV(exec, _mesa_LoadProgramNV); - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ - SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); - SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); - SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); - SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); - /* glVertexAttrib*NV functions handled in api_loopback.c */ + if (ctx->API == API_OPENGL) { + SET_BindProgramNV(exec, _mesa_BindProgram); + SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); + SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); + SET_GenProgramsNV(exec, _mesa_GenPrograms); + SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); + SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); + SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); + SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); + SET_GetProgramivNV(exec, _mesa_GetProgramivNV); + SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); + SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); + SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); + SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); + SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); + SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); + SET_IsProgramNV(exec, _mesa_IsProgramARB); + SET_LoadProgramNV(exec, _mesa_LoadProgramNV); + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ + SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); + SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); + SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); + SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); + /* glVertexAttrib*NV functions handled in api_loopback.c */ + } #endif /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); + if (ctx->API == API_OPENGL) { + SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); + SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); + } + /* Reused by ARB_vertex_array_object */ SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE); - SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE); /* 282. GL_NV_fragment_program */ #if FEATURE_NV_fragment_program - SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); - SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); - SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); - SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); - SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); - SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + if (ctx->API == API_OPENGL) { + SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); + SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); + SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); + SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); + SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); + SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + } #endif /* 262. GL_NV_point_sprite */ @@ -512,7 +527,9 @@ _mesa_create_exec_table(struct gl_context *ctx) /* 268. GL_EXT_stencil_two_side */ #if _HAVE_FULL_GL - SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); + if (ctx->API == API_OPENGL) { + SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); + } #endif /* 285. GL_NV_primitive_restart */ @@ -536,7 +553,7 @@ _mesa_create_exec_table(struct gl_context *ctx) /* ARB 3. GL_ARB_transpose_matrix */ #if _HAVE_FULL_GL - if (ctx->API != API_OPENGL_CORE) { + if (ctx->API == API_OPENGL) { SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); @@ -617,24 +634,26 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); - SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + if (ctx->API == API_OPENGL) { + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); + SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); + } SET_GetProgramivARB(exec, _mesa_GetProgramivARB); - SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); #endif /* ARB 28. GL_ARB_vertex_buffer_object */ - _mesa_init_bufferobj_dispatch(exec); + _mesa_init_bufferobj_dispatch(ctx, exec); /* ARB 29. GL_ARB_occlusion_query */ _mesa_init_queryobj_dispatch(exec); @@ -657,13 +676,17 @@ _mesa_create_exec_table(struct gl_context *ctx) SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB); /* GL_ATI_fragment_shader */ - _mesa_init_ati_fragment_shader_dispatch(exec); + if (ctx->API == API_OPENGL) { + _mesa_init_ati_fragment_shader_dispatch(exec); + } /* GL_ATI_envmap_bumpmap */ - SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI); - SET_GetTexBumpParameterfvATI(exec, _mesa_GetTexBumpParameterfvATI); - SET_TexBumpParameterivATI(exec, _mesa_TexBumpParameterivATI); - SET_TexBumpParameterfvATI(exec, _mesa_TexBumpParameterfvATI); + if (ctx->API == API_OPENGL) { + SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI); + SET_GetTexBumpParameterfvATI(exec, _mesa_GetTexBumpParameterfvATI); + SET_TexBumpParameterivATI(exec, _mesa_TexBumpParameterivATI); + SET_TexBumpParameterfvATI(exec, _mesa_TexBumpParameterfvATI); + } #if FEATURE_EXT_framebuffer_object SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); @@ -691,8 +714,10 @@ _mesa_create_exec_table(struct gl_context *ctx) /* GL_EXT_gpu_program_parameters */ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT); - SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT); + if (ctx->API == API_OPENGL) { + SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT); + SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT); + } #endif /* GL_MESA_texture_array / GL_EXT_texture_array */ @@ -701,7 +726,9 @@ _mesa_create_exec_table(struct gl_context *ctx) #endif /* GL_ATI_separate_stencil */ - SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); + if (ctx->API == API_OPENGL) { + SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); + } #if FEATURE_ARB_framebuffer_object /* The ARB_fbo functions are the union of @@ -800,6 +827,16 @@ _mesa_create_exec_table(struct gl_context *ctx) _mesa_init_sampler_object_dispatch(exec); #endif + if (_mesa_is_desktop_gl(ctx)) { + SET_InvalidateTexSubImage(exec, _mesa_InvalidateTexSubImage); + SET_InvalidateTexImage(exec, _mesa_InvalidateTexImage); + } + + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { + SET_InvalidateSubFramebuffer(exec, _mesa_InvalidateSubFramebuffer); + SET_InvalidateFramebuffer(exec, _mesa_InvalidateFramebuffer); + } + return exec; } diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 9cab35b0c..1a04eebdd 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -805,10 +805,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, samp->MaxAnisotropy); } - if (ctx->Extensions.ARB_shadow_ambient) { - _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, - samp->CompareFailValue); - } if (ctx->Extensions.ARB_shadow) { _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE, samp->CompareMode); diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 22d7927bb..df559821c 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -2200,8 +2200,100 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) } } +static void GLAPIENTRY +_mesa_InvalidateBufferSubData(GLuint buffer, GLintptr offset, + GLsizeiptr length) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + const GLintptr end = offset + length; + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateBufferSubData(name = 0x%x) invalid object", + buffer); + return; + } + + /* The GL_ARB_invalidate_subdata spec says: + * + * "An INVALID_VALUE error is generated if <offset> or <length> is + * negative, or if <offset> + <length> is greater than the value of + * BUFFER_SIZE." + */ + if (end < 0 || end > bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateBufferSubData(invalid offset or length)"); + return; + } + + /* The GL_ARB_invalidate_subdata spec says: + * + * "An INVALID_OPERATION error is generated if the buffer is currently + * mapped by MapBuffer, or if the invalidate range intersects the range + * currently mapped by MapBufferRange." + */ + if (_mesa_bufferobj_mapped(bufObj)) { + const GLintptr mapEnd = bufObj->Offset + bufObj->Length; + + /* The regions do not overlap if and only if the end of the discard + * region is before the mapped region or the start of the discard region + * is after the mapped region. + * + * Note that 'end' and 'mapEnd' are the first byte *after* the discard + * region and the mapped region, repsectively. It is okay for that byte + * to be mapped (for 'end') or discarded (for 'mapEnd'). + */ + if (!(end <= bufObj->Offset || offset >= mapEnd)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glInvalidateBufferSubData(intersection with mapped " + "range)"); + return; + } + } + + /* We don't actually do anything for this yet. Just return after + * validating the parameters and generating the required errors. + */ + return; +} + +static void GLAPIENTRY +_mesa_InvalidateBufferData(GLuint buffer) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *bufObj; + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateBufferData(name = 0x%x) invalid object", + buffer); + return; + } + + /* The GL_ARB_invalidate_subdata spec says: + * + * "An INVALID_OPERATION error is generated if the buffer is currently + * mapped by MapBuffer, or if the invalidate range intersects the range + * currently mapped by MapBufferRange." + */ + if (_mesa_bufferobj_mapped(bufObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glInvalidateBufferData(intersection with mapped " + "range)"); + return; + } + + /* We don't actually do anything for this yet. Just return after + * validating the parameters and generating the required errors. + */ + return; +} + void -_mesa_init_bufferobj_dispatch(struct _glapi_table *disp) +_mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp) { SET_BindBufferARB(disp, _mesa_BindBufferARB); SET_BufferDataARB(disp, _mesa_BufferDataARB); @@ -2214,6 +2306,14 @@ _mesa_init_bufferobj_dispatch(struct _glapi_table *disp) SET_IsBufferARB(disp, _mesa_IsBufferARB); SET_MapBufferARB(disp, _mesa_MapBufferARB); SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB); - SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange); - SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase); + + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { + SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange); + SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase); + } + + if (_mesa_is_desktop_gl(ctx)) { + SET_InvalidateBufferData(disp, _mesa_InvalidateBufferData); + SET_InvalidateBufferSubData(disp, _mesa_InvalidateBufferSubData); + } } diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index e1d0f7a97..15fdb9c30 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -167,6 +167,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); extern void -_mesa_init_bufferobj_dispatch(struct _glapi_table *disp); +_mesa_init_bufferobj_dispatch(struct gl_context *ctx, + struct _glapi_table *disp); #endif diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h index 6b7dafa78..e2387521f 100644 --- a/mesalib/src/mesa/main/context.h +++ b/mesalib/src/mesa/main/context.h @@ -310,6 +310,16 @@ _mesa_is_gles(const struct gl_context *ctx) } +/** + * Checks if the context is for GLES 3.x + */ +static inline GLboolean +_mesa_is_gles3(const struct gl_context *ctx) +{ + return ctx->API == API_OPENGLES2 && ctx->Version >= 30; +} + + #ifdef __cplusplus } #endif diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 5e13a9357..9e357cd09 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -88,28 +88,29 @@ static const struct extension extension_table[] = { { "GL_ARB_debug_output", o(dummy_true), GL, 2009 }, { "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 }, { "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 }, - { "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 }, + { "GL_ARB_depth_texture", o(ARB_depth_texture), GLL, 2001 }, { "GL_ARB_draw_buffers", o(dummy_true), GL, 2002 }, { "GL_ARB_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, { "GL_ARB_draw_elements_base_vertex", o(ARB_draw_elements_base_vertex), GL, 2009 }, { "GL_ARB_draw_instanced", o(ARB_draw_instanced), GL, 2008 }, { "GL_ARB_explicit_attrib_location", o(ARB_explicit_attrib_location), GL, 2009 }, { "GL_ARB_fragment_coord_conventions", o(ARB_fragment_coord_conventions), GL, 2009 }, - { "GL_ARB_fragment_program", o(ARB_fragment_program), GL, 2002 }, - { "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), GL, 2003 }, + { "GL_ARB_fragment_program", o(ARB_fragment_program), GLL, 2002 }, + { "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), GLL, 2003 }, { "GL_ARB_fragment_shader", o(ARB_fragment_shader), GL, 2002 }, { "GL_ARB_framebuffer_object", o(ARB_framebuffer_object), GL, 2005 }, { "GL_ARB_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, { "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), GL, 2003 }, { "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 }, { "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 }, + { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 }, { "GL_ARB_map_buffer_range", o(ARB_map_buffer_range), GL, 2008 }, - { "GL_ARB_multisample", o(dummy_true), GL, 1994 }, - { "GL_ARB_multitexture", o(dummy_true), GL, 1998 }, + { "GL_ARB_multisample", o(dummy_true), GLL, 1994 }, + { "GL_ARB_multitexture", o(dummy_true), GLL, 1998 }, { "GL_ARB_occlusion_query2", o(ARB_occlusion_query2), GL, 2003 }, - { "GL_ARB_occlusion_query", o(ARB_occlusion_query), GL, 2001 }, + { "GL_ARB_occlusion_query", o(ARB_occlusion_query), GLL, 2001 }, { "GL_ARB_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 }, - { "GL_ARB_point_parameters", o(EXT_point_parameters), GL, 1997 }, + { "GL_ARB_point_parameters", o(EXT_point_parameters), GLL, 1997 }, { "GL_ARB_point_sprite", o(ARB_point_sprite), GL, 2003 }, { "GL_ARB_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 }, { "GL_ARB_robustness", o(dummy_true), GL, 2010 }, @@ -119,21 +120,20 @@ static const struct extension extension_table[] = { { "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 }, { "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 }, - { "GL_ARB_shading_language_100", o(ARB_shading_language_100), GL, 2003 }, - { "GL_ARB_shadow_ambient", o(ARB_shadow_ambient), GL, 2001 }, - { "GL_ARB_shadow", o(ARB_shadow), GL, 2001 }, + { "GL_ARB_shading_language_100", o(ARB_shading_language_100), GLL, 2003 }, + { "GL_ARB_shadow", o(ARB_shadow), GLL, 2001 }, { "GL_ARB_sync", o(ARB_sync), GL, 2003 }, - { "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), GL, 2000 }, + { "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 2000 }, { "GL_ARB_texture_buffer_object", o(ARB_texture_buffer_object), GL, 2008 }, - { "GL_ARB_texture_compression", o(dummy_true), GL, 2000 }, + { "GL_ARB_texture_compression", o(dummy_true), GLL, 2000 }, { "GL_ARB_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 }, - { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GL, 1999 }, - { "GL_ARB_texture_env_add", o(dummy_true), GL, 1999 }, - { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GL, 2001 }, - { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GL, 2001 }, - { "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), GL, 2001 }, + { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GLL, 1999 }, + { "GL_ARB_texture_env_add", o(dummy_true), GLL, 1999 }, + { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GLL, 2001 }, + { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GLL, 2001 }, + { "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), GLL, 2001 }, { "GL_ARB_texture_float", o(ARB_texture_float), GL, 2004 }, - { "GL_ARB_texture_mirrored_repeat", o(dummy_true), GL, 2001 }, + { "GL_ARB_texture_mirrored_repeat", o(dummy_true), GLL, 2001 }, { "GL_ARB_texture_multisample", o(ARB_texture_multisample), GL, 2009 }, { "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), GL, 2003 }, { "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 }, @@ -145,74 +145,74 @@ static const struct extension extension_table[] = { { "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 }, { "GL_ARB_transform_feedback3", o(ARB_transform_feedback3), GL, 2010 }, { "GL_ARB_transform_feedback_instanced", o(ARB_transform_feedback_instanced), GL, 2011 }, - { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 }, + { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GLL, 1999 }, { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 }, { "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, { "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), GL, 2006 }, - { "GL_ARB_vertex_buffer_object", o(dummy_true), GL, 2003 }, - { "GL_ARB_vertex_program", o(ARB_vertex_program), GL, 2002 }, + { "GL_ARB_vertex_buffer_object", o(dummy_true), GLL, 2003 }, + { "GL_ARB_vertex_program", o(ARB_vertex_program), GLL, 2002 }, { "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 }, { "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 }, - { "GL_ARB_window_pos", o(ARB_window_pos), GL, 2001 }, + { "GL_ARB_window_pos", o(ARB_window_pos), GLL, 2001 }, /* EXT extensions */ { "GL_EXT_abgr", o(dummy_true), GL, 1995 }, - { "GL_EXT_bgra", o(dummy_true), GL, 1995 }, - { "GL_EXT_blend_color", o(EXT_blend_color), GL, 1995 }, + { "GL_EXT_bgra", o(dummy_true), GLL, 1995 }, + { "GL_EXT_blend_color", o(EXT_blend_color), GLL, 1995 }, { "GL_EXT_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 }, - { "GL_EXT_blend_func_separate", o(EXT_blend_func_separate), GL, 1999 }, - { "GL_EXT_blend_minmax", o(EXT_blend_minmax), GL | ES1 | ES2, 1995 }, - { "GL_EXT_blend_subtract", o(dummy_true), GL, 1995 }, + { "GL_EXT_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 }, + { "GL_EXT_blend_minmax", o(EXT_blend_minmax), GLL | ES1 | ES2, 1995 }, + { "GL_EXT_blend_subtract", o(dummy_true), GLL, 1995 }, { "GL_EXT_clip_volume_hint", o(EXT_clip_volume_hint), GL, 1996 }, - { "GL_EXT_compiled_vertex_array", o(EXT_compiled_vertex_array), GL, 1996 }, - { "GL_EXT_copy_texture", o(dummy_true), GL, 1995 }, + { "GL_EXT_compiled_vertex_array", o(EXT_compiled_vertex_array), GLL, 1996 }, + { "GL_EXT_copy_texture", o(dummy_true), GLL, 1995 }, { "GL_EXT_depth_bounds_test", o(EXT_depth_bounds_test), GL, 2002 }, { "GL_EXT_draw_buffers2", o(EXT_draw_buffers2), GL, 2006 }, { "GL_EXT_draw_instanced", o(ARB_draw_instanced), GL, 2006 }, - { "GL_EXT_draw_range_elements", o(EXT_draw_range_elements), GL, 1997 }, - { "GL_EXT_fog_coord", o(EXT_fog_coord), GL, 1999 }, + { "GL_EXT_draw_range_elements", o(EXT_draw_range_elements), GLL, 1997 }, + { "GL_EXT_fog_coord", o(EXT_fog_coord), GLL, 1999 }, { "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 }, { "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 }, { "GL_EXT_framebuffer_object", o(EXT_framebuffer_object), GL, 2000 }, { "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, - { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GL, 2006 }, + { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 }, { "GL_EXT_gpu_shader4", o(EXT_gpu_shader4), GL, 2006 }, - { "GL_EXT_multi_draw_arrays", o(dummy_true), GL | ES1 | ES2, 1999 }, + { "GL_EXT_multi_draw_arrays", o(dummy_true), GLL | ES1 | ES2, 1999 }, { "GL_EXT_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2005 }, { "GL_EXT_packed_float", o(EXT_packed_float), GL, 2004 }, - { "GL_EXT_packed_pixels", o(EXT_packed_pixels), GL, 1997 }, + { "GL_EXT_packed_pixels", o(EXT_packed_pixels), GLL, 1997 }, { "GL_EXT_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 }, - { "GL_EXT_point_parameters", o(EXT_point_parameters), GL, 1997 }, - { "GL_EXT_polygon_offset", o(dummy_true), GL, 1995 }, + { "GL_EXT_point_parameters", o(EXT_point_parameters), GLL, 1997 }, + { "GL_EXT_polygon_offset", o(dummy_true), GLL, 1995 }, { "GL_EXT_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 }, - { "GL_EXT_rescale_normal", o(EXT_rescale_normal), GL, 1997 }, - { "GL_EXT_secondary_color", o(EXT_secondary_color), GL, 1999 }, - { "GL_EXT_separate_shader_objects", o(EXT_separate_shader_objects), GL, 2008 }, - { "GL_EXT_separate_specular_color", o(EXT_separate_specular_color), GL, 1997 }, - { "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), GL, 2002 }, - { "GL_EXT_stencil_two_side", o(EXT_stencil_two_side), GL, 2001 }, - { "GL_EXT_stencil_wrap", o(dummy_true), GL, 2002 }, - { "GL_EXT_subtexture", o(dummy_true), GL, 1995 }, - { "GL_EXT_texture3D", o(EXT_texture3D), GL, 1996 }, + { "GL_EXT_rescale_normal", o(EXT_rescale_normal), GLL, 1997 }, + { "GL_EXT_secondary_color", o(EXT_secondary_color), GLL, 1999 }, + { "GL_EXT_separate_shader_objects", o(EXT_separate_shader_objects), GLL, 2008 }, + { "GL_EXT_separate_specular_color", o(EXT_separate_specular_color), GLL, 1997 }, + { "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), GLL, 2002 }, + { "GL_EXT_stencil_two_side", o(EXT_stencil_two_side), GLL, 2001 }, + { "GL_EXT_stencil_wrap", o(dummy_true), GLL, 2002 }, + { "GL_EXT_subtexture", o(dummy_true), GLL, 1995 }, + { "GL_EXT_texture3D", o(EXT_texture3D), GLL, 1996 }, { "GL_EXT_texture_array", o(EXT_texture_array), GL, 2006 }, { "GL_EXT_texture_compression_dxt1", o(EXT_texture_compression_s3tc), GL | ES1 | ES2, 2004 }, { "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL, 2006 }, { "GL_EXT_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 }, { "GL_EXT_texture_compression_s3tc", o(EXT_texture_compression_s3tc), GL, 2000 }, - { "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GL, 2001 }, - { "GL_EXT_texture_edge_clamp", o(dummy_true), GL, 1997 }, - { "GL_EXT_texture_env_add", o(dummy_true), GL, 1999 }, - { "GL_EXT_texture_env_combine", o(dummy_true), GL, 2000 }, - { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GL, 2000 }, + { "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GLL, 2001 }, + { "GL_EXT_texture_edge_clamp", o(dummy_true), GLL, 1997 }, + { "GL_EXT_texture_env_add", o(dummy_true), GLL, 1999 }, + { "GL_EXT_texture_env_combine", o(dummy_true), GLL, 2000 }, + { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GLL, 2000 }, { "GL_EXT_texture_filter_anisotropic", o(EXT_texture_filter_anisotropic), GL | ES1 | ES2, 1999 }, { "GL_EXT_texture_format_BGRA8888", o(dummy_true), ES1 | ES2, 2005 }, { "GL_EXT_texture_rg", o(ARB_texture_rg), ES2, 2011 }, { "GL_EXT_read_format_bgra", o(dummy_true), ES1 | ES2, 2009 }, { "GL_EXT_texture_integer", o(EXT_texture_integer), GL, 2006 }, - { "GL_EXT_texture_lod_bias", o(dummy_true), GL | ES1, 1999 }, + { "GL_EXT_texture_lod_bias", o(dummy_true), GLL | ES1, 1999 }, { "GL_EXT_texture_mirror_clamp", o(EXT_texture_mirror_clamp), GL, 2004 }, - { "GL_EXT_texture_object", o(dummy_true), GL, 1995 }, - { "GL_EXT_texture", o(dummy_true), GL, 1996 }, - { "GL_EXT_texture_rectangle", o(NV_texture_rectangle), GL, 2004 }, + { "GL_EXT_texture_object", o(dummy_true), GLL, 1995 }, + { "GL_EXT_texture", o(dummy_true), GLL, 1996 }, + { "GL_EXT_texture_rectangle", o(NV_texture_rectangle), GLL, 2004 }, { "GL_EXT_texture_shared_exponent", o(EXT_texture_shared_exponent), GL, 2004 }, { "GL_EXT_texture_snorm", o(EXT_texture_snorm), GL, 2009 }, { "GL_EXT_texture_sRGB", o(EXT_texture_sRGB), GL, 2004 }, @@ -223,7 +223,7 @@ static const struct extension extension_table[] = { { "GL_EXT_transform_feedback", o(EXT_transform_feedback), GL, 2011 }, { "GL_EXT_unpack_subimage", o(dummy_true), ES2, 2011 }, { "GL_EXT_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, - { "GL_EXT_vertex_array", o(dummy_true), GL, 1995 }, + { "GL_EXT_vertex_array", o(dummy_true), GLL, 1995 }, /* OES extensions */ { "GL_OES_blend_equation_separate", o(EXT_blend_equation_separate), ES1, 2009 }, @@ -274,52 +274,52 @@ static const struct extension extension_table[] = { { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, - { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GL, 2002 }, - { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GL, 2002 }, + { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GLL, 2002 }, + { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GLL, 2002 }, { "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 }, - { "GL_ATI_draw_buffers", o(dummy_true), GL, 2002 }, - { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GL, 2001 }, - { "GL_ATI_fragment_shader", o(ATI_fragment_shader), GL, 2001 }, - { "GL_ATI_separate_stencil", o(ATI_separate_stencil), GL, 2006 }, + { "GL_ATI_draw_buffers", o(dummy_true), GLL, 2002 }, + { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GLL, 2001 }, + { "GL_ATI_fragment_shader", o(ATI_fragment_shader), GLL, 2001 }, + { "GL_ATI_separate_stencil", o(ATI_separate_stencil), GLL, 2006 }, { "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL, 2004 }, - { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GL, 2002 }, + { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GLL, 2002 }, { "GL_ATI_texture_float", o(ARB_texture_float), GL, 2002 }, { "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL, 2006 }, { "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL, 1998 }, { "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GL, 1996 }, - { "GL_IBM_texture_mirrored_repeat", o(dummy_true), GL, 1998 }, - { "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GL, 1999 }, + { "GL_IBM_texture_mirrored_repeat", o(dummy_true), GLL, 1998 }, + { "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 }, { "GL_MESA_pack_invert", o(MESA_pack_invert), GL, 2002 }, { "GL_MESA_resize_buffers", o(MESA_resize_buffers), GL, 1999 }, - { "GL_MESA_texture_array", o(MESA_texture_array), GL, 2007 }, + { "GL_MESA_texture_array", o(MESA_texture_array), GLL, 2007 }, { "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), GL, 2009 }, - { "GL_MESA_window_pos", o(ARB_window_pos), GL, 2000 }, + { "GL_MESA_window_pos", o(ARB_window_pos), GLL, 2000 }, { "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), GL, 2002 }, - { "GL_NV_blend_square", o(NV_blend_square), GL, 1999 }, + { "GL_NV_blend_square", o(NV_blend_square), GLL, 1999 }, { "GL_NV_conditional_render", o(NV_conditional_render), GL, 2008 }, { "GL_NV_depth_clamp", o(ARB_depth_clamp), GL, 2001 }, { "GL_NV_draw_buffers", o(dummy_true), ES2, 2011 }, { "GL_NV_fbo_color_attachments", o(EXT_framebuffer_object), ES2, 2010 }, - { "GL_NV_fog_distance", o(NV_fog_distance), GL, 2001 }, - { "GL_NV_fragment_program", o(NV_fragment_program), GL, 2001 }, - { "GL_NV_fragment_program_option", o(NV_fragment_program_option), GL, 2005 }, - { "GL_NV_light_max_exponent", o(NV_light_max_exponent), GL, 1999 }, + { "GL_NV_fog_distance", o(NV_fog_distance), GLL, 2001 }, + { "GL_NV_fragment_program", o(NV_fragment_program), GLL, 2001 }, + { "GL_NV_fragment_program_option", o(NV_fragment_program_option), GLL, 2005 }, + { "GL_NV_light_max_exponent", o(NV_light_max_exponent), GLL, 1999 }, { "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 }, { "GL_NV_point_sprite", o(NV_point_sprite), GL, 2001 }, { "GL_NV_primitive_restart", o(NV_primitive_restart), GL, 2002 }, { "GL_NV_read_buffer", o(dummy_true), ES2, 2011 }, - { "GL_NV_texgen_reflection", o(NV_texgen_reflection), GL, 1999 }, + { "GL_NV_texgen_reflection", o(NV_texgen_reflection), GLL, 1999 }, { "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 }, - { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GL, 1999 }, - { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GL, 2000 }, - { "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), GL, 2001 }, - { "GL_NV_vertex_program", o(NV_vertex_program), GL, 2000 }, + { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 }, + { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 }, + { "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), GLL, 2001 }, + { "GL_NV_vertex_program", o(NV_vertex_program), GLL, 2000 }, { "GL_S3_s3tc", o(S3_s3tc), GL, 1999 }, - { "GL_SGIS_generate_mipmap", o(dummy_true), GL, 1997 }, - { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GL, 1997 }, - { "GL_SGIS_texture_edge_clamp", o(dummy_true), GL, 1997 }, - { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GL, 1997 }, - { "GL_SUN_multi_draw_arrays", o(dummy_true), GL, 1999 }, + { "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 }, + { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 }, + { "GL_SGIS_texture_edge_clamp", o(dummy_true), GLL, 1997 }, + { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GLL, 1997 }, + { "GL_SUN_multi_draw_arrays", o(dummy_true), GLL, 1999 }, { 0, 0, 0, 0 }, }; @@ -427,7 +427,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif ctx->Extensions.ARB_shadow = GL_TRUE; - ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index d558d7f87..aa8ba1882 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -685,6 +685,9 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, assert(_mesa_is_user_fbo(fb)); + /* we're changing framebuffer fields here */ + FLUSH_VERTICES(ctx, _NEW_BUFFERS); + numImages = 0; fb->Width = 0; fb->Height = 0; @@ -3006,3 +3009,144 @@ _mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment, "not implemented!"); } #endif /* FEATURE_ARB_geometry_shader4 */ + +static void +invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments, + const GLenum *attachments, GLint x, GLint y, + GLsizei width, GLsizei height, const char *name) +{ + int i; + struct gl_framebuffer *fb; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + fb = get_framebuffer_target(ctx, target); + if (!fb) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name); + return; + } + + if (numAttachments < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(numAttachments < 0)", name); + return; + } + + /* The GL_ARB_invalidate_subdata spec says: + * + * "If an attachment is specified that does not exist in the + * framebuffer bound to <target>, it is ignored." + * + * It also says: + * + * "If <attachments> contains COLOR_ATTACHMENTm and m is greater than + * or equal to the value of MAX_COLOR_ATTACHMENTS, then the error + * INVALID_OPERATION is generated." + * + * No mention is made of GL_AUXi being out of range. Therefore, we allow + * any enum that can be allowed by the API (OpenGL ES 3.0 has a different + * set of retrictions). + */ + for (i = 0; i < numAttachments; i++) { + if (_mesa_is_winsys_fbo(fb)) { + switch (attachments[i]) { + case GL_ACCUM: + case GL_AUX0: + case GL_AUX1: + case GL_AUX2: + case GL_AUX3: + /* Accumulation buffers and auxilary buffers were removed in + * OpenGL 3.1, and they never existed in OpenGL ES. + */ + if (ctx->API != API_OPENGL) + goto invalid_enum; + break; + case GL_COLOR: + case GL_DEPTH: + case GL_STENCIL: + break; + case GL_BACK_LEFT: + case GL_BACK_RIGHT: + case GL_FRONT_LEFT: + case GL_FRONT_RIGHT: + if (!_mesa_is_desktop_gl(ctx)) + goto invalid_enum; + break; + default: + goto invalid_enum; + } + } else { + switch (attachments[i]) { + case GL_DEPTH_ATTACHMENT: + case GL_STENCIL_ATTACHMENT: + break; + case GL_COLOR_ATTACHMENT0: + case GL_COLOR_ATTACHMENT1: + case GL_COLOR_ATTACHMENT2: + case GL_COLOR_ATTACHMENT3: + case GL_COLOR_ATTACHMENT4: + case GL_COLOR_ATTACHMENT5: + case GL_COLOR_ATTACHMENT6: + case GL_COLOR_ATTACHMENT7: + case GL_COLOR_ATTACHMENT8: + case GL_COLOR_ATTACHMENT9: + case GL_COLOR_ATTACHMENT10: + case GL_COLOR_ATTACHMENT11: + case GL_COLOR_ATTACHMENT12: + case GL_COLOR_ATTACHMENT13: + case GL_COLOR_ATTACHMENT14: + case GL_COLOR_ATTACHMENT15: { + const int k = attachments[i] - GL_COLOR_ATTACHMENT0; + if (k >= ctx->Const.MaxColorAttachments) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(attachment >= max. color attachments)", name); + return; + } + } + default: + goto invalid_enum; + } + } + } + + /* We don't actually do anything for this yet. Just return after + * validating the parameters and generating the required errors. + */ + return; + +invalid_enum: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(attachment)", name); + return; +} + +void GLAPIENTRY +_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, + const GLenum *attachments, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + invalidate_framebuffer_storage(target, numAttachments, attachments, + x, y, width, height, + "glInvalidateSubFramebuffer"); +} + +void GLAPIENTRY +_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, + const GLenum *attachments) +{ + /* The GL_ARB_invalidate_subdata spec says: + * + * "The command + * + * void InvalidateFramebuffer(enum target, + * sizei numAttachments, + * const enum *attachments); + * + * is equivalent to the command InvalidateSubFramebuffer with <x>, <y>, + * <width>, <height> equal to 0, 0, <MAX_VIEWPORT_DIMS[0]>, + * <MAX_VIEWPORT_DIMS[1]> respectively." + */ + invalidate_framebuffer_storage(target, numAttachments, attachments, + 0, 0, MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT, + "glInvalidateFramebuffer"); +} diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h index 3aee842f5..9cded3cfa 100644 --- a/mesalib/src/mesa/main/fbobject.h +++ b/mesalib/src/mesa/main/fbobject.h @@ -214,4 +214,13 @@ _mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +extern void GLAPIENTRY +_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, + const GLenum *attachments, GLint x, GLint y, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, + const GLenum *attachments); + #endif /* FBOBJECT_H */ diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 529c416a8..bd218520f 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -1604,6 +1604,11 @@ get_unpack_rgba_function(gl_format format) initialized = GL_TRUE; } + if (table[format] == NULL) { + _mesa_problem(NULL, "unsupported unpack for format %s", + _mesa_get_format_name(format)); + } + return table[format]; } diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 8fcb6b456..552c1cf69 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1250,7 +1250,6 @@ struct gl_sampler_object GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ - GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */ GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */ GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */ }; @@ -2972,7 +2971,6 @@ struct gl_extensions GLboolean ARB_shader_texture_lod; GLboolean ARB_shading_language_100; GLboolean ARB_shadow; - GLboolean ARB_shadow_ambient; GLboolean ARB_sync; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_buffer_object; diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 83192c157..7aebd45ea 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -462,8 +462,7 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max) } } -/* Customization of integer packing. We always treat src as uint, and can pack dst - * as any integer type/format combo. +/* Customization of unsigned integer packing. */ #define SRC_TYPE GLuint @@ -475,6 +474,14 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max) #undef SRC_CONVERT #undef FN_NAME +#define DST_TYPE GLint +#define SRC_CONVERT(x) MIN2(x, 0x7fffffff) +#define FN_NAME pack_int_from_uint_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + #define DST_TYPE GLushort #define SRC_CONVERT(x) MIN2(x, 0xffff) #define FN_NAME pack_ushort_from_uint_rgba @@ -507,18 +514,32 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max) #undef SRC_CONVERT #undef FN_NAME +#undef SRC_TYPE + +static void +_pack_rgba_span_from_uints_problem(struct gl_context *ctx, + GLenum dstFormat, GLenum dstType) +{ + _mesa_problem(ctx, + "Unsupported type (%s) / format (%s) " + "in _mesa_pack_rgba_span_from_uints", + _mesa_lookup_enum_by_nr(dstType), + _mesa_lookup_enum_by_nr(dstFormat)); +} + void -_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4], - GLenum dstFormat, GLenum dstType, - GLvoid *dstAddr) +_mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr) { + GLuint i; + switch(dstType) { case GL_UNSIGNED_INT: pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); break; case GL_INT: - /* No conversion necessary. */ - pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); + pack_int_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); break; case GL_UNSIGNED_SHORT: pack_ushort_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); @@ -532,11 +553,691 @@ _mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4], case GL_BYTE: pack_byte_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); break; + case GL_UNSIGNED_BYTE_3_3_2: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) << 5) + | (CLAMP(rgba[i][GCOMP], 0, 7) << 2) + | (CLAMP(rgba[i][BCOMP], 0, 3) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) ) + | (CLAMP(rgba[i][GCOMP], 0, 7) << 3) + | (CLAMP(rgba[i][BCOMP], 0, 3) << 6); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 63) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 63) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 11); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][ACOMP], 0, 15) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][ACOMP], 0, 15) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) << 12) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][RCOMP], 0, 15) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) ) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 15) << 12); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) ) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 15) << 12); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) ) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 12); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][ACOMP], 0, 1) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][RCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][ACOMP], 0, 1) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) << 11) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][RCOMP], 0, 1) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][ACOMP], 0, 1) << 15); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][RCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][ACOMP], 0, 1) << 15); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) ) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][RCOMP], 0, 1) << 15); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) << 24) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 255) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) << 24) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 255) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) << 24) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 255) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) ) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][ACOMP], 0, 255) << 24); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) ) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][ACOMP], 0, 255) << 24); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) ) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 24); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][ACOMP], 0, 3) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][RCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][ACOMP], 0, 3) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][RCOMP], 0, 3) ); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) ) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][ACOMP], 0, 3) << 30); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) ) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][RCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][ACOMP], 0, 3) << 30); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) ) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][RCOMP], 0, 3) << 30); + } + } else { + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + } + break; + default: + _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); + return; + } +} + + +/* Customization of signed integer packing. + */ +#define SRC_TYPE GLint + +#define DST_TYPE GLuint +#define SRC_CONVERT(x) MAX2(x, 0) +#define FN_NAME pack_uint_from_int_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + +#define DST_TYPE GLushort +#define SRC_CONVERT(x) MAX2(x, 0) +#define FN_NAME pack_ushort_from_int_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + +#define DST_TYPE GLshort +#define SRC_CONVERT(x) CLAMP(x, -0x8000, 0x7fff) +#define FN_NAME pack_short_from_int_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + +#define DST_TYPE GLubyte +#define SRC_CONVERT(x) MAX2(x, 0) +#define FN_NAME pack_ubyte_from_int_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + +#define DST_TYPE GLbyte +#define SRC_CONVERT(x) CLAMP(x, -0x80, 0x7f) +#define FN_NAME pack_byte_from_int_rgba +#include "pack_tmp.h" +#undef DST_TYPE +#undef SRC_CONVERT +#undef FN_NAME + +#undef SRC_TYPE + +static void +_pack_rgba_span_from_ints_problem(struct gl_context *ctx, + GLenum dstFormat, GLenum dstType) +{ + _mesa_problem(ctx, + "Unsupported type (%s) / format (%s) " + "in _mesa_pack_rgba_span_from_ints", + _mesa_lookup_enum_by_nr(dstType), + _mesa_lookup_enum_by_nr(dstFormat)); +} + +void +_mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr) +{ + GLuint i; + + switch(dstType) { + case GL_UNSIGNED_INT: + pack_uint_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_INT: + /* No conversion necessary. */ + pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_UNSIGNED_SHORT: + pack_ushort_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_SHORT: + pack_short_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_UNSIGNED_BYTE: + pack_ubyte_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_BYTE: + pack_byte_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); + break; + case GL_UNSIGNED_BYTE_3_3_2: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) << 5) + | (CLAMP(rgba[i][GCOMP], 0, 7) << 2) + | (CLAMP(rgba[i][BCOMP], 0, 3) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) ) + | (CLAMP(rgba[i][GCOMP], 0, 7) << 3) + | (CLAMP(rgba[i][BCOMP], 0, 3) << 6); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 63) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 63) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 11); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][ACOMP], 0, 15) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][ACOMP], 0, 15) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) << 12) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][RCOMP], 0, 15) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) ) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 15) << 12); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) ) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 15) << 12); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) ) + | (CLAMP(rgba[i][BCOMP], 0, 15) << 4) + | (CLAMP(rgba[i][GCOMP], 0, 15) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 15) << 12); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][ACOMP], 0, 1) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) << 11) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][RCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][ACOMP], 0, 1) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) << 11) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 6) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 1) + | (CLAMP(rgba[i][RCOMP], 0, 1) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][ACOMP], 0, 1) << 15); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) ) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][RCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][ACOMP], 0, 1) << 15); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) ) + | (CLAMP(rgba[i][BCOMP], 0, 31) << 5) + | (CLAMP(rgba[i][GCOMP], 0, 31) << 10) + | (CLAMP(rgba[i][RCOMP], 0, 1) << 15); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) << 24) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 255) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) << 24) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][ACOMP], 0, 255) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) << 24) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 255) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) ) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][ACOMP], 0, 255) << 24); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) ) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][ACOMP], 0, 255) << 24); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) ) + | (CLAMP(rgba[i][BCOMP], 0, 255) << 8) + | (CLAMP(rgba[i][GCOMP], 0, 255) << 16) + | (CLAMP(rgba[i][RCOMP], 0, 255) << 24); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][ACOMP], 0, 3) ); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][RCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][ACOMP], 0, 3) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) << 22) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 12) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 2) + | (CLAMP(rgba[i][RCOMP], 0, 3) ); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) ) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][ACOMP], 0, 3) << 30); + } + } + else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) ) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][RCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][ACOMP], 0, 3) << 30); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) dstAddr; + for (i=0;i<n;i++) { + dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) ) + | (CLAMP(rgba[i][BCOMP], 0, 1023) << 10) + | (CLAMP(rgba[i][GCOMP], 0, 1023) << 20) + | (CLAMP(rgba[i][RCOMP], 0, 3) << 30); + } + } else { + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); + } + break; default: - _mesa_problem(ctx, - "Unsupported type (%s) for format (%s)", - _mesa_lookup_enum_by_nr(dstType), - _mesa_lookup_enum_by_nr(dstFormat)); + _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); return; } } @@ -4913,7 +5614,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n, else { /* need to use double precision to prevent overflow problems */ for (i = 0; i < n; i++) { - GLdouble z = depthValues[i] * (GLfloat) depthMax; + GLdouble z = depthValues[i] * (GLdouble) depthMax; if (z >= (GLdouble) 0xffffffff) zValues[i] = 0xffffffff; else diff --git a/mesalib/src/mesa/main/pack.h b/mesalib/src/mesa/main/pack.h index cd49c7495..2fbdf9115 100644 --- a/mesalib/src/mesa/main/pack.h +++ b/mesalib/src/mesa/main/pack.h @@ -145,9 +145,15 @@ _mesa_unpack_image(GLuint dimensions, void -_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4], - GLenum dstFormat, GLenum dstType, - GLvoid *dstAddr); +_mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr); + + +void +_mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr); extern void diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 7ac877497..f0bc157d8 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -322,6 +322,8 @@ slow_read_rgba_pixels( struct gl_context *ctx, void *rgba; GLubyte *dst, *map; int dstStride, stride, j; + GLboolean dst_is_integer = _mesa_is_enum_format_integer(format); + GLboolean dst_is_uint = _mesa_is_format_unsigned(rbFormat); dstStride = _mesa_image_row_stride(packing, width, format, type); dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, @@ -339,12 +341,17 @@ slow_read_rgba_pixels( struct gl_context *ctx, goto done; for (j = 0; j < height; j++) { - if (_mesa_is_enum_format_integer(format)) { + if (dst_is_integer) { _mesa_unpack_uint_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba); _mesa_rebase_rgba_uint(width, (GLuint (*)[4]) rgba, rb->_BaseFormat); - _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4]) rgba, format, - type, dst); + if (dst_is_uint) { + _mesa_pack_rgba_span_from_uints(ctx, width, (GLuint (*)[4]) rgba, format, + type, dst); + } else { + _mesa_pack_rgba_span_from_ints(ctx, width, (GLint (*)[4]) rgba, format, + type, dst); + } } else { _mesa_unpack_rgba_row(rbFormat, width, map, (GLfloat (*)[4]) rgba); _mesa_rebase_rgba_float(width, (GLfloat (*)[4]) rgba, diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index dc8adfc3f..8bf5f490a 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -130,7 +130,6 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name) sampObj->MaxAnisotropy = 1.0F; sampObj->CompareMode = GL_NONE; sampObj->CompareFunc = GL_LEQUAL; - sampObj->CompareFailValue = 0.0; sampObj->sRGBDecode = GL_DECODE_EXT; sampObj->CubeMapSeamless = GL_FALSE; } diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 0ba3ff5b3..4cd87c645 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -306,7 +306,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, GLuint img, row; GLfloat (*rgba)[4]; GLuint (*rgba_uint)[4]; - GLboolean is_integer = _mesa_is_format_integer_color(texImage->TexFormat); + GLboolean tex_is_integer = _mesa_is_format_integer_color(texImage->TexFormat); + GLboolean tex_is_uint = _mesa_is_format_unsigned(texImage->TexFormat); /* Allocate buffer for one row of texels */ rgba = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat)); @@ -358,12 +359,19 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, width, height, format, type, img, row, 0); - if (is_integer) { + if (tex_is_integer) { _mesa_unpack_uint_rgba_row(texFormat, width, src, rgba_uint); if (rebaseFormat) _mesa_rebase_rgba_uint(width, rgba_uint, rebaseFormat); - _mesa_pack_rgba_span_int(ctx, width, rgba_uint, - format, type, dest); + if (tex_is_uint) { + _mesa_pack_rgba_span_from_uints(ctx, width, + (GLuint (*)[4]) rgba_uint, + format, type, dest); + } else { + _mesa_pack_rgba_span_from_ints(ctx, width, + (GLint (*)[4]) rgba_uint, + format, type, dest); + } } else { _mesa_unpack_rgba_row(texFormat, width, src, rgba); if (rebaseFormat) diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index f70da4fbc..1d905b608 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -144,7 +144,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->Sampler.MaxAnisotropy = 1.0; obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */ obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */ - obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */ obj->DepthMode = GL_LUMINANCE; obj->Sampler.CubeMapSeamless = GL_FALSE; obj->Swizzle[0] = GL_RED; @@ -257,7 +256,6 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->Sampler.MaxAnisotropy = src->Sampler.MaxAnisotropy; dest->Sampler.CompareMode = src->Sampler.CompareMode; dest->Sampler.CompareFunc = src->Sampler.CompareFunc; - dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue; dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless; dest->DepthMode = src->DepthMode; dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode; @@ -879,7 +877,58 @@ _mesa_total_texture_memory(struct gl_context *ctx) return total; } +static struct gl_texture_object * +invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture, + GLint level, const char *name) +{ + /* The GL_ARB_invalidate_subdata spec says: + * + * "If <texture> is zero or is not the name of a texture, the error + * INVALID_VALUE is generated." + * + * This performs the error check in a different order than listed in the + * spec. We have to get the texture object before we can validate the + * other parameters against values in the texture object. + */ + struct gl_texture_object *const t = _mesa_lookup_texture(ctx, texture); + if (texture == 0 || t == NULL) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", name); + return NULL; + } + /* The GL_ARB_invalidate_subdata spec says: + * + * "If <level> is less than zero or greater than the base 2 logarithm + * of the maximum texture width, height, or depth, the error + * INVALID_VALUE is generated." + */ + if (level < 0 || level > t->MaxLevel) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(level)", name); + return NULL; + } + + /* The GL_ARB_invalidate_subdata spec says: + * + * "If the target of <texture> is TEXTURE_RECTANGLE, TEXTURE_BUFFER, + * TEXTURE_2D_MULTISAMPLE, or TEXTURE_2D_MULTISAMPLE_ARRAY, and <level> + * is not zero, the error INVALID_VALUE is generated." + */ + if (level != 0) { + switch (t->Target) { + case GL_TEXTURE_RECTANGLE: + case GL_TEXTURE_BUFFER: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + _mesa_error(ctx, GL_INVALID_VALUE, "%s(level)", name); + return NULL; + + default: + break; + } + } + + return t; +} /*@}*/ @@ -1348,4 +1397,164 @@ _mesa_unlock_context_textures( struct gl_context *ctx ) _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); } +void GLAPIENTRY +_mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth) +{ + struct gl_texture_object *t; + struct gl_texture_image *image; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + t = invalidate_tex_image_error_check(ctx, texture, level, + "glInvalidateTexSubImage"); + + /* The GL_ARB_invalidate_subdata spec says: + * + * "...the specified subregion must be between -<b> and <dim>+<b> where + * <dim> is the size of the dimension of the texture image, and <b> is + * the size of the border of that texture image, otherwise + * INVALID_VALUE is generated (border is not applied to dimensions that + * don't exist in a given texture target)." + */ + image = t->Image[0][level]; + if (image) { + int xBorder; + int yBorder; + int zBorder; + int imageWidth; + int imageHeight; + int imageDepth; + + /* The GL_ARB_invalidate_subdata spec says: + * + * "For texture targets that don't have certain dimensions, this + * command treats those dimensions as having a size of 1. For + * example, to invalidate a portion of a two-dimensional texture, + * the application would use <zoffset> equal to zero and <depth> + * equal to one." + */ + switch (t->Target) { + case GL_TEXTURE_BUFFER: + xBorder = 0; + yBorder = 0; + zBorder = 0; + imageWidth = 1; + imageHeight = 1; + imageDepth = 1; + break; + case GL_TEXTURE_1D: + xBorder = image->Border; + yBorder = 0; + zBorder = 0; + imageWidth = image->Width; + imageHeight = 1; + imageDepth = 1; + break; + case GL_TEXTURE_1D_ARRAY: + xBorder = image->Border; + yBorder = 0; + zBorder = 0; + imageWidth = image->Width; + imageHeight = image->Height; + imageDepth = 1; + break; + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_RECTANGLE: + case GL_TEXTURE_2D_MULTISAMPLE: + xBorder = image->Border; + yBorder = image->Border; + zBorder = 0; + imageWidth = image->Width; + imageHeight = image->Height; + imageDepth = 1; + break; + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + xBorder = image->Border; + yBorder = image->Border; + zBorder = 0; + imageWidth = image->Width; + imageHeight = image->Height; + imageDepth = image->Depth; + break; + case GL_TEXTURE_3D: + xBorder = image->Border; + yBorder = image->Border; + zBorder = image->Border; + imageWidth = image->Width; + imageHeight = image->Height; + imageDepth = image->Depth; + break; + default: + assert(!"Should not get here."); + xBorder = 0; + yBorder = 0; + zBorder = 0; + imageWidth = 0; + imageHeight = 0; + imageDepth = 0; + break; + } + + if (xoffset < -xBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, "glInvalidateSubTexImage(xoffset)"); + return; + } + + if (xoffset + width > imageWidth + xBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateSubTexImage(xoffset+width)"); + return; + } + + if (yoffset < -yBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, "glInvalidateSubTexImage(yoffset)"); + return; + } + + if (yoffset + height > imageHeight + yBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateSubTexImage(yoffset+height)"); + return; + } + + if (zoffset < -zBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateSubTexImage(zoffset)"); + return; + } + + if (zoffset + depth > imageDepth + zBorder) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glInvalidateSubTexImage(zoffset+depth)"); + return; + } + } + + /* We don't actually do anything for this yet. Just return after + * validating the parameters and generating the required errors. + */ + return; +} + +void GLAPIENTRY +_mesa_InvalidateTexImage(GLuint texture, GLint level) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + invalidate_tex_image_error_check(ctx, texture, level, + "glInvalidateTexImage"); + + /* We don't actually do anything for this yet. Just return after + * validating the parameters and generating the required errors. + */ + return; +} + /*@}*/ diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index 23e1ade09..93e0d7738 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -152,6 +152,14 @@ _mesa_AreTexturesResident( GLsizei n, const GLuint *textures, extern GLboolean GLAPIENTRY _mesa_IsTexture( GLuint texture ); +extern void GLAPIENTRY +_mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth); + +extern void GLAPIENTRY +_mesa_InvalidateTexImage(GLuint texture, GLint level); + /*@}*/ diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 9e7c3e457..690fd6c25 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -541,20 +541,6 @@ set_tex_parameterf(struct gl_context *ctx, } return GL_FALSE; - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: - if (ctx->Extensions.ARB_shadow_ambient) { - if (texObj->Sampler.CompareFailValue != params[0]) { - flush(ctx); - texObj->Sampler.CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); - return GL_TRUE; - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)"); - } - return GL_FALSE; - case GL_TEXTURE_LOD_BIAS: /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */ if (texObj->Sampler.LodBias != params[0]) { @@ -1136,11 +1122,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) goto invalid_pname; *params = obj->Sampler.MaxAnisotropy; break; - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: - if (!ctx->Extensions.ARB_shadow_ambient) - goto invalid_pname; - *params = obj->Sampler.CompareFailValue; - break; case GL_GENERATE_MIPMAP_SGIS: *params = (GLfloat) obj->GenerateMipmap; break; @@ -1282,11 +1263,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) goto invalid_pname; *params = (GLint) obj->Sampler.MaxAnisotropy; break; - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: - if (!ctx->Extensions.ARB_shadow_ambient) - goto invalid_pname; - *params = (GLint) FLOAT_TO_INT(obj->Sampler.CompareFailValue); - break; case GL_GENERATE_MIPMAP_SGIS: *params = (GLint) obj->GenerateMipmap; break; diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 544c08d73..18429f581 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -3200,6 +3200,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) srcPacking); const GLuint *src = tempImage; GLint img, row; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3207,8 +3208,14 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLbyte *dstTexel = (GLbyte *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = (GLbyte) src[i]; + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLbyte) MIN2(src[i], 0x7f); + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLbyte) CLAMP((GLint) src[i], -0x80, 0x7f); + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3270,6 +3277,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) srcPacking); const GLuint *src = tempImage; GLint img, row; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3277,8 +3285,14 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLshort *dstTexel = (GLshort *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = (GLint) src[i]; + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLshort) MIN2(src[i], 0x7fff); + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLshort)CLAMP((GLint) src[i], -0x8000, 0x7fff); + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3340,6 +3354,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) srcPacking); const GLuint *src = tempImage; GLint img, row; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3347,8 +3362,14 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLint *dstTexel = (GLint *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = (GLint) src[i]; + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLint) MIN2(src[i], 0x7fffffff); + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLint) src[i]; + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3407,6 +3428,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) srcFormat, srcType, srcAddr, srcPacking); const GLuint *src = tempImage; GLint img, row; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3414,8 +3436,14 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLubyte *dstTexel = (GLubyte *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = (GLubyte) CLAMP(src[i], 0, 0xff); + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLubyte) MIN2(src[i], 0xff); + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLubyte) CLAMP((GLint) src[i], 0, 0xff); + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3474,6 +3502,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) srcFormat, srcType, srcAddr, srcPacking); const GLuint *src = tempImage; GLint img, row; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3481,8 +3510,14 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLushort *dstTexel = (GLushort *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = (GLushort) CLAMP(src[i], 0, 0xffff); + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLushort) MIN2(src[i], 0xffff); + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLushort) CLAMP((GLint) src[i], 0, 0xffff); + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3540,6 +3575,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLuint *src = tempImage; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); GLint img, row; if (!tempImage) return GL_FALSE; @@ -3548,8 +3584,14 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLuint *dstTexel = (GLuint *) dstRow; GLint i; - for (i = 0; i < srcWidth * components; i++) { - dstTexel[i] = src[i]; + if (is_unsigned) { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = src[i]; + } + } else { + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = MAX2((GLint) src[i], 0); + } } dstRow += dstRowStride; src += srcWidth * components; @@ -3867,6 +3909,7 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) srcPacking); const GLuint *src = tempImage; GLint img, row, col; + GLboolean is_unsigned = _mesa_is_type_unsigned(srcType); if (!tempImage) return GL_FALSE; for (img = 0; img < srcDepth; img++) { @@ -3874,14 +3917,26 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - for (col = 0; col < srcWidth; col++) { - GLushort a,r,g,b; - r = src[RCOMP]; - g = src[GCOMP]; - b = src[BCOMP]; - a = src[ACOMP]; - dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b); - src += 4; + if (is_unsigned) { + for (col = 0; col < srcWidth; col++) { + GLushort a,r,g,b; + r = MIN2(src[RCOMP], 0x3ff); + g = MIN2(src[GCOMP], 0x3ff); + b = MIN2(src[BCOMP], 0x3ff); + a = MIN2(src[ACOMP], 0x003); + dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b); + src += 4; + } + } else { + for (col = 0; col < srcWidth; col++) { + GLushort a,r,g,b; + r = CLAMP((GLint) src[RCOMP], 0, 0x3ff); + g = CLAMP((GLint) src[GCOMP], 0, 0x3ff); + b = CLAMP((GLint) src[BCOMP], 0, 0x3ff); + a = CLAMP((GLint) src[ACOMP], 0, 0x003); + dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b); + src += 4; + } } dstRow += dstRowStride; } diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index 91212218e..f9c6677b1 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -551,22 +551,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], value[3] = ctx->Pixel.AlphaBias; return; - case STATE_SHADOW_AMBIENT: - { - const int unit = (int) state[2]; - const struct gl_texture_object *texObj - = ctx->Texture.Unit[unit]._Current; - const struct gl_sampler_object *samp = - _mesa_get_samplerobj(ctx, unit); - if (texObj) { - value[0] = - value[1] = - value[2] = - value[3] = samp->CompareFailValue; - } - } - return; - case STATE_FB_SIZE: value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1); value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1); @@ -702,7 +686,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) return _NEW_MODELVIEW; case STATE_TEXRECT_SCALE: - case STATE_SHADOW_AMBIENT: case STATE_ROT_MATRIX_0: case STATE_ROT_MATRIX_1: return _NEW_TEXTURE; @@ -918,9 +901,6 @@ append_token(char *dst, gl_state_index k) case STATE_PT_BIAS: append(dst, "PTbias"); break; - case STATE_SHADOW_AMBIENT: - append(dst, "CompareFailValue"); - break; case STATE_FB_SIZE: append(dst, "FbSize"); break; diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h index 65baa7833..efd0e030c 100644 --- a/mesalib/src/mesa/program/prog_statevars.h +++ b/mesalib/src/mesa/program/prog_statevars.h @@ -124,7 +124,6 @@ typedef enum gl_state_index_ { STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ - STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */ STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */ STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */ diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak index ce248dea1..30e2219b0 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/sources.mak @@ -5,8 +5,8 @@ # this is part of MAIN_FILES MAIN_ES_FILES = \ - $(SRCDIR)main/api_exec_es1.c \ - $(SRCDIR)main/api_exec_es2.c + $(BUILDDIR)main/api_exec_es1.c \ + $(BUILDDIR)main/api_exec_es2.c MAIN_FILES = \ $(SRCDIR)main/api_arrayelt.c \ @@ -35,7 +35,6 @@ MAIN_FILES = \ $(SRCDIR)main/drawpix.c \ $(SRCDIR)main/drawtex.c \ $(SRCDIR)main/enable.c \ - $(SRCDIR)main/enums.c \ $(SRCDIR)main/errors.c \ $(SRCDIR)main/eval.c \ $(SRCDIR)main/execmem.c \ @@ -107,6 +106,7 @@ MAIN_FILES = \ $(SRCDIR)main/version.c \ $(SRCDIR)main/viewport.c \ $(SRCDIR)main/vtxfmt.c \ + $(BUILDDIR)main/enums.c \ $(MAIN_ES_FILES) MAIN_CXX_FILES = \ @@ -251,11 +251,9 @@ STATETRACKER_FILES = \ PROGRAM_FILES = \ $(SRCDIR)program/arbprogparse.c \ $(SRCDIR)program/hash_table.c \ - $(SRCDIR)program/lex.yy.c \ $(SRCDIR)program/nvfragparse.c \ $(SRCDIR)program/nvvertparse.c \ $(SRCDIR)program/program.c \ - $(SRCDIR)program/program_parse.tab.c \ $(SRCDIR)program/program_parse_extra.c \ $(SRCDIR)program/prog_cache.c \ $(SRCDIR)program/prog_execute.c \ @@ -269,7 +267,9 @@ PROGRAM_FILES = \ $(SRCDIR)program/prog_statevars.c \ $(SRCDIR)program/programopt.c \ $(SRCDIR)program/register_allocate.c \ - $(SRCDIR)program/symbol_table.c + $(SRCDIR)program/symbol_table.c \ + $(BUILDDIR)program/lex.yy.c \ + $(BUILDDIR)program/program_parse.tab.c SHADER_CXX_FILES = \ @@ -372,18 +372,18 @@ MESA_GALLIUM_OBJECTS = \ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_FILES:.c=.o) -### Other archives/libraries - -GLSL_LIBS = \ - $(TOP)/src/glsl/libglsl.a - - ### Include directories INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/glsl \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/auxiliary + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src/glsl \ + -I$(top_builddir)/src/glsl \ + -I$(top_srcdir)/src/glsl/glcpp \ + -I$(top_srcdir)/src/mesa \ + -I$(top_builddir)/src/mesa \ + -I$(top_srcdir)/src/mesa/main \ + -I$(top_builddir)/src/mesa/main \ + -I$(top_srcdir)/src/mapi \ + -I$(top_builddir)/src/mapi \ + -I$(top_srcdir)/src/gallium/include \ + -I$(top_srcdir)/src/gallium/auxiliary diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 204f505a6..d9e9d21f6 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -239,7 +239,8 @@ static void update_raster_state( struct st_context *st ) /* _NEW_FRAG_CLAMP */ raster->clamp_fragment_color = !st->clamp_frag_color_in_shader && - ctx->Color._ClampFragmentColor; + ctx->Color._ClampFragmentColor && + !ctx->DrawBuffer->_IntegerColor; raster->gl_rasterization_rules = 1; /* _NEW_RASTERIZER_DISCARD */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c index ae3491097..45e7a117f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_shader.c +++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c @@ -85,7 +85,8 @@ update_fp( struct st_context *st ) /* _NEW_FRAG_CLAMP */ key.clamp_color = st->clamp_frag_color_in_shader && - st->ctx->Color._ClampFragmentColor; + st->ctx->Color._ClampFragmentColor && + !st->ctx->DrawBuffer->_IntegerColor; st->fp_variant = st_get_fp_variant(st, stfp, &key); @@ -106,7 +107,7 @@ update_fp( struct st_context *st ) const struct st_tracked_state st_update_fp = { "st_update_fp", /* name */ { /* dirty */ - 0, /* mesa */ + _NEW_BUFFERS, /* mesa */ ST_NEW_FRAGMENT_PROGRAM /* st */ }, update_fp /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index 3c17bd6c3..7d9ccc1e5 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -424,7 +424,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, key.st = st; key.bitmap = GL_TRUE; key.clamp_color = st->clamp_frag_color_in_shader && - st->ctx->Color._ClampFragmentColor; + st->ctx->Color._ClampFragmentColor && + !st->ctx->DrawBuffer->_IntegerColor; fpv = st_get_fp_variant(st, st->fp, &key); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 88068ac60..9f1b427a9 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -697,7 +697,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, struct pipe_rasterizer_state rasterizer; memset(&rasterizer, 0, sizeof(rasterizer)); rasterizer.clamp_fragment_color = !st->clamp_frag_color_in_shader && - ctx->Color._ClampFragmentColor; + ctx->Color._ClampFragmentColor && + !ctx->DrawBuffer->_IntegerColor; rasterizer.gl_rasterization_rules = 1; rasterizer.depth_clip = !ctx->Transform.DepthClamp; rasterizer.scissor = ctx->Scissor.Enabled; @@ -1026,7 +1027,8 @@ get_color_fp_variant(struct st_context *st) ctx->Pixel.AlphaScale != 1.0); key.pixelMaps = ctx->Pixel.MapColorFlag; key.clamp_color = st->clamp_frag_color_in_shader && - st->ctx->Color._ClampFragmentColor; + st->ctx->Color._ClampFragmentColor && + !st->ctx->DrawBuffer->_IntegerColor; fpv = st_get_fp_variant(st, st->fp, &key); diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 51c899208..3c2aae913 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -3345,34 +3345,33 @@ sample_lambda_1d_array(struct gl_context *ctx, /** - * Compare texcoord against depth sample. Return 1.0 or the ambient value. + * Compare texcoord against depth sample. Return 1.0 or 0.0 value. */ static inline GLfloat -shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample, - GLfloat ambient) +shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) { switch (function) { case GL_LEQUAL: - return (coord <= depthSample) ? 1.0F : ambient; + return (coord <= depthSample) ? 1.0F : 0.0F; case GL_GEQUAL: - return (coord >= depthSample) ? 1.0F : ambient; + return (coord >= depthSample) ? 1.0F : 0.0F; case GL_LESS: - return (coord < depthSample) ? 1.0F : ambient; + return (coord < depthSample) ? 1.0F : 0.0F; case GL_GREATER: - return (coord > depthSample) ? 1.0F : ambient; + return (coord > depthSample) ? 1.0F : 0.0F; case GL_EQUAL: - return (coord == depthSample) ? 1.0F : ambient; + return (coord == depthSample) ? 1.0F : 0.0F; case GL_NOTEQUAL: - return (coord != depthSample) ? 1.0F : ambient; + return (coord != depthSample) ? 1.0F : 0.0F; case GL_ALWAYS: return 1.0F; case GL_NEVER: - return ambient; + return 0.0F; case GL_NONE: return depthSample; default: _mesa_problem(NULL, "Bad compare func in shadow_compare"); - return ambient; + return 0.0F; } } @@ -3384,9 +3383,9 @@ static inline GLfloat shadow_compare4(GLenum function, GLfloat coord, GLfloat depth00, GLfloat depth01, GLfloat depth10, GLfloat depth11, - GLfloat ambient, GLfloat wi, GLfloat wj) + GLfloat wi, GLfloat wj) { - const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F; + const GLfloat d = 0.25F; GLfloat luminance = 1.0F; switch (function) { @@ -3429,13 +3428,13 @@ shadow_compare4(GLenum function, GLfloat coord, case GL_ALWAYS: return 1.0F; case GL_NEVER: - return ambient; + return 0.0F; case GL_NONE: /* ordinary bilinear filtering */ return lerp_2d(wi, wj, depth00, depth10, depth01, depth11); default: _mesa_problem(NULL, "Bad compare func in sample_compare4"); - return ambient; + return 0.0F; } } @@ -3483,7 +3482,6 @@ sample_depth_texture( struct gl_context *ctx, const GLint depth = img->Depth; const GLuint compare_coord = (tObj->Target == GL_TEXTURE_2D_ARRAY_EXT) ? 3 : 2; - GLfloat ambient; GLenum function; GLfloat result; @@ -3497,8 +3495,6 @@ sample_depth_texture( struct gl_context *ctx, tObj->Target == GL_TEXTURE_2D_ARRAY_EXT || tObj->Target == GL_TEXTURE_CUBE_MAP); - ambient = samp->CompareFailValue; - /* XXXX if samp->MinFilter != samp->MagFilter, we're ignoring lambda */ function = (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ? @@ -3522,7 +3518,7 @@ sample_depth_texture( struct gl_context *ctx, depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F); - result = shadow_compare(function, depthRef, depthSample, ambient); + result = shadow_compare(function, depthRef, depthSample); switch (tObj->DepthMode) { case GL_LUMINANCE: @@ -3617,7 +3613,7 @@ sample_depth_texture( struct gl_context *ctx, result = shadow_compare4(function, depthRef, depth00, depth01, depth10, depth11, - ambient, wi, wj); + wi, wj); switch (tObj->DepthMode) { case GL_LUMINANCE: |