Likewise, rename the enum type to glsl_interp_mode.
Beyond the GLSL front-end, talking about "interpolation modes" seems
more natural than "interpolation qualifiers" - in the IR, we're removed
from how exactly the source language specifies how to interpolate an
input. Also, SPIR-V calls these "decorations" rather than "qualifiers".
Generated by:
$ find . -regextype egrep -regex '.*\.(c|cpp|h)' -type f -exec sed -i \
-e 's/INTERP_QUALIFIER_/INTERP_MODE_/g' \
-e 's/glsl_interp_qualifier/glsl_interp_mode/g' {} \;
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Dave Airlie <airlied@redhat.com>
static void
validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
- const glsl_interp_qualifier interpolation,
+ const glsl_interp_mode interpolation,
const struct ast_type_qualifier *qual,
const struct glsl_type *var_type,
ir_variable_mode mode)
* fragment shader."
*/
if (state->is_version(130, 300)
- && interpolation != INTERP_QUALIFIER_NONE) {
+ && interpolation != INTERP_MODE_NONE) {
const char *i = interpolation_string(interpolation);
if (mode != ir_var_shader_in && mode != ir_var_shader_out)
_mesa_glsl_error(loc, state,
* These deprecated storage qualifiers do not exist in GLSL ES 3.00.
*/
if (state->is_version(130, 0)
- && interpolation != INTERP_QUALIFIER_NONE
+ && interpolation != INTERP_MODE_NONE
&& qual->flags.q.varying) {
const char *i = interpolation_string(interpolation);
*/
if (state->is_version(130, 300)
&& var_type->contains_integer()
- && interpolation != INTERP_QUALIFIER_FLAT
+ && interpolation != INTERP_MODE_FLAT
&& ((state->stage == MESA_SHADER_FRAGMENT && mode == ir_var_shader_in)
|| (state->stage == MESA_SHADER_VERTEX && mode == ir_var_shader_out
&& state->es_shader))) {
*/
if (state->has_double()
&& var_type->contains_double()
- && interpolation != INTERP_QUALIFIER_FLAT
+ && interpolation != INTERP_MODE_FLAT
&& state->stage == MESA_SHADER_FRAGMENT
&& mode == ir_var_shader_in) {
_mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
}
}
-static glsl_interp_qualifier
+static glsl_interp_mode
interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
const struct glsl_type *var_type,
ir_variable_mode mode,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
- glsl_interp_qualifier interpolation;
+ glsl_interp_mode interpolation;
if (qual->flags.q.flat)
- interpolation = INTERP_QUALIFIER_FLAT;
+ interpolation = INTERP_MODE_FLAT;
else if (qual->flags.q.noperspective)
- interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ interpolation = INTERP_MODE_NOPERSPECTIVE;
else if (qual->flags.q.smooth)
- interpolation = INTERP_QUALIFIER_SMOOTH;
+ interpolation = INTERP_MODE_SMOOTH;
else if (state->es_shader &&
((mode == ir_var_shader_in &&
state->stage != MESA_SHADER_VERTEX) ||
* "When no interpolation qualifier is present, smooth interpolation
* is used."
*/
- interpolation = INTERP_QUALIFIER_SMOOTH;
+ interpolation = INTERP_MODE_SMOOTH;
else
- interpolation = INTERP_QUALIFIER_NONE;
+ interpolation = INTERP_MODE_NONE;
validate_interpolation_qualifier(state, loc,
interpolation,
this->fields[this->num_fields].matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED;
this->fields[this->num_fields].location = slot;
this->fields[this->num_fields].offset = -1;
- this->fields[this->num_fields].interpolation = INTERP_QUALIFIER_NONE;
+ this->fields[this->num_fields].interpolation = INTERP_MODE_NONE;
this->fields[this->num_fields].centroid = 0;
this->fields[this->num_fields].sample = 0;
this->fields[this->num_fields].patch = 0;
}
if (state->AMD_vertex_shader_layer_enable) {
var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->AMD_vertex_shader_viewport_index_enable) {
var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (compatibility) {
add_input(VERT_ATTRIB_POS, vec4_t, "gl_Vertex");
ir_variable *var;
var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
if (state->is_version(410, 0) || state->ARB_viewport_array_enable) {
var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->is_version(400, 0) || state->ARB_gpu_shader5_enable)
add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID");
* gl_PrimitiveIDIn as an {ARB,EXT}_geometry_shader4-only variable.
*/
var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
var = add_output(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->has_geometry_shader()) {
var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
/* gl_FragColor and gl_FragData were deprecated starting in desktop GLSL
if (state->is_version(430, 0) || state->ARB_fragment_layer_viewport_enable) {
var = add_input(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
var = add_input(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->is_version(450, 310) || state->ARB_ES3_1_compatibility_enable)
this->data.invariant = false;
this->data.how_declared = ir_var_declared_normally;
this->data.mode = mode;
- this->data.interpolation = INTERP_QUALIFIER_NONE;
+ this->data.interpolation = INTERP_MODE_NONE;
this->data.max_array_access = -1;
this->data.offset = 0;
this->data.precision = GLSL_PRECISION_NONE;
interpolation_string(unsigned interpolation)
{
switch (interpolation) {
- case INTERP_QUALIFIER_NONE: return "no";
- case INTERP_QUALIFIER_SMOOTH: return "smooth";
- case INTERP_QUALIFIER_FLAT: return "flat";
- case INTERP_QUALIFIER_NOPERSPECTIVE: return "noperspective";
+ case INTERP_MODE_NONE: return "no";
+ case INTERP_MODE_SMOOTH: return "smooth";
+ case INTERP_MODE_FLAT: return "flat";
+ case INTERP_MODE_NOPERSPECTIVE: return "noperspective";
}
assert(!"Should not get here.");
inline bool is_interpolation_flat() const
{
- return this->data.interpolation == INTERP_QUALIFIER_FLAT ||
+ return this->data.interpolation == INTERP_MODE_FLAT ||
this->type->contains_integer() ||
this->type->contains_double();
}
/**
* Interpolation mode for shader inputs / outputs
*
- * \sa glsl_interp_qualifier
+ * \sa glsl_interp_mode
*/
unsigned interpolation:2;
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
const char *const stream [] = {"", "stream1 ", "stream2 ", "stream3 "};
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
- STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
fprintf(f, "(%s%s%s%s%s%s%s%s%s) ",
loc, cent, samp, patc, inv, prec, mode[ir->data.mode],
} else if (strcmp(qualifier->value(), "stream3") == 0) {
var->data.stream = 3;
} else if (strcmp(qualifier->value(), "smooth") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ var->data.interpolation = INTERP_MODE_SMOOTH;
} else if (strcmp(qualifier->value(), "flat") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
} else if (strcmp(qualifier->value(), "noperspective") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ var->data.interpolation = INTERP_MODE_NOPERSPECTIVE;
} else {
ir_read_error(expr, "unknown qualifier: %s", qualifier->value());
return NULL;
if (stage == MESA_SHADER_FRAGMENT) {
gl_fragment_program *fprog = (gl_fragment_program *) prog;
fprog->InterpQualifier[idx] =
- (glsl_interp_qualifier) var->data.interpolation;
+ (glsl_interp_mode) var->data.interpolation;
if (var->data.centroid)
fprog->IsCentroid |= bitfield;
if (var->data.sample)
if (producer_var) {
producer_var->data.centroid = false;
producer_var->data.sample = false;
- producer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ producer_var->data.interpolation = INTERP_MODE_FLAT;
}
if (consumer_var) {
consumer_var->data.centroid = false;
consumer_var->data.sample = false;
- consumer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ consumer_var->data.interpolation = INTERP_MODE_FLAT;
}
}
(var->data.patch << 2);
packing_class *= 4;
packing_class += var->is_interpolation_flat()
- ? unsigned(INTERP_QUALIFIER_FLAT) : var->data.interpolation;
+ ? unsigned(INTERP_MODE_FLAT) : var->data.interpolation;
return packing_class;
}
* together when their interpolation mode is "flat". Treat integers as
* being flat when the interpolation mode is none.
*/
- assert(var->data.interpolation == INTERP_QUALIFIER_FLAT ||
- var->data.interpolation == INTERP_QUALIFIER_NONE ||
+ assert(var->data.interpolation == INTERP_MODE_FLAT ||
+ var->data.interpolation == INTERP_MODE_NONE ||
!var->type->contains_integer());
/* Clone the variable for program resource list before
packed_var->data.sample = unpacked_var->data.sample;
packed_var->data.patch = unpacked_var->data.patch;
packed_var->data.interpolation = packed_type == glsl_type::ivec4_type
- ? unsigned(INTERP_QUALIFIER_FLAT) : unpacked_var->data.interpolation;
+ ? unsigned(INTERP_MODE_FLAT) : unpacked_var->data.interpolation;
packed_var->data.location = location;
packed_var->data.precision = unpacked_var->data.precision;
packed_var->data.always_active_io = unpacked_var->data.always_active_io;
if ((mode == nir_var_shader_in && shader->stage != MESA_SHADER_VERTEX) ||
(mode == nir_var_shader_out && shader->stage != MESA_SHADER_FRAGMENT))
- var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ var->data.interpolation = INTERP_MODE_SMOOTH;
if (mode == nir_var_shader_in || mode == nir_var_uniform)
var->data.read_only = true;
/**
* Interpolation mode for shader inputs / outputs
*
- * \sa glsl_interp_qualifier
+ * \sa glsl_interp_mode
*/
unsigned interpolation:2;
/* if we don't already have one, insert a FACE input: */
if (!state->face) {
state->face = create_input(state->shader, ++maxloc, VARYING_SLOT_FACE);
- state->face->data.interpolation = INTERP_QUALIFIER_FLAT;
+ state->face->data.interpolation = INTERP_MODE_FLAT;
}
/* add required back-face color inputs: */
const char *const inv = (var->data.invariant) ? "invariant " : "";
fprintf(fp, "%s%s%s%s%s %s ",
cent, samp, patch, inv, get_variable_mode_str(var->data.mode),
- glsl_interp_qualifier_name(var->data.interpolation));
+ glsl_interp_mode_name(var->data.interpolation));
const char *const coher = (var->data.image.coherent) ? "coherent " : "";
const char *const volat = (var->data.image._volatile) ? "volatile " : "";
}
const char *
-glsl_interp_qualifier_name(enum glsl_interp_qualifier qual)
+glsl_interp_mode_name(enum glsl_interp_mode qual)
{
static const char *names[] = {
- ENUM(INTERP_QUALIFIER_NONE),
- ENUM(INTERP_QUALIFIER_SMOOTH),
- ENUM(INTERP_QUALIFIER_FLAT),
- ENUM(INTERP_QUALIFIER_NOPERSPECTIVE),
+ ENUM(INTERP_MODE_NONE),
+ ENUM(INTERP_MODE_SMOOTH),
+ ENUM(INTERP_MODE_FLAT),
+ ENUM(INTERP_MODE_NOPERSPECTIVE),
};
- STATIC_ASSERT(ARRAY_SIZE(names) == INTERP_QUALIFIER_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(names) == INTERP_MODE_COUNT);
return NAME(qual);
}
* The possible interpolation qualifiers that can be applied to a fragment
* shader input in GLSL.
*
- * Note: INTERP_QUALIFIER_NONE must be 0 so that memsetting the
+ * Note: INTERP_MODE_NONE must be 0 so that memsetting the
* gl_fragment_program data structure to 0 causes the default behavior.
*/
-enum glsl_interp_qualifier
+enum glsl_interp_mode
{
- INTERP_QUALIFIER_NONE = 0,
- INTERP_QUALIFIER_SMOOTH,
- INTERP_QUALIFIER_FLAT,
- INTERP_QUALIFIER_NOPERSPECTIVE,
- INTERP_QUALIFIER_COUNT /**< Number of interpolation qualifiers */
+ INTERP_MODE_NONE = 0,
+ INTERP_MODE_SMOOTH,
+ INTERP_MODE_FLAT,
+ INTERP_MODE_NOPERSPECTIVE,
+ INTERP_MODE_COUNT /**< Number of interpolation qualifiers */
};
-const char *glsl_interp_qualifier_name(enum glsl_interp_qualifier qual);
+const char *glsl_interp_mode_name(enum glsl_interp_mode qual);
/**
* Fragment program results
case SpvDecorationUniform:
break; /* FIXME: Do nothing with this for now. */
case SpvDecorationNoPerspective:
- ctx->fields[member].interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ ctx->fields[member].interpolation = INTERP_MODE_NOPERSPECTIVE;
break;
case SpvDecorationFlat:
- ctx->fields[member].interpolation = INTERP_QUALIFIER_FLAT;
+ ctx->fields[member].interpolation = INTERP_MODE_FLAT;
break;
case SpvDecorationCentroid:
ctx->fields[member].centroid = true;
case SpvDecorationRelaxedPrecision:
break; /* FIXME: Do nothing with this for now. */
case SpvDecorationNoPerspective:
- nir_var->data.interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ nir_var->data.interpolation = INTERP_MODE_NOPERSPECTIVE;
break;
case SpvDecorationFlat:
- nir_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ nir_var->data.interpolation = INTERP_MODE_FLAT;
break;
case SpvDecorationCentroid:
nir_var->data.centroid = true;
*/
switch (decl->Interp.Interpolate) {
case TGSI_INTERPOLATE_CONSTANT:
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
break;
case TGSI_INTERPOLATE_LINEAR:
- var->data.interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ var->data.interpolation = INTERP_MODE_NOPERSPECTIVE;
break;
case TGSI_INTERPOLATE_PERSPECTIVE:
- var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ var->data.interpolation = INTERP_MODE_SMOOTH;
break;
}
*/
uint32_t inloc = fp->inputs[j].inloc - 8;
- if ((fp->inputs[j].interpolate == INTERP_QUALIFIER_FLAT) ||
+ if ((fp->inputs[j].interpolate == INTERP_MODE_FLAT) ||
(fp->inputs[j].rasterflat && emit->rasterflat)) {
uint32_t loc = inloc;
*/
uint32_t inloc = s[FS].v->inputs[j].inloc - 8;
- if ((s[FS].v->inputs[j].interpolate == INTERP_QUALIFIER_FLAT) ||
+ if ((s[FS].v->inputs[j].interpolate == INTERP_MODE_FLAT) ||
(s[FS].v->inputs[j].rasterflat && emit->rasterflat)) {
uint32_t loc = inloc;
so->inputs[n].slot = slot;
so->inputs[n].compmask = 1;
so->inputs[n].regid = r;
- so->inputs[n].interpolate = INTERP_QUALIFIER_FLAT;
+ so->inputs[n].interpolate = INTERP_MODE_FLAT;
so->total_in++;
ctx->ir->ninputs = MAX2(ctx->ir->ninputs, r + 1);
* we need to do flat vs smooth shading depending on
* rast state:
*/
- if (in->data.interpolation == INTERP_QUALIFIER_NONE) {
+ if (in->data.interpolation == INTERP_MODE_NONE) {
switch (slot) {
case VARYING_SLOT_COL0:
case VARYING_SLOT_COL1:
}
if (ctx->flat_bypass) {
- if ((so->inputs[n].interpolate == INTERP_QUALIFIER_FLAT) ||
+ if ((so->inputs[n].interpolate == INTERP_MODE_FLAT) ||
(so->inputs[n].rasterflat && ctx->so->key.rasterflat))
use_ldlv = true;
}
/* fragment shader specific: */
bool bary : 1; /* fetched varying (vs one loaded into reg) */
bool rasterflat : 1; /* special handling for emit->rasterflat */
- enum glsl_interp_qualifier interpolate;
+ enum glsl_interp_mode interpolate;
} inputs[16 + 2]; /* +POSITION +FACE */
/* sum of input components (scalar). For frag shaders, it only counts
nir_variable *tex_pos_out = nir_variable_create(b.shader, nir_var_shader_out,
vec4, "v_tex_pos");
tex_pos_out->data.location = VARYING_SLOT_VAR0;
- tex_pos_out->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ tex_pos_out->data.interpolation = INTERP_MODE_SMOOTH;
nir_copy_var(&b, tex_pos_out, tex_pos_in);
return b.shader;
nir_variable *tex_pos_out = nir_variable_create(b.shader, nir_var_shader_out,
vec4, "v_tex_pos");
tex_pos_out->data.location = VARYING_SLOT_VAR0;
- tex_pos_out->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ tex_pos_out->data.interpolation = INTERP_MODE_SMOOTH;
nir_copy_var(&b, tex_pos_out, tex_pos_in);
nir_variable *other_in = nir_variable_create(b.shader, nir_var_shader_in,
nir_variable *other_out = nir_variable_create(b.shader, nir_var_shader_out,
vec4, "v_other");
other_out->data.location = VARYING_SLOT_VAR1;
- other_out->data.interpolation = INTERP_QUALIFIER_FLAT;
+ other_out->data.interpolation = INTERP_MODE_FLAT;
nir_copy_var(&b, other_out, other_in);
return b.shader;
nir_variable *tex_off_in = nir_variable_create(b.shader, nir_var_shader_in,
ivec3, "v_tex_off");
tex_off_in->data.location = VARYING_SLOT_VAR0;
- tex_off_in->data.interpolation = INTERP_QUALIFIER_FLAT;
+ tex_off_in->data.interpolation = INTERP_MODE_FLAT;
/* In location 1 we have a uvec4 that gives us the bounds of the
* destination. We need to discard if we get outside this boundary.
nir_variable *bounds_in = nir_variable_create(b.shader, nir_var_shader_in,
uvec4, "v_bounds");
bounds_in->data.location = VARYING_SLOT_VAR1;
- bounds_in->data.interpolation = INTERP_QUALIFIER_FLAT;
+ bounds_in->data.interpolation = INTERP_MODE_FLAT;
nir_variable *color_out = nir_variable_create(b.shader, nir_var_shader_out,
vec4, "f_color");
nir_variable_create(vs_b.shader, nir_var_shader_out, color_type,
"v_color");
vs_out_color->data.location = VARYING_SLOT_VAR0;
- vs_out_color->data.interpolation = INTERP_QUALIFIER_FLAT;
+ vs_out_color->data.interpolation = INTERP_MODE_FLAT;
nir_variable *fs_in_color =
nir_variable_create(fs_b.shader, nir_var_shader_in, color_type,
#define LOAD_INPUT(name, type)\
v->v_##name = nir_variable_create(b->shader, nir_var_shader_in, \
type, #name); \
- v->v_##name->data.interpolation = INTERP_QUALIFIER_FLAT; \
+ v->v_##name->data.interpolation = INTERP_MODE_FLAT; \
v->v_##name->data.location = VARYING_SLOT_VAR0 + \
offsetof(struct brw_blorp_wm_inputs, name) / (4 * sizeof(float));
nir_variable *v_color = nir_variable_create(b.shader, nir_var_shader_in,
glsl_vec4_type(), "v_color");
v_color->data.location = VARYING_SLOT_VAR0;
- v_color->data.interpolation = INTERP_QUALIFIER_FLAT;
+ v_color->data.interpolation = INTERP_MODE_FLAT;
nir_variable *frag_color = nir_variable_create(b.shader, nir_var_shader_out,
glsl_vec4_type(),
*/
GLuint interp = c->key.interpolation_mode.mode[slot];
- if (interp != INTERP_QUALIFIER_FLAT) {
+ if (interp != INTERP_MODE_FLAT) {
struct brw_reg tmp = get_tmp(c);
struct brw_reg t =
- interp == INTERP_QUALIFIER_NOPERSPECTIVE ? t_nopersp : t0;
+ interp == INTERP_MODE_NOPERSPECTIVE ? t_nopersp : t0;
brw_MUL(p,
vec4(brw_null_reg()),
struct brw_codegen *p = &c->func;
for (int i = 0; i < c->vue_map.num_slots; i++) {
- if (c->key.interpolation_mode.mode[i] == INTERP_QUALIFIER_FLAT) {
+ if (c->key.interpolation_mode.mode[i] == INTERP_MODE_FLAT) {
brw_MOV(p,
byte_offset(c->reg.vertex[to], brw_vue_slot_to_offset(i)),
byte_offset(c->reg.vertex[from], brw_vue_slot_to_offset(i)));
static inline bool brw_any_flat_varyings(struct interpolation_mode_map *map)
{
for (int i = 0; i < BRW_VARYING_SLOT_COUNT; i++)
- if (map->mode[i] == INTERP_QUALIFIER_FLAT)
+ if (map->mode[i] == INTERP_MODE_FLAT)
return true;
return false;
static inline bool brw_any_noperspective_varyings(struct interpolation_mode_map *map)
{
for (int i = 0; i < BRW_VARYING_SLOT_COUNT; i++)
- if (map->mode[i] == INTERP_QUALIFIER_NOPERSPECTIVE)
+ if (map->mode[i] == INTERP_MODE_NOPERSPECTIVE)
return true;
return false;
}
static enum brw_barycentric_mode
-barycentric_mode(enum glsl_interp_qualifier mode,
+barycentric_mode(enum glsl_interp_mode mode,
bool is_centroid, bool is_sample)
{
unsigned bary;
/* Barycentric modes don't make sense for flat inputs. */
- assert(mode != INTERP_QUALIFIER_FLAT);
+ assert(mode != INTERP_MODE_FLAT);
if (is_sample) {
bary = BRW_BARYCENTRIC_PERSPECTIVE_SAMPLE;
bary = BRW_BARYCENTRIC_PERSPECTIVE_PIXEL;
}
- if (mode == INTERP_QUALIFIER_NOPERSPECTIVE)
+ if (mode == INTERP_MODE_NOPERSPECTIVE)
bary += 3;
return (enum brw_barycentric_mode) bary;
void
fs_visitor::emit_general_interpolation(fs_reg *attr, const char *name,
const glsl_type *type,
- glsl_interp_qualifier interpolation_mode,
+ glsl_interp_mode interpolation_mode,
int *location, bool mod_centroid,
bool mod_sample)
{
attr->type = brw_type_for_base_type(type->get_scalar_type());
- if (interpolation_mode == INTERP_QUALIFIER_FLAT) {
+ if (interpolation_mode == INTERP_MODE_FLAT) {
/* Constant interpolation (flat shading) case. The SF has
* handed us defined values in only the constant offset
* field of the setup reg.
} else {
bld.emit(FS_OPCODE_LINTERP, *attr, delta_xy[bary], interp);
}
- if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) {
+ if (devinfo->gen < 6 && interpolation_mode == INTERP_MODE_SMOOTH) {
bld.MUL(*attr, *attr, this->pixel_w);
}
*attr = offset(*attr, bld, 1);
continue;
/* Flat inputs don't need barycentric modes. */
- if (var->data.interpolation == INTERP_QUALIFIER_FLAT)
+ if (var->data.interpolation == INTERP_MODE_FLAT)
continue;
/* Determine the set (or sets) of barycentric coordinates needed to
* for lit pixels, so we need both sets of barycentric coordinates.
*/
enum brw_barycentric_mode bary_mode =
- barycentric_mode((glsl_interp_qualifier) var->data.interpolation,
+ barycentric_mode((glsl_interp_mode) var->data.interpolation,
var->data.centroid, var->data.sample);
barycentric_interp_modes |= 1 << bary_mode;
continue;
/* flat shading */
- if (var->data.interpolation == INTERP_QUALIFIER_FLAT)
+ if (var->data.interpolation == INTERP_MODE_FLAT)
prog_data->flat_inputs |= (1 << input_index);
}
}
* Everything defaults to smooth except for the legacy GL color
* built-in variables, which might be flat depending on API state.
*/
- if (var->data.interpolation == INTERP_QUALIFIER_NONE) {
+ if (var->data.interpolation == INTERP_MODE_NONE) {
const bool flat = api_flat_shade &&
(var->data.location == VARYING_SLOT_COL0 ||
var->data.location == VARYING_SLOT_COL1);
- var->data.interpolation = flat ? INTERP_QUALIFIER_FLAT
- : INTERP_QUALIFIER_SMOOTH;
+ var->data.interpolation = flat ? INTERP_MODE_FLAT
+ : INTERP_MODE_SMOOTH;
}
/* Apply 'sample' if necessary for API state. */
if (per_sample_interpolation &&
- var->data.interpolation != INTERP_QUALIFIER_FLAT) {
+ var->data.interpolation != INTERP_MODE_FLAT) {
var->data.centroid = false;
var->data.sample = true;
}
fs_reg *emit_samplemaskin_setup();
void emit_general_interpolation(fs_reg *attr, const char *name,
const glsl_type *type,
- glsl_interp_qualifier interpolation_mode,
+ glsl_interp_mode interpolation_mode,
int *location, bool mod_centroid,
bool mod_sample);
fs_reg *emit_vs_system_value(int location);
} else {
int location = var->data.location;
emit_general_interpolation(&input, var->name, var->type,
- (glsl_interp_qualifier) var->data.interpolation,
+ (glsl_interp_mode) var->data.interpolation,
&location, var->data.centroid,
var->data.sample);
}
const fs_reg &dst,
const fs_reg &src,
const fs_reg &desc,
- glsl_interp_qualifier interpolation)
+ glsl_interp_mode interpolation)
{
fs_inst *inst;
fs_reg payload;
inst->mlen = mlen;
/* 2 floats per slot returned */
inst->regs_written = 2 * bld.dispatch_width() / 8;
- inst->pi_noperspective = interpolation == INTERP_QUALIFIER_NOPERSPECTIVE;
+ inst->pi_noperspective = interpolation == INTERP_MODE_NOPERSPECTIVE;
return inst;
}
wm_prog_data->pulls_bary = true;
fs_reg dst_xy = bld.vgrf(BRW_REGISTER_TYPE_F, 2);
- const glsl_interp_qualifier interpolation =
- (glsl_interp_qualifier) instr->variables[0]->var->data.interpolation;
+ const glsl_interp_mode interpolation =
+ (glsl_interp_mode) instr->variables[0]->var->data.interpolation;
switch (instr->intrinsic) {
case nir_intrinsic_interp_var_at_centroid:
static char const *get_qual_name(int mode)
{
switch (mode) {
- case INTERP_QUALIFIER_NONE: return "none";
- case INTERP_QUALIFIER_FLAT: return "flat";
- case INTERP_QUALIFIER_SMOOTH: return "smooth";
- case INTERP_QUALIFIER_NOPERSPECTIVE: return "nopersp";
+ case INTERP_MODE_NONE: return "none";
+ case INTERP_MODE_FLAT: return "flat";
+ case INTERP_MODE_SMOOTH: return "smooth";
+ case INTERP_MODE_NOPERSPECTIVE: return "nopersp";
default: return "???";
}
}
BRW_NEW_VUE_MAP_GEOM_OUT))
return;
- memset(&brw->interpolation_mode, INTERP_QUALIFIER_NONE, sizeof(brw->interpolation_mode));
+ memset(&brw->interpolation_mode, INTERP_MODE_NONE, sizeof(brw->interpolation_mode));
brw->ctx.NewDriverState |= BRW_NEW_INTERPOLATION_MAP;
/* HPOS always wants noperspective. setting it up here allows
* us to not need special handling in the SF program. */
if (varying == VARYING_SLOT_POS) {
- brw->interpolation_mode.mode[i] = INTERP_QUALIFIER_NOPERSPECTIVE;
+ brw->interpolation_mode.mode[i] = INTERP_MODE_NOPERSPECTIVE;
continue;
}
if (!(fprog->Base.InputsRead & BITFIELD64_BIT(frag_attrib)))
continue;
- enum glsl_interp_qualifier mode = fprog->InterpQualifier[frag_attrib];
+ enum glsl_interp_mode mode = fprog->InterpQualifier[frag_attrib];
/* If the mode is not specified, the default varies: Color values
* follow GL_SHADE_MODEL; everything else is smooth.
*/
- if (mode == INTERP_QUALIFIER_NONE) {
+ if (mode == INTERP_MODE_NONE) {
if (frag_attrib == VARYING_SLOT_COL0 || frag_attrib == VARYING_SLOT_COL1)
mode = brw->ctx.Light.ShadeModel == GL_FLAT
- ? INTERP_QUALIFIER_FLAT : INTERP_QUALIFIER_SMOOTH;
+ ? INTERP_MODE_FLAT : INTERP_MODE_SMOOTH;
else
- mode = INTERP_QUALIFIER_SMOOTH;
+ mode = INTERP_MODE_SMOOTH;
}
brw->interpolation_mode.mode[i] = mode;
int i;
for (i = 0; i < c->vue_map.num_slots; i++) {
- if (c->key.interpolation_mode.mode[i] == INTERP_QUALIFIER_FLAT) {
+ if (c->key.interpolation_mode.mode[i] == INTERP_MODE_FLAT) {
brw_MOV(p,
get_vue_slot(c, dst, i),
get_vue_slot(c, src, i));
int count = 0;
for (i = 0; i < c->vue_map.num_slots; i++)
- if (c->key.interpolation_mode.mode[i] == INTERP_QUALIFIER_FLAT)
+ if (c->key.interpolation_mode.mode[i] == INTERP_MODE_FLAT)
count++;
return count;
GLushort *pc_linear)
{
bool is_last_attr = (reg == c->nr_setup_regs - 1);
- enum glsl_interp_qualifier interp;
+ enum glsl_interp_mode interp;
*pc_persp = 0;
*pc_linear = 0;
*pc = 0xf;
interp = c->key.interpolation_mode.mode[vert_reg_to_vue_slot(c, reg, 0)];
- if (interp == INTERP_QUALIFIER_SMOOTH) {
+ if (interp == INTERP_MODE_SMOOTH) {
*pc_linear = 0xf;
*pc_persp = 0xf;
- } else if (interp == INTERP_QUALIFIER_NOPERSPECTIVE)
+ } else if (interp == INTERP_MODE_NOPERSPECTIVE)
*pc_linear = 0xf;
/* Maybe only processs one attribute on the final round:
*pc |= 0xf0;
interp = c->key.interpolation_mode.mode[vert_reg_to_vue_slot(c, reg, 1)];
- if (interp == INTERP_QUALIFIER_SMOOTH) {
+ if (interp == INTERP_MODE_SMOOTH) {
*pc_linear |= 0xf0;
*pc_persp |= 0xf0;
- } else if (interp == INTERP_QUALIFIER_NOPERSPECTIVE)
+ } else if (interp == INTERP_MODE_NOPERSPECTIVE)
*pc_linear |= 0xf0;
}
/**
* GLSL interpolation qualifier associated with each fragment shader input.
* For inputs that do not have an interpolation qualifier specified in
- * GLSL, the value is INTERP_QUALIFIER_NONE.
+ * GLSL, the value is INTERP_MODE_NONE.
*/
- enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX];
+ enum glsl_interp_mode InterpQualifier[VARYING_SLOT_MAX];
/**
* Bitfield indicating, for each fragment shader input, 1 if that input
/**
* Interpolation mode for shader inputs / outputs
*
- * \sa glsl_interp_qualifier
+ * \sa glsl_interp_mode
*/
unsigned interpolation:2;
*
* with appropriate substitutions in the uniform variables list:
*
- * decl_var uniform INTERP_QUALIFIER_NONE gl_FogParameters gl_Fog (0, 0)
+ * decl_var uniform INTERP_MODE_NONE gl_FogParameters gl_Fog (0, 0)
*
* would become:
*
- * decl_var uniform INTERP_QUALIFIER_NONE vec4 state.fog.color (0, 0)
- * decl_var uniform INTERP_QUALIFIER_NONE vec4 state.fog.params (0, 1)
+ * decl_var uniform INTERP_MODE_NONE vec4 state.fog.color (0, 0)
+ * decl_var uniform INTERP_MODE_NONE vec4 state.fog.params (0, 1)
*
* See in particular 'struct gl_builtin_uniform_element'.
*/
static unsigned
-st_translate_interp(enum glsl_interp_qualifier glsl_qual, bool is_color)
+st_translate_interp(enum glsl_interp_mode glsl_qual, bool is_color)
{
switch (glsl_qual) {
- case INTERP_QUALIFIER_NONE:
+ case INTERP_MODE_NONE:
if (is_color)
return TGSI_INTERPOLATE_COLOR;
return TGSI_INTERPOLATE_PERSPECTIVE;
- case INTERP_QUALIFIER_SMOOTH:
+ case INTERP_MODE_SMOOTH:
return TGSI_INTERPOLATE_PERSPECTIVE;
- case INTERP_QUALIFIER_FLAT:
+ case INTERP_MODE_FLAT:
return TGSI_INTERPOLATE_CONSTANT;
- case INTERP_QUALIFIER_NOPERSPECTIVE:
+ case INTERP_MODE_NOPERSPECTIVE:
return TGSI_INTERPOLATE_LINEAR;
default:
assert(0 && "unexpected interp mode in st_translate_interp()");