aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2012-06-18 12:10:13 -0700
committerPaul Berry <[email protected]>2012-06-25 11:03:26 -0700
commitbebb0438113efdcc1c2aaed95c70ba87de1d3053 (patch)
treeb0729ad934f0c59ddd321fa4f5bcc4772c972d8a
parent2a4af651e6997f2fb88efd07aad14542a1b08579 (diff)
glsl: Add IsCentroid bitfield to gl_fragment_program.
This bitfield tells the back-ends which of a fragment shader's inputs require centroid interpolation. It is only set for GLSL fragment shaders, since assembly fragment shaders don't support centroid interpolation. Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/glsl/ir_set_program_inouts.cpp6
-rw-r--r--src/mesa/main/mtypes.h6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
index 8f3edb96936..a7415c7e3f8 100644
--- a/src/glsl/ir_set_program_inouts.cpp
+++ b/src/glsl/ir_set_program_inouts.cpp
@@ -26,7 +26,8 @@
*
* Sets the InputsRead and OutputsWritten of Mesa programs.
*
- * Additionally, for fragment shaders, sets the InterpQualifier array.
+ * Additionally, for fragment shaders, sets the InterpQualifier array and
+ * IsCentroid bitfield.
*
* Mesa programs (gl_program, not gl_shader_program) have a set of
* flags indicating which varyings are read and written. Computing
@@ -88,6 +89,8 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
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;
@@ -178,6 +181,7 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
if (is_fragment_shader) {
memset(((gl_fragment_program *) prog)->InterpQualifier, 0,
sizeof(((gl_fragment_program *) prog)->InterpQualifier));
+ ((gl_fragment_program *) prog)->IsCentroid = 0;
}
visit_list_elements(&v, instructions);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index def0db1aa2d..f18b81ecb60 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2021,6 +2021,12 @@ struct gl_fragment_program
* GLSL, the value is INTERP_QUALIFIER_NONE.
*/
enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX];
+
+ /**
+ * Bitfield indicating, for each fragment shader input, 1 if that input
+ * uses centroid interpolation, 0 otherwise. Unused inputs are 0.
+ */
+ GLbitfield64 IsCentroid;
};