[Mesa-dev] [PATCH 1/6] mesa: implement ARB_compatibility
Marek Olšák
maraeo at gmail.com
Thu Feb 15 00:11:19 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/compiler/glsl/builtin_functions.cpp | 2 +-
src/compiler/glsl/builtin_types.cpp | 2 +-
src/compiler/glsl/builtin_variables.cpp | 2 +-
src/compiler/glsl/glsl_parser_extras.cpp | 1 +
src/compiler/glsl/glsl_parser_extras.h | 2 ++
src/mesa/main/extensions_table.h | 1 +
src/mesa/main/mtypes.h | 1 +
7 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 293e8bd..5f772c9 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -97,21 +97,21 @@ using namespace ir_builder;
static bool
always_available(const _mesa_glsl_parse_state *)
{
return true;
}
static bool
compatibility_vs_only(const _mesa_glsl_parse_state *state)
{
return state->stage == MESA_SHADER_VERTEX &&
- state->language_version <= 130 &&
+ (state->compat_shader || state->ARB_compatibility_enable) &&
!state->es_shader;
}
static bool
fs_only(const _mesa_glsl_parse_state *state)
{
return state->stage == MESA_SHADER_FRAGMENT;
}
static bool
diff --git a/src/compiler/glsl/builtin_types.cpp b/src/compiler/glsl/builtin_types.cpp
index b64f757..7a01cb4 100644
--- a/src/compiler/glsl/builtin_types.cpp
+++ b/src/compiler/glsl/builtin_types.cpp
@@ -281,21 +281,21 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
for (unsigned i = 0; i < ARRAY_SIZE(builtin_type_versions); i++) {
const struct builtin_type_versions *const t = &builtin_type_versions[i];
if (state->is_version(t->min_gl, t->min_es)) {
add_type(symbols, t->type);
}
}
/* Add deprecated structure types. While these were deprecated in 1.30,
* they're still present. We've removed them in 1.40+ (OpenGL 3.1+).
*/
- if (state->compat_shader) {
+ if (state->compat_shader || state->ARB_compatibility_enable) {
for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
add_type(symbols, deprecated_types[i]);
}
}
/* Add types for enabled extensions. They may have already been added
* by the version-based loop, but attempting to add them a second time
* is harmless.
*/
if (state->ARB_texture_cube_map_array_enable ||
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index a686cb6..f0210b6 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -434,21 +434,21 @@ private:
const glsl_type * const mat4_t;
per_vertex_accumulator per_vertex_in;
per_vertex_accumulator per_vertex_out;
};
builtin_variable_generator::builtin_variable_generator(
exec_list *instructions, struct _mesa_glsl_parse_state *state)
: instructions(instructions), state(state), symtab(state->symbols),
- compatibility(state->compat_shader || !state->is_version(140, 100)),
+ compatibility(state->compat_shader || state->ARB_compatibility_enable),
bool_t(glsl_type::bool_type), int_t(glsl_type::int_type),
uint_t(glsl_type::uint_type),
uint64_t(glsl_type::uint64_t_type),
float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type),
vec3_t(glsl_type::vec3_type), vec4_t(glsl_type::vec4_type),
uvec3_t(glsl_type::uvec3_type),
mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type)
{
}
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index d99916d..81d74e9 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -609,20 +609,21 @@ has_##name_str(const struct gl_context *ctx, gl_api api, uint8_t version) \
* Table of extensions that can be enabled/disabled within a shader,
* and the conditions under which they are supported.
*/
static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
/* ARB extensions go here, sorted alphabetically.
*/
EXT(ARB_ES3_1_compatibility),
EXT(ARB_ES3_2_compatibility),
EXT(ARB_arrays_of_arrays),
EXT(ARB_bindless_texture),
+ EXT(ARB_compatibility),
EXT(ARB_compute_shader),
EXT(ARB_compute_variable_group_size),
EXT(ARB_conservative_depth),
EXT(ARB_cull_distance),
EXT(ARB_derivative_control),
EXT(ARB_draw_buffers),
EXT(ARB_draw_instanced),
EXT(ARB_enhanced_layouts),
EXT(ARB_explicit_attrib_location),
EXT(ARB_explicit_uniform_location),
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 508befd..f88cb78 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -602,20 +602,22 @@ struct _mesa_glsl_parse_state {
/* ARB extensions go here, sorted alphabetically.
*/
bool ARB_ES3_1_compatibility_enable;
bool ARB_ES3_1_compatibility_warn;
bool ARB_ES3_2_compatibility_enable;
bool ARB_ES3_2_compatibility_warn;
bool ARB_arrays_of_arrays_enable;
bool ARB_arrays_of_arrays_warn;
bool ARB_bindless_texture_enable;
bool ARB_bindless_texture_warn;
+ bool ARB_compatibility_enable;
+ bool ARB_compatibility_warn;
bool ARB_compute_shader_enable;
bool ARB_compute_shader_warn;
bool ARB_compute_variable_group_size_enable;
bool ARB_compute_variable_group_size_warn;
bool ARB_conservative_depth_enable;
bool ARB_conservative_depth_warn;
bool ARB_cull_distance_enable;
bool ARB_cull_distance_warn;
bool ARB_derivative_control_enable;
bool ARB_derivative_control_warn;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index f4925ed..02c97a2 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -33,20 +33,21 @@ EXT(ARB_ES3_2_compatibility , ARB_ES3_2_compatibility
EXT(ARB_ES3_compatibility , ARB_ES3_compatibility , GLL, GLC, x , x , 2012)
EXT(ARB_arrays_of_arrays , ARB_arrays_of_arrays , GLL, GLC, x , x , 2012)
EXT(ARB_base_instance , ARB_base_instance , GLL, GLC, x , x , 2011)
EXT(ARB_bindless_texture , ARB_bindless_texture , GLL, GLC, x , x , 2013)
EXT(ARB_blend_func_extended , ARB_blend_func_extended , GLL, GLC, x , x , 2009)
EXT(ARB_buffer_storage , ARB_buffer_storage , GLL, GLC, x , x , 2013)
EXT(ARB_clear_buffer_object , dummy_true , GLL, GLC, x , x , 2012)
EXT(ARB_clear_texture , ARB_clear_texture , GLL, GLC, x , x , 2013)
EXT(ARB_clip_control , ARB_clip_control , GLL, GLC, x , x , 2014)
EXT(ARB_color_buffer_float , ARB_color_buffer_float , GLL, GLC, x , x , 2004)
+EXT(ARB_compatibility , ARB_compatibility , GLL, x , x , x , 2009)
EXT(ARB_compressed_texture_pixel_storage , dummy_true , GLL, GLC, x , x , 2011)
EXT(ARB_compute_shader , ARB_compute_shader , GLL, GLC, x , x , 2012)
EXT(ARB_compute_variable_group_size , ARB_compute_variable_group_size , GLL, GLC, x , x , 2013)
EXT(ARB_conditional_render_inverted , ARB_conditional_render_inverted , GLL, GLC, x , x , 2014)
EXT(ARB_conservative_depth , ARB_conservative_depth , GLL, GLC, x , x , 2011)
EXT(ARB_copy_buffer , dummy_true , GLL, GLC, x , x , 2008)
EXT(ARB_copy_image , ARB_copy_image , GLL, GLC, x , x , 2012)
EXT(ARB_cull_distance , ARB_cull_distance , GLL, GLC, x , x , 2014)
EXT(ARB_debug_output , dummy_true , GLL, GLC, x , x , 2009)
EXT(ARB_depth_buffer_float , ARB_depth_buffer_float , GLL, GLC, x , x , 2008)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7da3240..15484dc 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4117,20 +4117,21 @@ struct gl_extensions
GLboolean ARB_ES3_1_compatibility;
GLboolean ARB_ES3_2_compatibility;
GLboolean ARB_arrays_of_arrays;
GLboolean ARB_base_instance;
GLboolean ARB_bindless_texture;
GLboolean ARB_blend_func_extended;
GLboolean ARB_buffer_storage;
GLboolean ARB_clear_texture;
GLboolean ARB_clip_control;
GLboolean ARB_color_buffer_float;
+ GLboolean ARB_compatibility;
GLboolean ARB_compute_shader;
GLboolean ARB_compute_variable_group_size;
GLboolean ARB_conditional_render_inverted;
GLboolean ARB_conservative_depth;
GLboolean ARB_copy_image;
GLboolean ARB_cull_distance;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;
GLboolean ARB_depth_texture;
GLboolean ARB_derivative_control;
--
2.7.4
More information about the mesa-dev
mailing list