From: Marek Olšák Date: Thu, 19 Oct 2017 20:22:15 +0000 (+0200) Subject: mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=272fe9494232baab159d10901aecfe1786595b17;p=mesa.git mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile We already have piglit tests testing alpha, luminance, and intensity formats. They were skipped by piglit until now. Additionally, I'm enabling one ARB_texture_buffer_range piglit test to run with the compat profile. i965 behavior is unchanged except that it doesn't expose TBOs in the Compat profile. Not sure how that affects the GL version override. Reviewed-by: Nicolai Hähnle Reviewed-by: Eric Anholt --- diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py index 61eda4b0f98..7da0818f8ab 100644 --- a/src/mapi/glapi/gen/apiexec.py +++ b/src/mapi/glapi/gen/apiexec.py @@ -35,7 +35,7 @@ class exec_info(): Each of the attributes that is not None must have a valid value. The valid ranges are: - compatiblity: [10, 30] + compatibility: [10, ) core: [31, ) es1: [10, 11] es2: [20, ) @@ -66,9 +66,8 @@ class exec_info(): self.es2 = es2 functions = { - # OpenGL 3.1 / GL_ARB_texture_buffer_object. Mesa only exposes this - # extension with core profile. - "TexBuffer": exec_info(core=31, es2=31), + # OpenGL 3.1 / GL_ARB_texture_buffer_object. + "TexBuffer": exec_info(compatibility=20, core=31, es2=31), # OpenGL 3.2 / GL_OES_geometry_shader. "FramebufferTexture": exec_info(core=32, es2=31), @@ -144,9 +143,8 @@ functions = { # GetFloati_v also GL_ARB_shader_atomic_counters # GetDoublei_v also GL_ARB_shader_atomic_counters - # OpenGL 4.3 / GL_ARB_texture_buffer_range. Mesa can expose the extension - # with OpenGL 3.1. - "TexBufferRange": exec_info(core=31, es2=31), + # OpenGL 4.3 / GL_ARB_texture_buffer_range. + "TexBufferRange": exec_info(compatibility=20, core=31, es2=31), # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments. Mesa can expose the # extension with OpenGL 3.0. diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index 519d0a56cbf..4d17393948a 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -178,9 +178,11 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.ARB_pipeline_statistics_query = true; ctx->Extensions.ARB_sample_shading = true; ctx->Extensions.ARB_shading_language_420pack = true; - ctx->Extensions.ARB_texture_buffer_object = true; - ctx->Extensions.ARB_texture_buffer_object_rgb32 = true; - ctx->Extensions.ARB_texture_buffer_range = true; + if (ctx->API != API_OPENGL_COMPAT) { + ctx->Extensions.ARB_texture_buffer_object = true; + ctx->Extensions.ARB_texture_buffer_object_rgb32 = true; + ctx->Extensions.ARB_texture_buffer_range = true; + } ctx->Extensions.ARB_texture_cube_map_array = true; ctx->Extensions.ARB_texture_gather = true; ctx->Extensions.ARB_texture_multisample = true; diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 8d8b6376dc7..5b66e7d30df 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -133,9 +133,9 @@ EXT(ARB_sync , ARB_sync EXT(ARB_tessellation_shader , ARB_tessellation_shader , x , GLC, x , x , 2009) EXT(ARB_texture_barrier , NV_texture_barrier , GLL, GLC, x , x , 2014) EXT(ARB_texture_border_clamp , ARB_texture_border_clamp , GLL, x , x , x , 2000) -EXT(ARB_texture_buffer_object , ARB_texture_buffer_object , x , GLC, x , x , 2008) -EXT(ARB_texture_buffer_object_rgb32 , ARB_texture_buffer_object_rgb32 , x , GLC, x , x , 2009) -EXT(ARB_texture_buffer_range , ARB_texture_buffer_range , x , GLC, x , x , 2012) +EXT(ARB_texture_buffer_object , ARB_texture_buffer_object , GLL, GLC, x , x , 2008) +EXT(ARB_texture_buffer_object_rgb32 , ARB_texture_buffer_object_rgb32 , GLL, GLC, x , x , 2009) +EXT(ARB_texture_buffer_range , ARB_texture_buffer_range , GLL, GLC, x , x , 2012) EXT(ARB_texture_compression , dummy_true , GLL, x , x , x , 2000) EXT(ARB_texture_compression_bptc , ARB_texture_compression_bptc , GLL, GLC, x , x , 2010) EXT(ARB_texture_compression_rgtc , ARB_texture_compression_rgtc , GLL, GLC, x , x , 2004) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index e68a93b10ee..ea8d932b182 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -309,8 +309,6 @@ static const int extra_GLSL_130_es3[] = { }; static const int extra_texture_buffer_object[] = { - EXTRA_API_GL_CORE, - EXTRA_VERSION_31, EXT(ARB_texture_buffer_object), EXTRA_END }; diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index acd5cd1f011..20ef6e4977a 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -442,6 +442,16 @@ descriptor=[ # Enums in OpenGL and ES 3.1 { "apis": ["GL", "GL_CORE", "GLES31"], "params": [ +# GL_ARB_texture_buffer_object / GL_OES_texture_buffer + [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ], + [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], + +# GL_ARB_texture_buffer_range + [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ], + # GL_ARB_shader_image_load_store / GLES 3.1 [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), extra_ARB_shader_image_load_store" ], [ "MAX_VERTEX_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), extra_ARB_shader_image_load_store" ], @@ -602,16 +612,6 @@ descriptor=[ # GL_ARB_gpu_shader5 / GL_OES_geometry_shader [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5_or_oes_geometry_shader" ], -# GL_ARB_texture_buffer_object / GL_OES_texture_buffer - [ "MAX_TEXTURE_BUFFER_SIZE_ARB", "CONTEXT_INT(Const.MaxTextureBufferSize), extra_texture_buffer_object" ], - [ "TEXTURE_BINDING_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], - [ "TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_BUFFER_INDEX, extra_texture_buffer_object" ], - [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], - [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], - -# GL_ARB_texture_buffer_range - [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ], - # GL_OES_primitive_bounding_box [ "PRIMITIVE_BOUNDING_BOX_ARB", "CONTEXT_FLOAT8(PrimitiveBoundingBox), extra_OES_primitive_bounding_box" ], diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 8c511805b51..d7183de0f1a 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -504,6 +504,10 @@ const struct function common_desktop_functions_possible[] = { { "glDrawArraysInstanced", 31, -1 }, { "glDrawElementsInstanced", 31, -1 }, { "glPrimitiveRestartIndex", 31, -1 }, + { "glTexBuffer", 31, -1 }, + + /* GL_ARB_texture_buffer_range */ + { "glTexBufferRange", 43, -1 }, /* GL_ARB_shader_objects */ { "glDeleteObjectARB", 31, -1 }, @@ -1501,9 +1505,6 @@ const struct function gl_compatibility_functions_possible[] = { }; const struct function gl_core_functions_possible[] = { - /* GL 3.1 */ - { "glTexBuffer", 31, -1 }, - /* GL 3.2 */ { "glFramebufferTexture", 32, -1 }, @@ -1808,7 +1809,6 @@ const struct function gl_core_functions_possible[] = { { "glGetProgramResourceLocation", 43, -1 }, { "glGetProgramResourceLocationIndex", 43, -1 }, // { "glShaderStorageBlockBinding", 43, -1 }, // XXX: Add to xml - { "glTexBufferRange", 43, -1 }, // { "glTextureBufferRangeEXT", 43, -1 }, // XXX: Add to xml { "glTexStorage2DMultisample", 43, -1 }, { "glTexStorage3DMultisample", 43, -1 }, diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 039b93349e4..4a0f61eda81 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1287,8 +1287,8 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target * From the OpenGL 3.1 spec: * "target may also be TEXTURE_BUFFER, indicating the texture buffer." */ - return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) || - _mesa_has_OES_texture_buffer(ctx); + return (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31) || + _mesa_has_OES_texture_buffer(ctx); case GL_TEXTURE_CUBE_MAP_ARRAY: return _mesa_has_texture_cube_map_array(ctx); } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index e82090b7e45..8abf879ab98 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -412,7 +412,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, /* GL limits and extensions */ st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions); st_init_extensions(pipe->screen, &ctx->Const, - &ctx->Extensions, &st->options); + &ctx->Extensions, &st->options, ctx->API); if (st_have_perfmon(st)) { ctx->Extensions.AMD_performance_monitor = GL_TRUE; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index d4b8dc91139..de3d1ef4e9b 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -603,7 +603,8 @@ get_max_samples_for_formats(struct pipe_screen *screen, void st_init_extensions(struct pipe_screen *screen, struct gl_constants *consts, struct gl_extensions *extensions, - struct st_config_options *options) + struct st_config_options *options, + gl_api api) { unsigned i; GLboolean *extension_table = (GLboolean *) extensions; @@ -1120,6 +1121,11 @@ void st_init_extensions(struct pipe_screen *screen, consts->MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); + /* The OpenGL Compatibility profile requires arbitrary buffer swizzling. */ + if (api == API_OPENGL_COMPAT && + screen->get_param(screen, PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY)) + extensions->ARB_texture_buffer_object = GL_FALSE; + if (extensions->ARB_texture_buffer_object) { consts->MaxTextureBufferSize = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE), diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h index 951185caa3b..7bf1aa8c8cb 100644 --- a/src/mesa/state_tracker/st_extensions.h +++ b/src/mesa/state_tracker/st_extensions.h @@ -40,7 +40,8 @@ extern void st_init_limits(struct pipe_screen *screen, extern void st_init_extensions(struct pipe_screen *screen, struct gl_constants *consts, struct gl_extensions *extensions, - struct st_config_options *options); + struct st_config_options *options, + gl_api api); #endif /* ST_EXTENSIONS_H */ diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 953f7156c90..aedbc13f7d7 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -1177,7 +1177,7 @@ get_version(struct pipe_screen *screen, _mesa_init_extensions(&extensions); st_init_limits(screen, &consts, &extensions); - st_init_extensions(screen, &consts, &extensions, options); + st_init_extensions(screen, &consts, &extensions, options, api); return _mesa_get_version(&extensions, &consts, api); }