struct tgsi_declaration_interp di;
di.Interpolate = TGSI_INTERPOLATE_CONSTANT;
- di.Centroid = 0;
+ di.Location = TGSI_INTERPOLATE_LOC_CENTER;
di.CylindricalWrap = 0;
di.Padding = 0;
static struct tgsi_declaration_interp
tgsi_build_declaration_interp(unsigned interpolate,
- unsigned centroid,
+ unsigned interpolate_location,
unsigned cylindrical_wrap,
struct tgsi_declaration *declaration,
struct tgsi_header *header)
struct tgsi_declaration_interp di;
di.Interpolate = interpolate;
- di.Centroid = centroid;
+ di.Location = interpolate_location;
di.CylindricalWrap = cylindrical_wrap;
di.Padding = 0;
size++;
*di = tgsi_build_declaration_interp(full_decl->Interp.Interpolate,
- full_decl->Interp.Centroid,
+ full_decl->Interp.Location,
full_decl->Interp.CylindricalWrap,
declaration,
header);
ENM( decl->Interp.Interpolate, tgsi_interpolate_names );
}
- if (decl->Interp.Centroid) {
- TXT( ", CENTROID" );
+ if (decl->Interp.Location != TGSI_INTERPOLATE_LOC_CENTER) {
+ TXT( ", " );
+ ENM( decl->Interp.Location, tgsi_interpolate_locations );
}
if (decl->Interp.CylindricalWrap) {
info->input_semantic_name[reg] = (ubyte) semName;
info->input_semantic_index[reg] = (ubyte) semIndex;
info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
- info->input_centroid[reg] = (ubyte)fulldecl->Interp.Centroid;
+ info->input_interpolate_loc[reg] = (ubyte)fulldecl->Interp.Location;
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
info->num_inputs++;
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS];
- ubyte input_centroid[PIPE_MAX_SHADER_INPUTS];
+ ubyte input_interpolate_loc[PIPE_MAX_SHADER_INPUTS];
ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS];
ubyte input_cylindrical_wrap[PIPE_MAX_SHADER_INPUTS];
ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
"COLOR"
};
+const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
+{
+ "CENTER",
+ "CENTROID",
+ "SAMPLE",
+};
+
const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
{
"POINTS",
extern const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT];
+extern const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT];
+
extern const char *tgsi_primitive_names[PIPE_PRIM_MAX];
extern const char *tgsi_fs_coord_origin_names[2];
unsigned semantic_index;
unsigned interp;
unsigned char cylindrical_wrap;
- unsigned char centroid;
+ unsigned interp_location;
} fs_input[UREG_MAX_INPUT];
unsigned nr_fs_inputs;
unsigned semantic_index,
unsigned interp_mode,
unsigned cylindrical_wrap,
- unsigned centroid)
+ unsigned interp_location)
{
unsigned i;
ureg->fs_input[i].semantic_index = semantic_index;
ureg->fs_input[i].interp = interp_mode;
ureg->fs_input[i].cylindrical_wrap = cylindrical_wrap;
- ureg->fs_input[i].centroid = centroid;
+ ureg->fs_input[i].interp_location = interp_location;
ureg->nr_fs_inputs++;
} else {
set_bad(ureg);
unsigned semantic_index,
unsigned interpolate,
unsigned cylindrical_wrap,
- unsigned centroid)
+ unsigned interpolate_location)
{
union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 4);
out[2].value = 0;
out[2].decl_interp.Interpolate = interpolate;
out[2].decl_interp.CylindricalWrap = cylindrical_wrap;
- out[2].decl_interp.Centroid = centroid;
+ out[2].decl_interp.Location = interpolate_location;
out[3].value = 0;
out[3].decl_semantic.Name = semantic_name;
ureg->fs_input[i].semantic_index,
ureg->fs_input[i].interp,
ureg->fs_input[i].cylindrical_wrap,
- ureg->fs_input[i].centroid);
+ ureg->fs_input[i].interp_location);
}
} else {
for (i = 0; i < ureg->nr_gs_inputs; i++) {
unsigned semantic_index,
unsigned interp_mode,
unsigned cylindrical_wrap,
- unsigned centroid);
+ unsigned interp_location);
static INLINE struct ureg_src
ureg_DECL_fs_input_cyl(struct ureg_program *ureg,
The Interpolate field specifes the way input is being interpolated by
the rasteriser and is one of TGSI_INTERPOLATE_*.
+The Location field specifies the location inside the pixel that the
+interpolation should be done at, one of ``TGSI_INTERPOLATE_LOC_*``. Note that
+when per-sample shading is enabled, the implementation may choose to
+interpolate at the sample irrespective of the Location field.
+
The CylindricalWrap bitfield specifies which register components
should be subject to cylindrical wrapping when interpolating by the
rasteriser. If TGSI_CYLINDRICAL_WRAP_X is set to 1, the X component
tgsi->inputs[slot].semantic_index = index;
}
tgsi->inputs[slot].interp = interp->Interpolate;
- tgsi->inputs[slot].centroid = interp->Centroid;
+ tgsi->inputs[slot].centroid = interp->Location == TGSI_INTERPOLATE_LOC_CENTROID;
}
}
default:
break;
}
- if (decl->Interp.Centroid || info->io.sampleInterp)
+ if (decl->Interp.Location || info->io.sampleInterp)
info->in[i].centroid = 1;
}
}
ctx->shader->input[i].name = d->Semantic.Name;
ctx->shader->input[i].sid = d->Semantic.Index;
ctx->shader->input[i].interpolate = d->Interp.Interpolate;
- ctx->shader->input[i].centroid = d->Interp.Centroid;
+ ctx->shader->input[i].centroid = d->Interp.Location == TGSI_INTERPOLATE_LOC_CENTROID;
ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + d->Range.First;
if (ctx->type == TGSI_PROCESSOR_FRAGMENT) {
ctx->shader->input[i].spi_sid = r600_spi_sid(&ctx->shader->input[i]);
ctx->input_linear = TRUE;
if (ctx->info.input_interpolate[i] == TGSI_INTERPOLATE_PERSPECTIVE)
ctx->input_perspective = TRUE;
- if (ctx->info.input_centroid[i])
+ if (ctx->info.input_interpolate_loc[i] == TGSI_INTERPOLATE_LOC_CENTROID)
ctx->input_centroid = TRUE;
}
shader->input[i].sid = d->Semantic.Index;
shader->input[i].index = d->Range.First;
shader->input[i].interpolate = d->Interp.Interpolate;
- shader->input[i].centroid = d->Interp.Centroid;
+ shader->input[i].centroid = d->Interp.Location == TGSI_INTERPOLATE_LOC_CENTROID;
return -1;
case TGSI_FILE_OUTPUT:
case TGSI_INTERPOLATE_LINEAR:
if (si_shader_ctx->shader->key.ps.interp_at_sample)
interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_SAMPLE);
- else if (decl->Interp.Centroid)
+ else if (decl->Interp.Location == TGSI_INTERPOLATE_LOC_CENTROID)
interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_CENTROID);
else
interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_CENTER);
case TGSI_INTERPOLATE_PERSPECTIVE:
if (si_shader_ctx->shader->key.ps.interp_at_sample)
interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_SAMPLE);
- else if (decl->Interp.Centroid)
+ else if (decl->Interp.Location == TGSI_INTERPOLATE_LOC_CENTROID)
interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTROID);
else
interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTER);
#define TGSI_INTERPOLATE_COLOR 3 /* special color case for smooth/flat */
#define TGSI_INTERPOLATE_COUNT 4
+#define TGSI_INTERPOLATE_LOC_CENTER 0
+#define TGSI_INTERPOLATE_LOC_CENTROID 1
+#define TGSI_INTERPOLATE_LOC_SAMPLE 2
+#define TGSI_INTERPOLATE_LOC_COUNT 3
+
#define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
#define TGSI_CYLINDRICAL_WRAP_Z (1 << 2)
struct tgsi_declaration_interp
{
unsigned Interpolate : 4; /**< one of TGSI_INTERPOLATE_x */
- unsigned Centroid : 1; /**< centroid sampling? */
+ unsigned Location : 2; /**< one of TGSI_INTERPOLATE_LOC_x */
unsigned CylindricalWrap:4; /**< TGSI_CYLINDRICAL_WRAP_x flags */
- unsigned Padding : 23;
+ unsigned Padding : 22;
};
#define TGSI_SEMANTIC_POSITION 0
* \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 GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
inputSemanticName[i],
inputSemanticIndex[i],
interpMode[i], 0,
- is_centroid[i]);
+ interpLocation[i]);
}
if (proginfo->InputsRead & VARYING_BIT_POS) {
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
- NULL, /* is centroid */
+ NULL, /* interp location */
/* outputs */
num_outputs,
stvp->result_to_output,
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;
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];
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:
input_semantic_name,
input_semantic_index,
interpMode,
- is_centroid,
+ interpLocation,
/* outputs */
fs_num_outputs,
outputMapping,