aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-07-01 20:54:01 -0400
committerIlia Mirkin <[email protected]>2014-07-09 19:26:32 -0400
commit4c97ed4411e3653a082875b79587fb308c284a99 (patch)
treebc6f1666166da83a51525f6460d49c7d6d473166 /src/mesa/state_tracker
parente3b16294cb56bc0f3ee4a68a525884db0ce6806d (diff)
gallium: switch dedicated centroid field to interpolation location
The new location field can be either center, centroid, or sample, which indicates the location that the shader should interpolate at. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp5
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.h2
-rw-r--r--src/mesa/state_tracker/st_program.c13
3 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9e194313942..f47cd7d5350 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4848,6 +4848,7 @@ emit_edgeflags(struct st_translate *t)
* \param inputSemanticIndex the semantic index (ex: which texcoord) for
* each input
* \param interpMode the TGSI_INTERPOLATE_LINEAR/PERSP mode for each input
+ * \param interpLocation the TGSI_INTERPOLATE_LOC_* location for each input
* \param numOutputs number of output registers used
* \param outputMapping maps Mesa fragment program outputs to TGSI
* generic outputs
@@ -4869,7 +4870,7 @@ st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
@@ -4915,7 +4916,7 @@ st_translate_program(
inputSemanticName[i],
inputSemanticIndex[i],
interpMode[i], 0,
- is_centroid[i]);
+ interpLocation[i]);
}
if (proginfo->InputsRead & VARYING_BIT_POS) {
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h b/src/mesa/state_tracker/st_glsl_to_tgsi.h
index a3fe91f7e80..2e7cb78d514 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -45,7 +45,7 @@ enum pipe_error st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3570557fee6..b603759f8f8 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -351,7 +351,7 @@ st_translate_vertex_program(struct st_context *st,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
- NULL, /* is centroid */
+ NULL, /* interp location */
/* outputs */
num_outputs,
stvp->result_to_output,
@@ -481,6 +481,7 @@ st_translate_fragment_program(struct st_context *st,
GLuint outputMapping[FRAG_RESULT_MAX];
GLuint inputMapping[VARYING_SLOT_MAX];
GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
+ GLuint interpLocation[PIPE_MAX_SHADER_INPUTS];
GLuint attr;
GLbitfield64 inputsRead;
struct ureg_program *ureg;
@@ -489,7 +490,6 @@ st_translate_fragment_program(struct st_context *st,
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
- GLboolean is_centroid[PIPE_MAX_SHADER_INPUTS];
uint fs_num_inputs = 0;
ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
@@ -541,7 +541,12 @@ st_translate_fragment_program(struct st_context *st,
const GLuint slot = fs_num_inputs++;
inputMapping[attr] = slot;
- is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0;
+ if (stfp->Base.IsCentroid & BITFIELD64_BIT(attr))
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTROID;
+ else if (stfp->Base.IsSample & BITFIELD64_BIT(attr))
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
+ else
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
switch (attr) {
case VARYING_SLOT_POS:
@@ -768,7 +773,7 @@ st_translate_fragment_program(struct st_context *st,
input_semantic_name,
input_semantic_index,
interpMode,
- is_centroid,
+ interpLocation,
/* outputs */
fs_num_outputs,
outputMapping,