bkaradzic пре 12 година
родитељ
комит
687be4f31b
70 измењених фајлова са 1417 додато и 789 уклоњено
  1. 1 1
      3rdparty/glsl-optimizer/README.md
  2. 24 2
      3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp
  3. 33 7
      3rdparty/glsl-optimizer/src/glsl/builtin_function.cpp
  4. 5 0
      3rdparty/glsl-optimizer/src/glsl/builtin_variables.cpp
  5. 2 0
      3rdparty/glsl-optimizer/src/glsl/builtins/profiles/EXT_shadow_samplers.vert
  6. 0 122
      3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.c
  7. 12 6
      3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp
  8. 3 2
      3rdparty/glsl-optimizer/src/glsl/glsl_parser_extras.cpp
  9. 2 0
      3rdparty/glsl-optimizer/src/glsl/glsl_parser_extras.h
  10. 27 0
      3rdparty/glsl-optimizer/src/glsl/ir.h
  11. 16 1
      3rdparty/glsl-optimizer/src/glsl/ir_clone.cpp
  12. 9 0
      3rdparty/glsl-optimizer/src/glsl/ir_hierarchical_visitor.cpp
  13. 1 0
      3rdparty/glsl-optimizer/src/glsl/ir_hierarchical_visitor.h
  14. 6 0
      3rdparty/glsl-optimizer/src/glsl/ir_hv_accept.cpp
  15. 50 8
      3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp
  16. 6 0
      3rdparty/glsl-optimizer/src/glsl/ir_print_visitor.cpp
  17. 1 0
      3rdparty/glsl-optimizer/src/glsl/ir_print_visitor.h
  18. 0 213
      3rdparty/glsl-optimizer/src/glsl/ir_set_program_inouts.cpp
  19. 1 0
      3rdparty/glsl-optimizer/src/glsl/ir_visitor.h
  20. 5 2
      3rdparty/glsl-optimizer/src/glsl/linker.cpp
  21. 8 1
      3rdparty/glsl-optimizer/src/glsl/lower_jumps.cpp
  22. 10 0
      3rdparty/glsl-optimizer/src/glsl/msvc/mesaglsl2.sln
  23. 236 4
      3rdparty/glsl-optimizer/src/glsl/msvc/mesaglsl2.vcproj
  24. 18 0
      3rdparty/glsl-optimizer/src/glsl/opt_constant_variable.cpp
  25. 13 15
      3rdparty/glsl-optimizer/src/glsl/xcode/mesaglsl2.xcodeproj/project.pbxproj
  26. 1 0
      3rdparty/glsl-optimizer/src/mesa/main/mtypes.h
  27. 19 0
      3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-in.txt
  28. 35 0
      3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-ir.txt
  29. 23 0
      3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-out.txt
  30. 11 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-in.txt
  31. 12 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-inES.txt
  32. 28 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-ir.txt
  33. 29 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-irES.txt
  34. 6 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-out.txt
  35. 7 0
      3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES.txt
  36. 7 0
      3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-inES.txt
  37. 28 0
      3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-irES.txt
  38. 13 0
      3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-outES.txt
  39. 17 0
      3rdparty/glsl-optimizer/tests/fragment/prec-default-inES.txt
  40. 27 0
      3rdparty/glsl-optimizer/tests/fragment/prec-default-irES.txt
  41. 25 0
      3rdparty/glsl-optimizer/tests/fragment/prec-default-outES.txt
  42. 1 1
      3rdparty/glsl-optimizer/tests/fragment/prec-tempssimple-irES.txt
  43. 1 1
      3rdparty/glsl-optimizer/tests/fragment/prec-tempssimple-outES.txt
  44. 23 0
      3rdparty/glsl-optimizer/tests/fragment/sampler-precision-inES.txt
  45. 58 0
      3rdparty/glsl-optimizer/tests/fragment/sampler-precision-irES.txt
  46. 36 0
      3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES.txt
  47. 2 2
      3rdparty/glsl-optimizer/tests/fragment/tex2dlod-inES.txt
  48. 2 2
      3rdparty/glsl-optimizer/tests/fragment/tex2dlod-irES.txt
  49. 2 2
      3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES.txt
  50. 1 1
      3rdparty/glsl-optimizer/tests/fragment/texProj-outES.txt
  51. 80 122
      3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-in.txt
  52. 219 219
      3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-ir.txt
  53. 4 7
      3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-out.txt
  54. 7 7
      3rdparty/glsl-optimizer/tests/fragment/z-fxaa3-11-consolepc-outES.txt
  55. 32 32
      3rdparty/glsl-optimizer/tests/fragment/z-fxaa3-11-pc39-outES.txt
  56. 11 9
      3rdparty/glsl-optimizer/tests/glsl-optimizer-tests.xcodeproj/project.pbxproj
  57. 3 0
      3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp
  58. 158 0
      3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.vcproj
  59. BIN
      examples/runtime/shaders/dx11/fs_bump.bin
  60. BIN
      examples/runtime/shaders/dx11/fs_mesh.bin
  61. BIN
      examples/runtime/shaders/dx11/fs_raymarching.bin
  62. BIN
      examples/runtime/shaders/dx11/vs_bump.bin
  63. BIN
      examples/runtime/shaders/dx11/vs_callback.bin
  64. BIN
      examples/runtime/shaders/dx11/vs_cubes.bin
  65. BIN
      examples/runtime/shaders/dx11/vs_instancing.bin
  66. BIN
      examples/runtime/shaders/dx11/vs_mesh.bin
  67. BIN
      examples/runtime/shaders/dx11/vs_metaballs.bin
  68. BIN
      examples/runtime/shaders/dx11/vs_raymarching.bin
  69. BIN
      examples/runtime/shaders/dx11/vs_update.bin
  70. BIN
      tools/bin/shaderc.exe

+ 1 - 1
3rdparty/glsl-optimizer/README.md

@@ -23,7 +23,7 @@ GLSL Optimizer is licensed according to the terms of the MIT license.
 Usage
 -----
 
-Visual Studio 2008 (Windows, x86) and Xcode 3.2 (Mac, i386) project files for a static
+Visual Studio 2008 (Windows, x86) and Xcode 4.5+ (Mac, i386) project files for a static
 library are provided in `src/glsl/msvc/mesaglsl2.vcproj` and `src/glsl/xcode/mesaglsl2`
 respectively.
 

+ 24 - 2
3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp

@@ -2984,8 +2984,15 @@ ast_declarator_list::hir(exec_list *instructions,
 	  * but otherwise we run into trouble if a function is prototyped, a
 	  * global var is decled, then the function is defined with usage of
 	  * the global var.  See glslparsertest's CorrectModule.frag.
+	  * However, do not insert declarations before default precision statements.
 	  */
-	 instructions->push_head(var);
+	 exec_node* before_node = instructions->head;
+	 while (before_node && ((ir_instruction*)before_node)->ir_type == ir_type_precision)
+	    before_node = before_node->next;
+	 if (before_node)
+	    before_node->insert_before(var);
+	 else
+	    instructions->push_head(var);
       }
 
       instructions->append_list(&initializer_instructions);
@@ -3943,7 +3950,22 @@ ast_type_specifier::hir(exec_list *instructions,
          return NULL;
       }
 
-      /* FINISHME: Translate precision statements into IR. */
+      {
+         void *ctx = state;
+
+         const char* precision_type = NULL;
+         switch (this->precision) {
+         case glsl_precision_high:		precision_type = "highp"; break;
+         case glsl_precision_medium:		precision_type = "mediump"; break;
+         case glsl_precision_low:		precision_type = "lowp"; break;
+         case glsl_precision_undefined:	precision_type = ""; break;
+         }
+         char* precision_statement = ralloc_asprintf(ctx, "precision %s %s", precision_type, this->type_name);
+
+         ir_precision_statement *const stmt = new(ctx) ir_precision_statement(precision_statement);
+		  
+         instructions->push_head(stmt);
+      }
       return NULL;
    }
 

+ 33 - 7
3rdparty/glsl-optimizer/src/glsl/builtin_function.cpp

@@ -14474,6 +14474,25 @@ static const char *functions_for_EXT_shadow_samplers_frag [] = {
    builtin_shadow2DEXT,
    builtin_shadow2DProjEXT,
 };
+static const char prototypes_for_EXT_shadow_samplers_vert[] =
+   "(\n"
+   "(function shadow2DEXT\n"
+   "  (signature float\n"
+   "    (parameters\n"
+   "      (declare (in) sampler2DShadow sampler)\n"
+   "      (declare (in) vec3 coord))\n"
+   "    ()))\n"
+   "(function shadow2DProjEXT\n"
+   "  (signature float\n"
+   "    (parameters\n"
+   "      (declare (in) sampler2DShadow sampler)\n"
+   "      (declare (in) vec4 coord))\n"
+   "    ())))"
+;
+static const char *functions_for_EXT_shadow_samplers_vert [] = {
+   builtin_shadow2DEXT,
+   builtin_shadow2DProjEXT,
+};
 static const char prototypes_for_EXT_texture_array_frag[] =
    "(\n"
    "(function texture1DArray\n"
@@ -14731,7 +14750,7 @@ static const char *functions_for_OES_texture_3D_vert [] = {
    builtin_texture3DProj,
    builtin_texture3DProjLod,
 };
-static gl_shader *builtin_profiles[27];
+static gl_shader *builtin_profiles[28];
 
 static void *builtin_mem_ctx = NULL;
 
@@ -14921,43 +14940,50 @@ _mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state)
                          Elements(functions_for_EXT_shadow_samplers_frag));
    }
 
-   if (state->target == fragment_shader && state->EXT_texture_array_enable) {
+   if (state->target == vertex_shader && state->EXT_shadow_samplers_enable) {
       _mesa_read_profile(state, 21,
+                         prototypes_for_EXT_shadow_samplers_vert,
+                         functions_for_EXT_shadow_samplers_vert,
+                         Elements(functions_for_EXT_shadow_samplers_vert));
+   }
+
+   if (state->target == fragment_shader && state->EXT_texture_array_enable) {
+      _mesa_read_profile(state, 22,
                          prototypes_for_EXT_texture_array_frag,
                          functions_for_EXT_texture_array_frag,
                          Elements(functions_for_EXT_texture_array_frag));
    }
 
    if (state->target == vertex_shader && state->EXT_texture_array_enable) {
-      _mesa_read_profile(state, 22,
+      _mesa_read_profile(state, 23,
                          prototypes_for_EXT_texture_array_vert,
                          functions_for_EXT_texture_array_vert,
                          Elements(functions_for_EXT_texture_array_vert));
    }
 
    if (state->OES_EGL_image_external_enable) {
-      _mesa_read_profile(state, 23,
+      _mesa_read_profile(state, 24,
                          prototypes_for_OES_EGL_image_external_glsl,
                          functions_for_OES_EGL_image_external_glsl,
                          Elements(functions_for_OES_EGL_image_external_glsl));
    }
 
    if (state->target == fragment_shader && state->OES_standard_derivatives_enable) {
-      _mesa_read_profile(state, 24,
+      _mesa_read_profile(state, 25,
                          prototypes_for_OES_standard_derivatives_frag,
                          functions_for_OES_standard_derivatives_frag,
                          Elements(functions_for_OES_standard_derivatives_frag));
    }
 
    if (state->target == fragment_shader && state->OES_texture_3D_enable) {
-      _mesa_read_profile(state, 25,
+      _mesa_read_profile(state, 26,
                          prototypes_for_OES_texture_3D_frag,
                          functions_for_OES_texture_3D_frag,
                          Elements(functions_for_OES_texture_3D_frag));
    }
 
    if (state->target == vertex_shader && state->OES_texture_3D_enable) {
-      _mesa_read_profile(state, 26,
+      _mesa_read_profile(state, 27,
                          prototypes_for_OES_texture_3D_vert,
                          functions_for_OES_texture_3D_vert,
                          Elements(functions_for_OES_texture_3D_vert));

+ 5 - 0
3rdparty/glsl-optimizer/src/glsl/builtin_variables.cpp

@@ -812,6 +812,11 @@ generate_100ES_fs_variables(exec_list *instructions,
       add_builtin_variable(instructions, state->symbols,
 			   & builtin_100ES_fs_variables[i], state->es_shader);
    }
+	
+	if (state->EXT_frag_depth_enable) {
+		const builtin_variable fragDepthEXT = { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepthEXT", glsl_precision_high };
+		add_builtin_variable(instructions, state->symbols, &fragDepthEXT, state->es_shader);
+	}
 
    generate_100ES_uniforms(instructions, state);
 

+ 2 - 0
3rdparty/glsl-optimizer/src/glsl/builtins/profiles/EXT_shadow_samplers.vert

@@ -0,0 +1,2 @@
+float shadow2DEXT (sampler2DShadow sampler, vec3 coord);
+float shadow2DProjEXT (sampler2DShadow sampler, vec4 coord);

+ 0 - 122
3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.c

@@ -1,122 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "glcpp.h"
-#include "main/mtypes.h"
-#include "../standalone_scaffolding.h"
-
-extern int yydebug;
-
-void
-_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
-                       struct gl_shader *sh)
-{
-   (void) ctx;
-   *ptr = sh;
-}
-
-/* Read from fp until EOF and return a string of everything read.
- */
-static char *
-load_text_fp (void *ctx, FILE *fp)
-{
-#define CHUNK 4096
-	char *text = NULL;
-	size_t text_size = 0;
-	size_t total_read = 0;
-	size_t bytes;
-
-	while (1) {
-		if (total_read + CHUNK + 1 > text_size) {
-			text_size = text_size ? text_size * 2 : CHUNK + 1;
-			text = reralloc_size (ctx, text, text_size);
-			if (text == NULL) {
-				fprintf (stderr, "Out of memory\n");
-				return NULL;
-			}
-		}
-		bytes = fread (text + total_read, 1, CHUNK, fp);
-		total_read += bytes;
-
-		if (bytes < CHUNK) {
-			break;
-		}
-	}
-
-	text[total_read] = '\0';
-
-	return text;
-}
-
-static char *
-load_text_file(void *ctx, const char *filename)
-{
-	char *text;
-	FILE *fp;
-
-	if (filename == NULL || strcmp (filename, "-") == 0)
-		return load_text_fp (ctx, stdin);
-
-	fp = fopen (filename, "r");
-	if (fp == NULL) {
-		fprintf (stderr, "Failed to open file %s: %s\n",
-			 filename, strerror (errno));
-		return NULL;
-	}
-
-	text = load_text_fp (ctx, fp);
-
-	fclose(fp);
-
-	return text;
-}
-
-int
-main (int argc, char *argv[])
-{
-	char *filename = NULL;
-	void *ctx = ralloc(NULL, void*);
-	char *info_log = ralloc_strdup(ctx, "");
-	const char *shader;
-	int ret;
-
-	if (argc) {
-		filename = argv[1];
-	}
-
-	shader = load_text_file (ctx, filename);
-	if (shader == NULL)
-	   return 1;
-
-	ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
-
-	printf("%s", shader);
-	fprintf(stderr, "%s", info_log);
-
-	ralloc_free(ctx);
-
-	return ret;
-}

+ 12 - 6
3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp

@@ -31,6 +31,7 @@ initialize_mesa_context(struct gl_context *ctx, gl_api api)
    {
 	   ctx->Extensions.OES_standard_derivatives = GL_TRUE;
 	   ctx->Extensions.EXT_shadow_samplers = GL_TRUE;
+	   ctx->Extensions.EXT_frag_depth = GL_TRUE;
    }
 
    ctx->Const.GLSLVersion = 140;
@@ -137,7 +138,7 @@ static inline void debug_print_ir (const char* name, exec_list* ir, _mesa_glsl_p
 	printf("**** %s:\n", name);
 	//_mesa_print_ir (ir, state);
 	char* foobar = _mesa_print_ir_glsl(ir, state, ralloc_strdup(memctx, ""), kPrintGlslFragment);
-	printf(foobar);
+	printf("%s\n", foobar);
 	validate_ir_tree(ir);
 	#endif
 }
@@ -363,13 +364,15 @@ glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, co
 	memcpy(shader->shader->builtins_to_link, state->builtins_to_link, sizeof(shader->shader->builtins_to_link[0]) * state->num_builtins_to_link);
 	shader->shader->num_builtins_to_link = state->num_builtins_to_link;
 	
+	struct gl_shader* linked_shader = 0;
+
 	if (!state->error && !ir->is_empty())
 	{
-		struct gl_shader* linked_shader = link_intrastage_shaders(ctx->mem_ctx,
-																  &ctx->mesa_ctx,
-																  shader->whole_program,
-																  shader->whole_program->Shaders,
-																  shader->whole_program->NumShaders);
+		linked_shader = link_intrastage_shaders(ctx->mem_ctx,
+												&ctx->mesa_ctx,
+												shader->whole_program,
+												shader->whole_program->Shaders,
+												shader->whole_program->NumShaders);
 		if (!linked_shader)
 		{
 			shader->status = false;
@@ -401,6 +404,9 @@ glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, co
 	ralloc_free (ir);
 	ralloc_free (state);
 
+	if (linked_shader)
+		ralloc_free(linked_shader);
+
 	return shader;
 }
 

+ 3 - 2
3rdparty/glsl-optimizer/src/glsl/glsl_parser_extras.cpp

@@ -280,8 +280,9 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(OES_EGL_image_external,         true,  false, true,  false, true,      OES_EGL_image_external),
    EXT(ARB_shader_bit_encoding,        true,  true,  true,  true,  false,     ARB_shader_bit_encoding),
    EXT(ARB_uniform_buffer_object,      true,  false, true,  true,  false,     ARB_uniform_buffer_object),
-   EXT(OES_standard_derivatives,       false, false, true,  false,  true,     OES_standard_derivatives),
-   EXT(EXT_shadow_samplers,            false, false, true,  false, true,      EXT_shadow_samplers),
+   EXT(OES_standard_derivatives,       false, false, true,  false, true,      OES_standard_derivatives),
+   EXT(EXT_shadow_samplers,            true,  false, true,  false, true,      EXT_shadow_samplers),
+   EXT(EXT_frag_depth,                 true,  false, true,  false, true,      EXT_frag_depth),
 };
 
 #undef EXT

+ 2 - 0
3rdparty/glsl-optimizer/src/glsl/glsl_parser_extras.h

@@ -191,6 +191,8 @@ struct _mesa_glsl_parse_state {
    bool EXT_shader_texture_lod_warn;
    bool EXT_shadow_samplers_enable;
    bool EXT_shadow_samplers_warn;
+   bool EXT_frag_depth_enable;
+   bool EXT_frag_depth_warn;
    bool ARB_shader_stencil_export_enable;
    bool ARB_shader_stencil_export_warn;
    bool AMD_conservative_depth_enable;

+ 27 - 0
3rdparty/glsl-optimizer/src/glsl/ir.h

@@ -80,6 +80,7 @@ enum ir_node_type {
    ir_type_return,
    ir_type_swizzle,
    ir_type_texture,
+   ir_type_precision,
    ir_type_max /**< maximum ir_type enum number, for validation */
 };
 
@@ -1813,6 +1814,32 @@ private:
    ir_constant(void);
 };
 
+
+class ir_precision_statement : public ir_instruction {
+public:
+   ir_precision_statement(const char *statement_to_store)
+   {
+	   ir_type = ir_type_precision;
+	   precision_statement = statement_to_store;
+   }
+
+   virtual ir_precision_statement *clone(void *mem_ctx, struct hash_table *) const;
+
+   virtual void accept(ir_visitor *v)
+   {
+      v->visit(this);
+   }
+
+   virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+
+   /**
+    * Precision statement
+    */
+   const char *precision_statement;
+};
+
+
+
 /*@}*/
 
 /**

+ 16 - 1
3rdparty/glsl-optimizer/src/glsl/ir_clone.cpp

@@ -155,7 +155,14 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
       new_loop->to = this->to->clone(mem_ctx, ht);
    if (this->increment)
       new_loop->increment = this->increment->clone(mem_ctx, ht);
-   new_loop->counter = counter;
+
+   if (ht) {
+	   new_loop->counter = (ir_variable *)hash_table_find(ht, this->counter);
+	   if (!new_loop->counter)
+		   new_loop->counter = this->counter;
+   } else {
+	   new_loop->counter = this->counter;
+   }
 
    foreach_iter(exec_list_iterator, iter, this->body_instructions) {
       ir_instruction *ir = (ir_instruction *)iter.get();
@@ -388,6 +395,14 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
 }
 
 
+ir_precision_statement *
+ir_precision_statement::clone(void *mem_ctx, struct hash_table *ht) const
+{
+   return new(mem_ctx) ir_precision_statement(this->precision_statement);
+}
+
+
+
 class fixup_ir_call_visitor : public ir_hierarchical_visitor {
 public:
    fixup_ir_call_visitor(struct hash_table *ht)

+ 9 - 0
3rdparty/glsl-optimizer/src/glsl/ir_hierarchical_visitor.cpp

@@ -68,6 +68,15 @@ ir_hierarchical_visitor::visit(ir_loop_jump *ir)
    return visit_continue;
 }
 
+ir_visitor_status
+ir_hierarchical_visitor::visit(ir_precision_statement *ir)
+{
+   if (this->callback != NULL)
+      this->callback(ir, this->data);
+
+   return visit_continue;
+}
+
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
 {

+ 1 - 0
3rdparty/glsl-optimizer/src/glsl/ir_hierarchical_visitor.h

@@ -86,6 +86,7 @@ public:
    virtual ir_visitor_status visit(class ir_variable *);
    virtual ir_visitor_status visit(class ir_constant *);
    virtual ir_visitor_status visit(class ir_loop_jump *);
+   virtual ir_visitor_status visit(class ir_precision_statement *);
 
    /**
     * ir_dereference_variable isn't technically a leaf, but it is treated as a

+ 6 - 0
3rdparty/glsl-optimizer/src/glsl/ir_hv_accept.cpp

@@ -397,3 +397,9 @@ ir_if::accept(ir_hierarchical_visitor *v)
 
    return v->visit_leave(this);
 }
+
+ir_visitor_status
+ir_precision_statement::accept(ir_hierarchical_visitor *v)
+{
+   return v->visit(this);
+}

+ 50 - 8
3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp

@@ -113,7 +113,8 @@ public:
 	virtual void visit(ir_if *);
 	virtual void visit(ir_loop *);
 	virtual void visit(ir_loop_jump *);
-
+	virtual void visit(ir_precision_statement *);
+	
 	int indentation;
 	char* buffer;
 	global_print_tracker* globals;
@@ -139,6 +140,8 @@ _mesa_print_ir_glsl(exec_list *instructions,
 			ralloc_strcat (&buffer, "#extension GL_OES_standard_derivatives : enable\n");
 		if (state->EXT_shadow_samplers_enable)
 			ralloc_strcat (&buffer, "#extension GL_EXT_shadow_samplers : enable\n");
+		if (state->EXT_frag_depth_enable)
+			ralloc_strcat (&buffer, "#extension GL_EXT_frag_depth : enable\n");
 	}
    if (state) {
 	   ir_struct_usage_visitor v;
@@ -173,7 +176,8 @@ _mesa_print_ir_glsl(exec_list *instructions,
       ir_instruction *ir = (ir_instruction *)iter.get();
 	  if (ir->ir_type == ir_type_variable) {
 		ir_variable *var = static_cast<ir_variable*>(ir);
-		if (strstr(var->name, "gl_") == var->name)
+		if ((strstr(var->name, "gl_") == var->name)
+			  && !var->invariant)
 			continue;
 	  }
 
@@ -219,9 +223,23 @@ void ir_print_glsl_visitor::print_precision (ir_instruction* ir, const glsl_type
 {
 	if (!this->use_precision)
 		return;
-	if (type && !type->is_float() && (!type->is_array() || !type->element_type()->is_float()))
+	if (type &&
+		!type->is_float() &&
+		!type->is_sampler() &&
+		(!type->is_array() || !type->element_type()->is_float())
+	)
+	{
 		return;
+	}
 	glsl_precision prec = precision_from_ir(ir);
+	
+	// skip precision for samplers that end up being lowp (default anyway) or undefined
+	if (type && type->is_sampler())
+	{
+		if (prec == glsl_precision_low || prec == glsl_precision_undefined)
+			return;
+	}
+	
 	if (prec == glsl_precision_high || prec == glsl_precision_undefined)
 	{
 		if (ir->ir_type == ir_type_function_signature)
@@ -288,6 +306,13 @@ void ir_print_glsl_visitor::visit(ir_variable *ir)
      }
    }
 
+   // keep invariant declaration for builtin variables
+   if (strstr(ir->name, "gl_") == ir->name) {
+      ralloc_asprintf_append (&buffer, "%s", inv);
+      print_var_name (ir);
+      return;
+   }
+	
    ralloc_asprintf_append (&buffer, "%s%s%s%s",
 	  cent, inv, interp[ir->interpolation], mode[decormode][ir->mode]);
    print_precision (ir, ir->type);
@@ -582,19 +607,30 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
 		sampler_uv_dim = 3;
 	const bool is_proj = (uv_dim > sampler_uv_dim);
 	
-	// texture function name
-	ralloc_asprintf_append (&buffer, "%s", is_shadow ? "shadow" : "texture");
-	ralloc_asprintf_append (&buffer, "%s", tex_sampler_dim_name[sampler_dim]);
+    // texture function name
+    //ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130
+    if(state->language_version<130) 
+    {
+        ralloc_asprintf_append (&buffer, "%s", is_shadow ? "shadow" : "texture");
+        ralloc_asprintf_append (&buffer, "%s", tex_sampler_dim_name[sampler_dim]);
+    }
+    else 
+    {
+        ralloc_asprintf_append (&buffer, "texture");
+    }
 	
 	if (is_proj)
 		ralloc_asprintf_append (&buffer, "Proj");
 	if (ir->op == ir_txl)
 		ralloc_asprintf_append (&buffer, "Lod");
 	
-	if (is_shadow)
+	if (state->es_shader)
 	{
-		if (state->EXT_shadow_samplers_enable && state->es_shader)
+		if ( (is_shadow && state->EXT_shadow_samplers_enable) ||
+			(ir->op == ir_txl && state->EXT_shader_texture_lod_enable) )
+		{
 			ralloc_asprintf_append (&buffer, "EXT");
+		}
 	}
 	
 	ralloc_asprintf_append (&buffer, " (");
@@ -1073,3 +1109,9 @@ ir_print_glsl_visitor::visit(ir_loop_jump *ir)
 {
    ralloc_asprintf_append (&buffer, "%s", ir->is_break() ? "break" : "continue");
 }
+
+void
+ir_print_glsl_visitor::visit(ir_precision_statement *ir)
+{
+	ralloc_asprintf_append (&buffer, "%s", ir->precision_statement);
+}

+ 6 - 0
3rdparty/glsl-optimizer/src/glsl/ir_print_visitor.cpp

@@ -514,3 +514,9 @@ ir_print_visitor::visit(ir_loop_jump *ir)
 {
    printf("%s", ir->is_break() ? "break" : "continue");
 }
+
+void
+ir_print_visitor::visit(ir_precision_statement *ir)
+{
+	printf("%s", ir->precision_statement);
+}

+ 1 - 0
3rdparty/glsl-optimizer/src/glsl/ir_print_visitor.h

@@ -72,6 +72,7 @@ public:
    virtual void visit(ir_if *);
    virtual void visit(ir_loop *);
    virtual void visit(ir_loop_jump *);
+   virtual void visit(ir_precision_statement *);
    /*@}*/
 
 private:

+ 0 - 213
3rdparty/glsl-optimizer/src/glsl/ir_set_program_inouts.cpp

@@ -1,213 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file ir_set_program_inouts.cpp
- *
- * Sets the InputsRead and OutputsWritten of Mesa programs.
- *
- * Additionally, for fragment shaders, sets the InterpQualifier array, the
- * IsCentroid bitfield, and the UsesDFdy flag.
- *
- * Mesa programs (gl_program, not gl_shader_program) have a set of
- * flags indicating which varyings are read and written.  Computing
- * which are actually read from some sort of backend code can be
- * tricky when variable array indexing involved.  So this pass
- * provides support for setting InputsRead and OutputsWritten right
- * from the GLSL IR.
- */
-
-#include "main/core.h" /* for struct gl_program */
-#include "program/hash_table.h"
-#include "ir.h"
-#include "ir_visitor.h"
-#include "glsl_types.h"
-
-class ir_set_program_inouts_visitor : public ir_hierarchical_visitor {
-public:
-   ir_set_program_inouts_visitor(struct gl_program *prog,
-                                 bool is_fragment_shader)
-   {
-      this->prog = prog;
-      this->is_fragment_shader = is_fragment_shader;
-      this->ht = hash_table_ctor(0,
-				 hash_table_pointer_hash,
-				 hash_table_pointer_compare);
-   }
-   ~ir_set_program_inouts_visitor()
-   {
-      hash_table_dtor(this->ht);
-   }
-
-   virtual ir_visitor_status visit_enter(ir_dereference_array *);
-   virtual ir_visitor_status visit_enter(ir_function_signature *);
-   virtual ir_visitor_status visit_enter(ir_expression *);
-   virtual ir_visitor_status visit_enter(ir_discard *);
-   virtual ir_visitor_status visit(ir_dereference_variable *);
-   virtual ir_visitor_status visit(ir_variable *);
-
-   struct gl_program *prog;
-   struct hash_table *ht;
-   bool is_fragment_shader;
-};
-
-static void
-mark(struct gl_program *prog, ir_variable *var, int offset, int len,
-     bool is_fragment_shader)
-{
-   /* As of GLSL 1.20, varyings can only be floats, floating-point
-    * vectors or matrices, or arrays of them.  For Mesa programs using
-    * InputsRead/OutputsWritten, everything but matrices uses one
-    * slot, while matrices use a slot per column.  Presumably
-    * something doing a more clever packing would use something other
-    * than InputsRead/OutputsWritten.
-    */
-
-   for (int i = 0; i < len; i++) {
-      GLbitfield64 bitfield = BITFIELD64_BIT(var->location + var->index + offset + i);
-      if (var->mode == ir_var_in) {
-	 prog->InputsRead |= bitfield;
-         if (is_fragment_shader) {
-            gl_fragment_program *fprog = (gl_fragment_program *) prog;
-            fprog->InterpQualifier[var->location + var->index + offset + i] =
-               (glsl_interp_qualifier) var->interpolation;
-            if (var->centroid)
-               fprog->IsCentroid |= bitfield;
-         }
-      } else if (var->mode == ir_var_system_value) {
-         prog->SystemValuesRead |= bitfield;
-      } else {
-	 prog->OutputsWritten |= bitfield;
-      }
-   }
-}
-
-/* Default handler: Mark all the locations in the variable as used. */
-ir_visitor_status
-ir_set_program_inouts_visitor::visit(ir_dereference_variable *ir)
-{
-   if (hash_table_find(this->ht, ir->var) == NULL)
-      return visit_continue;
-
-   if (ir->type->is_array()) {
-      mark(this->prog, ir->var, 0,
-	   ir->type->length * ir->type->fields.array->matrix_columns,
-           this->is_fragment_shader);
-   } else {
-      mark(this->prog, ir->var, 0, ir->type->matrix_columns,
-           this->is_fragment_shader);
-   }
-
-   return visit_continue;
-}
-
-ir_visitor_status
-ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir)
-{
-   ir_dereference_variable *deref_var;
-   ir_constant *index = ir->array_index->as_constant();
-   deref_var = ir->array->as_dereference_variable();
-   ir_variable *var = NULL;
-
-   /* Check that we're dereferencing a shader in or out */
-   if (deref_var)
-      var = (ir_variable *)hash_table_find(this->ht, deref_var->var);
-
-   if (index && var) {
-      int width = 1;
-
-      if (deref_var->type->is_array() &&
-	  deref_var->type->fields.array->is_matrix()) {
-	 width = deref_var->type->fields.array->matrix_columns;
-      }
-
-      mark(this->prog, var, index->value.i[0] * width, width,
-           this->is_fragment_shader);
-      return visit_continue_with_parent;
-   }
-
-   return visit_continue;
-}
-
-ir_visitor_status
-ir_set_program_inouts_visitor::visit(ir_variable *ir)
-{
-   if (ir->mode == ir_var_in ||
-       ir->mode == ir_var_out ||
-       ir->mode == ir_var_system_value) {
-      hash_table_insert(this->ht, ir, ir);
-   }
-
-   return visit_continue;
-}
-
-ir_visitor_status
-ir_set_program_inouts_visitor::visit_enter(ir_function_signature *ir)
-{
-   /* We don't want to descend into the function parameters and
-    * consider them as shader inputs or outputs.
-    */
-   visit_list_elements(this, &ir->body);
-   return visit_continue_with_parent;
-}
-
-ir_visitor_status
-ir_set_program_inouts_visitor::visit_enter(ir_expression *ir)
-{
-   if (is_fragment_shader && ir->operation == ir_unop_dFdy) {
-      gl_fragment_program *fprog = (gl_fragment_program *) prog;
-      fprog->UsesDFdy = true;
-   }
-   return visit_continue;
-}
-
-ir_visitor_status
-ir_set_program_inouts_visitor::visit_enter(ir_discard *)
-{
-   /* discards are only allowed in fragment shaders. */
-   assert(is_fragment_shader);
-
-   gl_fragment_program *fprog = (gl_fragment_program *) prog;
-   fprog->UsesKill = true;
-
-   return visit_continue;
-}
-
-void
-do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
-                      bool is_fragment_shader)
-{
-   ir_set_program_inouts_visitor v(prog, is_fragment_shader);
-
-   prog->InputsRead = 0;
-   prog->OutputsWritten = 0;
-   prog->SystemValuesRead = 0;
-   if (is_fragment_shader) {
-      gl_fragment_program *fprog = (gl_fragment_program *) prog;
-      memset(fprog->InterpQualifier, 0, sizeof(fprog->InterpQualifier));
-      fprog->IsCentroid = 0;
-      fprog->UsesDFdy = false;
-      fprog->UsesKill = false;
-   }
-   visit_list_elements(&v, instructions);
-}

+ 1 - 0
3rdparty/glsl-optimizer/src/glsl/ir_visitor.h

@@ -62,6 +62,7 @@ public:
    virtual void visit(class ir_if *) = 0;
    virtual void visit(class ir_loop *) = 0;
    virtual void visit(class ir_loop_jump *) = 0;
+   virtual void visit(class ir_precision_statement *) = 0;
    /*@}*/
 };
 

+ 5 - 2
3rdparty/glsl-optimizer/src/glsl/linker.cpp

@@ -875,6 +875,9 @@ move_non_declarations(exec_list *instructions, exec_node *last,
 
       if (inst->as_function())
 	 continue;
+	   
+      if (inst->ir_type == ir_type_precision)
+         continue;
 
       ir_variable *var = inst->as_variable();
       if ((var != NULL) && (var->mode != ir_var_temporary))
@@ -1071,8 +1074,8 @@ link_intrastage_shaders(void *mem_ctx,
     */
    ir_function_signature *const main_sig = get_main_function_signature(linked);
 
-   /* Move any instructions other than variable declarations or function
-    * declarations into main.
+   /* Move any instructions other than variable declarations, function
+    * declarations or precision statements into main.
     */
    exec_node *insertion_point =
       move_non_declarations(linked->ir, (exec_node *) &main_sig->body, false,

+ 8 - 1
3rdparty/glsl-optimizer/src/glsl/lower_jumps.cpp

@@ -440,6 +440,11 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
        */
       (void) ir;
    }
+	
+   virtual void visit(class ir_precision_statement * ir)
+   {
+      /* Nothing needs to be done. */
+   }	
 
    enum jump_strength get_jump_strength(ir_instruction* ir)
    {
@@ -1002,10 +1007,12 @@ do_lower_jumps(exec_list *instructions, bool pull_out_jumps, bool lower_sub_retu
    v.lower_sub_return = lower_sub_return;
    v.lower_main_return = lower_main_return;
 
+   bool progress_ever = false;
    do {
       v.progress = false;
       visit_exec_list(instructions, &v);
+      progress_ever = v.progress || progress_ever;
    } while (v.progress);
 
-   return v.progress;
+   return progress_ever;
 }

+ 10 - 0
3rdparty/glsl-optimizer/src/glsl/msvc/mesaglsl2.sln

@@ -11,17 +11,27 @@ EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|Win32.Build.0 = Debug|Win32
+		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|x64.ActiveCfg = Debug|x64
+		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|x64.Build.0 = Debug|x64
 		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|Win32.ActiveCfg = Release|Win32
 		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|Win32.Build.0 = Release|Win32
+		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|x64.ActiveCfg = Release|x64
+		{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|x64.Build.0 = Release|x64
 		{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|Win32.ActiveCfg = Debug|Win32
 		{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|Win32.Build.0 = Debug|Win32
+		{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|x64.ActiveCfg = Debug|x64
+		{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|x64.Build.0 = Debug|x64
 		{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|Win32.ActiveCfg = Release|Win32
 		{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|Win32.Build.0 = Release|Win32
+		{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|x64.ActiveCfg = Release|x64
+		{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 236 - 4
3rdparty/glsl-optimizer/src/glsl/msvc/mesaglsl2.vcproj

@@ -12,14 +12,17 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="build/$(ProjectName)/$(ConfigurationName)"
-			IntermediateDirectory="build/$(ProjectName)/$(ConfigurationName)"
+			OutputDirectory="build/$(ProjectName)\$(ConfigurationName)"
+			IntermediateDirectory="build/$(ProjectName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="1"
 			>
@@ -81,10 +84,76 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			IntermediateDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../talloc;../../../include;../../mesa;../../mapi;../../../include/c99"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;snprintf=_snprintf"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4291;4996;4800;4099;4244;4018"
+				ForcedIncludeFiles=""
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)\$(ProjectName)-x64.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="build/$(ProjectName)/$(ConfigurationName)"
-			IntermediateDirectory="build/$(ProjectName)/$(ConfigurationName)"
+			OutputDirectory="build/$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="build/$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="1"
 			WholeProgramOptimization="0"
@@ -147,6 +216,73 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			IntermediateDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="../../talloc;../../../include;../../mesa;../../mapi;../../../include/c99"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;snprintf=_snprintf"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="1"
+				DisableSpecificWarnings="4291;4996;4800;4099;4244;4018"
+				ForcedIncludeFiles=""
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)\$(ProjectName)-x64.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -208,6 +344,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
@@ -216,6 +360,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\glsl_optimizer.cpp"
@@ -244,6 +396,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
@@ -252,6 +412,14 @@
 							Name="VCCustomBuildTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\glsl_parser_extras.cpp"
@@ -504,6 +672,14 @@
 							Name="VCCLCompilerTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
 					<FileConfiguration
 						Name="Release|Win32"
 						ExcludedFromBuild="true"
@@ -512,6 +688,14 @@
 							Name="VCCLCompilerTool"
 						/>
 					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
 				</File>
 				<File
 					RelativePath="..\opt_algebraic.cpp"
@@ -635,6 +819,14 @@
 								Name="VCCustomBuildTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCustomBuildTool"
+							/>
+						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|Win32"
 							ExcludedFromBuild="true"
@@ -643,6 +835,14 @@
 								Name="VCCustomBuildTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCustomBuildTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
 						RelativePath="..\glcpp\glcpp-parse.c"
@@ -663,6 +863,14 @@
 								Name="VCCustomBuildTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCustomBuildTool"
+							/>
+						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|Win32"
 							ExcludedFromBuild="true"
@@ -671,6 +879,14 @@
 								Name="VCCustomBuildTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCustomBuildTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
 						RelativePath="..\glcpp\glcpp.c"
@@ -683,6 +899,14 @@
 								Name="VCCLCompilerTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 						<FileConfiguration
 							Name="Release|Win32"
 							ExcludedFromBuild="true"
@@ -691,6 +915,14 @@
 								Name="VCCLCompilerTool"
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
 						RelativePath="..\glcpp\glcpp.h"

+ 18 - 0
3rdparty/glsl-optimizer/src/glsl/opt_constant_variable.cpp

@@ -53,6 +53,7 @@ public:
    virtual ir_visitor_status visit(ir_variable *);
    virtual ir_visitor_status visit_enter(ir_assignment *);
    virtual ir_visitor_status visit_enter(ir_call *);
+   virtual ir_visitor_status visit_enter(ir_function_signature *);
 
    exec_list list;
 };
@@ -162,6 +163,23 @@ ir_constant_variable_visitor::visit_enter(ir_call *ir)
    return visit_continue;
 }
 
+ir_visitor_status
+ir_constant_variable_visitor::visit_enter(ir_function_signature *ir)
+{
+   /* Mark any in parameters as assigned to */
+   foreach_iter(exec_list_iterator, iter, ir->parameters) {
+      ir_variable *var = (ir_variable *)iter.get();
+      if (var->mode == ir_var_in || var->mode == ir_var_const_in || var->mode == ir_var_inout) {
+         struct assignment_entry *entry;
+         entry = get_assignment_entry(var, &this->list);
+         entry->assignment_count++;
+      }
+   }
+   visit_list_elements(this, &ir->body);
+   return visit_continue_with_parent;
+}
+
+
 /**
  * Does a copy propagation pass on the code present in the instruction stream.
  */

+ 13 - 15
3rdparty/glsl-optimizer/src/glsl/xcode/mesaglsl2.xcodeproj/project.pbxproj

@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 45;
+	objectVersion = 46;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -258,7 +258,6 @@
 		2B6A99EE1223B1670059FBED /* glcpp-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "glcpp-parse.c"; path = "../glcpp/glcpp-parse.c"; sourceTree = SOURCE_ROOT; };
 		2B6A99EF1223B1670059FBED /* glcpp-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "glcpp-parse.h"; path = "../glcpp/glcpp-parse.h"; sourceTree = SOURCE_ROOT; };
 		2B6A99F01223B1670059FBED /* glcpp-parse.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; name = "glcpp-parse.y"; path = "../glcpp/glcpp-parse.y"; sourceTree = SOURCE_ROOT; };
-		2B6A99F11223B1670059FBED /* glcpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = glcpp.c; path = ../glcpp/glcpp.c; sourceTree = SOURCE_ROOT; };
 		2B6A99F21223B1670059FBED /* glcpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glcpp.h; path = ../glcpp/glcpp.h; sourceTree = SOURCE_ROOT; };
 		2B6A99F31223B1670059FBED /* pp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pp.c; path = ../glcpp/pp.c; sourceTree = SOURCE_ROOT; };
 		2B6AC7B5161EC99C0094FD86 /* prog_instruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prog_instruction.h; path = ../../mesa/program/prog_instruction.h; sourceTree = SOURCE_ROOT; };
@@ -422,7 +421,6 @@
 				2B6A99EE1223B1670059FBED /* glcpp-parse.c */,
 				2B6A99EF1223B1670059FBED /* glcpp-parse.h */,
 				2B6A99F01223B1670059FBED /* glcpp-parse.y */,
-				2B6A99F11223B1670059FBED /* glcpp.c */,
 				2B6A99F21223B1670059FBED /* glcpp.h */,
 				2B6A99F31223B1670059FBED /* pp.c */,
 			);
@@ -663,8 +661,11 @@
 /* Begin PBXProject section */
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0460;
+			};
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "mesaglsl2" */;
-			compatibilityVersion = "Xcode 3.1";
+			compatibilityVersion = "Xcode 3.2";
 			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
@@ -879,9 +880,9 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
 				GCC_MODEL_TUNING = G5;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				INSTALL_PATH = /usr/local/lib;
@@ -893,6 +894,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				COMBINE_HIDPI_IMAGES = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = /usr/local/lib;
@@ -906,7 +908,7 @@
 				ARCHS = i386;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_VERSION = 4.0;
+				GCC_VERSION = "";
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
@@ -915,9 +917,9 @@
 					../../../include,
 					../../mesa,
 				);
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;
-				PREBINDING = NO;
-				SDKROOT = macosx10.4;
+				SDKROOT = macosx;
 			};
 			name = Debug;
 		};
@@ -926,7 +928,7 @@
 			buildSettings = {
 				ARCHS = i386;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
-				GCC_VERSION = 4.0;
+				GCC_VERSION = "";
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
@@ -934,8 +936,8 @@
 					../../../include,
 					../../mesa,
 				);
-				PREBINDING = NO;
-				SDKROOT = macosx10.4;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
+				SDKROOT = macosx;
 			};
 			name = Release;
 		};
@@ -946,11 +948,9 @@
 				CONFIGURATION_BUILD_DIR = ..;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
 				GCC_MODEL_TUNING = G5;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				INSTALL_PATH = /usr/local/bin;
-				PREBINDING = NO;
 				PRODUCT_NAME = builtin_compiler;
 			};
 			name = Debug;
@@ -962,10 +962,8 @@
 				CONFIGURATION_BUILD_DIR = ..;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
 				GCC_MODEL_TUNING = G5;
 				INSTALL_PATH = /usr/local/bin;
-				PREBINDING = NO;
 				PRODUCT_NAME = builtin_compiler;
 				ZERO_LINK = NO;
 			};

+ 1 - 0
3rdparty/glsl-optimizer/src/mesa/main/mtypes.h

@@ -1145,6 +1145,7 @@ struct gl_extensions
    GLboolean EXT_vertex_array_bgra;
    GLboolean OES_standard_derivatives;
    GLboolean EXT_shadow_samplers;
+   GLboolean EXT_frag_depth;
    /* vendor extensions */
    GLboolean AMD_seamless_cubemap_per_texture;
    GLboolean APPLE_packed_pixels;

+ 19 - 0
3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-in.txt

@@ -0,0 +1,19 @@
+// Used to expose bugs in constant variable optimization,
+// when variables were deemed constant not taking into
+// account branches or previous dereferences of them.
+
+uniform float mode;
+float func (float c) {
+    if (mode == 2.0)
+        return c;
+    if (mode == 3.0)
+    	discard;
+    if (mode == 10.0)
+        c = 0.1;
+    return c;
+}
+void main() {
+    vec4 c = gl_FragCoord;
+    c.x = func(c.x);
+    gl_FragColor = c;
+}

+ 35 - 0
3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-ir.txt

@@ -0,0 +1,35 @@
+uniform float mode;
+float func (
+  in float c_1
+)
+{
+  if ((mode == 2.0)) {
+    return c_1;
+  };
+  if ((mode == 3.0)) {
+    discard;
+  };
+  if ((mode == 10.0)) {
+    float tmpvar_2;
+    tmpvar_2 = 0.1;
+    c_1 = tmpvar_2;
+  };
+  return c_1;
+}
+
+void main ()
+{
+  vec4 c_3;
+  vec4 tmpvar_4;
+  tmpvar_4 = gl_FragCoord;
+  c_3 = tmpvar_4;
+  float tmpvar_5;
+  tmpvar_5 = func (c_3.x);
+  float tmpvar_6;
+  tmpvar_6 = tmpvar_5;
+  c_3.x = tmpvar_6;
+  vec4 tmpvar_7;
+  tmpvar_7 = c_3;
+  gl_FragColor = tmpvar_7;
+}
+

+ 23 - 0
3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-out.txt

@@ -0,0 +1,23 @@
+uniform float mode;
+void main ()
+{
+  vec4 c_1;
+  c_1 = gl_FragCoord;
+  float c_2;
+  c_2 = gl_FragCoord.x;
+  float tmpvar_3;
+  if ((mode == 2.0)) {
+    tmpvar_3 = c_2;
+  } else {
+    if ((mode == 3.0)) {
+      discard;
+    };
+    if ((mode == 10.0)) {
+      c_2 = 0.1;
+    };
+    tmpvar_3 = c_2;
+  };
+  c_1.x = tmpvar_3;
+  gl_FragColor = c_1;
+}
+

+ 11 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-in.txt

@@ -0,0 +1,11 @@
+void xlat_main( out vec4 ocol, out float oz ) {
+    ocol = vec4( 0.5);
+    oz = 0.9;
+}
+void main() {
+    vec4 xlt_ocol;
+    float xlt_oz;
+    xlat_main( xlt_ocol, xlt_oz);
+    gl_FragData[0] = vec4(xlt_ocol);
+    gl_FragDepth = float(xlt_oz);
+}

+ 12 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-inES.txt

@@ -0,0 +1,12 @@
+#extension GL_EXT_frag_depth : require
+void xlat_main( out lowp vec4 ocol, out mediump float oz ) {
+    ocol = vec4( 0.5);
+    oz = 0.9;
+}
+void main() {
+    lowp vec4 xlt_ocol;
+    mediump float xlt_oz;
+    xlat_main( xlt_ocol, xlt_oz);
+    gl_FragData[0] = vec4(xlt_ocol);
+    gl_FragDepthEXT = float(xlt_oz);
+}

+ 28 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-ir.txt

@@ -0,0 +1,28 @@
+void xlat_main (
+  out vec4 ocol_1,
+  out float oz_2
+)
+{
+  vec4 tmpvar_3;
+  tmpvar_3 = vec4(0.5, 0.5, 0.5, 0.5);
+  ocol_1 = tmpvar_3;
+  float tmpvar_4;
+  tmpvar_4 = 0.9;
+  oz_2 = tmpvar_4;
+}
+
+void main ()
+{
+  float xlt_oz_5;
+  vec4 xlt_ocol_6;
+  xlat_main (xlt_ocol_6, xlt_oz_5);
+  vec4 tmpvar_7;
+  tmpvar_7 = xlt_ocol_6.xyzw;
+  vec4 tmpvar_8;
+  tmpvar_8 = tmpvar_7;
+  gl_FragData[0] = tmpvar_8;
+  float tmpvar_9;
+  tmpvar_9 = xlt_oz_5;
+  gl_FragDepth = tmpvar_9;
+}
+

+ 29 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-irES.txt

@@ -0,0 +1,29 @@
+#extension GL_EXT_frag_depth : enable
+void xlat_main (
+  out lowp vec4 ocol_1,
+  out mediump float oz_2
+)
+{
+  vec4 tmpvar_3;
+  tmpvar_3 = vec4(0.5, 0.5, 0.5, 0.5);
+  ocol_1 = tmpvar_3;
+  float tmpvar_4;
+  tmpvar_4 = 0.9;
+  oz_2 = tmpvar_4;
+}
+
+void main ()
+{
+  mediump float xlt_oz_5;
+  lowp vec4 xlt_ocol_6;
+  xlat_main (xlt_ocol_6, xlt_oz_5);
+  lowp vec4 tmpvar_7;
+  tmpvar_7 = xlt_ocol_6.xyzw;
+  lowp vec4 tmpvar_8;
+  tmpvar_8 = tmpvar_7;
+  gl_FragData[0] = tmpvar_8;
+  mediump float tmpvar_9;
+  tmpvar_9 = xlt_oz_5;
+  gl_FragDepthEXT = tmpvar_9;
+}
+

+ 6 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-out.txt

@@ -0,0 +1,6 @@
+void main ()
+{
+  gl_FragData[0] = vec4(0.5, 0.5, 0.5, 0.5);
+  gl_FragDepth = 0.9;
+}
+

+ 7 - 0
3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES.txt

@@ -0,0 +1,7 @@
+#extension GL_EXT_frag_depth : enable
+void main ()
+{
+  gl_FragData[0] = vec4(0.5, 0.5, 0.5, 0.5);
+  gl_FragDepthEXT = 0.9;
+}
+

+ 7 - 0
3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-inES.txt

@@ -0,0 +1,7 @@
+void main() {
+    int i = 0;
+    float f = 0.0;
+    for (; i < 32; (++i))
+        f += gl_FragCoord.x * float(i);
+    gl_FragColor = vec4(f);
+}

+ 28 - 0
3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-irES.txt

@@ -0,0 +1,28 @@
+void main ()
+{
+  mediump float f_1;
+  int i_2;
+  int tmpvar_3;
+  tmpvar_3 = 0;
+  i_2 = tmpvar_3;
+  float tmpvar_4;
+  tmpvar_4 = 0.0;
+  f_1 = tmpvar_4;
+  while (true) {
+    if (!((i_2 < 32))) {
+      break;
+    };
+    mediump float tmpvar_5;
+    tmpvar_5 = (f_1 + (gl_FragCoord.x * float(i_2)));
+    f_1 = tmpvar_5;
+    int tmpvar_6;
+    tmpvar_6 = (i_2 + 1);
+    i_2 = tmpvar_6;
+  };
+  mediump vec4 tmpvar_7;
+  tmpvar_7 = vec4(f_1);
+  mediump vec4 tmpvar_8;
+  tmpvar_8 = tmpvar_7;
+  gl_FragColor = tmpvar_8;
+}
+

+ 13 - 0
3rdparty/glsl-optimizer/tests/fragment/loop-fornounroll-outES.txt

@@ -0,0 +1,13 @@
+void main ()
+{
+  mediump float f_1;
+  int i_2;
+  i_2 = 0;
+  f_1 = 0.0;
+  for (int i_2 = 0; i_2 < 32; ) {
+    f_1 = (f_1 + (gl_FragCoord.x * float(i_2)));
+    i_2 = (i_2 + 1);
+  };
+  gl_FragColor = vec4(f_1);
+}
+

+ 17 - 0
3rdparty/glsl-optimizer/tests/fragment/prec-default-inES.txt

@@ -0,0 +1,17 @@
+precision highp float;
+precision lowp int;
+
+uniform float fh1;
+uniform highp float fh2;
+uniform mediump float fm;
+
+uniform int il1;
+uniform lowp int il2;
+uniform mediump int im;
+
+
+void main() {
+    lowp float f = fh1 + fh2 + fm;
+    highp int i = il1 + il2 + im;
+    gl_FragColor = vec4(f, i, 0.0, 0.0);
+}

+ 27 - 0
3rdparty/glsl-optimizer/tests/fragment/prec-default-irES.txt

@@ -0,0 +1,27 @@
+precision lowp int;
+precision highp float;
+uniform int im;
+uniform int il2;
+uniform int il1;
+uniform mediump float fm;
+uniform highp float fh2;
+uniform float fh1;
+void main ()
+{
+  int i_1;
+  lowp float f_2;
+  highp float tmpvar_3;
+  tmpvar_3 = ((fh1 + fh2) + fm);
+  f_2 = tmpvar_3;
+  int tmpvar_4;
+  tmpvar_4 = ((il1 + il2) + im);
+  i_1 = tmpvar_4;
+  highp vec4 tmpvar_5;
+  tmpvar_5.zw = vec2(0.0, 0.0);
+  tmpvar_5.x = f_2;
+  tmpvar_5.y = float(i_1);
+  highp vec4 tmpvar_6;
+  tmpvar_6 = tmpvar_5;
+  gl_FragColor = tmpvar_6;
+}
+

+ 25 - 0
3rdparty/glsl-optimizer/tests/fragment/prec-default-outES.txt

@@ -0,0 +1,25 @@
+precision lowp int;
+precision highp float;
+uniform int im;
+uniform int il2;
+uniform int il1;
+uniform mediump float fm;
+uniform highp float fh2;
+uniform float fh1;
+void main ()
+{
+  int i_1;
+  lowp float f_2;
+  highp float tmpvar_3;
+  tmpvar_3 = ((fh1 + fh2) + fm);
+  f_2 = tmpvar_3;
+  int tmpvar_4;
+  tmpvar_4 = ((il1 + il2) + im);
+  i_1 = tmpvar_4;
+  highp vec4 tmpvar_5;
+  tmpvar_5.zw = vec2(0.0, 0.0);
+  tmpvar_5.x = f_2;
+  tmpvar_5.y = float(i_1);
+  gl_FragColor = tmpvar_5;
+}
+

+ 1 - 1
3rdparty/glsl-optimizer/tests/fragment/prec-tempssimple-irES.txt

@@ -1,6 +1,6 @@
 varying mediump vec2 var_mediump;
 varying lowp vec2 var_lowp;
-uniform sampler2D tex_highp;
+uniform highp sampler2D tex_highp;
 uniform sampler2D tex_lowp;
 uniform sampler2D tex_def;
 void main ()

+ 1 - 1
3rdparty/glsl-optimizer/tests/fragment/prec-tempssimple-outES.txt

@@ -1,6 +1,6 @@
 varying mediump vec2 var_mediump;
 varying lowp vec2 var_lowp;
-uniform sampler2D tex_highp;
+uniform highp sampler2D tex_highp;
 uniform sampler2D tex_lowp;
 uniform sampler2D tex_def;
 void main ()

+ 23 - 0
3rdparty/glsl-optimizer/tests/fragment/sampler-precision-inES.txt

@@ -0,0 +1,23 @@
+uniform sampler2D texlow;
+uniform mediump sampler2D texmed;
+uniform highp sampler2D texhigh;
+uniform samplerCube cubelow;
+uniform mediump samplerCube cubemed;
+uniform highp samplerCube cubehigh;
+
+mediump vec4 xlat_main(in highp vec4 uv) {
+    mediump vec4 c;
+    c = texture2D(texlow, uv.xy);
+    c += texture2D(texmed, uv.xy);
+    c += texture2D(texhigh, uv.xy);
+    c += textureCube(cubelow, uv.xyz);
+    c += textureCube(cubemed, uv.xyz);
+    c += textureCube(cubehigh, uv.xyz);
+    return c;
+}
+varying highp vec4 varUV;
+void main() {
+    mediump vec4 r;
+    r = xlat_main(varUV);
+    gl_FragData[0] = r;
+}

+ 58 - 0
3rdparty/glsl-optimizer/tests/fragment/sampler-precision-irES.txt

@@ -0,0 +1,58 @@
+varying highp vec4 varUV;
+uniform highp samplerCube cubehigh;
+uniform mediump samplerCube cubemed;
+uniform samplerCube cubelow;
+uniform highp sampler2D texhigh;
+uniform mediump sampler2D texmed;
+uniform sampler2D texlow;
+mediump vec4 xlat_main (
+  in highp vec4 uv_1
+)
+{
+  mediump vec4 c_2;
+  lowp vec4 tmpvar_3;
+  tmpvar_3 = texture2D (texlow, uv_1.xy);
+  lowp vec4 tmpvar_4;
+  tmpvar_4 = tmpvar_3;
+  c_2 = tmpvar_4;
+  mediump vec4 tmpvar_5;
+  tmpvar_5 = texture2D (texmed, uv_1.xy);
+  mediump vec4 tmpvar_6;
+  tmpvar_6 = (c_2 + tmpvar_5);
+  c_2 = tmpvar_6;
+  highp vec4 tmpvar_7;
+  tmpvar_7 = texture2D (texhigh, uv_1.xy);
+  highp vec4 tmpvar_8;
+  tmpvar_8 = (c_2 + tmpvar_7);
+  c_2 = tmpvar_8;
+  lowp vec4 tmpvar_9;
+  tmpvar_9 = textureCube (cubelow, uv_1.xyz);
+  mediump vec4 tmpvar_10;
+  tmpvar_10 = (c_2 + tmpvar_9);
+  c_2 = tmpvar_10;
+  mediump vec4 tmpvar_11;
+  tmpvar_11 = textureCube (cubemed, uv_1.xyz);
+  mediump vec4 tmpvar_12;
+  tmpvar_12 = (c_2 + tmpvar_11);
+  c_2 = tmpvar_12;
+  highp vec4 tmpvar_13;
+  tmpvar_13 = textureCube (cubehigh, uv_1.xyz);
+  highp vec4 tmpvar_14;
+  tmpvar_14 = (c_2 + tmpvar_13);
+  c_2 = tmpvar_14;
+  return c_2;
+}
+
+void main ()
+{
+  mediump vec4 r_15;
+  mediump vec4 tmpvar_16;
+  tmpvar_16 = xlat_main (varUV);
+  mediump vec4 tmpvar_17;
+  tmpvar_17 = tmpvar_16;
+  r_15 = tmpvar_17;
+  mediump vec4 tmpvar_18;
+  tmpvar_18 = r_15;
+  gl_FragData[0] = tmpvar_18;
+}
+

+ 36 - 0
3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES.txt

@@ -0,0 +1,36 @@
+varying highp vec4 varUV;
+uniform highp samplerCube cubehigh;
+uniform mediump samplerCube cubemed;
+uniform samplerCube cubelow;
+uniform highp sampler2D texhigh;
+uniform mediump sampler2D texmed;
+uniform sampler2D texlow;
+void main ()
+{
+  mediump vec4 c_1;
+  lowp vec4 tmpvar_2;
+  tmpvar_2 = texture2D (texlow, varUV.xy);
+  c_1 = tmpvar_2;
+  mediump vec4 tmpvar_3;
+  tmpvar_3 = texture2D (texmed, varUV.xy);
+  mediump vec4 tmpvar_4;
+  tmpvar_4 = (c_1 + tmpvar_3);
+  highp vec4 tmpvar_5;
+  tmpvar_5 = texture2D (texhigh, varUV.xy);
+  highp vec4 tmpvar_6;
+  tmpvar_6 = (tmpvar_4 + tmpvar_5);
+  c_1 = tmpvar_6;
+  lowp vec4 tmpvar_7;
+  tmpvar_7 = textureCube (cubelow, varUV.xyz);
+  mediump vec4 tmpvar_8;
+  tmpvar_8 = textureCube (cubemed, varUV.xyz);
+  mediump vec4 tmpvar_9;
+  tmpvar_9 = ((c_1 + tmpvar_7) + tmpvar_8);
+  highp vec4 tmpvar_10;
+  tmpvar_10 = textureCube (cubehigh, varUV.xyz);
+  highp vec4 tmpvar_11;
+  tmpvar_11 = (tmpvar_9 + tmpvar_10);
+  c_1 = tmpvar_11;
+  gl_FragData[0] = c_1;
+}
+

+ 2 - 2
3rdparty/glsl-optimizer/tests/fragment/tex2dlod-inES.txt

@@ -1,6 +1,6 @@
-#extension GL_ARB_shader_texture_lod : require
+#extension GL_EXT_shader_texture_lod : require
 vec4 xll_tex2Dlod(sampler2D s, vec4 coord) {
-   return texture2DLod( s, coord.xy, coord.w);
+   return texture2DLodEXT( s, coord.xy, coord.w);
 }
 uniform sampler2D tex;
 mediump vec4 xlat_main( in highp vec4 uv );

+ 2 - 2
3rdparty/glsl-optimizer/tests/fragment/tex2dlod-irES.txt

@@ -1,4 +1,4 @@
-#extension GL_ARB_shader_texture_lod : enable
+#extension GL_EXT_shader_texture_lod : enable
 varying highp vec4 xlv_TEXCOORD0;
 uniform sampler2D tex;
 vec4 xll_tex2Dlod (
@@ -7,7 +7,7 @@ vec4 xll_tex2Dlod (
 )
 {
   lowp vec4 tmpvar_3;
-  tmpvar_3 = texture2DLod (s_1, coord_2.xy, coord_2.w);
+  tmpvar_3 = texture2DLodEXT (s_1, coord_2.xy, coord_2.w);
   return tmpvar_3;
 }
 

+ 2 - 2
3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES.txt

@@ -1,11 +1,11 @@
-#extension GL_ARB_shader_texture_lod : enable
+#extension GL_EXT_shader_texture_lod : enable
 varying highp vec4 xlv_TEXCOORD0;
 uniform sampler2D tex;
 void main ()
 {
   mediump vec4 tmpvar_1;
   lowp vec4 tmpvar_2;
-  tmpvar_2 = texture2DLod (tex, xlv_TEXCOORD0.xy, 0.0);
+  tmpvar_2 = texture2DLodEXT (tex, xlv_TEXCOORD0.xy, 0.0);
   tmpvar_1 = tmpvar_2;
   gl_FragData[0] = tmpvar_1;
 }

+ 1 - 1
3rdparty/glsl-optimizer/tests/fragment/texProj-outES.txt

@@ -6,7 +6,7 @@ uniform sampler2D tex;
 void main ()
 {
   lowp vec4 tmpvar_1;
-  tmpvar_1 = (((((texture2DProj (tex, uv) + texture2DProj (tex, uv.xyz)) + texture2DProjLod (tex, uv, 1.0)) + texture2DProjLod (tex, uv.xyz, 1.0)) + vec4(shadow2DEXT (shadowmap, uv.xyz))) + vec4(shadow2DProjEXT (shadowmap, uv)));
+  tmpvar_1 = (((((texture2DProj (tex, uv) + texture2DProj (tex, uv.xyz)) + texture2DProjLodEXT (tex, uv, 1.0)) + texture2DProjLodEXT (tex, uv.xyz, 1.0)) + vec4(shadow2DEXT (shadowmap, uv.xyz))) + vec4(shadow2DProjEXT (shadowmap, uv)));
   gl_FragColor = tmpvar_1;
 }
 

+ 80 - 122
3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-in.txt

@@ -12,169 +12,127 @@ vec3 FxaaFilterReturn( in vec3 rgb );
 vec3 FxaaPixelShader( in vec2 pos, in sampler2D tex, in vec2 rcpFrame );
 vec4 xlat_main( in vec2 uv );
 vec4 FxaaTexOff( in sampler2D tex, in vec2 pos, in vec2 off, in vec2 rcpFrame ) {
-    return xll_tex2Dlod( tex, vec4( (pos.xy  + (off * rcpFrame)), 0.00000, 0.00000));
+    return xll_tex2Dlod( tex, vec4( (pos.xy + (off * rcpFrame)), 0.0, 0.0));
 }
 vec4 FxaaTexLod0( in sampler2D tex, in vec2 pos ) {
-    return xll_tex2Dlod( tex, vec4( pos.xy , 0.00000, 0.00000));
+    return xll_tex2Dlod( tex, vec4( pos.xy, 0.0, 0.0));
 }
 float FxaaLuma( in vec3 rgb ) {
-    return ((rgb.y  * 1.96321) + rgb.x );
+    return ((rgb.y * (0.587 / 0.299)) + rgb.x);
 }
 vec3 FxaaLerp3( in vec3 a, in vec3 b, in float amountOfA ) {
-    return ((vec3( ( -amountOfA ), ( -amountOfA ), ( -amountOfA )) * b) + ((a * vec3( amountOfA, amountOfA, amountOfA)) + b));
+    return ((vec3( (-amountOfA), (-amountOfA), (-amountOfA)) * b) + ((a * vec3( amountOfA, amountOfA, amountOfA)) + b));
 }
 vec3 FxaaFilterReturn( in vec3 rgb ) {
     return rgb;
 }
 vec3 FxaaPixelShader( in vec2 pos, in sampler2D tex, in vec2 rcpFrame ) {
-    vec3 rgbN;
-    vec3 rgbW;
-    vec3 rgbM;
-    vec3 rgbE;
-    vec3 rgbS;
-    float lumaN;
-    float lumaW;
-    float lumaM;
-    float lumaE;
-    float lumaS;
-    float rangeMin;
-    float rangeMax;
-    float range;
-    vec3 rgbL;
-    float lumaL;
-    float rangeL;
-    float blendL;
-    vec3 rgbNW;
-    vec3 rgbNE;
-    vec3 rgbSW;
-    vec3 rgbSE;
-    float lumaNW;
-    float lumaNE;
-    float lumaSW;
-    float lumaSE;
-    float edgeVert;
-    float edgeHorz;
-    bool horzSpan;
-    float lengthSign;
-    float gradientN;
-    float gradientS;
-    bool pairN;
-    vec2 posN;
-    vec2 posP;
-    vec2 offNP;
-    float lumaEndN;
-    float lumaEndP;
-    bool doneN = false;
-    bool doneP = false;
-    int i = 0;
-    float dstN;
-    float dstP;
-    bool directionN;
-    float spanLength;
-    float subPixelOffset;
-    vec3 rgbF;
-    rgbN = FxaaTexOff( tex, pos.xy , vec2( 0.00000, -1.00000), rcpFrame).xyz ;
-    rgbW = FxaaTexOff( tex, pos.xy , vec2( -1.00000, 0.00000), rcpFrame).xyz ;
-    rgbM = FxaaTexOff( tex, pos.xy , vec2( 0.00000, 0.00000), rcpFrame).xyz ;
-    rgbE = FxaaTexOff( tex, pos.xy , vec2( 1.00000, 0.00000), rcpFrame).xyz ;
-    rgbS = FxaaTexOff( tex, pos.xy , vec2( 0.00000, 1.00000), rcpFrame).xyz ;
-    lumaN = FxaaLuma( rgbN);
-    lumaW = FxaaLuma( rgbW);
-    lumaM = FxaaLuma( rgbM);
-    lumaE = FxaaLuma( rgbE);
-    lumaS = FxaaLuma( rgbS);
-    rangeMin = min( lumaM, min( min( lumaN, lumaW), min( lumaS, lumaE)));
-    rangeMax = max( lumaM, max( max( lumaN, lumaW), max( lumaS, lumaE)));
-    range = (rangeMax - rangeMin);
-    if ( (range < max( 0.0416667, (rangeMax * 0.125000))) ){
+    vec3 rgbN = FxaaTexOff( tex, pos.xy, vec2( 0.0, -1.0), rcpFrame).xyz;
+    vec3 rgbW = FxaaTexOff( tex, pos.xy, vec2( -1.0, 0.0), rcpFrame).xyz;
+    vec3 rgbM = FxaaTexOff( tex, pos.xy, vec2( 0.0, 0.0), rcpFrame).xyz;
+    vec3 rgbE = FxaaTexOff( tex, pos.xy, vec2( 1.0, 0.0), rcpFrame).xyz;
+    vec3 rgbS = FxaaTexOff( tex, pos.xy, vec2( 0.0, 1.0), rcpFrame).xyz;
+    float lumaN = FxaaLuma( rgbN);
+    float lumaW = FxaaLuma( rgbW);
+    float lumaM = FxaaLuma( rgbM);
+    float lumaE = FxaaLuma( rgbE);
+    float lumaS = FxaaLuma( rgbS);
+    float rangeMin = min( lumaM, min( min( lumaN, lumaW), min( lumaS, lumaE)));
+    float rangeMax = max( lumaM, max( max( lumaN, lumaW), max( lumaS, lumaE)));
+    float range = (rangeMax - rangeMin);
+    if ((range < max( (1.0 / 24.0), (rangeMax * (1.0 / 8.0))))){
         return FxaaFilterReturn( rgbM);
     }
-    rgbL = ((((rgbN + rgbW) + rgbM) + rgbE) + rgbS);
-    lumaL = ((((lumaN + lumaW) + lumaE) + lumaS) * 0.250000);
-    rangeL = abs( (lumaL - lumaM) );
-    blendL = (max( 0.00000, ((rangeL / range) - 0.250000)) * 1.33333);
-    blendL = min( 0.750000, blendL);
-    rgbNW = FxaaTexOff( tex, pos.xy , vec2( -1.00000, -1.00000), rcpFrame).xyz ;
-    rgbNE = FxaaTexOff( tex, pos.xy , vec2( 1.00000, -1.00000), rcpFrame).xyz ;
-    rgbSW = FxaaTexOff( tex, pos.xy , vec2( -1.00000, 1.00000), rcpFrame).xyz ;
-    rgbSE = FxaaTexOff( tex, pos.xy , vec2( 1.00000, 1.00000), rcpFrame).xyz ;
+    vec3 rgbL = ((((rgbN + rgbW) + rgbM) + rgbE) + rgbS);
+    float lumaL = ((((lumaN + lumaW) + lumaE) + lumaS) * 0.25);
+    float rangeL = abs((lumaL - lumaM));
+    float blendL = (max( 0.0, ((rangeL / range) - (1.0 / 4.0))) * (1.0 / (1.0 - (1.0 / 4.0))));
+    blendL = min( (3.0 / 4.0), blendL);
+    vec3 rgbNW = FxaaTexOff( tex, pos.xy, vec2( -1.0, -1.0), rcpFrame).xyz;
+    vec3 rgbNE = FxaaTexOff( tex, pos.xy, vec2( 1.0, -1.0), rcpFrame).xyz;
+    vec3 rgbSW = FxaaTexOff( tex, pos.xy, vec2( -1.0, 1.0), rcpFrame).xyz;
+    vec3 rgbSE = FxaaTexOff( tex, pos.xy, vec2( 1.0, 1.0), rcpFrame).xyz;
     rgbL += (((rgbNW + rgbNE) + rgbSW) + rgbSE);
-    rgbL *= vec3( 0.111111, 0.111111, 0.111111);
-    lumaNW = FxaaLuma( rgbNW);
-    lumaNE = FxaaLuma( rgbNE);
-    lumaSW = FxaaLuma( rgbSW);
-    lumaSE = FxaaLuma( rgbSE);
-    edgeVert = ((abs( (((0.250000 * lumaNW) + (-0.500000 * lumaN)) + (0.250000 * lumaNE)) ) + abs( (((0.500000 * lumaW) + (-1.00000 * lumaM)) + (0.500000 * lumaE)) )) + abs( (((0.250000 * lumaSW) + (-0.500000 * lumaS)) + (0.250000 * lumaSE)) ));
-    edgeHorz = ((abs( (((0.250000 * lumaNW) + (-0.500000 * lumaW)) + (0.250000 * lumaSW)) ) + abs( (((0.500000 * lumaN) + (-1.00000 * lumaM)) + (0.500000 * lumaS)) )) + abs( (((0.250000 * lumaNE) + (-0.500000 * lumaE)) + (0.250000 * lumaSE)) ));
-    horzSpan = (edgeHorz >= edgeVert);
-    lengthSign = (( horzSpan ) ? ( ( -rcpFrame.y  ) ) : ( ( -rcpFrame.x  ) ));
-    if ( ( !horzSpan ) ){
+    rgbL *= vec3( (1.0 / 9.0), (1.0 / 9.0), (1.0 / 9.0));
+    float lumaNW = FxaaLuma( rgbNW);
+    float lumaNE = FxaaLuma( rgbNE);
+    float lumaSW = FxaaLuma( rgbSW);
+    float lumaSE = FxaaLuma( rgbSE);
+    float edgeVert = ((abs((((0.25 * lumaNW) + ((-0.5) * lumaN)) + (0.25 * lumaNE))) + abs((((0.5 * lumaW) + ((-1.0) * lumaM)) + (0.5 * lumaE)))) + abs((((0.25 * lumaSW) + ((-0.5) * lumaS)) + (0.25 * lumaSE))));
+    float edgeHorz = ((abs((((0.25 * lumaNW) + ((-0.5) * lumaW)) + (0.25 * lumaSW))) + abs((((0.5 * lumaN) + ((-1.0) * lumaM)) + (0.5 * lumaS)))) + abs((((0.25 * lumaNE) + ((-0.5) * lumaE)) + (0.25 * lumaSE))));
+    bool horzSpan = (edgeHorz >= edgeVert);
+    float lengthSign = (( horzSpan ) ? ( (-rcpFrame.y) ) : ( (-rcpFrame.x) ));
+    if ((!horzSpan)){
         lumaN = lumaW;
     }
-    if ( ( !horzSpan ) ){
+    if ((!horzSpan)){
         lumaS = lumaE;
     }
-    gradientN = abs( (lumaN - lumaM) );
-    gradientS = abs( (lumaS - lumaM) );
-    lumaN = ((lumaN + lumaM) * 0.500000);
-    lumaS = ((lumaS + lumaM) * 0.500000);
-    pairN = (gradientN >= gradientS);
-    if ( ( !pairN ) ){
+    float gradientN = abs((lumaN - lumaM));
+    float gradientS = abs((lumaS - lumaM));
+    lumaN = ((lumaN + lumaM) * 0.5);
+    lumaS = ((lumaS + lumaM) * 0.5);
+    bool pairN = (gradientN >= gradientS);
+    if ((!pairN)){
         lumaN = lumaS;
     }
-    if ( ( !pairN ) ){
+    if ((!pairN)){
         gradientN = gradientS;
     }
-    if ( ( !pairN ) ){
-        lengthSign *= -1.00000;
+    if ((!pairN)){
+        lengthSign *= (-1.0);
     }
-    posN.x  = (pos.x  + (( horzSpan ) ? ( 0.00000 ) : ( (lengthSign * 0.500000) )));
-    posN.y  = (pos.y  + (( horzSpan ) ? ( (lengthSign * 0.500000) ) : ( 0.00000 )));
-    gradientN *= 0.250000;
-    posP = posN;
-    offNP = (( horzSpan ) ? ( vec2( rcpFrame.x , 0.00000) ) : ( vec2( 0.00000, rcpFrame.y ) ));
-    lumaEndN = lumaN;
-    lumaEndP = lumaN;
-    posN += (offNP * vec2( -1.00000, -1.00000));
-    posP += (offNP * vec2( 1.00000, 1.00000));
-    for ( ; (i < 16); ( i++ )) {
-        if ( ( !doneN ) ){
-            lumaEndN = FxaaLuma( FxaaTexLod0( tex, posN.xy ).xyz );
+    vec2 posN;
+    posN.x = (pos.x + (( horzSpan ) ? ( 0.0 ) : ( (lengthSign * 0.5) )));
+    posN.y = (pos.y + (( horzSpan ) ? ( (lengthSign * 0.5) ) : ( 0.0 )));
+    gradientN *= (1.0 / 4.0);
+    vec2 posP = posN;
+    vec2 offNP = (( horzSpan ) ? ( vec2( rcpFrame.x, 0.0) ) : ( vec2( 0.0, rcpFrame.y) ));
+    float lumaEndN = lumaN;
+    float lumaEndP = lumaN;
+    bool doneN = false;
+    bool doneP = false;
+    posN += (offNP * vec2( (-1.0), (-1.0)));
+    posP += (offNP * vec2( 1.0, 1.0));
+    int i = 0;
+    for ( ; (i < 16); (i++)) {
+        if ((!doneN)){
+            lumaEndN = FxaaLuma( FxaaTexLod0( tex, posN.xy).xyz);
         }
-        if ( ( !doneP ) ){
-            lumaEndP = FxaaLuma( FxaaTexLod0( tex, posP.xy ).xyz );
+        if ((!doneP)){
+            lumaEndP = FxaaLuma( FxaaTexLod0( tex, posP.xy).xyz);
         }
-        doneN = (doneN || (abs( (lumaEndN - lumaN) ) >= gradientN));
-        doneP = (doneP || (abs( (lumaEndP - lumaN) ) >= gradientN));
-        if ( (doneN && doneP) ){
+        doneN = (doneN || (abs((lumaEndN - lumaN)) >= gradientN));
+        doneP = (doneP || (abs((lumaEndP - lumaN)) >= gradientN));
+        if ((doneN && doneP)){
             break;
         }
-        if ( ( !doneN ) ){
+        if ((!doneN)){
             posN -= offNP;
         }
-        if ( ( !doneP ) ){
+        if ((!doneP)){
             posP += offNP;
         }
     }
-    dstN = (( horzSpan ) ? ( (pos.x  - posN.x ) ) : ( (pos.y  - posN.y ) ));
-    dstP = (( horzSpan ) ? ( (posP.x  - pos.x ) ) : ( (posP.y  - pos.y ) ));
-    directionN = (dstN < dstP);
+    float dstN = (( horzSpan ) ? ( (pos.x - posN.x) ) : ( (pos.y - posN.y) ));
+    float dstP = (( horzSpan ) ? ( (posP.x - pos.x) ) : ( (posP.y - pos.y) ));
+    bool directionN = (dstN < dstP);
     lumaEndN = (( directionN ) ? ( lumaEndN ) : ( lumaEndP ));
-    if ( (((lumaM - lumaN) < 0.00000) == ((lumaEndN - lumaN) < 0.00000)) ){
-        lengthSign = 0.00000;
+    if ((((lumaM - lumaN) < 0.0) == ((lumaEndN - lumaN) < 0.0))){
+        lengthSign = 0.0;
     }
-    spanLength = (dstP + dstN);
+    float spanLength = (dstP + dstN);
     dstN = (( directionN ) ? ( dstN ) : ( dstP ));
-    subPixelOffset = ((0.500000 + (dstN * (-1.00000 / spanLength))) * lengthSign);
-    rgbF = FxaaTexLod0( tex, vec2( (pos.x  + (( horzSpan ) ? ( 0.00000 ) : ( subPixelOffset ))), (pos.y  + (( horzSpan ) ? ( subPixelOffset ) : ( 0.00000 ))))).xyz ;
+    float subPixelOffset = ((0.5 + (dstN * ((-1.0) / spanLength))) * lengthSign);
+    vec3 rgbF = FxaaTexLod0( tex, vec2( (pos.x + (( horzSpan ) ? ( 0.0 ) : ( subPixelOffset ))), (pos.y + (( horzSpan ) ? ( subPixelOffset ) : ( 0.0 ))))).xyz;
     return FxaaFilterReturn( FxaaLerp3( rgbL, rgbF, blendL));
 }
 vec4 xlat_main( in vec2 uv ) {
-    return vec4( FxaaPixelShader( uv.xy , _MainTex, _MainTex_TexelSize.xy ).xyz , 0.00000);
+    return vec4( FxaaPixelShader( uv.xy, _MainTex, _MainTex_TexelSize.xy).xyz, 0.0);
 }
 varying vec2 xlv_TEXCOORD0;
 void main() {
     vec4 xl_retval;
     xl_retval = xlat_main( vec2(xlv_TEXCOORD0));
-    gl_FragData[0] = vec4( xl_retval);
+    gl_FragData[0] = vec4(xl_retval);
 }

+ 219 - 219
3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-ir.txt

@@ -44,7 +44,7 @@ float FxaaLuma (
   in vec3 rgb_14
 )
 {
-  return ((rgb_14.y * 1.96321) + rgb_14.x);
+  return ((rgb_14.y * (0.587 / 0.299)) + rgb_14.x);
 }
 
 vec3 FxaaLerp3 (
@@ -123,289 +123,289 @@ vec3 FxaaPixelShader (
   vec3 rgbM_67;
   vec3 rgbW_68;
   vec3 rgbN_69;
-  bool tmpvar_70;
-  tmpvar_70 = bool(0);
-  doneN_32 = tmpvar_70;
-  bool tmpvar_71;
-  tmpvar_71 = bool(0);
-  doneP_31 = tmpvar_71;
-  int tmpvar_72;
-  tmpvar_72 = 0;
-  i_30 = tmpvar_72;
-  vec4 tmpvar_73;
-  tmpvar_73 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, -1.0), rcpFrame_23);
-  vec3 tmpvar_74;
-  tmpvar_74 = tmpvar_73.xyz;
-  rgbN_69 = tmpvar_74;
-  vec4 tmpvar_75;
-  tmpvar_75 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 0.0), rcpFrame_23);
-  vec3 tmpvar_76;
-  tmpvar_76 = tmpvar_75.xyz;
-  rgbW_68 = tmpvar_76;
-  vec4 tmpvar_77;
-  tmpvar_77 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 0.0), rcpFrame_23);
-  vec3 tmpvar_78;
-  tmpvar_78 = tmpvar_77.xyz;
-  rgbM_67 = tmpvar_78;
-  vec4 tmpvar_79;
-  tmpvar_79 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 0.0), rcpFrame_23);
-  vec3 tmpvar_80;
-  tmpvar_80 = tmpvar_79.xyz;
-  rgbE_66 = tmpvar_80;
-  vec4 tmpvar_81;
-  tmpvar_81 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 1.0), rcpFrame_23);
-  vec3 tmpvar_82;
-  tmpvar_82 = tmpvar_81.xyz;
-  rgbS_65 = tmpvar_82;
+  vec4 tmpvar_70;
+  tmpvar_70 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, -1.0), rcpFrame_23);
+  vec3 tmpvar_71;
+  tmpvar_71 = tmpvar_70.xyz;
+  rgbN_69 = tmpvar_71;
+  vec4 tmpvar_72;
+  tmpvar_72 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 0.0), rcpFrame_23);
+  vec3 tmpvar_73;
+  tmpvar_73 = tmpvar_72.xyz;
+  rgbW_68 = tmpvar_73;
+  vec4 tmpvar_74;
+  tmpvar_74 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 0.0), rcpFrame_23);
+  vec3 tmpvar_75;
+  tmpvar_75 = tmpvar_74.xyz;
+  rgbM_67 = tmpvar_75;
+  vec4 tmpvar_76;
+  tmpvar_76 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 0.0), rcpFrame_23);
+  vec3 tmpvar_77;
+  tmpvar_77 = tmpvar_76.xyz;
+  rgbE_66 = tmpvar_77;
+  vec4 tmpvar_78;
+  tmpvar_78 = FxaaTexOff (tex_22, pos_21.xy, vec2(0.0, 1.0), rcpFrame_23);
+  vec3 tmpvar_79;
+  tmpvar_79 = tmpvar_78.xyz;
+  rgbS_65 = tmpvar_79;
+  float tmpvar_80;
+  tmpvar_80 = FxaaLuma (rgbN_69);
+  float tmpvar_81;
+  tmpvar_81 = tmpvar_80;
+  lumaN_64 = tmpvar_81;
+  float tmpvar_82;
+  tmpvar_82 = FxaaLuma (rgbW_68);
   float tmpvar_83;
-  tmpvar_83 = FxaaLuma (rgbN_69);
+  tmpvar_83 = tmpvar_82;
+  lumaW_63 = tmpvar_83;
   float tmpvar_84;
-  tmpvar_84 = tmpvar_83;
-  lumaN_64 = tmpvar_84;
+  tmpvar_84 = FxaaLuma (rgbM_67);
   float tmpvar_85;
-  tmpvar_85 = FxaaLuma (rgbW_68);
+  tmpvar_85 = tmpvar_84;
+  lumaM_62 = tmpvar_85;
   float tmpvar_86;
-  tmpvar_86 = tmpvar_85;
-  lumaW_63 = tmpvar_86;
+  tmpvar_86 = FxaaLuma (rgbE_66);
   float tmpvar_87;
-  tmpvar_87 = FxaaLuma (rgbM_67);
+  tmpvar_87 = tmpvar_86;
+  lumaE_61 = tmpvar_87;
   float tmpvar_88;
-  tmpvar_88 = tmpvar_87;
-  lumaM_62 = tmpvar_88;
+  tmpvar_88 = FxaaLuma (rgbS_65);
   float tmpvar_89;
-  tmpvar_89 = FxaaLuma (rgbE_66);
+  tmpvar_89 = tmpvar_88;
+  lumaS_60 = tmpvar_89;
   float tmpvar_90;
-  tmpvar_90 = tmpvar_89;
-  lumaE_61 = tmpvar_90;
+  tmpvar_90 = min (lumaN_64, lumaW_63);
   float tmpvar_91;
-  tmpvar_91 = FxaaLuma (rgbS_65);
+  tmpvar_91 = min (lumaS_60, lumaE_61);
   float tmpvar_92;
-  tmpvar_92 = tmpvar_91;
-  lumaS_60 = tmpvar_92;
+  tmpvar_92 = min (tmpvar_90, tmpvar_91);
   float tmpvar_93;
-  tmpvar_93 = min (lumaN_64, lumaW_63);
+  tmpvar_93 = min (lumaM_62, tmpvar_92);
   float tmpvar_94;
-  tmpvar_94 = min (lumaS_60, lumaE_61);
+  tmpvar_94 = tmpvar_93;
+  rangeMin_59 = tmpvar_94;
   float tmpvar_95;
-  tmpvar_95 = min (tmpvar_93, tmpvar_94);
+  tmpvar_95 = max (lumaN_64, lumaW_63);
   float tmpvar_96;
-  tmpvar_96 = min (lumaM_62, tmpvar_95);
+  tmpvar_96 = max (lumaS_60, lumaE_61);
   float tmpvar_97;
-  tmpvar_97 = tmpvar_96;
-  rangeMin_59 = tmpvar_97;
+  tmpvar_97 = max (tmpvar_95, tmpvar_96);
   float tmpvar_98;
-  tmpvar_98 = max (lumaN_64, lumaW_63);
+  tmpvar_98 = max (lumaM_62, tmpvar_97);
   float tmpvar_99;
-  tmpvar_99 = max (lumaS_60, lumaE_61);
+  tmpvar_99 = tmpvar_98;
+  rangeMax_58 = tmpvar_99;
   float tmpvar_100;
-  tmpvar_100 = max (tmpvar_98, tmpvar_99);
+  tmpvar_100 = (rangeMax_58 - rangeMin_59);
+  range_57 = tmpvar_100;
   float tmpvar_101;
-  tmpvar_101 = max (lumaM_62, tmpvar_100);
-  float tmpvar_102;
-  tmpvar_102 = tmpvar_101;
-  rangeMax_58 = tmpvar_102;
-  float tmpvar_103;
-  tmpvar_103 = (rangeMax_58 - rangeMin_59);
-  range_57 = tmpvar_103;
-  float tmpvar_104;
-  tmpvar_104 = max (0.0416667, (rangeMax_58 * 0.125));
-  if ((range_57 < tmpvar_104)) {
-    vec3 tmpvar_105;
-    tmpvar_105 = FxaaFilterReturn (rgbM_67);
-    return tmpvar_105;
+  tmpvar_101 = max (0.0416667, (rangeMax_58 * (1.0 / 8.0)));
+  if ((range_57 < tmpvar_101)) {
+    vec3 tmpvar_102;
+    tmpvar_102 = FxaaFilterReturn (rgbM_67);
+    return tmpvar_102;
   };
-  vec3 tmpvar_106;
-  tmpvar_106 = ((((rgbN_69 + rgbW_68) + rgbM_67) + rgbE_66) + rgbS_65);
-  rgbL_56 = tmpvar_106;
+  vec3 tmpvar_103;
+  tmpvar_103 = ((((rgbN_69 + rgbW_68) + rgbM_67) + rgbE_66) + rgbS_65);
+  rgbL_56 = tmpvar_103;
+  float tmpvar_104;
+  tmpvar_104 = ((((lumaN_64 + lumaW_63) + lumaE_61) + lumaS_60) * 0.25);
+  lumaL_55 = tmpvar_104;
+  float tmpvar_105;
+  tmpvar_105 = abs ((lumaL_55 - lumaM_62));
+  float tmpvar_106;
+  tmpvar_106 = tmpvar_105;
+  rangeL_54 = tmpvar_106;
   float tmpvar_107;
-  tmpvar_107 = ((((lumaN_64 + lumaW_63) + lumaE_61) + lumaS_60) * 0.25);
-  lumaL_55 = tmpvar_107;
+  tmpvar_107 = max (0.0, ((rangeL_54 / range_57) - (1.0 / 4.0)));
   float tmpvar_108;
-  tmpvar_108 = abs ((lumaL_55 - lumaM_62));
+  tmpvar_108 = (tmpvar_107 * (1.0 / (1.0 - (1.0 / 4.0))));
+  blendL_53 = tmpvar_108;
   float tmpvar_109;
-  tmpvar_109 = tmpvar_108;
-  rangeL_54 = tmpvar_109;
+  tmpvar_109 = min (0.75, blendL_53);
   float tmpvar_110;
-  tmpvar_110 = max (0.0, ((rangeL_54 / range_57) - 0.25));
-  float tmpvar_111;
-  tmpvar_111 = (tmpvar_110 * 1.33333);
-  blendL_53 = tmpvar_111;
-  float tmpvar_112;
-  tmpvar_112 = min (0.75, blendL_53);
-  float tmpvar_113;
-  tmpvar_113 = tmpvar_112;
-  blendL_53 = tmpvar_113;
-  vec4 tmpvar_114;
-  tmpvar_114 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, -1.0), rcpFrame_23);
-  vec3 tmpvar_115;
-  tmpvar_115 = tmpvar_114.xyz;
-  rgbNW_52 = tmpvar_115;
-  vec4 tmpvar_116;
-  tmpvar_116 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, -1.0), rcpFrame_23);
-  vec3 tmpvar_117;
-  tmpvar_117 = tmpvar_116.xyz;
-  rgbNE_51 = tmpvar_117;
-  vec4 tmpvar_118;
-  tmpvar_118 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 1.0), rcpFrame_23);
+  tmpvar_110 = tmpvar_109;
+  blendL_53 = tmpvar_110;
+  vec4 tmpvar_111;
+  tmpvar_111 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, -1.0), rcpFrame_23);
+  vec3 tmpvar_112;
+  tmpvar_112 = tmpvar_111.xyz;
+  rgbNW_52 = tmpvar_112;
+  vec4 tmpvar_113;
+  tmpvar_113 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, -1.0), rcpFrame_23);
+  vec3 tmpvar_114;
+  tmpvar_114 = tmpvar_113.xyz;
+  rgbNE_51 = tmpvar_114;
+  vec4 tmpvar_115;
+  tmpvar_115 = FxaaTexOff (tex_22, pos_21.xy, vec2(-1.0, 1.0), rcpFrame_23);
+  vec3 tmpvar_116;
+  tmpvar_116 = tmpvar_115.xyz;
+  rgbSW_50 = tmpvar_116;
+  vec4 tmpvar_117;
+  tmpvar_117 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 1.0), rcpFrame_23);
+  vec3 tmpvar_118;
+  tmpvar_118 = tmpvar_117.xyz;
+  rgbSE_49 = tmpvar_118;
   vec3 tmpvar_119;
-  tmpvar_119 = tmpvar_118.xyz;
-  rgbSW_50 = tmpvar_119;
-  vec4 tmpvar_120;
-  tmpvar_120 = FxaaTexOff (tex_22, pos_21.xy, vec2(1.0, 1.0), rcpFrame_23);
-  vec3 tmpvar_121;
-  tmpvar_121 = tmpvar_120.xyz;
-  rgbSE_49 = tmpvar_121;
-  vec3 tmpvar_122;
-  tmpvar_122 = (rgbL_56 + (((rgbNW_52 + rgbNE_51) + rgbSW_50) + rgbSE_49));
-  rgbL_56 = tmpvar_122;
-  vec3 tmpvar_123;
-  tmpvar_123 = (rgbL_56 * vec3(0.111111, 0.111111, 0.111111));
-  rgbL_56 = tmpvar_123;
+  tmpvar_119 = (rgbL_56 + (((rgbNW_52 + rgbNE_51) + rgbSW_50) + rgbSE_49));
+  rgbL_56 = tmpvar_119;
+  vec3 tmpvar_120;
+  tmpvar_120 = (rgbL_56 * vec3(0.111111, 0.111111, 0.111111));
+  rgbL_56 = tmpvar_120;
+  float tmpvar_121;
+  tmpvar_121 = FxaaLuma (rgbNW_52);
+  float tmpvar_122;
+  tmpvar_122 = tmpvar_121;
+  lumaNW_48 = tmpvar_122;
+  float tmpvar_123;
+  tmpvar_123 = FxaaLuma (rgbNE_51);
   float tmpvar_124;
-  tmpvar_124 = FxaaLuma (rgbNW_52);
+  tmpvar_124 = tmpvar_123;
+  lumaNE_47 = tmpvar_124;
   float tmpvar_125;
-  tmpvar_125 = tmpvar_124;
-  lumaNW_48 = tmpvar_125;
+  tmpvar_125 = FxaaLuma (rgbSW_50);
   float tmpvar_126;
-  tmpvar_126 = FxaaLuma (rgbNE_51);
+  tmpvar_126 = tmpvar_125;
+  lumaSW_46 = tmpvar_126;
   float tmpvar_127;
-  tmpvar_127 = tmpvar_126;
-  lumaNE_47 = tmpvar_127;
+  tmpvar_127 = FxaaLuma (rgbSE_49);
   float tmpvar_128;
-  tmpvar_128 = FxaaLuma (rgbSW_50);
+  tmpvar_128 = tmpvar_127;
+  lumaSE_45 = tmpvar_128;
   float tmpvar_129;
-  tmpvar_129 = tmpvar_128;
-  lumaSW_46 = tmpvar_129;
+  tmpvar_129 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaN_64)) + (0.25 * lumaNE_47)));
   float tmpvar_130;
-  tmpvar_130 = FxaaLuma (rgbSE_49);
+  tmpvar_130 = abs ((((0.5 * lumaW_63) + (-(1.0) * lumaM_62)) + (0.5 * lumaE_61)));
   float tmpvar_131;
-  tmpvar_131 = tmpvar_130;
-  lumaSE_45 = tmpvar_131;
+  tmpvar_131 = abs ((((0.25 * lumaSW_46) + (-(0.5) * lumaS_60)) + (0.25 * lumaSE_45)));
   float tmpvar_132;
-  tmpvar_132 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaN_64)) + (0.25 * lumaNE_47)));
+  tmpvar_132 = ((tmpvar_129 + tmpvar_130) + tmpvar_131);
+  edgeVert_44 = tmpvar_132;
   float tmpvar_133;
-  tmpvar_133 = abs ((((0.5 * lumaW_63) + (-(1.0) * lumaM_62)) + (0.5 * lumaE_61)));
+  tmpvar_133 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaW_63)) + (0.25 * lumaSW_46)));
   float tmpvar_134;
-  tmpvar_134 = abs ((((0.25 * lumaSW_46) + (-(0.5) * lumaS_60)) + (0.25 * lumaSE_45)));
+  tmpvar_134 = abs ((((0.5 * lumaN_64) + (-(1.0) * lumaM_62)) + (0.5 * lumaS_60)));
   float tmpvar_135;
-  tmpvar_135 = ((tmpvar_132 + tmpvar_133) + tmpvar_134);
-  edgeVert_44 = tmpvar_135;
+  tmpvar_135 = abs ((((0.25 * lumaNE_47) + (-(0.5) * lumaE_61)) + (0.25 * lumaSE_45)));
   float tmpvar_136;
-  tmpvar_136 = abs ((((0.25 * lumaNW_48) + (-(0.5) * lumaW_63)) + (0.25 * lumaSW_46)));
-  float tmpvar_137;
-  tmpvar_137 = abs ((((0.5 * lumaN_64) + (-(1.0) * lumaM_62)) + (0.5 * lumaS_60)));
+  tmpvar_136 = ((tmpvar_133 + tmpvar_134) + tmpvar_135);
+  edgeHorz_43 = tmpvar_136;
+  bool tmpvar_137;
+  tmpvar_137 = (edgeHorz_43 >= edgeVert_44);
+  horzSpan_42 = tmpvar_137;
   float tmpvar_138;
-  tmpvar_138 = abs ((((0.25 * lumaNE_47) + (-(0.5) * lumaE_61)) + (0.25 * lumaSE_45)));
-  float tmpvar_139;
-  tmpvar_139 = ((tmpvar_136 + tmpvar_137) + tmpvar_138);
-  edgeHorz_43 = tmpvar_139;
-  bool tmpvar_140;
-  tmpvar_140 = (edgeHorz_43 >= edgeVert_44);
-  horzSpan_42 = tmpvar_140;
-  float tmpvar_141;
   if (horzSpan_42) {
-    tmpvar_141 = -(rcpFrame_23.y);
+    tmpvar_138 = -(rcpFrame_23.y);
   } else {
-    tmpvar_141 = -(rcpFrame_23.x);
+    tmpvar_138 = -(rcpFrame_23.x);
   };
-  float tmpvar_142;
-  tmpvar_142 = tmpvar_141;
-  lengthSign_41 = tmpvar_142;
+  float tmpvar_139;
+  tmpvar_139 = tmpvar_138;
+  lengthSign_41 = tmpvar_139;
   if (!(horzSpan_42)) {
-    float tmpvar_143;
-    tmpvar_143 = lumaW_63;
-    lumaN_64 = tmpvar_143;
+    float tmpvar_140;
+    tmpvar_140 = lumaW_63;
+    lumaN_64 = tmpvar_140;
   };
   if (!(horzSpan_42)) {
-    float tmpvar_144;
-    tmpvar_144 = lumaE_61;
-    lumaS_60 = tmpvar_144;
+    float tmpvar_141;
+    tmpvar_141 = lumaE_61;
+    lumaS_60 = tmpvar_141;
   };
+  float tmpvar_142;
+  tmpvar_142 = abs ((lumaN_64 - lumaM_62));
+  float tmpvar_143;
+  tmpvar_143 = tmpvar_142;
+  gradientN_40 = tmpvar_143;
+  float tmpvar_144;
+  tmpvar_144 = abs ((lumaS_60 - lumaM_62));
   float tmpvar_145;
-  tmpvar_145 = abs ((lumaN_64 - lumaM_62));
+  tmpvar_145 = tmpvar_144;
+  gradientS_39 = tmpvar_145;
   float tmpvar_146;
-  tmpvar_146 = tmpvar_145;
-  gradientN_40 = tmpvar_146;
+  tmpvar_146 = ((lumaN_64 + lumaM_62) * 0.5);
+  lumaN_64 = tmpvar_146;
   float tmpvar_147;
-  tmpvar_147 = abs ((lumaS_60 - lumaM_62));
-  float tmpvar_148;
-  tmpvar_148 = tmpvar_147;
-  gradientS_39 = tmpvar_148;
-  float tmpvar_149;
-  tmpvar_149 = ((lumaN_64 + lumaM_62) * 0.5);
-  lumaN_64 = tmpvar_149;
-  float tmpvar_150;
-  tmpvar_150 = ((lumaS_60 + lumaM_62) * 0.5);
-  lumaS_60 = tmpvar_150;
-  bool tmpvar_151;
-  tmpvar_151 = (gradientN_40 >= gradientS_39);
-  pairN_38 = tmpvar_151;
+  tmpvar_147 = ((lumaS_60 + lumaM_62) * 0.5);
+  lumaS_60 = tmpvar_147;
+  bool tmpvar_148;
+  tmpvar_148 = (gradientN_40 >= gradientS_39);
+  pairN_38 = tmpvar_148;
   if (!(pairN_38)) {
-    float tmpvar_152;
-    tmpvar_152 = lumaS_60;
-    lumaN_64 = tmpvar_152;
+    float tmpvar_149;
+    tmpvar_149 = lumaS_60;
+    lumaN_64 = tmpvar_149;
   };
   if (!(pairN_38)) {
-    float tmpvar_153;
-    tmpvar_153 = gradientS_39;
-    gradientN_40 = tmpvar_153;
+    float tmpvar_150;
+    tmpvar_150 = gradientS_39;
+    gradientN_40 = tmpvar_150;
   };
   if (!(pairN_38)) {
-    float tmpvar_154;
-    tmpvar_154 = (lengthSign_41 * -(1.0));
-    lengthSign_41 = tmpvar_154;
+    float tmpvar_151;
+    tmpvar_151 = (lengthSign_41 * -(1.0));
+    lengthSign_41 = tmpvar_151;
   };
-  float tmpvar_155;
+  float tmpvar_152;
   if (horzSpan_42) {
-    tmpvar_155 = 0.0;
+    tmpvar_152 = 0.0;
   } else {
-    tmpvar_155 = (lengthSign_41 * 0.5);
+    tmpvar_152 = (lengthSign_41 * 0.5);
   };
-  float tmpvar_156;
-  tmpvar_156 = (pos_21.x + tmpvar_155);
-  posN_37.x = tmpvar_156;
-  float tmpvar_157;
+  float tmpvar_153;
+  tmpvar_153 = (pos_21.x + tmpvar_152);
+  posN_37.x = tmpvar_153;
+  float tmpvar_154;
   if (horzSpan_42) {
-    tmpvar_157 = (lengthSign_41 * 0.5);
+    tmpvar_154 = (lengthSign_41 * 0.5);
   } else {
-    tmpvar_157 = 0.0;
+    tmpvar_154 = 0.0;
   };
-  float tmpvar_158;
-  tmpvar_158 = (pos_21.y + tmpvar_157);
-  posN_37.y = vec2(tmpvar_158).y;
-  float tmpvar_159;
-  tmpvar_159 = (gradientN_40 * 0.25);
-  gradientN_40 = tmpvar_159;
-  vec2 tmpvar_160;
-  tmpvar_160 = posN_37;
-  posP_36 = tmpvar_160;
-  vec2 tmpvar_161;
+  float tmpvar_155;
+  tmpvar_155 = (pos_21.y + tmpvar_154);
+  posN_37.y = vec2(tmpvar_155).y;
+  float tmpvar_156;
+  tmpvar_156 = (gradientN_40 * (1.0 / 4.0));
+  gradientN_40 = tmpvar_156;
+  vec2 tmpvar_157;
+  tmpvar_157 = posN_37;
+  posP_36 = tmpvar_157;
+  vec2 tmpvar_158;
   if (horzSpan_42) {
-    vec2 tmpvar_162;
-    tmpvar_162.y = 0.0;
-    tmpvar_162.x = rcpFrame_23.x;
-    tmpvar_161 = tmpvar_162;
+    vec2 tmpvar_159;
+    tmpvar_159.y = 0.0;
+    tmpvar_159.x = rcpFrame_23.x;
+    tmpvar_158 = tmpvar_159;
   } else {
-    vec2 tmpvar_163;
-    tmpvar_163.x = 0.0;
-    tmpvar_163.y = rcpFrame_23.y;
-    tmpvar_161 = tmpvar_163;
+    vec2 tmpvar_160;
+    tmpvar_160.x = 0.0;
+    tmpvar_160.y = rcpFrame_23.y;
+    tmpvar_158 = tmpvar_160;
   };
-  vec2 tmpvar_164;
-  tmpvar_164 = tmpvar_161;
-  offNP_35 = tmpvar_164;
-  float tmpvar_165;
-  tmpvar_165 = lumaN_64;
-  lumaEndN_34 = tmpvar_165;
-  float tmpvar_166;
-  tmpvar_166 = lumaN_64;
-  lumaEndP_33 = tmpvar_166;
+  vec2 tmpvar_161;
+  tmpvar_161 = tmpvar_158;
+  offNP_35 = tmpvar_161;
+  float tmpvar_162;
+  tmpvar_162 = lumaN_64;
+  lumaEndN_34 = tmpvar_162;
+  float tmpvar_163;
+  tmpvar_163 = lumaN_64;
+  lumaEndP_33 = tmpvar_163;
+  bool tmpvar_164;
+  tmpvar_164 = bool(0);
+  doneN_32 = tmpvar_164;
+  bool tmpvar_165;
+  tmpvar_165 = bool(0);
+  doneP_31 = tmpvar_165;
+  vec2 tmpvar_166;
+  tmpvar_166 = (posN_37 + (offNP_35 * vec2(-1.0, -1.0)));
+  posN_37 = tmpvar_166;
   vec2 tmpvar_167;
-  tmpvar_167 = (posN_37 + (offNP_35 * vec2(-1.0, -1.0)));
-  posN_37 = tmpvar_167;
-  vec2 tmpvar_168;
-  tmpvar_168 = (posP_36 + (offNP_35 * vec2(1.0, 1.0)));
-  posP_36 = tmpvar_168;
+  tmpvar_167 = (posP_36 + (offNP_35 * vec2(1.0, 1.0)));
+  posP_36 = tmpvar_167;
+  int tmpvar_168;
+  tmpvar_168 = 0;
+  i_30 = tmpvar_168;
   while (true) {
     if (!((i_30 < 16))) {
       break;

+ 4 - 7
3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-out.txt

@@ -19,9 +19,6 @@ void main ()
   float lengthSign_12;
   float lumaS_13;
   float lumaN_14;
-  doneN_5 = bool(0);
-  doneP_4 = bool(0);
-  i_3 = 0;
   vec4 tmpvar_15;
   tmpvar_15.zw = vec2(0.0, 0.0);
   tmpvar_15.xy = (xlv_TEXCOORD0 + (vec2(0.0, -1.0) * _MainTex_TexelSize.xy));
@@ -163,12 +160,12 @@ void main ()
     offNP_8 = tmpvar_54;
     lumaEndN_7 = lumaN_14;
     lumaEndP_6 = lumaN_14;
+    doneN_5 = bool(0);
+    doneP_4 = bool(0);
     posN_10 = (posN_10 + (tmpvar_54 * vec2(-1.0, -1.0)));
     posP_9 = (posP_9 + tmpvar_54);
-    while (true) {
-      if ((i_3 >= 16)) {
-        break;
-      };
+    i_3 = 0;
+    for (int i_3 = 0; i_3 < 16; ) {
       if (!(doneN_5)) {
         vec4 tmpvar_57;
         tmpvar_57 = texture2DLod (_MainTex, posN_10, 0.0);

+ 7 - 7
3rdparty/glsl-optimizer/tests/fragment/z-fxaa3-11-consolepc-outES.txt

@@ -14,23 +14,23 @@ void main ()
   highp vec2 dir_5;
   highp float lumaM_6;
   lowp vec4 tmpvar_7;
-  tmpvar_7 = texture2DLod (_MainTex, xlv_TEXCOORD1.xy, 0.0);
+  tmpvar_7 = texture2DLodEXT (_MainTex, xlv_TEXCOORD1.xy, 0.0);
   highp float tmpvar_8;
   tmpvar_8 = tmpvar_7.y;
   lowp vec4 tmpvar_9;
-  tmpvar_9 = texture2DLod (_MainTex, xlv_TEXCOORD1.xw, 0.0);
+  tmpvar_9 = texture2DLodEXT (_MainTex, xlv_TEXCOORD1.xw, 0.0);
   highp float tmpvar_10;
   tmpvar_10 = tmpvar_9.y;
   lowp vec4 tmpvar_11;
-  tmpvar_11 = texture2DLod (_MainTex, xlv_TEXCOORD1.zy, 0.0);
+  tmpvar_11 = texture2DLodEXT (_MainTex, xlv_TEXCOORD1.zy, 0.0);
   highp float tmpvar_12;
   tmpvar_12 = tmpvar_11.y;
   lowp vec4 tmpvar_13;
-  tmpvar_13 = texture2DLod (_MainTex, xlv_TEXCOORD1.zw, 0.0);
+  tmpvar_13 = texture2DLodEXT (_MainTex, xlv_TEXCOORD1.zw, 0.0);
   highp float tmpvar_14;
   tmpvar_14 = tmpvar_13.y;
   lowp vec4 tmpvar_15;
-  tmpvar_15 = texture2DLod (_MainTex, xlv_TEXCOORD0, 0.0);
+  tmpvar_15 = texture2DLodEXT (_MainTex, xlv_TEXCOORD0, 0.0);
   lowp float tmpvar_16;
   tmpvar_16 = tmpvar_15.y;
   lumaM_6 = tmpvar_16;
@@ -70,9 +70,9 @@ void main ()
     tmpvar_29.zw = vec2(0.0, 0.0);
     tmpvar_29.xy = (xlv_TEXCOORD0 + (tmpvar_27 * fxaaConsoleRcpFrameOpt2_2.zw));
     lowp vec4 tmpvar_30;
-    tmpvar_30 = (texture2DLod (_MainTex, tmpvar_25.xy, 0.0) + texture2DLod (_MainTex, tmpvar_26.xy, 0.0));
+    tmpvar_30 = (texture2DLodEXT (_MainTex, tmpvar_25.xy, 0.0) + texture2DLodEXT (_MainTex, tmpvar_26.xy, 0.0));
     lowp vec4 tmpvar_31;
-    tmpvar_31 = (((texture2DLod (_MainTex, tmpvar_28.xy, 0.0) + texture2DLod (_MainTex, tmpvar_29.xy, 0.0)) * 0.25) + (tmpvar_30 * 0.25));
+    tmpvar_31 = (((texture2DLodEXT (_MainTex, tmpvar_28.xy, 0.0) + texture2DLodEXT (_MainTex, tmpvar_29.xy, 0.0)) * 0.25) + (tmpvar_30 * 0.25));
     rgbyB_4 = tmpvar_31;
     if (((tmpvar_31.y < tmpvar_19) || (tmpvar_31.y > tmpvar_18))) {
       rgbyB_4.xyz = (tmpvar_30.xyz * 0.5);

+ 32 - 32
3rdparty/glsl-optimizer/tests/fragment/z-fxaa3-11-pc39-outES.txt

@@ -23,13 +23,13 @@ void main ()
   posM_15.x = xlv_TEXCOORD0.x;
   posM_15.y = xlv_TEXCOORD0.y;
   lowp vec4 tmpvar_16;
-  tmpvar_16 = texture2DLod (_MainTex, xlv_TEXCOORD0, 0.0);
+  tmpvar_16 = texture2DLodEXT (_MainTex, xlv_TEXCOORD0, 0.0);
   rgbyM_14 = tmpvar_16;
   highp vec4 tmpvar_17;
   tmpvar_17.zw = vec2(0.0, 0.0);
   tmpvar_17.xy = (xlv_TEXCOORD0 + (vec2(0.0, 1.0) * _MainTex_TexelSize.xy));
   lowp vec4 tmpvar_18;
-  tmpvar_18 = texture2DLod (_MainTex, tmpvar_17.xy, 0.0);
+  tmpvar_18 = texture2DLodEXT (_MainTex, tmpvar_17.xy, 0.0);
   highp vec4 rgba_19;
   rgba_19 = tmpvar_18;
   lumaS_13 = rgba_19.w;
@@ -37,7 +37,7 @@ void main ()
   tmpvar_20.zw = vec2(0.0, 0.0);
   tmpvar_20.xy = (xlv_TEXCOORD0 + (vec2(1.0, 0.0) * _MainTex_TexelSize.xy));
   lowp vec4 tmpvar_21;
-  tmpvar_21 = texture2DLod (_MainTex, tmpvar_20.xy, 0.0);
+  tmpvar_21 = texture2DLodEXT (_MainTex, tmpvar_20.xy, 0.0);
   highp float tmpvar_22;
   highp vec4 rgba_23;
   rgba_23 = tmpvar_21;
@@ -46,7 +46,7 @@ void main ()
   tmpvar_24.zw = vec2(0.0, 0.0);
   tmpvar_24.xy = (xlv_TEXCOORD0 + (vec2(0.0, -1.0) * _MainTex_TexelSize.xy));
   lowp vec4 tmpvar_25;
-  tmpvar_25 = texture2DLod (_MainTex, tmpvar_24.xy, 0.0);
+  tmpvar_25 = texture2DLodEXT (_MainTex, tmpvar_24.xy, 0.0);
   highp vec4 rgba_26;
   rgba_26 = tmpvar_25;
   lumaN_12 = rgba_26.w;
@@ -54,7 +54,7 @@ void main ()
   tmpvar_27.zw = vec2(0.0, 0.0);
   tmpvar_27.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 0.0) * _MainTex_TexelSize.xy));
   lowp vec4 tmpvar_28;
-  tmpvar_28 = texture2DLod (_MainTex, tmpvar_27.xy, 0.0);
+  tmpvar_28 = texture2DLodEXT (_MainTex, tmpvar_27.xy, 0.0);
   highp float tmpvar_29;
   highp vec4 rgba_30;
   rgba_30 = tmpvar_28;
@@ -70,28 +70,28 @@ void main ()
     tmpvar_33.zw = vec2(0.0, 0.0);
     tmpvar_33.xy = (xlv_TEXCOORD0 + (vec2(-1.0, -1.0) * _MainTex_TexelSize.xy));
     lowp vec4 tmpvar_34;
-    tmpvar_34 = texture2DLod (_MainTex, tmpvar_33.xy, 0.0);
+    tmpvar_34 = texture2DLodEXT (_MainTex, tmpvar_33.xy, 0.0);
     highp vec4 rgba_35;
     rgba_35 = tmpvar_34;
     highp vec4 tmpvar_36;
     tmpvar_36.zw = vec2(0.0, 0.0);
     tmpvar_36.xy = (xlv_TEXCOORD0 + _MainTex_TexelSize.xy);
     lowp vec4 tmpvar_37;
-    tmpvar_37 = texture2DLod (_MainTex, tmpvar_36.xy, 0.0);
+    tmpvar_37 = texture2DLodEXT (_MainTex, tmpvar_36.xy, 0.0);
     highp vec4 rgba_38;
     rgba_38 = tmpvar_37;
     highp vec4 tmpvar_39;
     tmpvar_39.zw = vec2(0.0, 0.0);
     tmpvar_39.xy = (xlv_TEXCOORD0 + (vec2(1.0, -1.0) * _MainTex_TexelSize.xy));
     lowp vec4 tmpvar_40;
-    tmpvar_40 = texture2DLod (_MainTex, tmpvar_39.xy, 0.0);
+    tmpvar_40 = texture2DLodEXT (_MainTex, tmpvar_39.xy, 0.0);
     highp vec4 rgba_41;
     rgba_41 = tmpvar_40;
     highp vec4 tmpvar_42;
     tmpvar_42.zw = vec2(0.0, 0.0);
     tmpvar_42.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 1.0) * _MainTex_TexelSize.xy));
     lowp vec4 tmpvar_43;
-    tmpvar_43 = texture2DLod (_MainTex, tmpvar_42.xy, 0.0);
+    tmpvar_43 = texture2DLodEXT (_MainTex, tmpvar_42.xy, 0.0);
     highp vec4 rgba_44;
     rgba_44 = tmpvar_43;
     highp float tmpvar_45;
@@ -163,14 +163,14 @@ void main ()
     highp float tmpvar_61;
     tmpvar_61 = ((-2.0 * tmpvar_58) + 3.0);
     lowp vec4 tmpvar_62;
-    tmpvar_62 = texture2DLod (_MainTex, posN_8, 0.0);
+    tmpvar_62 = texture2DLodEXT (_MainTex, posN_8, 0.0);
     highp vec4 rgba_63;
     rgba_63 = tmpvar_62;
     lumaEndN_6 = rgba_63.w;
     highp float tmpvar_64;
     tmpvar_64 = (tmpvar_58 * tmpvar_58);
     lowp vec4 tmpvar_65;
-    tmpvar_65 = texture2DLod (_MainTex, posP_7, 0.0);
+    tmpvar_65 = texture2DLodEXT (_MainTex, posP_7, 0.0);
     highp vec4 rgba_66;
     rgba_66 = tmpvar_65;
     lumaEndP_5 = rgba_66.w;
@@ -210,14 +210,14 @@ void main ()
     if (tmpvar_74) {
       if (!(tmpvar_72)) {
         lowp vec4 tmpvar_75;
-        tmpvar_75 = texture2DLod (_MainTex, posN_8, 0.0);
+        tmpvar_75 = texture2DLodEXT (_MainTex, posN_8, 0.0);
         highp vec4 rgba_76;
         rgba_76 = tmpvar_75;
         lumaEndN_6 = rgba_76.w;
       };
       if (!(tmpvar_73)) {
         lowp vec4 tmpvar_77;
-        tmpvar_77 = texture2DLod (_MainTex, posP_7, 0.0);
+        tmpvar_77 = texture2DLodEXT (_MainTex, posP_7, 0.0);
         highp vec4 rgba_78;
         rgba_78 = tmpvar_77;
         lumaEndP_5 = rgba_78.w;
@@ -249,14 +249,14 @@ void main ()
       if (tmpvar_81) {
         if (!(tmpvar_79)) {
           lowp vec4 tmpvar_82;
-          tmpvar_82 = texture2DLod (_MainTex, posN_8, 0.0);
+          tmpvar_82 = texture2DLodEXT (_MainTex, posN_8, 0.0);
           highp vec4 rgba_83;
           rgba_83 = tmpvar_82;
           lumaEndN_6 = rgba_83.w;
         };
         if (!(tmpvar_80)) {
           lowp vec4 tmpvar_84;
-          tmpvar_84 = texture2DLod (_MainTex, posP_7, 0.0);
+          tmpvar_84 = texture2DLodEXT (_MainTex, posP_7, 0.0);
           highp vec4 rgba_85;
           rgba_85 = tmpvar_84;
           lumaEndP_5 = rgba_85.w;
@@ -288,14 +288,14 @@ void main ()
         if (tmpvar_88) {
           if (!(tmpvar_86)) {
             lowp vec4 tmpvar_89;
-            tmpvar_89 = texture2DLod (_MainTex, posN_8, 0.0);
+            tmpvar_89 = texture2DLodEXT (_MainTex, posN_8, 0.0);
             highp vec4 rgba_90;
             rgba_90 = tmpvar_89;
             lumaEndN_6 = rgba_90.w;
           };
           if (!(tmpvar_87)) {
             lowp vec4 tmpvar_91;
-            tmpvar_91 = texture2DLod (_MainTex, posP_7, 0.0);
+            tmpvar_91 = texture2DLodEXT (_MainTex, posP_7, 0.0);
             highp vec4 rgba_92;
             rgba_92 = tmpvar_91;
             lumaEndP_5 = rgba_92.w;
@@ -327,14 +327,14 @@ void main ()
           if (tmpvar_95) {
             if (!(tmpvar_93)) {
               lowp vec4 tmpvar_96;
-              tmpvar_96 = texture2DLod (_MainTex, posN_8, 0.0);
+              tmpvar_96 = texture2DLodEXT (_MainTex, posN_8, 0.0);
               highp vec4 rgba_97;
               rgba_97 = tmpvar_96;
               lumaEndN_6 = rgba_97.w;
             };
             if (!(tmpvar_94)) {
               lowp vec4 tmpvar_98;
-              tmpvar_98 = texture2DLod (_MainTex, posP_7, 0.0);
+              tmpvar_98 = texture2DLodEXT (_MainTex, posP_7, 0.0);
               highp vec4 rgba_99;
               rgba_99 = tmpvar_98;
               lumaEndP_5 = rgba_99.w;
@@ -366,14 +366,14 @@ void main ()
             if (tmpvar_102) {
               if (!(tmpvar_100)) {
                 lowp vec4 tmpvar_103;
-                tmpvar_103 = texture2DLod (_MainTex, posN_8, 0.0);
+                tmpvar_103 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                 highp vec4 rgba_104;
                 rgba_104 = tmpvar_103;
                 lumaEndN_6 = rgba_104.w;
               };
               if (!(tmpvar_101)) {
                 lowp vec4 tmpvar_105;
-                tmpvar_105 = texture2DLod (_MainTex, posP_7, 0.0);
+                tmpvar_105 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                 highp vec4 rgba_106;
                 rgba_106 = tmpvar_105;
                 lumaEndP_5 = rgba_106.w;
@@ -405,14 +405,14 @@ void main ()
               if (tmpvar_109) {
                 if (!(tmpvar_107)) {
                   lowp vec4 tmpvar_110;
-                  tmpvar_110 = texture2DLod (_MainTex, posN_8, 0.0);
+                  tmpvar_110 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                   highp vec4 rgba_111;
                   rgba_111 = tmpvar_110;
                   lumaEndN_6 = rgba_111.w;
                 };
                 if (!(tmpvar_108)) {
                   lowp vec4 tmpvar_112;
-                  tmpvar_112 = texture2DLod (_MainTex, posP_7, 0.0);
+                  tmpvar_112 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                   highp vec4 rgba_113;
                   rgba_113 = tmpvar_112;
                   lumaEndP_5 = rgba_113.w;
@@ -444,14 +444,14 @@ void main ()
                 if (tmpvar_116) {
                   if (!(tmpvar_114)) {
                     lowp vec4 tmpvar_117;
-                    tmpvar_117 = texture2DLod (_MainTex, posN_8, 0.0);
+                    tmpvar_117 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                     highp vec4 rgba_118;
                     rgba_118 = tmpvar_117;
                     lumaEndN_6 = rgba_118.w;
                   };
                   if (!(tmpvar_115)) {
                     lowp vec4 tmpvar_119;
-                    tmpvar_119 = texture2DLod (_MainTex, posP_7, 0.0);
+                    tmpvar_119 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                     highp vec4 rgba_120;
                     rgba_120 = tmpvar_119;
                     lumaEndP_5 = rgba_120.w;
@@ -483,14 +483,14 @@ void main ()
                   if (tmpvar_123) {
                     if (!(tmpvar_121)) {
                       lowp vec4 tmpvar_124;
-                      tmpvar_124 = texture2DLod (_MainTex, posN_8, 0.0);
+                      tmpvar_124 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                       highp vec4 rgba_125;
                       rgba_125 = tmpvar_124;
                       lumaEndN_6 = rgba_125.w;
                     };
                     if (!(tmpvar_122)) {
                       lowp vec4 tmpvar_126;
-                      tmpvar_126 = texture2DLod (_MainTex, posP_7, 0.0);
+                      tmpvar_126 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                       highp vec4 rgba_127;
                       rgba_127 = tmpvar_126;
                       lumaEndP_5 = rgba_127.w;
@@ -522,14 +522,14 @@ void main ()
                     if (tmpvar_130) {
                       if (!(tmpvar_128)) {
                         lowp vec4 tmpvar_131;
-                        tmpvar_131 = texture2DLod (_MainTex, posN_8, 0.0);
+                        tmpvar_131 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                         highp vec4 rgba_132;
                         rgba_132 = tmpvar_131;
                         lumaEndN_6 = rgba_132.w;
                       };
                       if (!(tmpvar_129)) {
                         lowp vec4 tmpvar_133;
-                        tmpvar_133 = texture2DLod (_MainTex, posP_7, 0.0);
+                        tmpvar_133 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                         highp vec4 rgba_134;
                         rgba_134 = tmpvar_133;
                         lumaEndP_5 = rgba_134.w;
@@ -561,14 +561,14 @@ void main ()
                       if (tmpvar_137) {
                         if (!(tmpvar_135)) {
                           lowp vec4 tmpvar_138;
-                          tmpvar_138 = texture2DLod (_MainTex, posN_8, 0.0);
+                          tmpvar_138 = texture2DLodEXT (_MainTex, posN_8, 0.0);
                           highp vec4 rgba_139;
                           rgba_139 = tmpvar_138;
                           lumaEndN_6 = rgba_139.w;
                         };
                         if (!(tmpvar_136)) {
                           lowp vec4 tmpvar_140;
-                          tmpvar_140 = texture2DLod (_MainTex, posP_7, 0.0);
+                          tmpvar_140 = texture2DLodEXT (_MainTex, posP_7, 0.0);
                           highp vec4 rgba_141;
                           rgba_141 = tmpvar_140;
                           lumaEndP_5 = rgba_141.w;
@@ -646,7 +646,7 @@ void main ()
       posM_15.y = (xlv_TEXCOORD0.y + (tmpvar_152 * lengthSign_11));
     };
     lowp vec4 tmpvar_153;
-    tmpvar_153 = texture2DLod (_MainTex, posM_15, 0.0);
+    tmpvar_153 = texture2DLodEXT (_MainTex, posM_15, 0.0);
     highp vec4 tmpvar_154;
     tmpvar_154.xyz = tmpvar_153.xyz;
     tmpvar_154.w = rgbyM_14.w;

+ 11 - 9
3rdparty/glsl-optimizer/tests/glsl-optimizer-tests.xcodeproj/project.pbxproj

@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 45;
+	objectVersion = 46;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -135,8 +135,11 @@
 /* Begin PBXProject section */
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0460;
+			};
 			buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "glsl-optimizer-tests" */;
-			compatibilityVersion = "Xcode 3.1";
+			compatibilityVersion = "Xcode 3.2";
 			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
@@ -203,7 +206,6 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				COPY_PHASE_STRIP = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
 				GCC_MODEL_TUNING = G5;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				INSTALL_PATH = /usr/local/bin;
@@ -228,12 +230,12 @@
 				ARCHS = i386;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_VERSION = 4.0;
+				GCC_VERSION = "";
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;
-				PREBINDING = NO;
-				SDKROOT = macosx10.4;
+				SDKROOT = macosx;
 			};
 			name = Debug;
 		};
@@ -242,15 +244,15 @@
 			buildSettings = {
 				ARCHS = i386;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
-				GCC_VERSION = 4.0;
+				GCC_VERSION = "";
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
 				GCC_WARN_PROTOTYPE_CONVERSION = YES;
 				GCC_WARN_SHADOW = YES;
 				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				PREBINDING = NO;
-				SDKROOT = macosx10.4;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
+				SDKROOT = macosx;
 			};
 			name = Release;
 		};

+ 3 - 0
3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp

@@ -156,6 +156,7 @@ static bool CheckGLSL (bool vertex, bool gles, const std::string& testName, cons
 		src += "#define highp\n";
 		src += "#define texture2DLodEXT texture2DLod\n";
 		src += "#define texture2DProjLodEXT texture2DProjLod\n";
+		src += "#define gl_FragDepthEXT gl_FragDepth\n";
 		src += "float shadow2DEXT (sampler2DShadow s, vec3 p) { return shadow2D(s,p).r; }\n";
 		src += "float shadow2DProjEXT (sampler2DShadow s, vec4 p) { return shadow2DProj(s,p).r; }\n";
 	}
@@ -165,6 +166,8 @@ static bool CheckGLSL (bool vertex, bool gles, const std::string& testName, cons
 		replace_string (src, "GL_EXT_shader_texture_lod", "GL_ARB_shader_texture_lod", 0);
 		replace_string (src, "#extension GL_OES_standard_derivatives : require", "", 0);
 		replace_string (src, "#extension GL_EXT_shadow_samplers : require", "", 0);
+		replace_string (src, "#extension GL_EXT_frag_depth : require", "", 0);
+		replace_string (src, "precision ", "// precision ", 0);
 	}
 	const char* sourcePtr = src.c_str();
 

+ 158 - 0
3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.vcproj

@@ -12,6 +12,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -91,6 +94,82 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			IntermediateDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="talloc;../../../include;../../mesa;../../mapi;."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="opengl32.lib"
+				LinkIncremental="2"
+				GenerateManifest="false"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="build/$(ProjectName)/$(ConfigurationName)"
@@ -169,6 +248,85 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			IntermediateDirectory="build/$(ProjectName)/$(PlatformName)/$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="talloc;../../../include;../../mesa;../../mapi;."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="opengl32.lib"
+				LinkIncremental="1"
+				GenerateManifest="false"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>

BIN
examples/runtime/shaders/dx11/fs_bump.bin


BIN
examples/runtime/shaders/dx11/fs_mesh.bin


BIN
examples/runtime/shaders/dx11/fs_raymarching.bin


BIN
examples/runtime/shaders/dx11/vs_bump.bin


BIN
examples/runtime/shaders/dx11/vs_callback.bin


BIN
examples/runtime/shaders/dx11/vs_cubes.bin


BIN
examples/runtime/shaders/dx11/vs_instancing.bin


BIN
examples/runtime/shaders/dx11/vs_mesh.bin


BIN
examples/runtime/shaders/dx11/vs_metaballs.bin


BIN
examples/runtime/shaders/dx11/vs_raymarching.bin


BIN
examples/runtime/shaders/dx11/vs_update.bin


BIN
tools/bin/shaderc.exe