summaryrefslogtreecommitdiff
path: root/ir_variable.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-25 14:48:25 -0700
committerEric Anholt <eric@anholt.net>2010-03-25 14:48:25 -0700
commitb3f743ab0badc0ca7cba16d7989ec7ba368f6b36 (patch)
tree3a1d1f3bd34a9b7360ec7e8347f9d624b1645c02 /ir_variable.cpp
parent7c15bb2465b2c22a7de810b399b4aa7bfa1467c0 (diff)
Set up fragment shader builtin variables.
Diffstat (limited to 'ir_variable.cpp')
-rw-r--r--ir_variable.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/ir_variable.cpp b/ir_variable.cpp
index 283842c..9344170 100644
--- a/ir_variable.cpp
+++ b/ir_variable.cpp
@@ -127,6 +127,57 @@ initialize_vs_variables(exec_list *instructions,
}
}
+static void
+generate_110_fs_variables(exec_list *instructions,
+ glsl_symbol_table *symtab)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
+ add_builtin_variable(& builtin_core_fs_variables[i],
+ instructions, symtab);
+ }
+
+ /* FINISHME: Add support for gl_FragData[GL_MAX_DRAW_BUFFERS]. */
+}
+
+static void
+generate_120_fs_variables(exec_list *instructions,
+ glsl_symbol_table *symtab)
+{
+ /* GLSL version 1.20 did not add any built-in variables in the fragment
+ * shader.
+ */
+ generate_110_fs_variables(instructions, symtab);
+}
+
+static void
+generate_130_fs_variables(exec_list *instructions,
+ glsl_symbol_table *symtab)
+{
+ generate_120_fs_variables(instructions, symtab);
+
+ /* FINISHME: Add support fo gl_ClipDistance. The size of this array is
+ * FINISHME: implementation dependent based on the value of
+ * FINISHME: GL_MAX_CLIP_DISTANCES.
+ */
+}
+
+static void
+initialize_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+
+ switch (state->language_version) {
+ case 110:
+ generate_110_fs_variables(instructions, state->symbols);
+ break;
+ case 120:
+ generate_120_fs_variables(instructions, state->symbols);
+ break;
+ case 130:
+ generate_130_fs_variables(instructions, state->symbols);
+ break;
+ }
+}
void
_mesa_glsl_initialize_variables(exec_list *instructions,
@@ -137,7 +188,9 @@ _mesa_glsl_initialize_variables(exec_list *instructions,
initialize_vs_variables(instructions, state);
break;
case geometry_shader:
+ break;
case fragment_shader:
+ initialize_fs_variables(instructions, state);
break;
}
}