summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-02-05 14:21:13 -0800
committerJason Ekstrand <[email protected]>2016-02-05 14:21:13 -0800
commit9645b8eb1f1b79e537ad8ddb683507df7bc9da58 (patch)
tree8e554a43a136b5f7951ff8734d42deb5e81c262b /src/glsl
parent3eebf3686be3de10cbeda8acd884e82df3e1438a (diff)
parent41875ac4edd8c884225c44c0840bd20291b410ca (diff)
Merge branch mesa-public/master into vulkan
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_functions.cpp2
-rw-r--r--src/glsl/builtin_variables.cpp25
-rw-r--r--src/glsl/glsl_parser.yy4
-rw-r--r--src/glsl/glsl_parser_extras.cpp1
-rw-r--r--src/glsl/glsl_parser_extras.h7
-rw-r--r--src/glsl/link_varyings.cpp13
-rw-r--r--src/glsl/lower_instructions.cpp4
7 files changed, 31 insertions, 25 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index f2e2165e8c3..95e86df1cdd 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -3267,7 +3267,7 @@ builtin_builder::_atan2(const glsl_type *type)
ir_factory outer_then(&outer_if->then_instructions, mem_ctx);
/* Then...call atan(y/x) */
- do_atan(body, glsl_type::float_type, r, div(y, x));
+ do_atan(outer_then, glsl_type::float_type, r, div(y, x));
/* ...and fix it up: */
ir_if *inner_if = new(mem_ctx) ir_if(less(x, imm(0.0f)));
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 221aab0043b..ccc04c00cea 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -667,7 +667,7 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxVaryingComponents", state->ctx->Const.MaxVarying * 4);
}
- if (state->is_version(150, 0)) {
+ if (state->has_geometry_shader()) {
add_const("gl_MaxVertexOutputComponents",
state->Const.MaxVertexOutputComponents);
add_const("gl_MaxGeometryInputComponents",
@@ -730,12 +730,11 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxAtomicCounterBindings",
state->Const.MaxAtomicBufferBindings);
- /* When Mesa adds support for GL_OES_geometry_shader and
- * GL_OES_tessellation_shader, this will need to change.
- */
- if (!state->es_shader) {
+ if (state->has_geometry_shader()) {
add_const("gl_MaxGeometryAtomicCounters",
state->Const.MaxGeometryAtomicCounters);
+ }
+ if (!state->es_shader) {
add_const("gl_MaxTessControlAtomicCounters",
state->Const.MaxTessControlAtomicCounters);
add_const("gl_MaxTessEvaluationAtomicCounters",
@@ -753,12 +752,11 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxAtomicCounterBufferSize",
state->Const.MaxAtomicCounterBufferSize);
- /* When Mesa adds support for GL_OES_geometry_shader and
- * GL_OES_tessellation_shader, this will need to change.
- */
- if (!state->es_shader) {
+ if (state->has_geometry_shader()) {
add_const("gl_MaxGeometryAtomicCounterBuffers",
state->Const.MaxGeometryAtomicCounterBuffers);
+ }
+ if (!state->es_shader) {
add_const("gl_MaxTessControlAtomicCounterBuffers",
state->Const.MaxTessControlAtomicCounterBuffers);
add_const("gl_MaxTessEvaluationAtomicCounterBuffers",
@@ -814,13 +812,16 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxCombinedImageUniforms",
state->Const.MaxCombinedImageUniforms);
+ if (state->has_geometry_shader()) {
+ add_const("gl_MaxGeometryImageUniforms",
+ state->Const.MaxGeometryImageUniforms);
+ }
+
if (!state->es_shader) {
add_const("gl_MaxCombinedImageUnitsAndFragmentOutputs",
state->Const.MaxCombinedShaderOutputResources);
add_const("gl_MaxImageSamples",
state->Const.MaxImageSamples);
- add_const("gl_MaxGeometryImageUniforms",
- state->Const.MaxGeometryImageUniforms);
}
if (state->is_version(450, 310)) {
@@ -1070,7 +1071,7 @@ builtin_variable_generator::generate_fs_special_vars()
if (state->is_version(120, 100))
add_input(VARYING_SLOT_PNTC, vec2_t, "gl_PointCoord");
- if (state->is_version(150, 0)) {
+ if (state->has_geometry_shader()) {
var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID");
var->data.interpolation = INTERP_QUALIFIER_FLAT;
}
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 10198758944..2109fb2eedd 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1270,7 +1270,7 @@ layout_qualifier_id:
}
}
- if ($$.flags.i && !state->is_version(150, 0)) {
+ if ($$.flags.i && !state->has_geometry_shader()) {
_mesa_glsl_error(& @1, state, "#version 150 layout "
"qualifier `%s' used", $1);
}
@@ -1507,7 +1507,7 @@ layout_qualifier_id:
if (match_layout_qualifier("max_vertices", $1, state) == 0) {
$$.flags.q.max_vertices = 1;
$$.max_vertices = new(ctx) ast_layout_expression(@1, $3);
- if (!state->is_version(150, 0)) {
+ if (!state->has_geometry_shader()) {
_mesa_glsl_error(& @3, state,
"#version 150 max_vertices qualifier "
"specified", $3);
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 131a5641f8f..ecf0d7f76e5 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -600,6 +600,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
/* OES extensions go here, sorted alphabetically.
*/
EXT(OES_EGL_image_external, false, true, OES_EGL_image_external),
+ EXT(OES_geometry_shader, false, true, OES_geometry_shader),
EXT(OES_standard_derivatives, false, true, OES_standard_derivatives),
EXT(OES_texture_3D, false, true, dummy_true),
EXT(OES_texture_storage_multisample_2d_array, false, true, ARB_texture_multisample),
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index ecc29920918..3f88e01d599 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -265,6 +265,11 @@ struct _mesa_glsl_parse_state {
return ARB_compute_shader_enable || is_version(430, 310);
}
+ bool has_geometry_shader() const
+ {
+ return OES_geometry_shader_enable || is_version(150, 320);
+ }
+
void process_version_directive(YYLTYPE *locp, int version,
const char *ident);
@@ -586,6 +591,8 @@ struct _mesa_glsl_parse_state {
*/
bool OES_EGL_image_external_enable;
bool OES_EGL_image_external_warn;
+ bool OES_geometry_shader_enable;
+ bool OES_geometry_shader_warn;
bool OES_standard_derivatives_enable;
bool OES_standard_derivatives_warn;
bool OES_texture_3D_enable;
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 09f80d0f39d..264b69ca619 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -1001,23 +1001,20 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
const ir_variable *const var = (producer_var != NULL)
? producer_var : consumer_var;
+ const gl_shader_stage stage = (producer_var != NULL)
+ ? producer_stage : consumer_stage;
+ const glsl_type *type = get_varying_type(var, stage);
this->matches[this->num_matches].packing_class
= this->compute_packing_class(var);
this->matches[this->num_matches].packing_order
= this->compute_packing_order(var);
if (this->disable_varying_packing) {
- unsigned slots;
- gl_shader_stage stage =
- (producer_var != NULL) ? producer_stage : consumer_stage;
-
- const glsl_type *type = get_varying_type(var, stage);
-
- slots = type->count_attribute_slots(false);
+ unsigned slots = type->count_attribute_slots(false);
this->matches[this->num_matches].num_components = slots * 4;
} else {
this->matches[this->num_matches].num_components
- = var->type->component_slots();
+ = type->component_slots();
}
this->matches[this->num_matches].producer_var = producer_var;
this->matches[this->num_matches].consumer_var = consumer_var;
diff --git a/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp
index d140be346cf..7c2d4d7ce51 100644
--- a/src/glsl/lower_instructions.cpp
+++ b/src/glsl/lower_instructions.cpp
@@ -470,8 +470,8 @@ lower_instructions_visitor::dldexp_to_arith(ir_expression *ir)
ir_constant *sign_mask = new(ir) ir_constant(0x80000000u);
- ir_constant *exp_shift = new(ir) ir_constant(20, vec_elem);
- ir_constant *exp_width = new(ir) ir_constant(11, vec_elem);
+ ir_constant *exp_shift = new(ir) ir_constant(20u);
+ ir_constant *exp_width = new(ir) ir_constant(11u);
ir_constant *exp_bias = new(ir) ir_constant(1022, vec_elem);
/* Temporary variables */