unsigned mesa_index;
unsigned array_id; /* TGSI ArrayID; 1-based: 0 means not an array */
unsigned size;
+ unsigned interp_loc;
enum glsl_interp_mode interp;
enum glsl_base_type base_type;
ubyte usage_mask; /* GLSL-style usage-mask, i.e. single bit per double */
return type->is_array() || type->is_matrix();
}
+static unsigned
+st_translate_interp_loc(ir_variable *var)
+{
+ if (var->data.centroid)
+ return TGSI_INTERPOLATE_LOC_CENTROID;
+ else if (var->data.sample)
+ return TGSI_INTERPOLATE_LOC_SAMPLE;
+ else
+ return TGSI_INTERPOLATE_LOC_CENTER;
+}
+
void
glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir)
{
decl->mesa_index = var->data.location;
decl->interp = (glsl_interp_mode) var->data.interpolation;
+ decl->interp_loc = st_translate_interp_loc(var);
decl->base_type = type_without_array->base_type;
decl->usage_mask = u_bit_consecutive(component, num_components);
* \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
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const GLuint outputSlotToAttr[],
}
unsigned interp_mode = 0;
+ unsigned interp_location = 0;
if (procType == PIPE_SHADER_FRAGMENT) {
assert(interpMode);
interp_mode = interpMode[slot] != TGSI_INTERPOLATE_COUNT ?
interpMode[slot] :
st_translate_interp(decl->interp, inputSlotToAttr[slot]);
+
+ interp_location = decl->interp_loc;
}
src = ureg_DECL_fs_input_cyl_centroid_layout(ureg,
inputSemanticName[slot], inputSemanticIndex[slot],
- interp_mode, 0, interpLocation ? interpLocation[slot] : 0,
- slot, tgsi_usage_mask, decl->array_id, decl->size);
+ interp_mode, 0, interp_location, slot, tgsi_usage_mask,
+ decl->array_id, decl->size);
for (unsigned j = 0; j < decl->size; ++j) {
if (t->inputs[slot + j].File != TGSI_FILE_INPUT) {
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
- NULL, /* interp location */
/* outputs */
num_outputs,
stvp->result_to_output,
GLuint inputMapping[VARYING_SLOT_MAX];
GLuint inputSlotToAttr[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;
inputMapping[attr] = slot;
inputSlotToAttr[slot] = attr;
- 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:
input_semantic_name,
input_semantic_index,
interpMode,
- interpLocation,
/* outputs */
fs_num_outputs,
outputMapping,
input_semantic_name,
input_semantic_index,
NULL,
- NULL,
/* outputs */
num_outputs,
outputMapping,