};
static const builtin_variable builtin_core_fs_variables[] = {
- { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" },
- { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" },
+ { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" },
+ { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" },
{ ir_var_shader_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" },
};
static const builtin_variable builtin_100ES_fs_variables[] = {
- { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" },
+ { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" },
};
static const builtin_variable builtin_300ES_vs_variables[] = {
};
static const builtin_variable builtin_300ES_fs_variables[] = {
- { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" },
- { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" },
+ { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" },
+ { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" },
{ ir_var_shader_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" },
- { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" },
+ { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" },
};
static const builtin_variable builtin_110_fs_variables[] = {
};
static const builtin_variable builtin_110_deprecated_fs_variables[] = {
- { ir_var_shader_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" },
- { ir_var_shader_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" },
- { ir_var_shader_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" },
+ { ir_var_shader_in, VARYING_SLOT_COL0, "vec4", "gl_Color" },
+ { ir_var_shader_in, VARYING_SLOT_COL1, "vec4", "gl_SecondaryColor" },
+ { ir_var_shader_in, VARYING_SLOT_FOGC, "float", "gl_FogFragCoord" },
};
static const builtin_variable builtin_110_deprecated_vs_variables[] = {
};
static const builtin_variable builtin_120_fs_variables[] = {
- { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" },
+ { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" },
};
static const builtin_variable builtin_130_vs_variables[] = {
glsl_type::get_array_instance(glsl_type::vec4_type, VERT_ATTRIB_MAX);
add_uniform(instructions, symtab, "gl_CurrentAttribVertMESA", vert_attribs);
const glsl_type *const frag_attribs =
- glsl_type::get_array_instance(glsl_type::vec4_type, FRAG_ATTRIB_MAX);
+ glsl_type::get_array_instance(glsl_type::vec4_type, VARYING_SLOT_MAX);
add_uniform(instructions, symtab, "gl_CurrentAttribFragMESA", frag_attribs);
}
add_variable(instructions, state->symbols,
"gl_TexCoord", vec4_array_type, ir_var_shader_in,
- FRAG_ATTRIB_TEX0);
+ VARYING_SLOT_TEX0);
generate_ARB_draw_buffers_variables(instructions, state, false,
fragment_shader);
add_variable(instructions, state->symbols,
"gl_ClipDistance", clip_distance_array_type, ir_var_shader_in,
- FRAG_ATTRIB_CLIP_DIST0);
+ VARYING_SLOT_CLIP_DIST0);
}
static void
return (glsl_interp_qualifier) this->interpolation;
int location = this->location;
bool is_gl_Color =
- location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1;
+ location == VARYING_SLOT_COL0 || location == VARYING_SLOT_COL1;
if (flat_shade && is_gl_Color)
return INTERP_QUALIFIER_FLAT;
else
*
* - Vertex shader input: one of the values from \c gl_vert_attrib.
* - Vertex shader output: one of the values from \c gl_varying_slot.
- * - Fragment shader input: one of the values from \c gl_frag_attrib.
+ * - Fragment shader input: one of the values from \c gl_varying_slot.
* - Fragment shader output: one of the values from \c gl_frag_result.
* - Uniforms: Per-stage uniform slot number for default uniform block.
* - Uniforms: Index within the uniform block definition for UBO members.
/**
* The location which has been assigned for this varying. This is
* expressed in multiples of a float, with the first generic varying
- * (i.e. the one referred to by VARYING_SLOT_VAR0 or FRAG_ATTRIB_VAR0)
- * represented by the value 0.
+ * (i.e. the one referred to by VARYING_SLOT_VAR0) represented by the
+ * value 0.
*/
unsigned generic_location;
} *matches;
if (shaderType == GL_FRAGMENT_SHADER &&
var->mode == ir_var_shader_in) {
switch (var->location) {
- case FRAG_ATTRIB_WPOS:
- case FRAG_ATTRIB_FACE:
- case FRAG_ATTRIB_PNTC:
+ case VARYING_SLOT_POS:
+ case VARYING_SLOT_FACE:
+ case VARYING_SLOT_PNTC:
return false;
default:
return true;
unsigned num_tfeedback_decls,
tfeedback_decl *tfeedback_decls)
{
- /* FINISHME: Set dynamically when geometry shader support is added. */
const unsigned producer_base = VARYING_SLOT_VAR0;
- const unsigned consumer_base = FRAG_ATTRIB_VAR0;
+ const unsigned consumer_base = VARYING_SLOT_VAR0;
varying_matches matches(ctx->Const.DisableVaryingPacking);
hash_table *tfeedback_candidates
= hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
link_invalidate_variable_locations(
prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
- FRAG_ATTRIB_VAR0, FRAG_RESULT_DATA0);
+ VARYING_SLOT_VAR0, FRAG_RESULT_DATA0);
}
/* FINISHME: The value of the max_attribute_index parameter is
break;
case PROGRAM_INPUT:
switch (source->Index) {
- case FRAG_ATTRIB_WPOS:
+ case VARYING_SLOT_POS:
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
break;
- case FRAG_ATTRIB_COL0:
+ case VARYING_SLOT_COL0:
src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
break;
- case FRAG_ATTRIB_COL1:
+ case VARYING_SLOT_COL1:
src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ);
src = swizzle(src, X, Y, Z, ONE);
break;
- case FRAG_ATTRIB_FOGC:
+ case VARYING_SLOT_FOGC:
src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W);
src = swizzle(src, W, ZERO, ZERO, ONE);
break;
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
+ case VARYING_SLOT_TEX0:
+ case VARYING_SLOT_TEX1:
+ case VARYING_SLOT_TEX2:
+ case VARYING_SLOT_TEX3:
+ case VARYING_SLOT_TEX4:
+ case VARYING_SLOT_TEX5:
+ case VARYING_SLOT_TEX6:
+ case VARYING_SLOT_TEX7:
src = i915_emit_decl(p, REG_TYPE_T,
- T_TEX0 + (source->Index - FRAG_ATTRIB_TEX0),
+ T_TEX0 + (source->Index - VARYING_SLOT_TEX0),
D0_CHANNEL_ALL);
break;
- case FRAG_ATTRIB_VAR0:
- case FRAG_ATTRIB_VAR0 + 1:
- case FRAG_ATTRIB_VAR0 + 2:
- case FRAG_ATTRIB_VAR0 + 3:
- case FRAG_ATTRIB_VAR0 + 4:
- case FRAG_ATTRIB_VAR0 + 5:
- case FRAG_ATTRIB_VAR0 + 6:
- case FRAG_ATTRIB_VAR0 + 7:
+ case VARYING_SLOT_VAR0:
+ case VARYING_SLOT_VAR0 + 1:
+ case VARYING_SLOT_VAR0 + 2:
+ case VARYING_SLOT_VAR0 + 3:
+ case VARYING_SLOT_VAR0 + 4:
+ case VARYING_SLOT_VAR0 + 5:
+ case VARYING_SLOT_VAR0 + 6:
+ case VARYING_SLOT_VAR0 + 7:
src = i915_emit_decl(p, REG_TYPE_T,
- T_TEX0 + (source->Index - FRAG_ATTRIB_VAR0),
+ T_TEX0 + (source->Index - VARYING_SLOT_VAR0),
D0_CHANNEL_ALL);
break;
p->wpos_tex = -1;
for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputs & (FRAG_BIT_TEX(i) | FRAG_BIT_VAR(i)))
+ if (inputs & (VARYING_BIT_TEX(i) | VARYING_BIT_VAR(i)))
continue;
- else if (inputs & FRAG_BIT_WPOS) {
+ else if (inputs & VARYING_BIT_POS) {
p->wpos_tex = i;
- inputs &= ~FRAG_BIT_WPOS;
+ inputs &= ~VARYING_BIT_POS;
}
}
- if (inputs & FRAG_BIT_WPOS) {
+ if (inputs & VARYING_BIT_POS) {
i915_program_error(p, "No free texcoord for wpos value");
}
}
intel->coloroffset = 0;
intel->specoffset = 0;
- if (inputsRead & FRAG_BITS_TEX_ANY || p->wpos_tex != -1) {
+ if (inputsRead & VARYING_BITS_TEX_ANY || p->wpos_tex != -1) {
EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16);
}
else {
if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled)
EMIT_ATTR(_TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4);
- if (inputsRead & FRAG_BIT_COL0) {
+ if (inputsRead & VARYING_BIT_COL0) {
intel->coloroffset = offset / 4;
EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4);
}
- if (inputsRead & FRAG_BIT_COL1) {
+ if (inputsRead & VARYING_BIT_COL1) {
intel->specoffset = offset / 4;
EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_4UB_4F_BGRA, S4_VFMT_SPEC_FOG, 4);
}
- if ((inputsRead & FRAG_BIT_FOGC)) {
+ if ((inputsRead & VARYING_BIT_FOGC)) {
EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4);
}
for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputsRead & FRAG_BIT_TEX(i)) {
+ if (inputsRead & VARYING_BIT_TEX(i)) {
int sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
EMIT_ATTR(_TNL_ATTRIB_TEX0 + i, EMIT_SZ(sz), 0, sz * 4);
}
- else if (inputsRead & FRAG_BIT_VAR(i)) {
+ else if (inputsRead & VARYING_BIT_VAR(i)) {
int sz = VB->AttribPtr[_TNL_ATTRIB_GENERIC0 + i]->size;
s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
/* _NEW_POINT */
if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
coord_replace_bits |= (1 << i);
- if (inputsRead & FRAG_BIT_TEX(i))
+ if (inputsRead & VARYING_BIT_TEX(i))
tex_coord_unit_bits |= (1 << i);
}
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps;
const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
- bool have_wpos = (fprog && (fprog->Base.InputsRead & FRAG_BIT_WPOS));
+ bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS));
GLuint index = 0;
if (INTEL_DEBUG & DEBUG_STATE)
emit(FS_OPCODE_LINTERP, wpos,
this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],
this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],
- interp_reg(FRAG_ATTRIB_WPOS, 2));
+ interp_reg(VARYING_SLOT_POS, 2));
}
wpos.reg_offset++;
* attribute, as well as making brw_vs_constval.c
* handle varyings other than gl_TexCoord.
*/
- if (location >= FRAG_ATTRIB_TEX0 &&
- location <= FRAG_ATTRIB_TEX7 &&
+ if (location >= VARYING_SLOT_TEX0 &&
+ location <= VARYING_SLOT_TEX7 &&
k == 3 && !(c->key.proj_attrib_mask
& BITFIELD64_BIT(location))) {
emit(BRW_OPCODE_MOV, attr, fs_reg(1.0f));
void
fs_visitor::calculate_urb_setup()
{
- for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) {
urb_setup[i] = -1;
}
int urb_next = 0;
/* Figure out where each of the incoming setup attributes lands. */
if (intel->gen >= 6) {
- for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) {
if (fp->Base.InputsRead & BITFIELD64_BIT(i)) {
urb_setup[i] = urb_next++;
}
*
* See compile_sf_prog() for more info.
*/
- if (fp->Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_PNTC))
- urb_setup[FRAG_ATTRIB_PNTC] = urb_next++;
+ if (fp->Base.InputsRead & BITFIELD64_BIT(VARYING_SLOT_PNTC))
+ urb_setup[VARYING_SLOT_PNTC] = urb_next++;
}
/* Each attribute is 4 setup channels, each of which is half a reg. */
{
struct intel_context *intel = &brw->intel;
bool uses_depth =
- (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
+ (fp->Base.InputsRead & (1 << VARYING_SLOT_POS)) != 0;
unsigned barycentric_interp_modes = c->prog_data.barycentric_interp_modes;
assert(intel->gen >= 6);
key.proj_attrib_mask = ~(GLbitfield64) 0;
if (intel->gen < 6)
- key.vp_outputs_written |= BITFIELD64_BIT(FRAG_ATTRIB_WPOS);
+ key.vp_outputs_written |= BITFIELD64_BIT(VARYING_SLOT_POS);
- for (int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (int i = 0; i < VARYING_SLOT_MAX; i++) {
if (!(fp->Base.InputsRead & BITFIELD64_BIT(i)))
continue;
}
}
- if (fp->Base.InputsRead & FRAG_BIT_WPOS) {
+ if (fp->Base.InputsRead & VARYING_BIT_POS) {
key.drawable_height = ctx->DrawBuffer->Height;
}
- if ((fp->Base.InputsRead & FRAG_BIT_WPOS) || program_uses_dfdy) {
+ if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
}
int first_non_payload_grf;
/** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
int max_grf;
- int urb_setup[FRAG_ATTRIB_MAX];
+ int urb_setup[VARYING_SLOT_MAX];
fs_reg *fp_temp_regs;
fs_reg *fp_input_regs;
}
}
- fp_input_regs = rzalloc_array(mem_ctx, fs_reg, FRAG_ATTRIB_MAX);
- for (int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ fp_input_regs = rzalloc_array(mem_ctx, fs_reg, VARYING_SLOT_MAX);
+ for (int i = 0; i < VARYING_SLOT_MAX; i++) {
if (fp->Base.InputsRead & BITFIELD64_BIT(i)) {
/* Make up a dummy instruction to reuse code for emitting
* interpolation.
i);
switch (i) {
- case FRAG_ATTRIB_WPOS:
+ case VARYING_SLOT_POS:
ir->pixel_center_integer = fp->PixelCenterInteger;
ir->origin_upper_left = fp->OriginUpperLeft;
fp_input_regs[i] = *emit_fragcoord_interpolation(ir);
break;
- case FRAG_ATTRIB_FACE:
+ case VARYING_SLOT_FACE:
fp_input_regs[i] = *emit_frontfacing_interpolation(ir);
break;
default:
fp_input_regs[i] = *emit_general_interpolation(ir);
- if (i == FRAG_ATTRIB_FOGC) {
+ if (i == VARYING_SLOT_FOGC) {
emit(MOV(regoffset(fp_input_regs[i], 1), fs_reg(0.0f)));
emit(MOV(regoffset(fp_input_regs[i], 2), fs_reg(0.0f)));
emit(MOV(regoffset(fp_input_regs[i], 3), fs_reg(1.0f)));
emit(FS_OPCODE_LINTERP, wpos_w,
this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],
this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC],
- interp_reg(FRAG_ATTRIB_WPOS, 3));
+ interp_reg(VARYING_SLOT_POS, 3));
/* Compute the pixel 1/W value from wpos.w. */
this->pixel_w = fs_reg(this, glsl_type::float_type);
emit_math(SHADER_OPCODE_RCP, this->pixel_w, wpos_w);
key.point_sprite_coord_replace |= (1 << i);
}
}
- if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_PNTC))
+ if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(VARYING_SLOT_PNTC))
key.do_point_coord = 1;
/*
* Window coordinates in a FBO are inverted, which means point
if (ctx->Point.PointSprite) {
for (int i = 0; i < 8; i++) {
if (ctx->Point.CoordReplace[i]) {
- t.size_masks[4-1] |= FRAG_BIT_TEX(i);
- t.size_masks[3-1] |= FRAG_BIT_TEX(i);
- t.size_masks[2-1] |= FRAG_BIT_TEX(i);
- t.size_masks[1-1] |= FRAG_BIT_TEX(i);
+ t.size_masks[4-1] |= VARYING_BIT_TEX(i);
+ t.size_masks[3-1] |= VARYING_BIT_TEX(i);
+ t.size_masks[2-1] |= VARYING_BIT_TEX(i);
+ t.size_masks[1-1] |= VARYING_BIT_TEX(i);
}
}
}
* modes are in use, and set the appropriate bits in
* barycentric_interp_modes.
*/
- for (attr = 0; attr < FRAG_ATTRIB_MAX; ++attr) {
+ for (attr = 0; attr < VARYING_SLOT_MAX; ++attr) {
enum glsl_interp_qualifier interp_qualifier =
fprog->InterpQualifier[attr];
bool is_centroid = fprog->IsCentroid & BITFIELD64_BIT(attr);
- bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1;
+ bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1;
/* Ignore unused inputs. */
if (!(fprog->Base.InputsRead & BITFIELD64_BIT(attr)))
continue;
/* Ignore WPOS and FACE, because they don't require interpolation. */
- if (attr == FRAG_ATTRIB_WPOS || attr == FRAG_ATTRIB_FACE)
+ if (attr == VARYING_SLOT_POS || attr == VARYING_SLOT_FACE)
continue;
/* Determine the set (or sets) of barycentric coordinates needed to
* For DRI2 the origin_x/y will always be (0,0) but we still need the
* drawable height in order to invert the Y axis.
*/
- if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) {
+ if (fp->program.Base.InputsRead & VARYING_BIT_POS) {
key->drawable_height = ctx->DrawBuffer->Height;
}
- if ((fp->program.Base.InputsRead & FRAG_BIT_WPOS) || program_uses_dfdy) {
+ if ((fp->program.Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
key->render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
}
bool kill_stats_promoted_workaround = false;
int lookup = c->key.iz_lookup;
bool uses_depth =
- (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
+ (fp->Base.InputsRead & (1 << VARYING_SLOT_POS)) != 0;
assert(lookup < IZ_BIT_MAX);
/* BRW_NEW_FRAGMENT_PROGRAM */
wm->wm5.program_uses_depth = (fp->Base.InputsRead &
- (1 << FRAG_ATTRIB_WPOS)) != 0;
+ (1 << VARYING_SLOT_POS)) != 0;
wm->wm5.program_computes_depth = (fp->Base.OutputsWritten &
BITFIELD64_BIT(FRAG_RESULT_DEPTH)) != 0;
/* _NEW_BUFFERS
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
int fs_attr, bool two_side_color, uint32_t *max_source_attr)
{
- if (fs_attr == FRAG_ATTRIB_WPOS) {
+ if (fs_attr == VARYING_SLOT_POS) {
/* This attribute will be overwritten by the fragment shader's
* interpolation code (see emit_interp() in brw_wm_fp.c), so just let it
* reference the first available attribute.
int attr = 0, input_index = 0;
int urb_entry_read_offset = 1;
float point_size;
- uint16_t attr_overrides[FRAG_ATTRIB_MAX];
+ uint16_t attr_overrides[VARYING_SLOT_MAX];
uint32_t point_sprite_origin;
dw1 = GEN6_SF_SWIZZLE_ENABLE | num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT;
* they source from.
*/
uint32_t max_source_attr = 0;
- for (; attr < FRAG_ATTRIB_MAX; attr++) {
+ for (; attr < VARYING_SLOT_MAX; attr++) {
enum glsl_interp_qualifier interp_qualifier =
brw->fragment_program->InterpQualifier[attr];
- bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1;
+ bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1;
if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)))
continue;
/* _NEW_POINT */
if (ctx->Point.PointSprite &&
- (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) &&
- ctx->Point.CoordReplace[attr - FRAG_ATTRIB_TEX0]) {
+ (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
+ ctx->Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
dw16 |= (1 << input_index);
}
- if (attr == FRAG_ATTRIB_PNTC)
+ if (attr == VARYING_SLOT_PNTC)
dw16 |= (1 << input_index);
/* flat shading */
&max_source_attr);
}
- for (; input_index < FRAG_ATTRIB_MAX; input_index++)
+ for (; input_index < VARYING_SLOT_MAX; input_index++)
attr_overrides[input_index] = 0;
/* From the Sandy Bridge PRM, Volume 2, Part 1, documentation for
dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE;
/* BRW_NEW_FRAGMENT_PROGRAM */
- if (fp->program.Base.InputsRead & FRAG_BIT_WPOS)
+ if (fp->program.Base.InputsRead & VARYING_BIT_POS)
dw5 |= GEN6_WM_USES_SOURCE_DEPTH | GEN6_WM_USES_SOURCE_W;
if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
dw5 |= GEN6_WM_COMPUTED_DEPTH;
int i;
int attr = 0, input_index = 0;
int urb_entry_read_offset = 1;
- uint16_t attr_overrides[FRAG_ATTRIB_MAX];
+ uint16_t attr_overrides[VARYING_SLOT_MAX];
/* _NEW_BUFFERS */
bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
uint32_t point_sprite_origin;
* they source from.
*/
uint32_t max_source_attr = 0;
- for (; attr < FRAG_ATTRIB_MAX; attr++) {
+ for (; attr < VARYING_SLOT_MAX; attr++) {
enum glsl_interp_qualifier interp_qualifier =
brw->fragment_program->InterpQualifier[attr];
- bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1;
+ bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1;
if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)))
continue;
if (ctx->Point.PointSprite &&
- attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7 &&
- ctx->Point.CoordReplace[attr - FRAG_ATTRIB_TEX0]) {
+ attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7 &&
+ ctx->Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
dw10 |= (1 << input_index);
}
- if (attr == FRAG_ATTRIB_PNTC)
+ if (attr == VARYING_SLOT_PNTC)
dw10 |= (1 << input_index);
/* flat shading */
dw1 |= urb_entry_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
urb_entry_read_offset << GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT;
- for (; input_index < FRAG_ATTRIB_MAX; input_index++)
+ for (; input_index < VARYING_SLOT_MAX; input_index++)
attr_overrides[input_index] = 0;
BEGIN_BATCH(14);
dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE;
/* BRW_NEW_FRAGMENT_PROGRAM */
- if (fp->program.Base.InputsRead & FRAG_BIT_WPOS)
+ if (fp->program.Base.InputsRead & VARYING_BIT_POS)
dw1 |= GEN7_WM_USES_SOURCE_DEPTH | GEN7_WM_USES_SOURCE_W;
if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
writes_depth = true;
vert1->color[0], vert1->color[1],
vert1->color[2], vert1->color[3],
xmesa->pixelformat);
- int x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
- int y0 = YFLIP(xrb, (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]);
- int x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
- int y1 = YFLIP(xrb, (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]);
+ int x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0];
+ int y0 = YFLIP(xrb, (GLint) vert0->attrib[VARYING_SLOT_POS][1]);
+ int x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0];
+ int y1 = YFLIP(xrb, (GLint) vert1->attrib[VARYING_SLOT_POS][1]);
XMesaSetForeground(dpy, gc, pixel);
XMesaSetFunction(dpy, gc, GXxor);
XSetLineAttributes(dpy, gc, (int) ctx->Line.Width,
{
gl_buffer_index bi = BUFFER_FRONT_LEFT;
gl_face_index fi = FACE_POS_X;
- gl_frag_attrib fa = FRAG_ATTRIB_WPOS;
gl_frag_result fr = FRAG_RESULT_DEPTH;
gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX;
gl_vert_attrib va = VERT_ATTRIB_POS;
(void) bi;
(void) fi;
- (void) fa;
(void) fr;
(void) ti;
(void) va;
/* check that we don't exceed the size of various bitfields */
assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
- assert(FRAG_ATTRIB_MAX <=
+ assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield));
}
else if (ctx->RenderMode == GL_FEEDBACK) {
/* _NEW_RENDERMODE */
- fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
+ fp_inputs = (VARYING_BIT_COL0 | VARYING_BIT_TEX0);
}
else if (!(vertexProgram || vertexShader)) {
/* Fixed function vertex logic */
*/
/* _NEW_POINT */
if (ctx->Point.PointSprite)
- varying_inputs |= FRAG_BITS_TEX_ANY;
+ varying_inputs |= VARYING_BITS_TEX_ANY;
/* First look at what values may be computed by the generated
* vertex program:
*/
/* _NEW_LIGHT */
if (ctx->Light.Enabled) {
- fp_inputs |= FRAG_BIT_COL0;
+ fp_inputs |= VARYING_BIT_COL0;
if (texenv_doing_secondary_color(ctx))
- fp_inputs |= FRAG_BIT_COL1;
+ fp_inputs |= VARYING_BIT_COL1;
}
/* _NEW_TEXTURE */
fp_inputs |= (ctx->Texture._TexGenEnabled |
- ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0;
+ ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0;
/* Then look at what might be varying as a result of enabled
* arrays, etc:
*/
if (varying_inputs & VERT_BIT_COLOR0)
- fp_inputs |= FRAG_BIT_COL0;
+ fp_inputs |= VARYING_BIT_COL0;
if (varying_inputs & VERT_BIT_COLOR1)
- fp_inputs |= FRAG_BIT_COL1;
+ fp_inputs |= VARYING_BIT_COL1;
fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0)
- << FRAG_ATTRIB_TEX0);
+ << VARYING_SLOT_TEX0);
}
else {
*/
/* _NEW_POINT */
if (ctx->Point.PointSprite)
- vp_outputs |= FRAG_BITS_TEX_ANY;
+ vp_outputs |= VARYING_BITS_TEX_ANY;
if (vp_outputs & (1 << VARYING_SLOT_COL0))
- fp_inputs |= FRAG_BIT_COL0;
+ fp_inputs |= VARYING_BIT_COL0;
if (vp_outputs & (1 << VARYING_SLOT_COL1))
- fp_inputs |= FRAG_BIT_COL1;
+ fp_inputs |= VARYING_BIT_COL1;
fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0)
- << FRAG_ATTRIB_TEX0);
+ << VARYING_SLOT_TEX0);
}
return fp_inputs;
static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
{
GLuint i, j;
- GLbitfield inputs_referenced = FRAG_BIT_COL0;
+ GLbitfield inputs_referenced = VARYING_BIT_COL0;
const GLbitfield inputs_available = get_fp_input_mask( ctx );
GLuint keySize;
key->unit[i].enabled = 1;
key->enabled_units |= (1<<i);
key->nr_enabled_units = i + 1;
- inputs_referenced |= FRAG_BIT_TEX(i);
+ inputs_referenced |= VARYING_BIT_TEX(i);
key->unit[i].source_index =
translate_tex_src_bit(texUnit->_ReallyEnabled);
/* _NEW_LIGHT | _NEW_FOG */
if (texenv_doing_secondary_color(ctx)) {
key->separate_specular = 1;
- inputs_referenced |= FRAG_BIT_COL1;
+ inputs_referenced |= VARYING_BIT_COL1;
}
/* _NEW_FOG */
if (ctx->Fog.Enabled) {
key->fog_enabled = 1;
key->fog_mode = translate_fog_mode(ctx->Fog.Mode);
- inputs_referenced |= FRAG_BIT_FOGC; /* maybe */
+ inputs_referenced |= VARYING_BIT_FOGC; /* maybe */
}
/* _NEW_BUFFERS */
static ir_rvalue *
get_gl_Color(texenv_fragment_program *p)
{
- if (p->state->inputs_available & FRAG_BIT_COL0) {
+ if (p->state->inputs_available & VARYING_BIT_COL0) {
ir_variable *var = p->shader->symbols->get_variable("gl_Color");
assert(var);
return new(p->mem_ctx) ir_dereference_variable(var);
const GLuint texTarget = p->state->unit[unit].source_index;
ir_rvalue *texcoord;
- if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) {
+ if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) {
texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit);
} else if (p->texcoord_tex[unit]) {
texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]);
p->emit(assign(spec_result, cf));
ir_rvalue *secondary;
- if (p->state->inputs_available & FRAG_BIT_COL1) {
+ if (p->state->inputs_available & VARYING_BIT_COL1) {
ir_variable *var =
p->shader->symbols->get_variable("gl_SecondaryColor");
assert(var);
if (ctx->RenderMode == GL_FEEDBACK) {
/* make sure the vertprog emits color and tex0 */
- key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
+ key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0);
}
key->separate_specular = (ctx->Light.Model.ColorControl ==
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
- if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
+ if (!(p->state->fragprog_inputs_read & VARYING_BIT_TEX(i)))
continue;
if (p->state->unit[i].coord_replace)
/* Lighting calculations:
*/
- if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) {
+ if (p->state->fragprog_inputs_read & (VARYING_BIT_COL0|VARYING_BIT_COL1)) {
if (p->state->light_global_enabled)
build_lighting(p);
else {
- if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
+ if (p->state->fragprog_inputs_read & VARYING_BIT_COL0)
emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0);
- if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
+ if (p->state->fragprog_inputs_read & VARYING_BIT_COL1)
emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1);
}
}
- if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC)
+ if (p->state->fragprog_inputs_read & VARYING_BIT_FOGC)
build_fog(p);
- if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
+ if (p->state->fragprog_inputs_read & VARYING_BITS_TEX_ANY)
build_texture_transform(p);
if (p->state->point_attenuated)
/*********************************************/
-/**
- * Indexes for fragment program input attributes.
- */
-typedef enum
-{
- FRAG_ATTRIB_WPOS = VARYING_SLOT_POS,
- FRAG_ATTRIB_COL0 = VARYING_SLOT_COL0,
- FRAG_ATTRIB_COL1 = VARYING_SLOT_COL1,
- FRAG_ATTRIB_FOGC = VARYING_SLOT_FOGC,
- FRAG_ATTRIB_TEX0 = VARYING_SLOT_TEX0,
- FRAG_ATTRIB_TEX1 = VARYING_SLOT_TEX1,
- FRAG_ATTRIB_TEX2 = VARYING_SLOT_TEX2,
- FRAG_ATTRIB_TEX3 = VARYING_SLOT_TEX3,
- FRAG_ATTRIB_TEX4 = VARYING_SLOT_TEX4,
- FRAG_ATTRIB_TEX5 = VARYING_SLOT_TEX5,
- FRAG_ATTRIB_TEX6 = VARYING_SLOT_TEX6,
- FRAG_ATTRIB_TEX7 = VARYING_SLOT_TEX7,
- FRAG_ATTRIB_FACE = VARYING_SLOT_FACE, /**< front/back face */
- FRAG_ATTRIB_PNTC = VARYING_SLOT_PNTC, /**< sprite/point coord */
- FRAG_ATTRIB_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0,
- FRAG_ATTRIB_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1,
- FRAG_ATTRIB_VAR0 = VARYING_SLOT_VAR0, /**< shader varying */
- FRAG_ATTRIB_MAX = VARYING_SLOT_MAX
-} gl_frag_attrib;
-
-
/**
* Determine if the given gl_varying_slot appears in the fragment shader.
*/
}
-/**
- * Bitflags for fragment program input attributes.
- */
-/*@{*/
-#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
-#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
-#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
-#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
-#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE)
-#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC)
-#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
-#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
-#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
-#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
-#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
-#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
-#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
-#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
-#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0)
-
-#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U))
-#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V))
-
-#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
- FRAG_BIT_TEX1| \
- FRAG_BIT_TEX2| \
- FRAG_BIT_TEX3| \
- FRAG_BIT_TEX4| \
- FRAG_BIT_TEX5| \
- FRAG_BIT_TEX6| \
- FRAG_BIT_TEX7)
-/*@}*/
-
-
/**
* Fragment program results
*/
* For inputs that do not have an interpolation qualifier specified in
* GLSL, the value is INTERP_QUALIFIER_NONE.
*/
- enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX];
+ enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX];
/**
* Bitfield indicating, for each fragment shader input, 1 if that input
if (ctx->FragmentProgram._Current &&
(ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
- (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1))
+ (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1))
return GL_TRUE;
return GL_FALSE;
if (fprog) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits
- = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
+ = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask;
}
else {
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
explicit src_reg(dst_reg reg);
gl_register_file file; /**< PROGRAM_* from Mesa */
- int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */
+ int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */
GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */
int negate; /**< NEGATE_XYZW mask from mesa */
/** Register index should be offset by the integer in this reg. */
explicit dst_reg(src_reg reg);
gl_register_file file; /**< PROGRAM_* from Mesa */
- int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */
+ int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */
int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
GLuint cond_mask:4;
/** Register index should be offset by the integer in this reg. */
return machine->VertAttribs[reg];
}
else {
- if (reg >= FRAG_ATTRIB_MAX)
+ if (reg >= VARYING_SLOT_MAX)
return ZeroVec;
return machine->Attribs[reg][machine->CurElement];
}
if (source->File == PROGRAM_INPUT &&
source->Index < (GLint) machine->NumDeriv) {
const GLint col = machine->CurElement;
- const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3];
+ const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3];
const GLfloat invQ = 1.0f / w;
GLfloat deriv[4];
*/
if (machine->NumDeriv > 0 &&
inst->SrcReg[0].File == PROGRAM_INPUT &&
- inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) {
+ inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) {
/* simple texture fetch for which we should have derivatives */
GLuint attr = inst->SrcReg[0].Index;
machine->FetchTexelDeriv(ctx, texcoord,
arb_input_attrib_string(GLint index, GLenum progType)
{
/*
- * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens.
+ * These strings should match the VERT_ATTRIB_x and VARYING_SLOT_x tokens.
*/
static const char *const vertAttribs[] = {
"vertex.position",
"fragment.(fourteen)", /* VARYING_SLOT_BFC1 */
"fragment.(fifteen)", /* VARYING_SLOT_EDGE */
"fragment.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */
- "fragment.(seventeen)", /* FRAG_ATTRIB_CLIP_DIST0 */
- "fragment.(eighteen)", /* FRAG_ATTRIB_CLIP_DIST1 */
+ "fragment.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */
+ "fragment.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */
"fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
"fragment.(twenty)", /* VARYING_SLOT_LAYER */
- "fragment.(twenty-one)", /* FRAG_ATTRIB_FACE */
- "fragment.(twenty-two)", /* FRAG_ATTRIB_PNTC */
+ "fragment.(twenty-one)", /* VARYING_SLOT_FACE */
+ "fragment.(twenty-two)", /* VARYING_SLOT_PNTC */
"fragment.varying[0]",
"fragment.varying[1]",
"fragment.varying[2]",
/* sanity checks */
STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX);
- STATIC_ASSERT(Elements(fragAttribs) == FRAG_ATTRIB_MAX);
+ STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX);
assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0);
assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0);
- assert(strcmp(fragAttribs[FRAG_ATTRIB_TEX0], "fragment.texcoord[0]") == 0);
- assert(strcmp(fragAttribs[FRAG_ATTRIB_VAR0+15], "fragment.varying[15]") == 0);
+ assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0);
+ assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
assert(index < Elements(vertAttribs));
* of progB_colorFile/progB_colorIndex below...
*/
progB_colorFile = PROGRAM_INPUT;
- progB_colorIndex = FRAG_ATTRIB_COL0;
+ progB_colorIndex = VARYING_SLOT_COL0;
/*
* The fragment program may get color from a state var rather than
p->StateIndexes[0] == STATE_INTERNAL &&
p->StateIndexes[1] == STATE_CURRENT_ATTRIB &&
(int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) {
- progB_inputsRead |= FRAG_BIT_COL0;
+ progB_inputsRead |= VARYING_BIT_COL0;
progB_colorFile = PROGRAM_STATE_VAR;
progB_colorIndex = i;
break;
* new temporary register.
*/
if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) &&
- (progB_inputsRead & FRAG_BIT_COL0)) {
+ (progB_inputsRead & VARYING_BIT_COL0)) {
GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS,
firstTemp);
if (tempReg < 0) {
/* compute combined program's InputsRead */
inputsB = progB_inputsRead;
if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
- inputsB &= ~(1 << FRAG_ATTRIB_COL0);
+ inputsB &= ~(1 << VARYING_SLOT_COL0);
}
newProg->InputsRead = progA->InputsRead | inputsB;
newProg->OutputsWritten = progB->OutputsWritten;
case MESA_SHADER_VERTEX:
return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs;
case MESA_SHADER_FRAGMENT:
- return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying;
+ return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying;
case MESA_SHADER_GEOMETRY:
return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying;
default:
fragAttribItem: POSITION
{
- $$ = FRAG_ATTRIB_WPOS;
+ $$ = VARYING_SLOT_POS;
}
| COLOR optColorType
{
- $$ = FRAG_ATTRIB_COL0 + $2;
+ $$ = VARYING_SLOT_COL0 + $2;
}
| FOGCOORD
{
- $$ = FRAG_ATTRIB_FOGC;
+ $$ = VARYING_SLOT_FOGC;
}
| TEXCOORD optTexCoordUnitNum
{
- $$ = FRAG_ATTRIB_TEX0 + $2;
+ $$ = VARYING_SLOT_TEX0 + $2;
}
;
* \param saturate True if writes to color outputs should be clamped to [0, 1]
*
* \note
- * This function sets \c FRAG_BIT_FOGC in \c fprog->Base.InputsRead.
+ * This function sets \c VARYING_BIT_FOGC in \c fprog->Base.InputsRead.
*
* \todo With a little work, this function could be adapted to add fog code
* to vertex programs too.
inst->DstReg.Index = fogFactorTemp;
inst->DstReg.WriteMask = WRITEMASK_X;
inst->SrcReg[0].File = PROGRAM_INPUT;
- inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC;
+ inst->SrcReg[0].Index = VARYING_SLOT_FOGC;
inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
inst->SrcReg[1].File = PROGRAM_STATE_VAR;
inst->SrcReg[1].Index = fogPRefOpt;
inst->SrcReg[0].Swizzle
= (fog_mode == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW;
inst->SrcReg[1].File = PROGRAM_INPUT;
- inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC;
+ inst->SrcReg[1].Index = VARYING_SLOT_FOGC;
inst->SrcReg[1].Swizzle = SWIZZLE_XXXX;
inst++;
if (fog_mode == GL_EXP2) {
/* install new instructions */
fprog->Base.Instructions = newInst;
fprog->Base.NumInstructions = inst - newInst;
- fprog->Base.InputsRead |= FRAG_BIT_FOGC;
+ fprog->Base.InputsRead |= VARYING_BIT_FOGC;
assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR));
}
inst[0].DstReg.File = PROGRAM_OUTPUT;
inst[0].DstReg.Index = FRAG_RESULT_COLOR;
inst[0].SrcReg[0].File = PROGRAM_INPUT;
- if (prog->Base.InputsRead & FRAG_BIT_COL0)
- inputAttr = FRAG_ATTRIB_COL0;
+ if (prog->Base.InputsRead & VARYING_BIT_COL0)
+ inputAttr = VARYING_SLOT_COL0;
else
- inputAttr = FRAG_ATTRIB_TEX0;
+ inputAttr = VARYING_SLOT_TEX0;
inst[0].SrcReg[0].Index = inputAttr;
inst[1].Opcode = OPCODE_END;
inst[ic].DstReg.File = PROGRAM_TEMPORARY;
inst[ic].DstReg.Index = colorTemp;
inst[ic].SrcReg[0].File = PROGRAM_INPUT;
- inst[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ inst[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
inst[ic].TexSrcUnit = 0;
inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
- fp->Base.InputsRead = BITFIELD64_BIT(FRAG_ATTRIB_TEX0);
+ fp->Base.InputsRead = BITFIELD64_BIT(VARYING_SLOT_TEX0);
fp->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
raster->sprite_coord_enable |= 1 << i;
}
}
- if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) {
+ if (fragProg->Base.InputsRead & VARYING_BIT_PNTC) {
raster->sprite_coord_enable |=
- 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0);
+ 1 << (VARYING_SLOT_PNTC - VARYING_SLOT_TEX0);
}
raster->point_quad_rasterization = 1;
p->Instructions[ic].DstReg.File = PROGRAM_TEMPORARY;
p->Instructions[ic].DstReg.Index = 0;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
p->Instructions[ic].TexSrcUnit = samplerIndex;
p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
assert(ic == p->NumInstructions);
- p->InputsRead = FRAG_BIT_TEX0;
+ p->InputsRead = VARYING_BIT_TEX0;
p->OutputsWritten = 0x0;
p->SamplersUsed = (1 << samplerIndex);
inst[0].DstReg.Index == FRAG_RESULT_COLOR &&
inst[0].DstReg.WriteMask == WRITEMASK_XYZW &&
inst[0].SrcReg[0].File == PROGRAM_INPUT &&
- inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 &&
+ inst[0].SrcReg[0].Index == VARYING_SLOT_COL0 &&
inst[0].SrcReg[0].Swizzle == SWIZZLE_XYZW) {
return GL_TRUE;
}
p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
p->Instructions[ic].TexSrcUnit = 0;
p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
+ p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_COL0;
ic++;
}
p->Instructions[ic].DstReg.Index = FRAG_RESULT_STENCIL;
p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Y;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
p->Instructions[ic].TexSrcUnit = 1;
p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
assert(ic == p->NumInstructions);
- p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
+ p->InputsRead = VARYING_BIT_TEX0 | VARYING_BIT_COL0;
p->OutputsWritten = 0;
if (write_depth) {
p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH);
st_validate_state(st);
/* determine if we need vertex color */
- if (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL0)
+ if (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL0)
emitColor = GL_TRUE;
else
emitColor = GL_FALSE;
explicit st_src_reg(st_dst_reg reg);
gl_register_file file; /**< PROGRAM_* from Mesa */
- int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */
+ int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */
int index2D;
GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */
int negate; /**< NEGATE_XYZW mask from mesa */
explicit st_dst_reg(st_src_reg reg);
gl_register_file file; /**< PROGRAM_* from Mesa */
- int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */
+ int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */
int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
GLuint cond_mask:4;
int type; /** GLSL_TYPE_* from GLSL IR (enum glsl_base_type) */
* Get initial pixel color from the texture.
* TEX colorTemp, fragment.texcoord[0], texture[0], 2D;
*/
- coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type);
+ coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type);
src0 = v->get_temp(glsl_type::vec4_type);
dst0 = st_dst_reg(src0);
inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord);
inst->sampler = 0;
inst->tex_target = TEXTURE_2D_INDEX;
- prog->InputsRead |= FRAG_BIT_TEX0;
+ prog->InputsRead |= VARYING_BIT_TEX0;
prog->SamplersUsed |= (1 << 0); /* mark sampler 0 as used */
v->samplers_used |= (1 << 0);
for (int i=0; i<3; i++) {
src_regs[i] = inst->src[i];
if (src_regs[i].file == PROGRAM_INPUT &&
- src_regs[i].index == FRAG_ATTRIB_COL0)
+ src_regs[i].index == VARYING_SLOT_COL0)
{
src_regs[i].file = PROGRAM_TEMPORARY;
src_regs[i].index = src0.index;
v->num_immediates = original->num_immediates;
/* TEX tmp0, fragment.texcoord[0], texture[0], 2D; */
- coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type);
+ coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type);
src0 = v->get_temp(glsl_type::vec4_type);
dst0 = st_dst_reg(src0);
inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord);
inst->sampler = samplerIndex;
inst->tex_target = TEXTURE_2D_INDEX;
- prog->InputsRead |= FRAG_BIT_TEX0;
+ prog->InputsRead |= VARYING_BIT_TEX0;
prog->SamplersUsed |= (1 << samplerIndex); /* mark sampler as used */
v->samplers_used |= (1 << samplerIndex);
struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst );
struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg );
- struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
+ struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]];
/* First, apply the coordinate shift: */
if (adjX || adjY[0] || adjY[1]) {
/* Use wpos_temp as position input from here on:
*/
- t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
+ t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp);
}
{
struct ureg_program *ureg = t->ureg;
struct ureg_dst face_temp = ureg_DECL_temporary(ureg);
- struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]];
+ struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]];
/* MOV_SAT face_temp, input[face] */
face_temp = ureg_saturate(face_temp);
ureg_MOV(ureg, face_temp, face_input);
/* Use face_temp as face input from here on: */
- t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp);
+ t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp);
}
static void
is_centroid[i]);
}
- if (proginfo->InputsRead & FRAG_BIT_WPOS) {
+ if (proginfo->InputsRead & VARYING_BIT_POS) {
/* Must do this after setting up t->inputs, and before
* emitting constant references, below:
*/
emit_wpos(st_context(ctx), t, proginfo, ureg);
}
- if (proginfo->InputsRead & FRAG_BIT_FACE)
+ if (proginfo->InputsRead & VARYING_BIT_FACE)
emit_face_var(t);
/*
struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst );
struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg );
- struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
+ struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]];
/* First, apply the coordinate shift: */
if (adjX || adjY[0] || adjY[1]) {
/* Use wpos_temp as position input from here on:
*/
- t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
+ t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp);
}
{
struct ureg_program *ureg = t->ureg;
struct ureg_dst face_temp = ureg_DECL_temporary( ureg );
- struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]];
+ struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]];
/* MOV_SAT face_temp, input[face]
*/
/* Use face_temp as face input from here on:
*/
- t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp);
+ t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp);
}
interpMode[i]);
}
- if (program->InputsRead & FRAG_BIT_WPOS) {
+ if (program->InputsRead & VARYING_BIT_POS) {
/* Must do this after setting up t->inputs, and before
* emitting constant references, below:
*/
emit_wpos(st_context(ctx), t, program, ureg);
}
- if (program->InputsRead & FRAG_BIT_FACE) {
+ if (program->InputsRead & VARYING_BIT_FACE) {
emit_face_var( t, program );
}
default:
assert(attr < VARYING_SLOT_MAX);
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 -
- FRAG_ATTRIB_TEX0 +
+ stvp->output_semantic_index[slot] = (VARYING_SLOT_VAR0 -
+ VARYING_SLOT_TEX0 +
attr -
VARYING_SLOT_VAR0);
break;
GLboolean deleteFP = GL_FALSE;
GLuint outputMapping[FRAG_RESULT_MAX];
- GLuint inputMapping[FRAG_ATTRIB_MAX];
+ GLuint inputMapping[VARYING_SLOT_MAX];
GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
GLuint attr;
GLbitfield64 inputsRead;
* Convert Mesa program inputs to TGSI input register semantics.
*/
inputsRead = stfp->Base.Base.InputsRead;
- for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
+ for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = fs_num_inputs++;
is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0;
switch (attr) {
- case FRAG_ATTRIB_WPOS:
+ case VARYING_SLOT_POS:
input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
break;
- case FRAG_ATTRIB_COL0:
+ case VARYING_SLOT_COL0:
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
input_semantic_index[slot] = 0;
interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
TRUE);
break;
- case FRAG_ATTRIB_COL1:
+ case VARYING_SLOT_COL1:
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
input_semantic_index[slot] = 1;
interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
TRUE);
break;
- case FRAG_ATTRIB_FOGC:
+ case VARYING_SLOT_FOGC:
input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
- case FRAG_ATTRIB_FACE:
+ case VARYING_SLOT_FACE:
input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
break;
- case FRAG_ATTRIB_CLIP_DIST0:
+ case VARYING_SLOT_CLIP_DIST0:
input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
- case FRAG_ATTRIB_CLIP_DIST1:
+ case VARYING_SLOT_CLIP_DIST1:
input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
input_semantic_index[slot] = 1;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
/* In most cases, there is nothing special about these
* inputs, so adopt a convention to use the generic
- * semantic name and the mesa FRAG_ATTRIB_ number as the
+ * semantic name and the mesa VARYING_SLOT_ number as the
* index.
*
* All that is required is that the vertex shader labels
* zero or be restricted to a particular range -- nobody
* should be building tables based on semantic index.
*/
- case FRAG_ATTRIB_PNTC:
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
- case FRAG_ATTRIB_VAR0:
+ case VARYING_SLOT_PNTC:
+ case VARYING_SLOT_TEX0:
+ case VARYING_SLOT_TEX1:
+ case VARYING_SLOT_TEX2:
+ case VARYING_SLOT_TEX3:
+ case VARYING_SLOT_TEX4:
+ case VARYING_SLOT_TEX5:
+ case VARYING_SLOT_TEX6:
+ case VARYING_SLOT_TEX7:
+ case VARYING_SLOT_VAR0:
default:
/* Actually, let's try and zero-base this just for
* readability of the generated TGSI.
*/
- assert(attr >= FRAG_ATTRIB_TEX0);
- input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
+ assert(attr >= VARYING_SLOT_TEX0);
+ input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0);
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- if (attr == FRAG_ATTRIB_PNTC)
+ if (attr == VARYING_SLOT_PNTC)
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
else
interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4];
/* DO_ATTRIBS */
GLfloat wPlane[4];
- GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4];
- GLfloat lambda[FRAG_ATTRIB_MAX];
- GLfloat texWidth[FRAG_ATTRIB_MAX];
- GLfloat texHeight[FRAG_ATTRIB_MAX];
+ GLfloat attrPlane[VARYING_SLOT_MAX][4][4];
+ GLfloat lambda[VARYING_SLOT_MAX];
+ GLfloat texWidth[VARYING_SLOT_MAX];
+ GLfloat texHeight[VARYING_SLOT_MAX];
SWspan span;
};
#if defined(DO_ATTRIBS)
ATTRIB_LOOP_BEGIN
GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
- if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0
+ if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0
&& !_swrast_use_fragment_program(ctx)) {
/* texcoord w/ divide by Q */
- const GLuint unit = attr - FRAG_ATTRIB_TEX0;
+ const GLuint unit = attr - VARYING_SLOT_TEX0;
const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]);
GLuint c;
for (c = 0; c < 3; c++) {
/* Init the LineInfo struct */
struct LineInfo line;
- line.x0 = v0->attrib[FRAG_ATTRIB_WPOS][0];
- line.y0 = v0->attrib[FRAG_ATTRIB_WPOS][1];
- line.x1 = v1->attrib[FRAG_ATTRIB_WPOS][0];
- line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1];
+ line.x0 = v0->attrib[VARYING_SLOT_POS][0];
+ line.y0 = v0->attrib[VARYING_SLOT_POS][1];
+ line.x1 = v1->attrib[VARYING_SLOT_POS][0];
+ line.y1 = v1->attrib[VARYING_SLOT_POS][1];
line.dx = line.x1 - line.x0;
line.dy = line.y1 - line.y0;
line.len = sqrtf(line.dx * line.dx + line.dy * line.dy);
#ifdef DO_Z
line.span.arrayMask |= SPAN_Z;
compute_plane(line.x0, line.y0, line.x1, line.y1,
- v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane);
+ v0->attrib[VARYING_SLOT_POS][2], v1->attrib[VARYING_SLOT_POS][2], line.zPlane);
#endif
line.span.arrayMask |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
}
#if defined(DO_ATTRIBS)
{
- const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3];
+ const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3];
+ const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3];
line.span.arrayMask |= SPAN_LAMBDA;
compute_plane(line.x0, line.y0, line.x1, line.y1, invW0, invW1, line.wPlane);
ATTRIB_LOOP_BEGIN
}
}
line.span.arrayAttribs |= BITFIELD64_BIT(attr);
- if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) {
- const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) {
+ const GLuint u = attr - VARYING_SLOT_TEX0;
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
line.texWidth[attr] = (GLfloat) texImage->Width;
/*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *p1 = v1->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *p2 = v2->attrib[FRAG_ATTRIB_WPOS];
+ const GLfloat *p0 = v0->attrib[VARYING_SLOT_POS];
+ const GLfloat *p1 = v1->attrib[VARYING_SLOT_POS];
+ const GLfloat *p2 = v2->attrib[VARYING_SLOT_POS];
const SWvertex *vMin, *vMid, *vMax;
GLint iyMin, iyMax;
GLfloat yMin, yMax;
#endif
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4];
#if defined(DO_ATTRIBS)
- GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4];
+ GLfloat attrPlane[VARYING_SLOT_MAX][4][4];
GLfloat wPlane[4]; /* win[3] */
#endif
GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
/* determine bottom to top order of vertices */
{
- GLfloat y0 = v0->attrib[FRAG_ATTRIB_WPOS][1];
- GLfloat y1 = v1->attrib[FRAG_ATTRIB_WPOS][1];
- GLfloat y2 = v2->attrib[FRAG_ATTRIB_WPOS][1];
+ GLfloat y0 = v0->attrib[VARYING_SLOT_POS][1];
+ GLfloat y1 = v1->attrib[VARYING_SLOT_POS][1];
+ GLfloat y2 = v2->attrib[VARYING_SLOT_POS][1];
if (y0 <= y1) {
if (y1 <= y2) {
vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */
}
}
- majDx = vMax->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0];
- majDy = vMax->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1];
+ majDx = vMax->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0];
+ majDy = vMax->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1];
/* front/back-face determination and cullling */
{
- const GLfloat botDx = vMid->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0];
- const GLfloat botDy = vMid->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1];
+ const GLfloat botDx = vMid->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0];
+ const GLfloat botDy = vMid->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1];
const GLfloat area = majDx * botDy - botDx * majDy;
/* Do backface culling */
if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area))
span.arrayMask |= SPAN_RGBA;
#if defined(DO_ATTRIBS)
{
- const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat invW2 = v2->attrib[FRAG_ATTRIB_WPOS][3];
+ const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3];
+ const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3];
+ const GLfloat invW2 = v2->attrib[VARYING_SLOT_POS][3];
compute_plane(p0, p1, p2, invW0, invW1, invW2, wPlane);
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = plane_dx(wPlane);
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = plane_dy(wPlane);
+ span.attrStepX[VARYING_SLOT_POS][3] = plane_dx(wPlane);
+ span.attrStepY[VARYING_SLOT_POS][3] = plane_dy(wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
if (swrast->_InterpMode[attr] == GL_FLAT) {
* edges, stopping when we find that coverage = 0. If the long edge
* is on the left we scan left-to-right. Else, we scan right-to-left.
*/
- yMin = vMin->attrib[FRAG_ATTRIB_WPOS][1];
- yMax = vMax->attrib[FRAG_ATTRIB_WPOS][1];
+ yMin = vMin->attrib[VARYING_SLOT_POS][1];
+ yMax = vMax->attrib[VARYING_SLOT_POS][1];
iyMin = (GLint) yMin;
iyMax = (GLint) yMax + 1;
if (ltor) {
/* scan left to right */
- const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS];
+ const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS];
+ const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS];
+ const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS];
const GLfloat dxdy = majDx / majDy;
const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F;
GLint iy;
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
+ span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
}
else {
/* scan right to left */
- const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS];
- const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS];
+ const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS];
+ const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS];
+ const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS];
const GLfloat dxdy = majDx / majDy;
const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F;
GLint iy;
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane);
+ span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
ALPHA_TEST(rgba[i][ACOMP], ;);
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
const GLfloat ref = ctx->Color.AlphaRef;
ALPHA_TEST(rgba[i][ACOMP], ;);
}
if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
pass_tex -= GL_TEXTURE0_ARB;
COPY_4V(machine->Registers[idx],
- span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]);
+ span->array->attribs[VARYING_SLOT_TEX0 + pass_tex][column]);
}
else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
pass_tex -= GL_REG_0_ATI;
if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
coord_source -= GL_TEXTURE0_ARB;
COPY_4V(tex_coords,
- span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]);
+ span->array->attribs[VARYING_SLOT_TEX0 + coord_source][column]);
}
else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
coord_source -= GL_REG_0_ATI;
machine->Registers[i][j] = 0.0;
}
- COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]);
- COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[VARYING_SLOT_COL0][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[VARYING_SLOT_COL1][col]);
}
const GLfloat *colOut = machine.Registers[0];
/*fprintf(stderr,"outputs %f %f %f %f\n",
colOut[0], colOut[1], colOut[2], colOut[3]); */
- COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut);
+ COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], colOut);
}
}
}
if (_swrast_use_fragment_program(ctx)) {
/* fragment program/shader */
attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
- attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */
+ attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
}
else if (ctx->ATIFragmentShader._Enabled) {
attribsMask = ~0; /* XXX fix me */
attribsMask = 0x0;
#if CHAN_TYPE == GL_FLOAT
- attribsMask |= FRAG_BIT_COL0;
+ attribsMask |= VARYING_BIT_COL0;
#endif
if (ctx->Fog.ColorSumEnabled ||
(ctx->Light.Enabled &&
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
- attribsMask |= FRAG_BIT_COL1;
+ attribsMask |= VARYING_BIT_COL1;
}
if (swrast->_FogEnabled)
- attribsMask |= FRAG_BIT_FOGC;
+ attribsMask |= VARYING_BIT_FOGC;
- attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
+ attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0);
}
swrast->_ActiveAttribMask = attribsMask;
/* Update _ActiveAttribs[] list */
{
GLuint i, num = 0;
- for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
if (attribsMask & BITFIELD64_BIT(i)) {
swrast->_ActiveAttribs[num++] = i;
/* how should this attribute be interpolated? */
- if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
+ if (i == VARYING_SLOT_COL0 || i == VARYING_SLOT_COL1)
swrast->_InterpMode[i] = ctx->Light.ShadeModel;
else
swrast->_InterpMode[i] = GL_SMOOTH;
#elif CHAN_TYPE == GL_UNSIGNED_SHORT
swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].rgba16;
#else
- swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[FRAG_ATTRIB_COL0];
+ swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[VARYING_SLOT_COL0];
#endif
}
if (SWRAST_DEBUG_VERTICES) {
_mesa_debug(ctx, "win %f %f %f %f\n",
- v->attrib[FRAG_ATTRIB_WPOS][0],
- v->attrib[FRAG_ATTRIB_WPOS][1],
- v->attrib[FRAG_ATTRIB_WPOS][2],
- v->attrib[FRAG_ATTRIB_WPOS][3]);
+ v->attrib[VARYING_SLOT_POS][0],
+ v->attrib[VARYING_SLOT_POS][1],
+ v->attrib[VARYING_SLOT_POS][2],
+ v->attrib[VARYING_SLOT_POS][3]);
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Texture.Unit[i]._ReallyEnabled)
_mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
- v->attrib[FRAG_ATTRIB_TEX0 + i][0],
- v->attrib[FRAG_ATTRIB_TEX0 + i][1],
- v->attrib[FRAG_ATTRIB_TEX0 + i][2],
- v->attrib[FRAG_ATTRIB_TEX0 + i][3]);
+ v->attrib[VARYING_SLOT_TEX0 + i][0],
+ v->attrib[VARYING_SLOT_TEX0 + i][1],
+ v->attrib[VARYING_SLOT_TEX0 + i][2],
+ v->attrib[VARYING_SLOT_TEX0 + i][3]);
#if CHAN_TYPE == GL_FLOAT
_mesa_debug(ctx, "color %f %f %f %f\n",
v->color[0], v->color[1], v->color[2], v->color[3]);
#endif
_mesa_debug(ctx, "spec %g %g %g %g\n",
- v->attrib[FRAG_ATTRIB_COL1][0],
- v->attrib[FRAG_ATTRIB_COL1][1],
- v->attrib[FRAG_ATTRIB_COL1][2],
- v->attrib[FRAG_ATTRIB_COL1][3]);
- _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
- _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
+ v->attrib[VARYING_SLOT_COL1][0],
+ v->attrib[VARYING_SLOT_COL1][1],
+ v->attrib[VARYING_SLOT_COL1][2],
+ v->attrib[VARYING_SLOT_COL1][3]);
+ _mesa_debug(ctx, "fog %f\n", v->attrib[VARYING_SLOT_FOGC][0]);
+ _mesa_debug(ctx, "index %f\n", v->attrib[VARYING_SLOT_CI][0]);
_mesa_debug(ctx, "pointsize %f\n", v->pointSize);
_mesa_debug(ctx, "\n");
}
GLboolean _DeferredTexture;
/** List/array of the fragment attributes to interpolate */
- GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
- /** Same info, but as a bitmask of FRAG_BIT_x bits */
+ GLuint _ActiveAttribs[VARYING_SLOT_MAX];
+ /** Same info, but as a bitmask of VARYING_BIT_x bits */
GLbitfield64 _ActiveAttribMask;
/** Number of fragment attributes to interpolate */
GLuint _NumActiveAttribs;
/** Indicates how each attrib is to be interpolated (lines/tris) */
- GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */
+ GLenum _InterpMode[VARYING_SLOT_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */
/* Working values:
*/
INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
span.arrayMask = SPAN_RGBA;
- span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
+ span.arrayAttribs = VARYING_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
tmpImage = malloc(width * height * sizeof(GLfloat) * 4);
ASSERT(width < SWRAST_MAX_WIDTH);
for (row = 0; row < height; row++, sy += stepy, dy += stepy) {
- GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0];
+ GLvoid *rgba = span.array->attribs[VARYING_SLOT_COL0];
/* Get row/span of source pixels */
if (overlapping) {
INIT_SPAN(span, GL_BITMAP);
_swrast_span_default_attribs(ctx, &span);
span.arrayMask = SPAN_RGBA;
- span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
+ span.arrayAttribs = VARYING_BIT_COL0; /* we're fill in COL0 attrib values */
if (ctx->DrawBuffer->_NumColorDrawBuffers > 0) {
GLenum datatype = _mesa_get_format_datatype(
= _mesa_image_row_stride(unpack, width, format, type);
GLint skipPixels = 0;
/* use span array for temp color storage */
- GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0];
/* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */
while (skipPixels < width) {
feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv)
{
GLfloat win[4];
- const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
- const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0];
+ const GLfloat *vtc = v->attrib[VARYING_SLOT_TEX0];
+ const GLfloat *color = v->attrib[VARYING_SLOT_COL0];
- win[0] = v->attrib[FRAG_ATTRIB_WPOS][0];
- win[1] = v->attrib[FRAG_ATTRIB_WPOS][1];
- win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF;
- win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3];
+ win[0] = v->attrib[VARYING_SLOT_POS][0];
+ win[1] = v->attrib[VARYING_SLOT_POS][1];
+ win[2] = v->attrib[VARYING_SLOT_POS][2] / ctx->DrawBuffer->_DepthMaxF;
+ win[3] = 1.0F / v->attrib[VARYING_SLOT_POS][3];
_mesa_feedback_vertex(ctx, win, color, vtc);
}
if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs );
+ _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs );
+ _mesa_update_hitflag( ctx, v2->attrib[VARYING_SLOT_POS][2] * zs );
}
}
_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs );
+ _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs );
}
_swrast_select_point(struct gl_context *ctx, const SWvertex *v)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v->attrib[VARYING_SLOT_POS][2] * zs );
}
* \param COMPUTE_F code to compute the fog blend factor, f.
*/
#define FOG_LOOP(TYPE, FOG_FUNC) \
-if (span->arrayAttribs & FRAG_BIT_FOGC) { \
+if (span->arrayAttribs & VARYING_BIT_FOGC) { \
GLuint i; \
for (i = 0; i < span->end; i++) { \
- const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0]; \
+ const GLfloat fogCoord = span->array->attribs[VARYING_SLOT_FOGC][i][0]; \
const GLfloat c = FABSF(fogCoord); \
GLfloat f, oneMinusF; \
FOG_FUNC(f, c); \
} \
} \
else { \
- const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0]; \
- GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0]; \
- const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3]; \
- GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; \
+ const GLfloat fogStep = span->attrStepX[VARYING_SLOT_FOGC][0]; \
+ GLfloat fogCoord = span->attrStart[VARYING_SLOT_FOGC][0]; \
+ const GLfloat wStep = span->attrStepX[VARYING_SLOT_POS][3]; \
+ GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; \
GLuint i; \
for (i = 0; i < span->end; i++) { \
const GLfloat c = FABSF(fogCoord) / w; \
FOG_LOOP(GLushort, LINEAR_FOG);
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, LINEAR_FOG);
}
FOG_LOOP(GLushort, EXP_FOG);
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, EXP_FOG);
}
FOG_LOOP(GLushort, EXP2_FOG);
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, EXP2_FOG);
}
FOG_LOOP(GLushort, BLEND_FOG);
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, BLEND_FOG);
}
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
- GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col];
+ GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col];
/* ARB_fragment_coord_conventions */
if (program->OriginUpperLeft)
machine->DerivX = (GLfloat (*)[4]) span->attrStepX;
machine->DerivY = (GLfloat (*)[4]) span->attrStepY;
- machine->NumDeriv = FRAG_ATTRIB_MAX;
+ machine->NumDeriv = VARYING_SLOT_MAX;
machine->Samplers = program->Base.SamplerUnits;
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->Shader.CurrentFragmentProgram) {
/* Store front/back facing value */
- machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing;
+ machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing;
}
machine->CurElement = col;
/* Store result color */
if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
- COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
+ COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i],
machine->Outputs[FRAG_RESULT_COLOR]);
}
else {
GLuint buf;
for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) {
- COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i],
+ COPY_4V(span->array->attribs[VARYING_SLOT_COL0 + buf][i],
machine->Outputs[FRAG_RESULT_DATA0 + buf]);
}
}
const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
/* incoming colors should be floats */
- if (program->Base.InputsRead & FRAG_BIT_COL0) {
+ if (program->Base.InputsRead & VARYING_BIT_COL0) {
ASSERT(span->array->ChanType == GL_FLOAT);
}
COPY_CHAN4(cSave[0], ncv0->color);
COPY_CHAN4(cSave[1], ncv1->color);
/* sum v0 */
- rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
/* sum v1 */
- rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum);
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
GLuint interpFlags = 0;
- GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
- GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
- GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1];
- GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1];
+ GLint x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0];
+ GLint x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0];
+ GLint y0 = (GLint) vert0->attrib[VARYING_SLOT_POS][1];
+ GLint y1 = (GLint) vert1->attrib[VARYING_SLOT_POS][1];
GLint dx, dy;
GLint numPixels;
GLint xstep, ystep;
/* Cull primitives with malformed coordinates.
*/
{
- GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1]
- + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1];
+ GLfloat tmp = vert0->attrib[VARYING_SLOT_POS][0] + vert0->attrib[VARYING_SLOT_POS][1]
+ + vert1->attrib[VARYING_SLOT_POS][0] + vert1->attrib[VARYING_SLOT_POS][1];
if (IS_INF_OR_NAN(tmp))
return;
}
/*
printf("%s():\n", __FUNCTION__);
printf(" (%f, %f, %f) -> (%f, %f, %f)\n",
- vert0->attrib[FRAG_ATTRIB_WPOS][0],
- vert0->attrib[FRAG_ATTRIB_WPOS][1],
- vert0->attrib[FRAG_ATTRIB_WPOS][2],
- vert1->attrib[FRAG_ATTRIB_WPOS][0],
- vert1->attrib[FRAG_ATTRIB_WPOS][1],
- vert1->attrib[FRAG_ATTRIB_WPOS][2]);
+ vert0->attrib[VARYING_SLOT_POS][0],
+ vert0->attrib[VARYING_SLOT_POS][1],
+ vert0->attrib[VARYING_SLOT_POS][2],
+ vert1->attrib[VARYING_SLOT_POS][0],
+ vert1->attrib[VARYING_SLOT_POS][1],
+ vert1->attrib[VARYING_SLOT_POS][2]);
printf(" (%d, %d, %d) -> (%d, %d, %d)\n",
vert0->color[0], vert0->color[1], vert0->color[2],
vert1->color[0], vert1->color[1], vert1->color[2]);
/*
printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy,
- vert0->attrib[FRAG_ATTRIB_COL1][0],
- vert0->attrib[FRAG_ATTRIB_COL1][1],
- vert0->attrib[FRAG_ATTRIB_COL1][2],
- vert0->attrib[FRAG_ATTRIB_COL1][3],
- vert1->attrib[FRAG_ATTRIB_COL1][0],
- vert1->attrib[FRAG_ATTRIB_COL1][1],
- vert1->attrib[FRAG_ATTRIB_COL1][2],
- vert1->attrib[FRAG_ATTRIB_COL1][3]);
+ vert0->attrib[VARYING_SLOT_COL1][0],
+ vert0->attrib[VARYING_SLOT_COL1][1],
+ vert0->attrib[VARYING_SLOT_COL1][2],
+ vert0->attrib[VARYING_SLOT_COL1][3],
+ vert1->attrib[VARYING_SLOT_COL1][0],
+ vert1->attrib[VARYING_SLOT_COL1][1],
+ vert1->attrib[VARYING_SLOT_COL1][2],
+ vert1->attrib[VARYING_SLOT_COL1][3]);
*/
#ifdef DEPTH_TYPE
interpFlags |= SPAN_Z;
{
if (depthBits <= 16) {
- span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF;
- span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2]
- - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels;
+ span.z = FloatToFixed(vert0->attrib[VARYING_SLOT_POS][2]) + FIXED_HALF;
+ span.zStep = FloatToFixed( vert1->attrib[VARYING_SLOT_POS][2]
+ - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels;
}
else {
/* don't use fixed point */
- span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2];
- span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2]
- - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels);
+ span.z = (GLuint) vert0->attrib[VARYING_SLOT_POS][2];
+ span.zStep = (GLint) (( vert1->attrib[VARYING_SLOT_POS][2]
+ - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels);
}
}
#endif
#if defined(INTERP_ATTRIBS)
{
const GLfloat invLen = 1.0F / numPixels;
- const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3];
+ const GLfloat invw0 = vert0->attrib[VARYING_SLOT_POS][3];
+ const GLfloat invw1 = vert1->attrib[VARYING_SLOT_POS][3];
- span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0;
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen;
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
+ span.attrStart[VARYING_SLOT_POS][3] = invw0;
+ span.attrStepX[VARYING_SLOT_POS][3] = (invw1 - invw0) * invLen;
+ span.attrStepY[VARYING_SLOT_POS][3] = 0.0;
ATTRIB_LOOP_BEGIN
if (swrast->_InterpMode[attr] == GL_FLAT) {
}
else {
logicop_uint4(ctx, 4 * span->end,
- (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0],
+ (GLuint *) span->array->attribs[VARYING_SLOT_COL0],
(const GLuint *) rbPixels, span->array->mask);
}
}
const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0;
const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0;
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
- GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
+ GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[VARYING_SLOT_COL0];
GLuint i;
for (i = 0; i < n; i++) {
src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask);
*/
#define CULL_INVALID(V) \
do { \
- float tmp = (V)->attrib[FRAG_ATTRIB_WPOS][0] \
- + (V)->attrib[FRAG_ATTRIB_WPOS][1]; \
+ float tmp = (V)->attrib[VARYING_SLOT_POS][0] \
+ + (V)->attrib[VARYING_SLOT_POS][1]; \
if (IS_INF_OR_NAN(tmp)) \
return; \
} while(0)
/* z coord */
if (ctx->DrawBuffer->Visual.depthBits <= 16)
- span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
else
- span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
span.zStep = 0;
size = get_size(ctx, vert, GL_FALSE);
span.alphaStep = 0;
/* need these for fragment programs */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span.attrStart[VARYING_SLOT_POS][3] = 1.0F;
+ span.attrStepX[VARYING_SLOT_POS][3] = 0.0F;
+ span.attrStepY[VARYING_SLOT_POS][3] = 0.0F;
{
GLfloat s, r, dsdx;
}
ATTRIB_LOOP_BEGIN
- if (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) {
+ if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) {
/* a texcoord attribute */
- const GLuint u = attr - FRAG_ATTRIB_TEX0;
+ const GLuint u = attr - VARYING_SLOT_TEX0;
ASSERT(u < Elements(ctx->Point.CoordReplace));
if (ctx->Point.CoordReplace[u]) {
tCoords[numTcoords++] = attr;
continue;
}
}
- else if (attr == FRAG_ATTRIB_PNTC) {
+ else if (attr == VARYING_SLOT_PNTC) {
/* GLSL gl_PointCoord.xy (.zw undefined) */
- span.attrStart[FRAG_ATTRIB_PNTC][0] = 0.0;
- span.attrStart[FRAG_ATTRIB_PNTC][1] = 0.0; /* t0 set below */
- span.attrStepX[FRAG_ATTRIB_PNTC][0] = dsdx;
- span.attrStepX[FRAG_ATTRIB_PNTC][1] = 0.0;
- span.attrStepY[FRAG_ATTRIB_PNTC][0] = 0.0;
- span.attrStepY[FRAG_ATTRIB_PNTC][1] = dtdy;
- tCoords[numTcoords++] = FRAG_ATTRIB_PNTC;
+ span.attrStart[VARYING_SLOT_PNTC][0] = 0.0;
+ span.attrStart[VARYING_SLOT_PNTC][1] = 0.0; /* t0 set below */
+ span.attrStepX[VARYING_SLOT_PNTC][0] = dsdx;
+ span.attrStepX[VARYING_SLOT_PNTC][1] = 0.0;
+ span.attrStepY[VARYING_SLOT_PNTC][0] = 0.0;
+ span.attrStepY[VARYING_SLOT_PNTC][1] = dtdy;
+ tCoords[numTcoords++] = VARYING_SLOT_PNTC;
continue;
}
/* use vertex's texcoord/attrib */
/* compute pos, bounds and render */
{
- const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0];
- const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1];
+ const GLfloat x = vert->attrib[VARYING_SLOT_POS][0];
+ const GLfloat y = vert->attrib[VARYING_SLOT_POS][1];
GLint iSize = (GLint) (size + 0.5F);
GLint xmin, xmax, ymin, ymax, iy;
GLint iRadius;
/* z coord */
if (ctx->DrawBuffer->Visual.depthBits <= 16)
- span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
else
- span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
span.zStep = 0;
size = get_size(ctx, vert, GL_TRUE);
span.alphaStep = 0;
/* need these for fragment programs */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span.attrStart[VARYING_SLOT_POS][3] = 1.0F;
+ span.attrStepX[VARYING_SLOT_POS][3] = 0.0F;
+ span.attrStepY[VARYING_SLOT_POS][3] = 0.0F;
ATTRIB_LOOP_BEGIN
COPY_4V(span.attrStart[attr], vert->attrib[attr]);
/* compute pos, bounds and render */
{
- const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0];
- const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1];
+ const GLfloat x = vert->attrib[VARYING_SLOT_POS][0];
+ const GLfloat y = vert->attrib[VARYING_SLOT_POS][1];
const GLfloat radius = 0.5F * size;
const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
const GLfloat rmax = radius + 0.7071F;
/* z coord */
if (ctx->DrawBuffer->Visual.depthBits <= 16)
- span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
else
- span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
span.zStep = 0;
size = get_size(ctx, vert, GL_FALSE);
span.alphaStep = 0;
/* need these for fragment programs */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span.attrStart[VARYING_SLOT_POS][3] = 1.0F;
+ span.attrStepX[VARYING_SLOT_POS][3] = 0.0F;
+ span.attrStepY[VARYING_SLOT_POS][3] = 0.0F;
ATTRIB_LOOP_BEGIN
COPY_4V(span.attrStart[attr], vert->attrib[attr]);
/* compute pos, bounds and render */
{
- const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0];
- const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1];
+ const GLfloat x = vert->attrib[VARYING_SLOT_POS][0];
+ const GLfloat y = vert->attrib[VARYING_SLOT_POS][1];
GLint iSize = (GLint) (size + 0.5F);
GLint xmin, xmax, ymin, ymax, ix, iy;
GLint iRadius;
span->arrayAttribs = swrast->_ActiveAttribMask; /* we'll produce these vals */
/* need these for fragment programs */
- span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
- span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
- span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span->attrStart[VARYING_SLOT_POS][3] = 1.0F;
+ span->attrStepX[VARYING_SLOT_POS][3] = 0.0F;
+ span->attrStepY[VARYING_SLOT_POS][3] = 0.0F;
/* check if we need to flush */
if (span->end >= SWRAST_MAX_WIDTH ||
ATTRIB_LOOP_END
/* fragment position */
- span->array->x[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][0];
- span->array->y[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][1];
- span->array->z[count] = (GLint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
+ span->array->x[count] = (GLint) vert->attrib[VARYING_SLOT_POS][0];
+ span->array->y[count] = (GLint) vert->attrib[VARYING_SLOT_POS][1];
+ span->array->z[count] = (GLint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F);
span->end = count + 1;
ASSERT(span->end <= SWRAST_MAX_WIDTH);
/* save */
COPY_CHAN4(cSave, ncv0->color);
/* sum */
- rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
}
/* W (for perspective correction) */
- span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0;
- span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0;
- span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
+ span->attrStart[VARYING_SLOT_POS][3] = 1.0;
+ span->attrStepX[VARYING_SLOT_POS][3] = 0.0;
+ span->attrStepY[VARYING_SLOT_POS][3] = 0.0;
/* primary color, or color index */
UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
span->alphaStep = 0;
span->interpMask |= SPAN_RGBA;
- COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
- ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
+ COPY_4V(span->attrStart[VARYING_SLOT_COL0], ctx->Current.RasterColor);
+ ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0);
/* Secondary color */
if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled)
{
- COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor);
- ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);
+ COPY_4V(span->attrStart[VARYING_SLOT_COL1], ctx->Current.RasterSecondaryColor);
+ ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0);
}
/* fog */
/* fog blend factor should be computed from fogcoord now */
fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
}
- span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal;
- span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
- span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
+ span->attrStart[VARYING_SLOT_FOGC][0] = fogVal;
+ span->attrStepX[VARYING_SLOT_FOGC][0] = 0.0;
+ span->attrStepY[VARYING_SLOT_FOGC][0] = 0.0;
}
/* texcoords */
{
GLuint i;
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- const GLuint attr = FRAG_ATTRIB_TEX0 + i;
+ const GLuint attr = VARYING_SLOT_TEX0 + i;
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
if (_swrast_use_fragment_program(ctx) ||
ctx->ATIFragmentShader._Enabled) {
* Interpolate the active attributes (and'd with attrMask) to
* fill in span->array->attribs[].
* Perspective correction will be done. The point/line/triangle function
- * should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]!
+ * should have computed attrStart/Step values for VARYING_SLOT_POS[3]!
*/
static inline void
interpolate_active_attribs(struct gl_context *ctx, SWspan *span,
ATTRIB_LOOP_BEGIN
if (attrMask & BITFIELD64_BIT(attr)) {
- const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
- GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3];
+ const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
+ GLfloat w = span->attrStart[VARYING_SLOT_POS][3];
const GLfloat dv0dx = span->attrStepX[attr][0];
const GLfloat dv1dx = span->attrStepX[attr][1];
const GLfloat dv2dx = span->attrStepX[attr][2];
break;
#endif
case GL_FLOAT:
- interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
+ interpolate_active_attribs(ctx, span, VARYING_BIT_COL0);
break;
default:
_mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors",
/**
- * Populate the FRAG_ATTRIB_COL0 array.
+ * Populate the VARYING_SLOT_COL0 array.
*/
static inline void
interpolate_float_colors(SWspan *span)
{
- GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0];
const GLuint n = span->end;
GLuint i;
- assert(!(span->arrayAttribs & FRAG_BIT_COL0));
+ assert(!(span->arrayAttribs & VARYING_BIT_COL0));
if (span->arrayMask & SPAN_RGBA) {
/* convert array of int colors */
}
}
- span->arrayAttribs |= FRAG_BIT_COL0;
+ span->arrayAttribs |= VARYING_BIT_COL0;
span->array->ChanType = GL_FLOAT;
}
/**
- * Fill in the span.array->attrib[FRAG_ATTRIB_TEXn] arrays from the
+ * Fill in the span.array->attrib[VARYING_SLOT_TEXn] arrays from the
* using the attrStart/Step values.
*
* This function only used during fixed-function fragment processing.
/* XXX CoordUnits vs. ImageUnits */
for (u = 0; u < maxUnit; u++) {
if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
- const GLuint attr = FRAG_ATTRIB_TEX0 + u;
+ const GLuint attr = VARYING_SLOT_TEX0 + u;
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
GLfloat texW, texH;
GLboolean needLambda;
if (_swrast_use_fragment_program(ctx)
|| ctx->ATIFragmentShader._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
- const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
- GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx;
+ const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
+ GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
for (i = 0; i < span->end; i++) {
const GLfloat invW = 1.0F / w;
texcoord[i][0] = s * invW;
if (_swrast_use_fragment_program(ctx) ||
ctx->ATIFragmentShader._Enabled) {
/* do perspective correction but don't divide s, t, r by q */
- const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
- GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx;
+ const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
+ GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
for (i = 0; i < span->end; i++) {
const GLfloat invW = 1.0F / w;
texcoord[i][0] = s * invW;
/**
- * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array.
+ * Fill in the arrays->attribs[VARYING_SLOT_POS] array.
*/
static inline void
interpolate_wpos(struct gl_context *ctx, SWspan *span)
{
- GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
+ GLfloat (*wpos)[4] = span->array->attribs[VARYING_SLOT_POS];
GLuint i;
const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat w, dw;
}
}
- dw = span->attrStepX[FRAG_ATTRIB_WPOS][3];
- w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw;
+ dw = span->attrStepX[VARYING_SLOT_POS][3];
+ w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dw;
for (i = 0; i < span->end; i++) {
wpos[i][2] = (GLfloat) span->array->z[i] * zScale;
wpos[i][3] = w;
* fragment attributes.
* For arrays of values, shift them left.
*/
- for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
if (span->interpMask & (1 << i)) {
GLuint j;
for (j = 0; j < 4; j++) {
#define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
- for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
if (span->arrayAttribs & (1 << i)) {
/* shift array elements left by 'leftClip' */
SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
/**
* Add specular colors to primary colors.
* Only called during fixed-function operation.
- * Result is float color array (FRAG_ATTRIB_COL0).
+ * Result is float color array (VARYING_SLOT_COL0).
*/
static inline void
add_specular(struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLubyte *mask = span->array->mask;
- GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
- GLfloat (*col1)[4] = span->array->attribs[FRAG_ATTRIB_COL1];
+ GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0];
+ GLfloat (*col1)[4] = span->array->attribs[VARYING_SLOT_COL1];
GLuint i;
ASSERT(!_swrast_use_fragment_program(ctx));
ASSERT(span->arrayMask & SPAN_RGBA);
- ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1);
+ ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1);
(void) swrast; /* silence warning */
if (span->array->ChanType == GL_FLOAT) {
- if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
- interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
+ if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) {
+ interpolate_active_attribs(ctx, span, VARYING_BIT_COL0);
}
}
else {
/* need float colors */
- if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
+ if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) {
interpolate_float_colors(span);
}
}
- if ((span->arrayAttribs & FRAG_BIT_COL1) == 0) {
+ if ((span->arrayAttribs & VARYING_BIT_COL1) == 0) {
/* XXX could avoid this and interpolate COL1 in the loop below */
- interpolate_active_attribs(ctx, span, FRAG_BIT_COL1);
+ interpolate_active_attribs(ctx, span, VARYING_BIT_COL1);
}
- ASSERT(span->arrayAttribs & FRAG_BIT_COL0);
- ASSERT(span->arrayAttribs & FRAG_BIT_COL1);
+ ASSERT(span->arrayAttribs & VARYING_BIT_COL0);
+ ASSERT(span->arrayAttribs & VARYING_BIT_COL1);
for (i = 0; i < span->end; i++) {
if (mask[i]) {
}
}
else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
for (i = 0; i < span->end; i++) {
rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i];
/* clamp later */
static inline void
clamp_colors(SWspan *span)
{
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0];
GLuint i;
ASSERT(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
GLvoid *src, *dst;
if (output > 0 || span->array->ChanType == GL_FLOAT) {
- src = span->array->attribs[FRAG_ATTRIB_COL0 + output];
+ src = span->array->attribs[VARYING_SLOT_COL0 + output];
span->array->ChanType = GL_FLOAT;
}
else if (span->array->ChanType == GL_UNSIGNED_BYTE) {
dst = span->array->rgba16;
}
else {
- dst = span->array->attribs[FRAG_ATTRIB_COL0];
+ dst = span->array->attribs[VARYING_SLOT_COL0];
}
_mesa_convert_colors(span->array->ChanType, src,
convert_color_type(span, GL_FLOAT, 0);
}
else {
- span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0];
+ span->array->rgba = (void *) span->array->attribs[VARYING_SLOT_COL0];
}
if (span->primitive != GL_POINT ||
_swrast_span_interpolate_z (ctx, span);
#if 0
- if (inputsRead & FRAG_BIT_WPOS)
+ if (inputsRead & VARYING_BIT_POS)
#else
/* XXX always interpolate wpos so that DDX/DDY work */
#endif
/* conventional texturing */
#if CHAN_BITS == 32
- if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
+ if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) {
interpolate_int_colors(ctx, span);
}
#else
if (!(span->arrayMask & SPAN_RGBA))
interpolate_int_colors(ctx, span);
#endif
- if ((span->arrayAttribs & FRAG_BITS_TEX_ANY) == 0x0)
+ if ((span->arrayAttribs & VARYING_BITS_TEX_ANY) == 0x0)
interpolate_texcoords(ctx, span);
_swrast_texture_span(ctx, span);
}
#if CHAN_BITS == 32
- if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
- interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
+ if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) {
+ interpolate_active_attribs(ctx, span, VARYING_BIT_COL0);
}
#else
if ((span->arrayMask & SPAN_RGBA) == 0) {
}
else {
span->array->rgba = (void *)
- span->array->attribs[FRAG_ATTRIB_COL0];
+ span->array->attribs[VARYING_SLOT_COL0];
}
}
void *rbPixels;
/* Point rbPixels to a temporary space */
- rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1];
+ rbPixels = span->array->attribs[VARYING_SLOT_MAX - 1];
/* Get destination values from renderbuffer */
if (span->arrayMask & SPAN_XY) {
*/
typedef struct sw_span_arrays
{
- /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */
+ /** Per-fragment attributes (indexed by VARYING_SLOT_* tokens) */
/* XXX someday look at transposing first two indexes for better memory
* access pattern.
*/
- GLfloat attribs[FRAG_ATTRIB_MAX][SWRAST_MAX_WIDTH][4];
+ GLfloat attribs[VARYING_SLOT_MAX][SWRAST_MAX_WIDTH][4];
/** This mask indicates which fragments are alive or culled */
GLubyte mask[SWRAST_MAX_WIDTH];
GLbitfield interpMask;
/** Fragment attribute interpolants */
- GLfloat attrStart[FRAG_ATTRIB_MAX][4]; /**< initial value */
- GLfloat attrStepX[FRAG_ATTRIB_MAX][4]; /**< dvalue/dx */
- GLfloat attrStepY[FRAG_ATTRIB_MAX][4]; /**< dvalue/dy */
+ GLfloat attrStart[VARYING_SLOT_MAX][4]; /**< initial value */
+ GLfloat attrStepX[VARYING_SLOT_MAX][4]; /**< dvalue/dx */
+ GLfloat attrStepY[VARYING_SLOT_MAX][4]; /**< dvalue/dy */
/* XXX the rest of these will go away eventually... */
*/
GLbitfield arrayMask;
- /** Mask of FRAG_BIT_x bits */
+ /** Mask of VARYING_BIT_x bits */
GLbitfield64 arrayAttribs;
/**
if (texUnit->_ReallyEnabled &&
texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
- span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
+ span->array->attribs[VARYING_SLOT_TEX0 + unit];
float4_array targetcoords =
- span->array->attribs[FRAG_ATTRIB_TEX0 +
+ span->array->attribs[VARYING_SLOT_TEX0 +
ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0];
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
if (texUnit->_ReallyEnabled &&
texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
- span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
+ span->array->attribs[VARYING_SLOT_TEX0 + unit];
const struct gl_texture_object *curObj = texUnit->_Current;
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
GLfloat *lambda = span->array->lambda[unit];
* from the context list of available texture objects.
*/
const GLuint u = texture_unit_index(ctx, tObj);
- const GLuint attr = FRAG_ATTRIB_TEX0 + u;
+ const GLuint attr = VARYING_SLOT_TEX0 + u;
GLfloat texW, texH;
const GLfloat dsdx = span->attrStepX[attr][0];
const SWvertex *v2 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0];
- GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1];
- GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0];
- GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1];
+ GLfloat ex = v1->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0];
+ GLfloat ey = v1->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1];
+ GLfloat fx = v2->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0];
+ GLfloat fy = v2->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1];
GLfloat c = ex*fy-ey*fx;
if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign <= 0.0F)
const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits;
ctx->Texture._EnabledCoordUnits = 0;
- tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1);
- tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1);
- tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1);
- tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1);
- /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */
- tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3];
- tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3];
+ tex_coord[0] = span->attrStart[VARYING_SLOT_TEX0][0] * (info->smask + 1);
+ tex_step[0] = span->attrStepX[VARYING_SLOT_TEX0][0] * (info->smask + 1);
+ tex_coord[1] = span->attrStart[VARYING_SLOT_TEX0][1] * (info->tmask + 1);
+ tex_step[1] = span->attrStepX[VARYING_SLOT_TEX0][1] * (info->tmask + 1);
+ /* span->attrStart[VARYING_SLOT_TEX0][2] only if 3D-texturing, here only 2D */
+ tex_coord[2] = span->attrStart[VARYING_SLOT_TEX0][3];
+ tex_step[2] = span->attrStepX[VARYING_SLOT_TEX0][3];
switch (info->filter) {
case GL_NEAREST:
COPY_CHAN4( cSave[1], ncv1->color );
COPY_CHAN4( cSave[2], ncv2->color );
/* sum v0 */
- rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
/* sum v1 */
- rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum);
/* sum v2 */
- rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[FRAG_ATTRIB_COL1][0];
- gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[FRAG_ATTRIB_COL1][1];
- bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[FRAG_ATTRIB_COL1][2];
+ rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[VARYING_SLOT_COL1][0];
+ gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[VARYING_SLOT_COL1][1];
+ bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[VARYING_SLOT_COL1][2];
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[0], rSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[1], gSum);
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[2], bSum);
/*
printf("%s()\n", __FUNCTION__);
printf(" %g, %g, %g\n",
- v0->attrib[FRAG_ATTRIB_WPOS][0],
- v0->attrib[FRAG_ATTRIB_WPOS][1],
- v0->attrib[FRAG_ATTRIB_WPOS][2]);
+ v0->attrib[VARYING_SLOT_POS][0],
+ v0->attrib[VARYING_SLOT_POS][1],
+ v0->attrib[VARYING_SLOT_POS][2]);
printf(" %g, %g, %g\n",
- v1->attrib[FRAG_ATTRIB_WPOS][0],
- v1->attrib[FRAG_ATTRIB_WPOS][1],
- v1->attrib[FRAG_ATTRIB_WPOS][2]);
+ v1->attrib[VARYING_SLOT_POS][0],
+ v1->attrib[VARYING_SLOT_POS][1],
+ v1->attrib[VARYING_SLOT_POS][2]);
printf(" %g, %g, %g\n",
- v2->attrib[FRAG_ATTRIB_WPOS][0],
- v2->attrib[FRAG_ATTRIB_WPOS][1],
- v2->attrib[FRAG_ATTRIB_WPOS][2]);
+ v2->attrib[VARYING_SLOT_POS][0],
+ v2->attrib[VARYING_SLOT_POS][1],
+ v2->attrib[VARYING_SLOT_POS][2]);
*/
/* Compute fixed point x,y coords w/ half-pixel offsets and snapping.
* And find the order of the 3 vertices along the Y axis.
*/
{
- const GLfixed fy0 = FloatToFixed(v0->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask;
- const GLfixed fy1 = FloatToFixed(v1->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask;
- const GLfixed fy2 = FloatToFixed(v2->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask;
+ const GLfixed fy0 = FloatToFixed(v0->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask;
+ const GLfixed fy1 = FloatToFixed(v1->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask;
+ const GLfixed fy2 = FloatToFixed(v2->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask;
if (fy0 <= fy1) {
if (fy1 <= fy2) {
/* y0 <= y1 <= y2 */
}
/* fixed point X coords */
- vMin_fx = FloatToFixed(vMin->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask;
- vMid_fx = FloatToFixed(vMid->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask;
- vMax_fx = FloatToFixed(vMax->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask;
+ vMin_fx = FloatToFixed(vMin->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask;
+ vMid_fx = FloatToFixed(vMid->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask;
+ vMax_fx = FloatToFixed(vMax->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask;
}
/* vertex/edge relationship */
#ifdef INTERP_Z
span.interpMask |= SPAN_Z;
{
- GLfloat eMaj_dz = vMax->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2];
- GLfloat eBot_dz = vMid->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2];
- span.attrStepX[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz);
- if (span.attrStepX[FRAG_ATTRIB_WPOS][2] > maxDepth ||
- span.attrStepX[FRAG_ATTRIB_WPOS][2] < -maxDepth) {
+ GLfloat eMaj_dz = vMax->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2];
+ GLfloat eBot_dz = vMid->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2];
+ span.attrStepX[VARYING_SLOT_POS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz);
+ if (span.attrStepX[VARYING_SLOT_POS][2] > maxDepth ||
+ span.attrStepX[VARYING_SLOT_POS][2] < -maxDepth) {
/* probably a sliver triangle */
- span.attrStepX[FRAG_ATTRIB_WPOS][2] = 0.0;
- span.attrStepY[FRAG_ATTRIB_WPOS][2] = 0.0;
+ span.attrStepX[VARYING_SLOT_POS][2] = 0.0;
+ span.attrStepY[VARYING_SLOT_POS][2] = 0.0;
}
else {
- span.attrStepY[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx);
+ span.attrStepY[VARYING_SLOT_POS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx);
}
if (depthBits <= 16)
- span.zStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_WPOS][2]);
+ span.zStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_POS][2]);
else
- span.zStep = (GLint) span.attrStepX[FRAG_ATTRIB_WPOS][2];
+ span.zStep = (GLint) span.attrStepX[VARYING_SLOT_POS][2];
}
#endif
#ifdef INTERP_RGB
GLfloat eMaj_da = (GLfloat) (vMax->color[ACOMP] - vMin->color[ACOMP]);
GLfloat eBot_da = (GLfloat) (vMid->color[ACOMP] - vMin->color[ACOMP]);
# endif
- span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
- span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
- span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
- span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
- span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
- span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
- span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]);
- span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]);
- span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]);
+ span.attrStepX[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
+ span.attrStepY[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
+ span.attrStepX[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
+ span.attrStepY[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
+ span.attrStepX[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
+ span.attrStepY[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
+ span.redStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][0]);
+ span.greenStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][1]);
+ span.blueStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][2]);
# ifdef INTERP_ALPHA
- span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
- span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
- span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]);
+ span.attrStepX[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
+ span.attrStepY[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
+ span.alphaStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][3]);
# endif /* INTERP_ALPHA */
}
else {
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
span.interpMask |= SPAN_FLAT;
- span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F;
- span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F;
- span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F;
+ span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F;
+ span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F;
+ span.attrStepX[VARYING_SLOT_COL0][2] = span.attrStepY[VARYING_SLOT_COL0][2] = 0.0F;
span.redStep = 0;
span.greenStep = 0;
span.blueStep = 0;
# ifdef INTERP_ALPHA
- span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F;
+ span.attrStepX[VARYING_SLOT_COL0][3] = span.attrStepY[VARYING_SLOT_COL0][3] = 0.0F;
span.alphaStep = 0;
# endif
}
#endif /* INTERP_RGB */
#ifdef INTERP_INT_TEX
{
- GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE;
- GLfloat eBot_ds = (vMid->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE;
- GLfloat eMaj_dt = (vMax->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE;
- GLfloat eBot_dt = (vMid->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE;
- span.attrStepX[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
- span.attrStepY[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx);
- span.attrStepX[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
- span.attrStepY[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
- span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][0]);
- span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][1]);
+ GLfloat eMaj_ds = (vMax->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE;
+ GLfloat eBot_ds = (vMid->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE;
+ GLfloat eMaj_dt = (vMax->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE;
+ GLfloat eBot_dt = (vMid->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE;
+ span.attrStepX[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
+ span.attrStepY[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx);
+ span.attrStepX[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
+ span.attrStepY[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
+ span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][0]);
+ span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][1]);
}
#endif
#ifdef INTERP_ATTRIBS
{
- /* attrib[FRAG_ATTRIB_WPOS][3] is 1/W */
- const GLfloat wMax = vMax->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat wMin = vMin->attrib[FRAG_ATTRIB_WPOS][3];
- const GLfloat wMid = vMid->attrib[FRAG_ATTRIB_WPOS][3];
+ /* attrib[VARYING_SLOT_POS][3] is 1/W */
+ const GLfloat wMax = vMax->attrib[VARYING_SLOT_POS][3];
+ const GLfloat wMin = vMin->attrib[VARYING_SLOT_POS][3];
+ const GLfloat wMid = vMid->attrib[VARYING_SLOT_POS][3];
{
const GLfloat eMaj_dw = wMax - wMin;
const GLfloat eBot_dw = wMid - wMin;
- span.attrStepX[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw);
- span.attrStepY[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx);
+ span.attrStepX[VARYING_SLOT_POS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw);
+ span.attrStepY[VARYING_SLOT_POS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx);
}
ATTRIB_LOOP_BEGIN
if (swrast->_InterpMode[attr] == GL_FLAT) {
#endif
#ifdef INTERP_ATTRIBS
GLfloat wLeft = 0, dwOuter = 0, dwInner;
- GLfloat attrLeft[FRAG_ATTRIB_MAX][4];
- GLfloat daOuter[FRAG_ATTRIB_MAX][4], daInner[FRAG_ATTRIB_MAX][4];
+ GLfloat attrLeft[VARYING_SLOT_MAX][4];
+ GLfloat daOuter[VARYING_SLOT_MAX][4], daInner[VARYING_SLOT_MAX][4];
#endif
for (subTriangle=0; subTriangle<=1; subTriangle++) {
#ifdef INTERP_Z
{
- GLfloat z0 = vLower->attrib[FRAG_ATTRIB_WPOS][2];
+ GLfloat z0 = vLower->attrib[VARYING_SLOT_POS][2];
if (depthBits <= 16) {
/* interpolate fixed-pt values */
GLfloat tmp = (z0 * FIXED_SCALE
- + span.attrStepX[FRAG_ATTRIB_WPOS][2] * adjx
- + span.attrStepY[FRAG_ATTRIB_WPOS][2] * adjy) + FIXED_HALF;
+ + span.attrStepX[VARYING_SLOT_POS][2] * adjx
+ + span.attrStepY[VARYING_SLOT_POS][2] * adjy) + FIXED_HALF;
if (tmp < MAX_GLUINT / 2)
zLeft = (GLfixed) tmp;
else
zLeft = MAX_GLUINT / 2;
- fdzOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_WPOS][2] +
- dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]);
+ fdzOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_POS][2] +
+ dxOuter * span.attrStepX[VARYING_SLOT_POS][2]);
}
else {
/* interpolate depth values w/out scaling */
- zLeft = (GLuint) (z0 + span.attrStepX[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjx)
- + span.attrStepY[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjy));
- fdzOuter = (GLint) (span.attrStepY[FRAG_ATTRIB_WPOS][2] +
- dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]);
+ zLeft = (GLuint) (z0 + span.attrStepX[VARYING_SLOT_POS][2] * FixedToFloat(adjx)
+ + span.attrStepY[VARYING_SLOT_POS][2] * FixedToFloat(adjy));
+ fdzOuter = (GLint) (span.attrStepY[VARYING_SLOT_POS][2] +
+ dxOuter * span.attrStepX[VARYING_SLOT_POS][2]);
}
# ifdef DEPTH_TYPE
zRow = (DEPTH_TYPE *)
#ifdef INTERP_RGB
if (ctx->Light.ShadeModel == GL_SMOOTH) {
rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP])
- + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx
- + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF;
+ + span.attrStepX[VARYING_SLOT_COL0][0] * adjx
+ + span.attrStepY[VARYING_SLOT_COL0][0] * adjy) + FIXED_HALF;
gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP])
- + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx
- + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF;
+ + span.attrStepX[VARYING_SLOT_COL0][1] * adjx
+ + span.attrStepY[VARYING_SLOT_COL0][1] * adjy) + FIXED_HALF;
bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP])
- + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx
- + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF;
- fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]);
- fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]);
- fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]);
+ + span.attrStepX[VARYING_SLOT_COL0][2] * adjx
+ + span.attrStepY[VARYING_SLOT_COL0][2] * adjy) + FIXED_HALF;
+ fdrOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][0]
+ + dxOuter * span.attrStepX[VARYING_SLOT_COL0][0]);
+ fdgOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][1]
+ + dxOuter * span.attrStepX[VARYING_SLOT_COL0][1]);
+ fdbOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][2]
+ + dxOuter * span.attrStepX[VARYING_SLOT_COL0][2]);
# ifdef INTERP_ALPHA
aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP])
- + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx
- + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF;
- fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]);
+ + span.attrStepX[VARYING_SLOT_COL0][3] * adjx
+ + span.attrStepY[VARYING_SLOT_COL0][3] * adjy) + FIXED_HALF;
+ fdaOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][3]
+ + dxOuter * span.attrStepX[VARYING_SLOT_COL0][3]);
# endif
}
else {
#ifdef INTERP_INT_TEX
{
GLfloat s0, t0;
- s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE;
- sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx
- + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF;
- dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]);
-
- t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE;
- tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx
- + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF;
- dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1]
- + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]);
+ s0 = vLower->attrib[VARYING_SLOT_TEX0][0] * S_SCALE;
+ sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][0] * adjx
+ + span.attrStepY[VARYING_SLOT_TEX0][0] * adjy) + FIXED_HALF;
+ dsOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][0]
+ + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][0]);
+
+ t0 = vLower->attrib[VARYING_SLOT_TEX0][1] * T_SCALE;
+ tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][1] * adjx
+ + span.attrStepY[VARYING_SLOT_TEX0][1] * adjy) + FIXED_HALF;
+ dtOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][1]
+ + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][1]);
}
#endif
#ifdef INTERP_ATTRIBS
{
- const GLuint attr = FRAG_ATTRIB_WPOS;
- wLeft = vLower->attrib[FRAG_ATTRIB_WPOS][3]
+ const GLuint attr = VARYING_SLOT_POS;
+ wLeft = vLower->attrib[VARYING_SLOT_POS][3]
+ (span.attrStepX[attr][3] * adjx
+ span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE);
dwOuter = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3];
}
ATTRIB_LOOP_BEGIN
- const GLfloat invW = vLower->attrib[FRAG_ATTRIB_WPOS][3];
+ const GLfloat invW = vLower->attrib[VARYING_SLOT_POS][3];
if (swrast->_InterpMode[attr] == GL_FLAT) {
GLuint c;
for (c = 0; c < 4; c++) {
dtInner = dtOuter + span.intTexStep[1];
#endif
#ifdef INTERP_ATTRIBS
- dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3];
+ dwInner = dwOuter + span.attrStepX[VARYING_SLOT_POS][3];
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
#endif
#ifdef INTERP_ATTRIBS
- span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft;
+ span.attrStart[VARYING_SLOT_POS][3] = wLeft;
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT)
zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16;
else
- zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0];
+ zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[VARYING_SLOT_COL0];
- COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]);
- COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]);
- COPY_4V(zoomed.attrStepY[FRAG_ATTRIB_WPOS], span->attrStepY[FRAG_ATTRIB_WPOS]);
+ COPY_4V(zoomed.attrStart[VARYING_SLOT_POS], span->attrStart[VARYING_SLOT_POS]);
+ COPY_4V(zoomed.attrStepX[VARYING_SLOT_POS], span->attrStepX[VARYING_SLOT_POS]);
+ COPY_4V(zoomed.attrStepY[VARYING_SLOT_POS], span->attrStepY[VARYING_SLOT_POS]);
- zoomed.attrStart[FRAG_ATTRIB_FOGC][0] = span->attrStart[FRAG_ATTRIB_FOGC][0];
- zoomed.attrStepX[FRAG_ATTRIB_FOGC][0] = span->attrStepX[FRAG_ATTRIB_FOGC][0];
- zoomed.attrStepY[FRAG_ATTRIB_FOGC][0] = span->attrStepY[FRAG_ATTRIB_FOGC][0];
+ zoomed.attrStart[VARYING_SLOT_FOGC][0] = span->attrStart[VARYING_SLOT_FOGC][0];
+ zoomed.attrStepX[VARYING_SLOT_FOGC][0] = span->attrStepX[VARYING_SLOT_FOGC][0];
+ zoomed.attrStepY[VARYING_SLOT_FOGC][0] = span->attrStepY[VARYING_SLOT_FOGC][0];
if (format == GL_RGBA || format == GL_RGB) {
/* copy Z info */
/* we'll generate an array of colorss */
zoomed.interpMask = span->interpMask & ~SPAN_RGBA;
zoomed.arrayMask |= SPAN_RGBA;
- zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */
+ zoomed.arrayAttribs |= VARYING_BIT_COL0; /* we'll produce these values */
ASSERT(span->arrayMask & SPAN_RGBA);
}
else if (format == GL_DEPTH_COMPONENT) {
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
ASSERT(j >= 0);
ASSERT(j < (GLint) span->end);
- COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]);
+ COPY_4V(zoomed.array->attribs[VARYING_SLOT_COL0][i], rgba[j]);
}
}
}
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
ASSERT(j >= 0);
ASSERT(j < (GLint) span->end);
- zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0];
- zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1];
- zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2];
- zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F;
+ zoomed.array->attribs[VARYING_SLOT_COL0][i][0] = rgb[j][0];
+ zoomed.array->attribs[VARYING_SLOT_COL0][i][1] = rgb[j][1];
+ zoomed.array->attribs[VARYING_SLOT_COL0][i][2] = rgb[j][2];
+ zoomed.array->attribs[VARYING_SLOT_COL0][i][3] = 1.0F;
}
}
}
* improve its usefulness as a fallback mechanism for hardware
* drivers.
*
- * wpos = attr[FRAG_ATTRIB_WPOS] and MUST BE THE FIRST values in the
+ * wpos = attr[VARYING_SLOT_POS] and MUST BE THE FIRST values in the
* vertex because of the tnl clipping code.
* wpos[0] and [1] are the screen-coords of SWvertex.
* primitives unaccelerated), hook in swrast_setup instead.
*/
typedef struct {
- GLfloat attrib[FRAG_ATTRIB_MAX][4];
+ GLfloat attrib[VARYING_SLOT_MAX][4];
GLchan color[4]; /** integer color */
GLfloat pointSize;
} SWvertex;
-#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
+#define VARYING_SLOT_CI VARYING_SLOT_COL0
struct swrast_device_driver;
swsetup->intColors = intColors;
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] );
+ EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[VARYING_SLOT_POS] );
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) {
if (swsetup->intColors)
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
else
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]);
+ EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[VARYING_SLOT_COL0]);
}
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]);
+ EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[VARYING_SLOT_COL1]);
}
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F;
- EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]);
+ EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[VARYING_SLOT_FOGC]);
}
if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX))
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) {
EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F,
- attrib[FRAG_ATTRIB_TEX0 + i] );
+ attrib[VARYING_SLOT_TEX0 + i] );
}
}
}
for (i = 0; i < ctx->Const.MaxVarying; i++) {
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i))) {
EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
- attrib[FRAG_ATTRIB_VAR0 + i] );
+ attrib[VARYING_SLOT_VAR0 + i] );
}
}
}
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp );
- dest->attrib[FRAG_ATTRIB_WPOS][0] = m[0] * tmp[0] + m[12];
- dest->attrib[FRAG_ATTRIB_WPOS][1] = m[5] * tmp[1] + m[13];
- dest->attrib[FRAG_ATTRIB_WPOS][2] = m[10] * tmp[2] + m[14];
- dest->attrib[FRAG_ATTRIB_WPOS][3] = tmp[3];
+ dest->attrib[VARYING_SLOT_POS][0] = m[0] * tmp[0] + m[12];
+ dest->attrib[VARYING_SLOT_POS][1] = m[5] * tmp[1] + m[13];
+ dest->attrib[VARYING_SLOT_POS][2] = m[10] * tmp[2] + m[14];
+ dest->attrib[VARYING_SLOT_POS][3] = tmp[3];
/** XXX try to limit these loops someday */
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i,
- dest->attrib[FRAG_ATTRIB_TEX0 + i] );
+ dest->attrib[VARYING_SLOT_TEX0 + i] );
for (i = 0 ; i < ctx->Const.MaxVarying ; i++)
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i,
- dest->attrib[FRAG_ATTRIB_VAR0 + i] );
+ dest->attrib[VARYING_SLOT_VAR0 + i] );
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0,
- dest->attrib[FRAG_ATTRIB_COL0] );
+ dest->attrib[VARYING_SLOT_COL0] );
UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp );
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1,
- dest->attrib[FRAG_ATTRIB_COL1]);
+ dest->attrib[VARYING_SLOT_COL1]);
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp );
- dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0];
+ dest->attrib[VARYING_SLOT_FOGC][0] = tmp[0];
/* XXX See _tnl_get_attr about pointsize ... */
_tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp );
/* save colors/indexes for v0, v1 vertices */
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
- COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]);
- COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]);
+ COPY_4V(s[0], v0->attrib[VARYING_SLOT_COL1]);
+ COPY_4V(s[1], v1->attrib[VARYING_SLOT_COL1]);
/* copy v2 color/indexes to v0, v1 indexes */
COPY_CHAN4(v0->color, v2->color);
COPY_CHAN4(v1->color, v2->color);
- COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
- COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
+ COPY_4V(v0->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]);
+ COPY_4V(v1->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]);
render(ctx, ef, e0, e1, e2, v0, v1, v2);
COPY_CHAN4(v0->color, c[0]);
COPY_CHAN4(v1->color, c[1]);
- COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]);
- COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]);
+ COPY_4V(v0->attrib[VARYING_SLOT_COL1], s[0]);
+ COPY_4V(v1->attrib[VARYING_SLOT_COL1], s[1]);
}
else {
render(ctx, ef, e0, e1, e2, v0, v1, v2);
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
- GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0];
- GLfloat ey = v[0]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1];
- GLfloat fx = v[1]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0];
- GLfloat fy = v[1]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1];
+ GLfloat ex = v[0]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0];
+ GLfloat ey = v[0]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1];
+ GLfloat fx = v[1]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0];
+ GLfloat fy = v[1]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1];
GLfloat cc = ex*fy - ey*fx;
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
COPY_CHAN4(saved_color[2], v[2]->color);
}
else {
- COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]);
- COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]);
- COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]);
+ COPY_4V(saved_col0[0], v[0]->attrib[VARYING_SLOT_COL0]);
+ COPY_4V(saved_col0[1], v[1]->attrib[VARYING_SLOT_COL0]);
+ COPY_4V(saved_col0[2], v[2]->attrib[VARYING_SLOT_COL0]);
}
if (VB->BackfaceColorPtr->stride) {
SS_COLOR(v[2]->color, vbcolor[e2]);
}
else {
- COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]);
- COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]);
- COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]);
+ COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[e0]);
+ COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[e1]);
+ COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[e2]);
}
}
else {
SS_COLOR(v[2]->color, vbcolor[0]);
}
else {
- COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
- COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
- COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
+ COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[0]);
+ COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[0]);
+ COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[0]);
}
}
}
if (VB->BackfaceSecondaryColorPtr) {
GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
- COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]);
- COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]);
- COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]);
+ COPY_4V(saved_spec[0], v[0]->attrib[VARYING_SLOT_COL1]);
+ COPY_4V(saved_spec[1], v[1]->attrib[VARYING_SLOT_COL1]);
+ COPY_4V(saved_spec[2], v[2]->attrib[VARYING_SLOT_COL1]);
if (VB->BackfaceSecondaryColorPtr->stride) {
- SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]);
- SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]);
- SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]);
+ SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[e0]);
+ SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[e1]);
+ SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[e2]);
}
else {
- SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
- SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
- SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
+ SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[0]);
+ SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[0]);
+ SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[0]);
}
}
}
if (IND & SS_OFFSET_BIT) {
const GLfloat max = ctx->DrawBuffer->_DepthMaxF;
/* save original Z values (restored later) */
- z[0] = v[0]->attrib[FRAG_ATTRIB_WPOS][2];
- z[1] = v[1]->attrib[FRAG_ATTRIB_WPOS][2];
- z[2] = v[2]->attrib[FRAG_ATTRIB_WPOS][2];
+ z[0] = v[0]->attrib[VARYING_SLOT_POS][2];
+ z[1] = v[1]->attrib[VARYING_SLOT_POS][2];
+ z[2] = v[2]->attrib[VARYING_SLOT_POS][2];
/* Note that Z values are already scaled to [0,65535] (for example)
* so no MRD value is used here.
*/
offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor;
}
/* new Z values */
- oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
- oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
- oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max);
+ oz0 = CLAMP(v[0]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max);
+ oz1 = CLAMP(v[1]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max);
+ oz2 = CLAMP(v[2]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max);
}
}
if (mode == GL_POINT) {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) {
- v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0;
- v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1;
- v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2;
+ v[0]->attrib[VARYING_SLOT_POS][2] = oz0;
+ v[1]->attrib[VARYING_SLOT_POS][2] = oz1;
+ v[2]->attrib[VARYING_SLOT_POS][2] = oz2;
}
_swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri);
} else if (mode == GL_LINE) {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
- v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0;
- v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1;
- v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2;
+ v[0]->attrib[VARYING_SLOT_POS][2] = oz0;
+ v[1]->attrib[VARYING_SLOT_POS][2] = oz1;
+ v[2]->attrib[VARYING_SLOT_POS][2] = oz2;
}
_swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri);
} else {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) {
- v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0;
- v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1;
- v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2;
+ v[0]->attrib[VARYING_SLOT_POS][2] = oz0;
+ v[1]->attrib[VARYING_SLOT_POS][2] = oz1;
+ v[2]->attrib[VARYING_SLOT_POS][2] = oz2;
}
_swrast_Triangle( ctx, v[0], v[1], v[2] );
}
* Restore original vertex colors, etc.
*/
if (IND & SS_OFFSET_BIT) {
- v[0]->attrib[FRAG_ATTRIB_WPOS][2] = z[0];
- v[1]->attrib[FRAG_ATTRIB_WPOS][2] = z[1];
- v[2]->attrib[FRAG_ATTRIB_WPOS][2] = z[2];
+ v[0]->attrib[VARYING_SLOT_POS][2] = z[0];
+ v[1]->attrib[VARYING_SLOT_POS][2] = z[1];
+ v[2]->attrib[VARYING_SLOT_POS][2] = z[2];
}
if (IND & SS_TWOSIDE_BIT) {
COPY_CHAN4(v[2]->color, saved_color[2]);
}
else {
- COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]);
- COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]);
- COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]);
+ COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], saved_col0[0]);
+ COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], saved_col0[1]);
+ COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], saved_col0[2]);
}
}
if (VB->BackfaceSecondaryColorPtr) {
- COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]);
- COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]);
- COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]);
+ COPY_4V(v[0]->attrib[VARYING_SLOT_COL1], saved_spec[0]);
+ COPY_4V(v[1]->attrib[VARYING_SLOT_COL1], saved_spec[1]);
+ COPY_4V(v[2]->attrib[VARYING_SLOT_COL1], saved_spec[2]);
}
}
}
*/
tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS);
- if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
+ if (!fp || (fp->Base.InputsRead & VARYING_BIT_COL0)) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0);
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
- (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
+ (fp && fp->Base.InputsRead & VARYING_BIT_TEX(i))) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i));
}
}
if (ctx->Fog.Enabled
- || (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) {
+ || (fp != NULL && (fp->Base.InputsRead & VARYING_BIT_FOGC) != 0)) {
/* Either fixed-function fog or a fragment program needs fog coord.
*/
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG);
if (format == TINY_VERTEX_FORMAT) {
if (HAVE_HW_VIEWPORT) {
- dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x + s[12];
- dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y + s[13];
- dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z + s[14];
- dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
+ dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x + s[12];
+ dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y + s[13];
+ dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z + s[14];
+ dst->attrib[VARYING_SLOT_POS][3] = 1.0;
} else {
- dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( src->v.x );
- dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( src->v.y );
- dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( src->v.z );
- dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
+ dst->attrib[VARYING_SLOT_POS][0] = UNVIEWPORT_X( src->v.x );
+ dst->attrib[VARYING_SLOT_POS][1] = UNVIEWPORT_Y( src->v.y );
+ dst->attrib[VARYING_SLOT_POS][2] = UNVIEWPORT_Z( src->v.z );
+ dst->attrib[VARYING_SLOT_POS][3] = 1.0;
}
dst->color[0] = src->tv.color.red;
if (HAVE_HW_VIEWPORT) {
if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
GLfloat oow = 1.0 / src->v.w;
- dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x * oow + s[12];
- dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y * oow + s[13];
- dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z * oow + s[14];
- dst->attrib[FRAG_ATTRIB_WPOS][3] = oow;
+ dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x * oow + s[12];
+ dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y * oow + s[13];
+ dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z * oow + s[14];
+ dst->attrib[VARYING_SLOT_POS][3] = oow;
} else {
- dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x + s[12];
- dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y + s[13];
- dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z + s[14];
- dst->attrib[FRAG_ATTRIB_WPOS][3] = src->v.w;
+ dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x + s[12];
+ dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y + s[13];
+ dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z + s[14];
+ dst->attrib[VARYING_SLOT_POS][3] = src->v.w;
}
} else {
- dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( src->v.x );
- dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( src->v.y );
- dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( src->v.z );
- dst->attrib[FRAG_ATTRIB_WPOS][3] = src->v.w;
+ dst->attrib[VARYING_SLOT_POS][0] = UNVIEWPORT_X( src->v.x );
+ dst->attrib[VARYING_SLOT_POS][1] = UNVIEWPORT_Y( src->v.y );
+ dst->attrib[VARYING_SLOT_POS][2] = UNVIEWPORT_Z( src->v.z );
+ dst->attrib[VARYING_SLOT_POS][3] = src->v.w;
}
dst->color[0] = src->v.color.red;
dst->color[2] = src->v.color.blue;
dst->color[3] = src->v.color.alpha;
- dst->attrib[FRAG_ATTRIB_COL1][0] = UBYTE_TO_FLOAT(src->v.specular.red);
- dst->attrib[FRAG_ATTRIB_COL1][1] = UBYTE_TO_FLOAT(src->v.specular.green);
- dst->attrib[FRAG_ATTRIB_COL1][2] = UBYTE_TO_FLOAT(src->v.specular.blue);
+ dst->attrib[VARYING_SLOT_COL1][0] = UBYTE_TO_FLOAT(src->v.specular.red);
+ dst->attrib[VARYING_SLOT_COL1][1] = UBYTE_TO_FLOAT(src->v.specular.green);
+ dst->attrib[VARYING_SLOT_COL1][2] = UBYTE_TO_FLOAT(src->v.specular.blue);
- dst->attrib[FRAG_ATTRIB_FOGC][0] = UBYTE_TO_FLOAT(src->v.specular.alpha);
+ dst->attrib[VARYING_SLOT_FOGC][0] = UBYTE_TO_FLOAT(src->v.specular.alpha);
if (HAVE_PTEX_VERTICES &&
((HAVE_TEX2_VERTICES && format == PROJ_TEX3_VERTEX_FORMAT) ||
(format == PROJ_TEX1_VERTEX_FORMAT))) {
- dst->attrib[FRAG_ATTRIB_TEX0][0] = src->pv.u0;
- dst->attrib[FRAG_ATTRIB_TEX0][1] = src->pv.v0;
- dst->attrib[FRAG_ATTRIB_TEX0][3] = src->pv.q0;
+ dst->attrib[VARYING_SLOT_TEX0][0] = src->pv.u0;
+ dst->attrib[VARYING_SLOT_TEX0][1] = src->pv.v0;
+ dst->attrib[VARYING_SLOT_TEX0][3] = src->pv.q0;
- dst->attrib[FRAG_ATTRIB_TEX1][0] = src->pv.u1;
- dst->attrib[FRAG_ATTRIB_TEX1][1] = src->pv.v1;
- dst->attrib[FRAG_ATTRIB_TEX1][3] = src->pv.q1;
+ dst->attrib[VARYING_SLOT_TEX1][0] = src->pv.u1;
+ dst->attrib[VARYING_SLOT_TEX1][1] = src->pv.v1;
+ dst->attrib[VARYING_SLOT_TEX1][3] = src->pv.q1;
if (HAVE_TEX2_VERTICES) {
- dst->attrib[FRAG_ATTRIB_TEX2][0] = src->pv.u2;
- dst->attrib[FRAG_ATTRIB_TEX2][1] = src->pv.v2;
- dst->attrib[FRAG_ATTRIB_TEX2][3] = src->pv.q2;
+ dst->attrib[VARYING_SLOT_TEX2][0] = src->pv.u2;
+ dst->attrib[VARYING_SLOT_TEX2][1] = src->pv.v2;
+ dst->attrib[VARYING_SLOT_TEX2][3] = src->pv.q2;
}
if (HAVE_TEX3_VERTICES) {
- dst->attrib[FRAG_ATTRIB_TEX3][0] = src->pv.u3;
- dst->attrib[FRAG_ATTRIB_TEX3][1] = src->pv.v3;
- dst->attrib[FRAG_ATTRIB_TEX3][3] = src->pv.q3;
+ dst->attrib[VARYING_SLOT_TEX3][0] = src->pv.u3;
+ dst->attrib[VARYING_SLOT_TEX3][1] = src->pv.v3;
+ dst->attrib[VARYING_SLOT_TEX3][3] = src->pv.q3;
}
}
else {
- dst->attrib[FRAG_ATTRIB_TEX0][0] = src->v.u0;
- dst->attrib[FRAG_ATTRIB_TEX0][1] = src->v.v0;
- dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
+ dst->attrib[VARYING_SLOT_TEX0][0] = src->v.u0;
+ dst->attrib[VARYING_SLOT_TEX0][1] = src->v.v0;
+ dst->attrib[VARYING_SLOT_TEX0][3] = 1.0;
- dst->attrib[FRAG_ATTRIB_TEX1][0] = src->v.u1;
- dst->attrib[FRAG_ATTRIB_TEX1][1] = src->v.v1;
- dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0;
+ dst->attrib[VARYING_SLOT_TEX1][0] = src->v.u1;
+ dst->attrib[VARYING_SLOT_TEX1][1] = src->v.v1;
+ dst->attrib[VARYING_SLOT_TEX1][3] = 1.0;
if (HAVE_TEX2_VERTICES) {
- dst->attrib[FRAG_ATTRIB_TEX2][0] = src->v.u2;
- dst->attrib[FRAG_ATTRIB_TEX2][1] = src->v.v2;
- dst->attrib[FRAG_ATTRIB_TEX2][3] = 1.0;
+ dst->attrib[VARYING_SLOT_TEX2][0] = src->v.u2;
+ dst->attrib[VARYING_SLOT_TEX2][1] = src->v.v2;
+ dst->attrib[VARYING_SLOT_TEX2][3] = 1.0;
}
if (HAVE_TEX3_VERTICES) {
- dst->attrib[FRAG_ATTRIB_TEX3][0] = src->v.u3;
- dst->attrib[FRAG_ATTRIB_TEX3][1] = src->v.v3;
- dst->attrib[FRAG_ATTRIB_TEX3][3] = 1.0;
+ dst->attrib[VARYING_SLOT_TEX3][0] = src->v.u3;
+ dst->attrib[VARYING_SLOT_TEX3][1] = src->v.v3;
+ dst->attrib[VARYING_SLOT_TEX3][3] = 1.0;
}
}
}