aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/linker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl/linker.cpp')
-rw-r--r--mesalib/src/glsl/linker.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 57be4931d..7689198b0 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -559,14 +559,21 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
* vertex processing has occurred. Its value is undefined if
* the vertex shader executable does not write gl_Position."
*
- * GLSL ES 3.00 is similar to GLSL 1.40--failing to write to gl_Position is
- * not an error.
+ * All GLSL ES Versions are similar to GLSL 1.40--failing to write to
+ * gl_Position is not an error.
*/
if (prog->Version < (prog->IsES ? 300 : 140)) {
find_assignment_visitor find("gl_Position");
find.run(shader->ir);
if (!find.variable_found()) {
- linker_error(prog, "vertex shader does not write to `gl_Position'\n");
+ if (prog->IsES) {
+ linker_warning(prog,
+ "vertex shader does not write to `gl_Position'."
+ "It's value is undefined. \n");
+ } else {
+ linker_error(prog,
+ "vertex shader does not write to `gl_Position'. \n");
+ }
return;
}
}
@@ -1115,8 +1122,8 @@ move_non_declarations(exec_list *instructions, exec_node *last,
/**
* Get the function signature for main from a shader
*/
-static ir_function_signature *
-get_main_function_signature(gl_shader *sh)
+ir_function_signature *
+link_get_main_function_signature(gl_shader *sh)
{
ir_function *const f = sh->symbols->get_function("main");
if (f != NULL) {
@@ -1644,7 +1651,7 @@ link_intrastage_shaders(void *mem_ctx,
*/
gl_shader *main = NULL;
for (unsigned i = 0; i < num_shaders; i++) {
- if (get_main_function_signature(shader_list[i]) != NULL) {
+ if (link_get_main_function_signature(shader_list[i]) != NULL) {
main = shader_list[i];
break;
}
@@ -1673,7 +1680,8 @@ link_intrastage_shaders(void *mem_ctx,
/* The a pointer to the main function in the final linked shader (i.e., the
* copy of the original shader that contained the main function).
*/
- ir_function_signature *const main_sig = get_main_function_signature(linked);
+ ir_function_signature *const main_sig =
+ link_get_main_function_signature(linked);
/* Move any instructions other than variable declarations or function
* declarations into main.
@@ -1736,6 +1744,9 @@ link_intrastage_shaders(void *mem_ctx,
}
}
+ if (ctx->Const.VertexID_is_zero_based)
+ lower_vertex_id(linked);
+
/* Make a pass over all variable declarations to ensure that arrays with
* unspecified sizes have a size specified. The size is inferred from the
* max_array_access field.