aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-01-04 16:25:32 +0100
committermarha <marha@users.sourceforge.net>2015-01-04 16:25:32 +0100
commit5e5a48ff8cd08f123601cd0625ca62a86675aac9 (patch)
treeea1c2cee139e8e1ce389a7f956e9874db1e0a650 /mesalib/src/glsl
parenta1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (diff)
downloadvcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.tar.gz
vcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.tar.bz2
vcxsrv-5e5a48ff8cd08f123601cd0625ca62a86675aac9.zip
fontconfig libX11 mesa xserver git update 4 Jan 2015
xserver commit dc777c346d5d452a53b13b917c45f6a1bad2f20b libX11 commit 446f5f7f41317a85a0cd0efa5e6a1b37bc99fba2 fontconfig commit 4420b27c074821a1d1f9d6ebe822a610176a417d mesa commit 48094d0e6554a9df36bf00fc2793ade46cf92406
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/Makefile.am20
-rw-r--r--mesalib/src/glsl/Makefile.sources31
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp8
-rw-r--r--mesalib/src/glsl/builtin_variables.cpp4
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y5
-rw-r--r--mesalib/src/glsl/glsl_parser.yy24
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp20
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h5
-rw-r--r--mesalib/src/glsl/glsl_types.cpp3
-rw-r--r--mesalib/src/glsl/ir_variable_refcount.cpp9
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.cpp6
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp3
-rw-r--r--mesalib/src/glsl/link_varyings.cpp10
-rw-r--r--mesalib/src/glsl/linker.cpp39
-rw-r--r--mesalib/src/glsl/main.cpp2
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp12
16 files changed, 161 insertions, 40 deletions
diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am
index 0ccc81d75..9a3131738 100644
--- a/mesalib/src/glsl/Makefile.am
+++ b/mesalib/src/glsl/Makefile.am
@@ -30,6 +30,13 @@ AM_CPPFLAGS = \
AM_CFLAGS = $(VISIBILITY_CFLAGS)
AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
+ glsl_lexer.ll \
+ glsl_parser.yy \
+ glcpp/glcpp-lex.l \
+ glcpp/glcpp-parse.y \
+ SConscript
+
include Makefile.sources
TESTS = glcpp/tests/glcpp-test \
@@ -77,6 +84,7 @@ tests_uniform_initializer_test_SOURCES = \
tests/copy_constant_to_storage_tests.cpp \
tests/set_uniform_initializer_tests.cpp \
tests/uniform_initializer_utils.cpp \
+ tests/uniform_initializer_utils.h \
tests/common.c
tests_uniform_initializer_test_CFLAGS = \
$(PTHREAD_CFLAGS)
@@ -102,6 +110,7 @@ libglcpp_la_LIBADD = \
libglcpp_la_SOURCES = \
glcpp/glcpp-lex.c \
glcpp/glcpp-parse.c \
+ glcpp/glcpp-parse.h \
$(LIBGLCPP_FILES)
glcpp_glcpp_SOURCES = \
@@ -116,6 +125,7 @@ libglsl_la_LIBADD = libglcpp.la
libglsl_la_SOURCES = \
glsl_lexer.cpp \
glsl_parser.cpp \
+ glsl_parser.h \
$(LIBGLSL_FILES)
glsl_compiler_SOURCES = \
@@ -135,7 +145,8 @@ glsl_test_SOURCES = \
$(GLSL_SRCDIR)/standalone_scaffolding.cpp \
tests/common.c \
test.cpp \
- test_optpass.cpp
+ test_optpass.cpp \
+ test_optpass.h
glsl_test_LDADD = libglsl.la
@@ -198,3 +209,10 @@ CLEANFILES = \
glcpp/glcpp-parse.h \
glsl_parser.h \
$(BUILT_SOURCES)
+
+clean-local:
+ $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
+
+dist-hook:
+ $(RM) glcpp/tests/*.out
+ $(RM) glcpp/tests/subtest*/*.out
diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources
index 676fa0d7a..e2acbac25 100644
--- a/mesalib/src/glsl/Makefile.sources
+++ b/mesalib/src/glsl/Makefile.sources
@@ -6,6 +6,7 @@ GLSL_BUILDDIR = $(top_builddir)/src/glsl
# libglcpp
LIBGLCPP_FILES = \
+ $(GLSL_SRCDIR)/glcpp/glcpp.h \
$(GLSL_SRCDIR)/glcpp/pp.c
LIBGLCPP_GENERATED_FILES = \
@@ -15,47 +16,70 @@ LIBGLCPP_GENERATED_FILES = \
# libglsl
LIBGLSL_FILES = \
+ $(GLSL_SRCDIR)/ast.h \
$(GLSL_SRCDIR)/ast_array_index.cpp \
$(GLSL_SRCDIR)/ast_expr.cpp \
$(GLSL_SRCDIR)/ast_function.cpp \
$(GLSL_SRCDIR)/ast_to_hir.cpp \
$(GLSL_SRCDIR)/ast_type.cpp \
$(GLSL_SRCDIR)/builtin_functions.cpp \
+ $(GLSL_SRCDIR)/builtin_type_macros.h \
$(GLSL_SRCDIR)/builtin_types.cpp \
$(GLSL_SRCDIR)/builtin_variables.cpp \
$(GLSL_SRCDIR)/glsl_parser_extras.cpp \
- $(GLSL_SRCDIR)/glsl_types.cpp \
+ $(GLSL_SRCDIR)/glsl_parser_extras.h \
$(GLSL_SRCDIR)/glsl_symbol_table.cpp \
+ $(GLSL_SRCDIR)/glsl_symbol_table.h \
+ $(GLSL_SRCDIR)/glsl_types.cpp \
+ $(GLSL_SRCDIR)/glsl_types.h \
$(GLSL_SRCDIR)/hir_field_selection.cpp \
$(GLSL_SRCDIR)/ir_basic_block.cpp \
+ $(GLSL_SRCDIR)/ir_basic_block.h \
$(GLSL_SRCDIR)/ir_builder.cpp \
+ $(GLSL_SRCDIR)/ir_builder.h \
$(GLSL_SRCDIR)/ir_clone.cpp \
$(GLSL_SRCDIR)/ir_constant_expression.cpp \
$(GLSL_SRCDIR)/ir.cpp \
+ $(GLSL_SRCDIR)/ir.h \
$(GLSL_SRCDIR)/ir_equals.cpp \
$(GLSL_SRCDIR)/ir_expression_flattening.cpp \
+ $(GLSL_SRCDIR)/ir_expression_flattening.h \
$(GLSL_SRCDIR)/ir_function_can_inline.cpp \
$(GLSL_SRCDIR)/ir_function_detect_recursion.cpp \
+ $(GLSL_SRCDIR)/ir_function_inlining.h \
$(GLSL_SRCDIR)/ir_function.cpp \
$(GLSL_SRCDIR)/ir_hierarchical_visitor.cpp \
+ $(GLSL_SRCDIR)/ir_hierarchical_visitor.h \
$(GLSL_SRCDIR)/ir_hv_accept.cpp \
$(GLSL_SRCDIR)/ir_import_prototypes.cpp \
+ $(GLSL_SRCDIR)/ir_optimization.h \
$(GLSL_SRCDIR)/ir_print_visitor.cpp \
+ $(GLSL_SRCDIR)/ir_print_visitor.h \
$(GLSL_SRCDIR)/ir_reader.cpp \
+ $(GLSL_SRCDIR)/ir_reader.h \
$(GLSL_SRCDIR)/ir_rvalue_visitor.cpp \
+ $(GLSL_SRCDIR)/ir_rvalue_visitor.h \
$(GLSL_SRCDIR)/ir_set_program_inouts.cpp \
+ $(GLSL_SRCDIR)/ir_uniform.h \
$(GLSL_SRCDIR)/ir_validate.cpp \
$(GLSL_SRCDIR)/ir_variable_refcount.cpp \
+ $(GLSL_SRCDIR)/ir_variable_refcount.h \
+ $(GLSL_SRCDIR)/ir_visitor.h \
$(GLSL_SRCDIR)/linker.cpp \
+ $(GLSL_SRCDIR)/linker.h \
$(GLSL_SRCDIR)/link_atomics.cpp \
$(GLSL_SRCDIR)/link_functions.cpp \
$(GLSL_SRCDIR)/link_interface_blocks.cpp \
$(GLSL_SRCDIR)/link_uniforms.cpp \
$(GLSL_SRCDIR)/link_uniform_initializers.cpp \
$(GLSL_SRCDIR)/link_uniform_block_active_visitor.cpp \
+ $(GLSL_SRCDIR)/link_uniform_block_active_visitor.h \
$(GLSL_SRCDIR)/link_uniform_blocks.cpp \
$(GLSL_SRCDIR)/link_varyings.cpp \
+ $(GLSL_SRCDIR)/link_varyings.h \
+ $(GLSL_SRCDIR)/list.h \
$(GLSL_SRCDIR)/loop_analysis.cpp \
+ $(GLSL_SRCDIR)/loop_analysis.h \
$(GLSL_SRCDIR)/loop_controls.cpp \
$(GLSL_SRCDIR)/loop_unroll.cpp \
$(GLSL_SRCDIR)/lower_clip_distance.cpp \
@@ -105,12 +129,15 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/opt_swizzle_swizzle.cpp \
$(GLSL_SRCDIR)/opt_tree_grafting.cpp \
$(GLSL_SRCDIR)/opt_vectorize.cpp \
- $(GLSL_SRCDIR)/s_expression.cpp
+ $(GLSL_SRCDIR)/program.h \
+ $(GLSL_SRCDIR)/s_expression.cpp \
+ $(GLSL_SRCDIR)/s_expression.h
# glsl_compiler
GLSL_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/standalone_scaffolding.cpp \
+ $(GLSL_SRCDIR)/standalone_scaffolding.h \
$(GLSL_SRCDIR)/main.cpp
# libglsl generated sources
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index fe1e1291e..811a9557d 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -5908,7 +5908,7 @@ ast_cs_input_layout::hir(exec_list *instructions,
* declare it earlier).
*/
ir_variable *var = new(state->symbols)
- ir_variable(glsl_type::ivec3_type, "gl_WorkGroupSize", ir_var_auto);
+ ir_variable(glsl_type::uvec3_type, "gl_WorkGroupSize", ir_var_auto);
var->data.how_declared = ir_var_declared_implicitly;
var->data.read_only = true;
instructions->push_tail(var);
@@ -5916,10 +5916,10 @@ ast_cs_input_layout::hir(exec_list *instructions,
ir_constant_data data;
memset(&data, 0, sizeof(data));
for (int i = 0; i < 3; i++)
- data.i[i] = this->local_size[i];
- var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data);
+ data.u[i] = this->local_size[i];
+ var->constant_value = new(var) ir_constant(glsl_type::uvec3_type, &data);
var->constant_initializer =
- new(var) ir_constant(glsl_type::ivec3_type, &data);
+ new(var) ir_constant(glsl_type::uvec3_type, &data);
var->data.has_initializer = true;
return NULL;
diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp
index c36d19831..65e32ad73 100644
--- a/mesalib/src/glsl/builtin_variables.cpp
+++ b/mesalib/src/glsl/builtin_variables.cpp
@@ -724,6 +724,10 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxCombinedImageUniforms",
state->Const.MaxCombinedImageUniforms);
}
+
+ if (state->is_version(410, 0) ||
+ state->ARB_viewport_array_enable)
+ add_const("gl_MaxViewports", state->Const.MaxViewports);
}
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index f1119eb80..9b1a4f401 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -290,9 +290,10 @@ control_line_success:
macro_t *macro;
if (strcmp("__LINE__", $4) == 0
|| strcmp("__FILE__", $4) == 0
- || strcmp("__VERSION__", $4) == 0)
+ || strcmp("__VERSION__", $4) == 0
+ || strncmp("GL_", $4, 3) == 0)
glcpp_error(& @1, parser, "Built-in (pre-defined)"
- " macro names can not be undefined.");
+ " macro names cannot be undefined.");
macro = hash_table_find (parser->defines, $4);
if (macro) {
diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy
index 6160e265e..7fb8c38ab 100644
--- a/mesalib/src/glsl/glsl_parser.yy
+++ b/mesalib/src/glsl/glsl_parser.yy
@@ -331,7 +331,18 @@ pragma_statement:
| PRAGMA_OPTIMIZE_OFF EOL
| PRAGMA_INVARIANT_ALL EOL
{
- if (!state->is_version(120, 100)) {
+ /* Pragma invariant(all) cannot be used in a fragment shader.
+ *
+ * Page 27 of the GLSL 1.20 spec, Page 53 of the GLSL ES 3.00 spec:
+ *
+ * "It is an error to use this pragma in a fragment shader."
+ */
+ if (state->is_version(120, 300) &&
+ state->stage == MESA_SHADER_FRAGMENT) {
+ _mesa_glsl_error(& @1, state,
+ "pragma `invariant(all)' cannot be used "
+ "in a fragment shader.");
+ } else if (!state->is_version(120, 100)) {
_mesa_glsl_warning(& @1, state,
"pragma `invariant(all)' not supported in %s "
"(GLSL ES 1.00 or GLSL 1.20 required)",
@@ -1591,6 +1602,17 @@ type_qualifier:
$$ = $2;
$$.flags.q.invariant = 1;
+
+ /* GLSL ES 3.00 spec, section 4.6.1 "The Invariant Qualifier":
+ *
+ * "Only variables output from a shader can be candidates for invariance.
+ * This includes user-defined output variables and the built-in output
+ * variables. As only outputs can be declared as invariant, an invariant
+ * output from one shader stage will still match an input of a subsequent
+ * stage without the input being declared as invariant."
+ */
+ if (state->es_shader && state->language_version >= 300 && $$.flags.q.in)
+ _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs");
}
| interpolation_qualifier type_qualifier
{
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 27e3301e2..27e2eaf37 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -25,12 +25,10 @@
#include <string.h>
#include <assert.h>
-extern "C" {
#include "main/core.h" /* for struct gl_context */
#include "main/context.h"
#include "main/shaderobj.h"
-}
-
+#include "util/u_atomic.h" /* for p_atomic_cmpxchg */
#include "util/ralloc.h"
#include "ast.h"
#include "glsl_parser_extras.h"
@@ -50,7 +48,7 @@ glsl_compute_version_string(void *mem_ctx, bool is_es, unsigned version)
static const unsigned known_desktop_glsl_versions[] =
- { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 };
+ { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440, 450 };
_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
@@ -134,6 +132,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
+ /* ARB_viewport_array */
+ this->Const.MaxViewports = ctx->Const.MaxViewports;
+
this->current_function = NULL;
this->toplevel_ir = NULL;
this->found_return = false;
@@ -141,6 +142,12 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->user_structures = NULL;
this->num_user_structures = 0;
+ /* supported_versions should be large enough to support the known desktop
+ * GLSL versions plus 2 GLES versions (ES2 & ES3)
+ */
+ STATIC_ASSERT((ARRAY_SIZE(known_desktop_glsl_versions) + 2) ==
+ ARRAY_SIZE(this->supported_versions));
+
/* Populate the list of supported GLSL versions */
/* FINISHME: Once the OpenGL 3.0 'forward compatible' context or
* the OpenGL 3.2 Core context is supported, this logic will need
@@ -168,8 +175,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->supported_versions[this->num_supported_versions].es = true;
this->num_supported_versions++;
}
- assert(this->num_supported_versions
- <= ARRAY_SIZE(this->supported_versions));
/* Create a string for use in error messages to tell the user which GLSL
* versions are supported.
@@ -1447,7 +1452,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
const char *source = shader->Source;
if (ctx->Const.GenerateTemporaryNames)
- ir_variable::temporaries_allocate_names = true;
+ (void) p_atomic_cmpxchg(&ir_variable::temporaries_allocate_names,
+ false, true);
state->error = glcpp_preprocess(state, &source, &state->info_log,
&ctx->Extensions, ctx);
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index c14d74c98..e04f7ced5 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -217,7 +217,7 @@ struct _mesa_glsl_parse_state {
struct {
unsigned ver;
bool es;
- } supported_versions[12];
+ } supported_versions[14];
bool es_shader;
unsigned language_version;
@@ -343,6 +343,9 @@ struct _mesa_glsl_parse_state {
unsigned MaxGeometryImageUniforms;
unsigned MaxFragmentImageUniforms;
unsigned MaxCombinedImageUniforms;
+
+ /* ARB_viewport_array */
+ unsigned MaxViewports;
} Const;
/**
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 5f9919348..0d2eb7cec 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -25,9 +25,8 @@
#include "main/core.h" /* for Elements, MAX2 */
#include "glsl_parser_extras.h"
#include "glsl_types.h"
-extern "C" {
#include "program/hash_table.h"
-}
+
mtx_t glsl_type::mutex = _MTX_INITIALIZER_NP;
hash_table *glsl_type::array_types = NULL;
diff --git a/mesalib/src/glsl/ir_variable_refcount.cpp b/mesalib/src/glsl/ir_variable_refcount.cpp
index f67fe6784..e4d825c45 100644
--- a/mesalib/src/glsl/ir_variable_refcount.cpp
+++ b/mesalib/src/glsl/ir_variable_refcount.cpp
@@ -38,7 +38,8 @@
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
{
this->mem_ctx = ralloc_context(NULL);
- this->ht = _mesa_hash_table_create(NULL, _mesa_key_pointer_equal);
+ this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
}
static void
@@ -70,15 +71,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
- struct hash_entry *e = _mesa_hash_table_search(this->ht,
- _mesa_hash_pointer(var),
- var);
+ struct hash_entry *e = _mesa_hash_table_search(this->ht, var);
if (e)
return (ir_variable_refcount_entry *)e->data;
ir_variable_refcount_entry *entry = new ir_variable_refcount_entry(var);
assert(entry->referenced_count == 0);
- _mesa_hash_table_insert(this->ht, _mesa_hash_pointer(var), var, entry);
+ _mesa_hash_table_insert(this->ht, var, entry);
return entry;
}
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
index 9da6a4bba..292cde343 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
@@ -27,9 +27,8 @@
link_uniform_block_active *
process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
{
- const uint32_t h = _mesa_hash_string(var->get_interface_type()->name);
const hash_entry *const existing_block =
- _mesa_hash_table_search(ht, h, var->get_interface_type()->name);
+ _mesa_hash_table_search(ht, var->get_interface_type()->name);
const glsl_type *const block_type = var->is_interface_instance()
? var->type : var->get_interface_type();
@@ -54,8 +53,7 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
b->binding = 0;
}
- _mesa_hash_table_insert(ht, h, var->get_interface_type()->name,
- (void *) b);
+ _mesa_hash_table_insert(ht, var->get_interface_type()->name, (void *) b);
return b;
} else {
link_uniform_block_active *const b =
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index 536fcd458..f5fc5022e 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -182,7 +182,8 @@ link_uniform_blocks(void *mem_ctx,
* the hash is organized by block-name.
*/
struct hash_table *block_hash =
- _mesa_hash_table_create(mem_ctx, _mesa_key_string_equal);
+ _mesa_hash_table_create(mem_ctx, _mesa_key_hash_string,
+ _mesa_key_string_equal);
if (block_hash == NULL) {
_mesa_error_no_memory(__func__);
diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp
index 1866ab265..22617990f 100644
--- a/mesalib/src/glsl/link_varyings.cpp
+++ b/mesalib/src/glsl/link_varyings.cpp
@@ -116,7 +116,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
return;
}
- if (input->data.invariant != output->data.invariant) {
+ if (!prog->IsES && input->data.invariant != output->data.invariant) {
linker_error(prog,
"%s shader output `%s' %s invariant qualifier, "
"but %s shader input %s invariant qualifier\n",
@@ -835,9 +835,11 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
* regardless of where they appear. We can trivially satisfy that
* requirement by changing the interpolation type to flat here.
*/
- producer_var->data.centroid = false;
- producer_var->data.sample = false;
- producer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ if (producer_var) {
+ producer_var->data.centroid = false;
+ producer_var->data.sample = false;
+ producer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ }
if (consumer_var) {
consumer_var->data.centroid = false;
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index de6b1fb9f..3f5eac1e2 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -76,10 +76,9 @@
#include "ir_rvalue_visitor.h"
#include "ir_uniform.h"
-extern "C" {
#include "main/shaderobj.h"
#include "main/enums.h"
-}
+
void linker_error(gl_shader_program *, const char *, ...);
@@ -732,8 +731,27 @@ cross_validate_globals(struct gl_shader_program *prog,
&& ((var->type->length == 0)
|| (existing->type->length == 0))) {
if (var->type->length != 0) {
+ if (var->type->length <= existing->data.max_array_access) {
+ linker_error(prog, "%s `%s' declared as type "
+ "`%s' but outermost dimension has an index"
+ " of `%i'\n",
+ mode_string(var),
+ var->name, var->type->name,
+ existing->data.max_array_access);
+ return;
+ }
existing->type = var->type;
- }
+ } else if (existing->type->length != 0
+ && existing->type->length <=
+ var->data.max_array_access) {
+ linker_error(prog, "%s `%s' declared as type "
+ "`%s' but outermost dimension has an index"
+ " of `%i'\n",
+ mode_string(var),
+ var->name, existing->type->name,
+ var->data.max_array_access);
+ return;
+ }
} else if (var->type->is_record()
&& existing->type->is_record()
&& existing->type->record_compare(var->type)) {
@@ -2746,6 +2764,21 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (last >= 0 && last < MESA_SHADER_FRAGMENT) {
gl_shader *const sh = prog->_LinkedShaders[last];
+ if (first == MESA_SHADER_GEOMETRY) {
+ /* There was no vertex shader, but we still have to assign varying
+ * locations for use by geometry shader inputs in SSO.
+ *
+ * If the shader is not separable (i.e., prog->SeparateShader is
+ * false), linking will have already failed when first is
+ * MESA_SHADER_GEOMETRY.
+ */
+ if (!assign_varying_locations(ctx, mem_ctx, prog,
+ NULL, sh,
+ num_tfeedback_decls, tfeedback_decls,
+ prog->Geom.VerticesIn))
+ goto done;
+ }
+
if (num_tfeedback_decls != 0 || prog->SeparateShader) {
/* There was no fragment shader, but we still have to assign varying
* locations for use by transform feedback.
diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp
index 91e457ada..ccac83996 100644
--- a/mesalib/src/glsl/main.cpp
+++ b/mesalib/src/glsl/main.cpp
@@ -182,8 +182,6 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.MaxGeometryOutputVertices = 256;
ctx->Const.MaxGeometryTotalOutputComponents = 1024;
-// ctx->Const.MaxGeometryVaryingComponents = 64;
-
ctx->Const.MaxVarying = 60 / 4;
break;
case 300:
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 430f5cb97..c6f4a9c78 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -584,6 +584,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_all_equal:
+ case ir_binop_any_nequal:
+ if (ir->operands[0]->type->is_scalar() &&
+ ir->operands[1]->type->is_scalar())
+ return new(mem_ctx) ir_expression(ir->operation == ir_binop_all_equal
+ ? ir_binop_equal : ir_binop_nequal,
+ ir->operands[0],
+ ir->operands[1]);
+ break;
+
case ir_binop_rshift:
case ir_binop_lshift:
/* 0 >> x == 0 */
@@ -679,7 +689,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
case ir_binop_min:
case ir_binop_max:
- if (ir->type->base_type != GLSL_TYPE_FLOAT)
+ if (ir->type->base_type != GLSL_TYPE_FLOAT || options->EmitNoSat)
break;
/* Replace min(max) operations and its commutative combinations with