diff options
author | marha <marha@users.sourceforge.net> | 2011-11-14 09:38:56 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-11-14 09:38:56 +0100 |
commit | 156e37d3879b316329e3e05579414031da2647e2 (patch) | |
tree | 59fb1dce046fd3aab228e224bff8b0c1d074f876 /mesalib/src/glsl | |
parent | d783adea42f29bd7917929597ca1031b70587e1d (diff) | |
download | vcxsrv-156e37d3879b316329e3e05579414031da2647e2.tar.gz vcxsrv-156e37d3879b316329e3e05579414031da2647e2.tar.bz2 vcxsrv-156e37d3879b316329e3e05579414031da2647e2.zip |
libX11 libXext libXinerama libXmu libfontenc libxcb mesa pixman git update
14 nov 2011
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r-- | mesalib/src/glsl/Makefile.sources | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/builtin_variables.cpp (renamed from mesalib/src/glsl/ir_variable.cpp) | 87 | ||||
-rw-r--r-- | mesalib/src/glsl/builtin_variables.h | 110 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-parse.y | 3 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_constant_expression.cpp | 6 |
5 files changed, 96 insertions, 112 deletions
diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index b4bfff09c..c65bfe4ff 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -20,6 +20,7 @@ LIBGLSL_CXX_SOURCES := \ ast_function.cpp \ ast_to_hir.cpp \ ast_type.cpp \ + builtin_variables.cpp \ glsl_parser_extras.cpp \ glsl_types.cpp \ glsl_symbol_table.cpp \ @@ -40,7 +41,6 @@ LIBGLSL_CXX_SOURCES := \ ir_rvalue_visitor.cpp \ ir_set_program_inouts.cpp \ ir_validate.cpp \ - ir_variable.cpp \ ir_variable_refcount.cpp \ linker.cpp \ link_functions.cpp \ diff --git a/mesalib/src/glsl/ir_variable.cpp b/mesalib/src/glsl/builtin_variables.cpp index 3092507bc..ed6b922ca 100644 --- a/mesalib/src/glsl/ir_variable.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -24,7 +24,7 @@ #include "ir.h" #include "glsl_parser_extras.h" #include "glsl_symbol_table.h" -#include "builtin_variables.h" +#include "main/core.h" #include "main/uniforms.h" #include "program/prog_parameter.h" #include "program/prog_statevars.h" @@ -39,6 +39,91 @@ generate_ARB_draw_instanced_variables(exec_list *, struct _mesa_glsl_parse_state *, bool, _mesa_glsl_parser_targets); +struct builtin_variable { + enum ir_variable_mode mode; + int slot; + const char *type; + const char *name; +}; + +static const builtin_variable builtin_core_vs_variables[] = { + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, + { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, +}; + +static const builtin_variable builtin_core_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, +}; + +static const builtin_variable builtin_100ES_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_110_fs_variables[] = { + { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, +}; + +static const builtin_variable builtin_110_deprecated_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, + { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_110_deprecated_vs_variables[] = { + { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, + { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, + { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, + { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, + { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, + { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, + { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, + { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, + { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, + { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, + { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, + { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, + { ir_var_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, + { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_120_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_130_vs_variables[] = { + { ir_var_system_value, SYSTEM_VALUE_VERTEX_ID, "int", "gl_VertexID" }, +}; + +static const builtin_variable builtin_110_deprecated_uniforms[] = { + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, + { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "float", "gl_NormalScale" }, + { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, + + /* Mesa-internal ATI_envmap_bumpmap state. */ + { ir_var_uniform, -1, "vec2", "gl_BumpRotMatrix0MESA"}, + { ir_var_uniform, -1, "vec2", "gl_BumpRotMatrix1MESA"}, + { ir_var_uniform, -1, "vec4", "gl_FogParamsOptimizedMESA"}, +}; + static struct gl_builtin_uniform_element gl_DepthRange_elements[] = { {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, diff --git a/mesalib/src/glsl/builtin_variables.h b/mesalib/src/glsl/builtin_variables.h deleted file mode 100644 index 237b361d8..000000000 --- a/mesalib/src/glsl/builtin_variables.h +++ /dev/null @@ -1,110 +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 "main/core.h" /* for slot numbers */ - -struct builtin_variable { - enum ir_variable_mode mode; - int slot; - const char *type; - const char *name; -}; - -static const builtin_variable builtin_core_vs_variables[] = { - { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, - { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, -}; - -static const builtin_variable builtin_core_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, - { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, -}; - -static const builtin_variable builtin_100ES_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, -}; - -static const builtin_variable builtin_110_fs_variables[] = { - { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, -}; - -static const builtin_variable builtin_110_deprecated_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, - { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, -}; - -static const builtin_variable builtin_110_deprecated_vs_variables[] = { - { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, - { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, - { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, - { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, - { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, - { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, - { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, - { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, - { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, - { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, - { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, - { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, - { ir_var_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, - { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, - { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, - { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, - { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, - { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, -}; - -static const builtin_variable builtin_120_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, -}; - -static const builtin_variable builtin_130_vs_variables[] = { - { ir_var_in, -1, "int", "gl_VertexID" }, -}; - -static const builtin_variable builtin_110_deprecated_uniforms[] = { - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, - { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, - { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, - { ir_var_uniform, -1, "float", "gl_NormalScale" }, - { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, - - /* Mesa-internal ATI_envmap_bumpmap state. */ - { ir_var_uniform, -1, "vec2", "gl_BumpRotMatrix0MESA"}, - { ir_var_uniform, -1, "vec2", "gl_BumpRotMatrix1MESA"}, - { ir_var_uniform, -1, "vec4", "gl_FogParamsOptimizedMESA"}, -}; - diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index 1b17ff43a..c0457b057 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1132,6 +1132,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_shader_texture_lod) add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1); + if (extensions->ARB_draw_instanced) + add_builtin_define(parser, "GL_ARB_draw_instanced", 1); + if (extensions->AMD_conservative_depth) { add_builtin_define(parser, "GL_AMD_conservative_depth", 1); add_builtin_define(parser, "GL_ARB_conservative_depth", 1); diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index 492be325f..adca62e8d 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -713,6 +713,9 @@ ir_expression::constant_expression_value() case GLSL_TYPE_FLOAT: data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] == op[1]->value.b[c]; + break; default: assert(0); } @@ -731,6 +734,9 @@ ir_expression::constant_expression_value() case GLSL_TYPE_FLOAT: data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] != op[1]->value.b[c]; + break; default: assert(0); } |