diff options
author | marha <marha@users.sourceforge.net> | 2011-09-09 16:49:03 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-09 16:49:03 +0200 |
commit | 05cf7dd22994a1dbfd3580b00690c01c392a5797 (patch) | |
tree | ec1c29b5f8a67c54b13b44f1eb7aa700f91fef9e /mesalib/src/glsl/ir_variable.cpp | |
parent | 0947b921a3223c14322f10d83e71618d1724b734 (diff) | |
parent | f9cf11136d65f20aab4fb6d5fc3ec3c59185a0b4 (diff) | |
download | vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.tar.gz vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.tar.bz2 vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/include/GL/internal/dri_interface.h
mesalib/scons/gallium.py
mesalib/src/glsl/ast_to_hir.cpp
mesalib/src/glsl/glsl_parser_extras.cpp
mesalib/src/glsl/ir_variable.cpp
mesalib/src/glsl/linker.cpp
mesalib/src/mesa/SConscript
mesalib/src/mesa/drivers/common/driverfuncs.c
mesalib/src/mesa/main/compiler.h
mesalib/src/mesa/main/formats.c
mesalib/src/mesa/main/formats.h
mesalib/src/mesa/main/texcompress.c
mesalib/src/mesa/main/texgetimage.c
mesalib/src/mesa/sources.mak
Diffstat (limited to 'mesalib/src/glsl/ir_variable.cpp')
-rw-r--r-- | mesalib/src/glsl/ir_variable.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/mesalib/src/glsl/ir_variable.cpp b/mesalib/src/glsl/ir_variable.cpp index 8495043fe..76f79da92 100644 --- a/mesalib/src/glsl/ir_variable.cpp +++ b/mesalib/src/glsl/ir_variable.cpp @@ -585,6 +585,17 @@ generate_120_vs_variables(exec_list *instructions, static void
+generate_130_uniforms(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ glsl_symbol_table *const symtab = state->symbols;
+
+ add_builtin_constant(instructions, symtab, "gl_MaxClipDistances",
+ state->Const.MaxClipPlanes);
+}
+
+
+static void
generate_130_vs_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
@@ -595,9 +606,20 @@ generate_130_vs_variables(exec_list *instructions, & builtin_130_vs_variables[i]);
}
+ generate_130_uniforms(instructions, state);
+
+ /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ * The gl_ClipDistance array is predeclared as unsized and must
+ * be sized by the shader either redeclaring it with a size or
+ * indexing it only with integral constant expressions.
+ *
+ * We represent this in Mesa by initially declaring the array as
+ * size 0.
+ */
const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type,
- state->Const.MaxClipPlanes);
+ glsl_type::get_array_instance(glsl_type::float_type, 0);
/* FINISHME: gl_ClipDistance needs a real location assigned. */
add_variable(instructions, state->symbols,
@@ -802,9 +824,22 @@ generate_130_fs_variables(exec_list *instructions, {
generate_120_fs_variables(instructions, state);
+ generate_130_uniforms(instructions, state);
+
+ /* From the GLSL 1.30 spec, section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ * The built-in input variable gl_ClipDistance array contains linearly
+ * interpolated values for the vertex values written by the vertex shader
+ * to the gl_ClipDistance vertex output variable. This array must be
+ * sized in the fragment shader either implicitly or explicitly to be the
+ * same size as it was sized in the vertex shader.
+ *
+ * In other words, the array must be pre-declared as implicitly sized. We
+ * represent this in Mesa by initially declaring the array as size 0.
+ */
const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type,
- state->Const.MaxClipPlanes);
+ glsl_type::get_array_instance(glsl_type::float_type, 0);
/* FINISHME: gl_ClipDistance needs a real location assigned. */
add_variable(instructions, state->symbols,
|