};
static const builtin_variable builtin_core_vs_variables[] = {
- { ir_var_shader_out, VERT_RESULT_HPOS, "vec4", "gl_Position" },
- { ir_var_shader_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" },
+ { ir_var_shader_out, VARYING_SLOT_POS, "vec4", "gl_Position" },
+ { ir_var_shader_out, VARYING_SLOT_PSIZ, "float", "gl_PointSize" },
};
static const builtin_variable builtin_core_fs_variables[] = {
{ ir_var_shader_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" },
{ ir_var_shader_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" },
{ ir_var_shader_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" },
- { ir_var_shader_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" },
- { ir_var_shader_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" },
- { ir_var_shader_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" },
- { ir_var_shader_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" },
- { ir_var_shader_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" },
- { ir_var_shader_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" },
+ { ir_var_shader_out, VARYING_SLOT_CLIP_VERTEX, "vec4", "gl_ClipVertex" },
+ { ir_var_shader_out, VARYING_SLOT_COL0, "vec4", "gl_FrontColor" },
+ { ir_var_shader_out, VARYING_SLOT_BFC0, "vec4", "gl_BackColor" },
+ { ir_var_shader_out, VARYING_SLOT_COL1, "vec4", "gl_FrontSecondaryColor" },
+ { ir_var_shader_out, VARYING_SLOT_BFC1, "vec4", "gl_BackSecondaryColor" },
+ { ir_var_shader_out, VARYING_SLOT_FOGC, "float", "gl_FogFragCoord" },
};
static const builtin_variable builtin_120_fs_variables[] = {
add_variable(instructions, state->symbols,
"gl_TexCoord", vec4_array_type, ir_var_shader_out,
- VERT_RESULT_TEX0);
+ VARYING_SLOT_TEX0);
generate_ARB_draw_buffers_variables(instructions, state, false,
vertex_shader);
add_variable(instructions, state->symbols,
"gl_ClipDistance", clip_distance_array_type, ir_var_shader_out,
- VERT_RESULT_CLIP_DIST0);
+ VARYING_SLOT_CLIP_DIST0);
}
* The precise meaning of this field depends on the nature of the variable.
*
* - Vertex shader input: one of the values from \c gl_vert_attrib.
- * - Vertex shader output: one of the values from \c gl_vert_result.
+ * - 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 output: one of the values from \c gl_frag_result.
* - Uniforms: Per-stage uniform slot number for default uniform block.
/**
* 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 VERT_RESULT_VAR0 or FRAG_ATTRIB_VAR0)
+ * (i.e. the one referred to by VARYING_SLOT_VAR0 or FRAG_ATTRIB_VAR0)
* represented by the value 0.
*/
unsigned generic_location;
tfeedback_decl *tfeedback_decls)
{
/* FINISHME: Set dynamically when geometry shader support is added. */
- const unsigned producer_base = VERT_RESULT_VAR0;
+ const unsigned producer_base = VARYING_SLOT_VAR0;
const unsigned consumer_base = FRAG_ATTRIB_VAR0;
varying_matches matches(ctx->Const.DisableVaryingPacking);
hash_table *tfeedback_candidates
if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
link_invalidate_variable_locations(
prog->_LinkedShaders[MESA_SHADER_VERTEX],
- VERT_ATTRIB_GENERIC0, VERT_RESULT_VAR0);
+ VERT_ATTRIB_GENERIC0, VARYING_SLOT_VAR0);
}
/* FINISHME: Geometry shaders not implemented yet */
if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
/**
* Location representing the first generic varying slot for this shader
- * stage (e.g. VERT_RESULT_VAR0 if we are packing vertex shader outputs).
+ * stage (e.g. VARYING_SLOT_VAR0 if we are packing vertex shader outputs).
* Varyings whose location is less than this value are assumed to
* correspond to special fixed function hardware, so they are not lowered.
*/
struct brw_indirect plane_ptr = brw_indirect(4, 0);
struct brw_reg v1_null_ud = retype(vec1(brw_null_reg()), BRW_REGISTER_TYPE_UD);
GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_HPOS);
+ VARYING_SLOT_POS);
brw_MOV(p, get_addr_reg(vtx0), brw_address(c->reg.vertex[0]));
brw_MOV(p, get_addr_reg(vtx1), brw_address(c->reg.vertex[1]));
struct brw_indirect outlist_ptr = brw_indirect(5, 0);
struct brw_indirect freelist_ptr = brw_indirect(6, 0);
GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_HPOS);
+ VARYING_SLOT_POS);
brw_MOV(p, get_addr_reg(vtxPrev), brw_address(c->reg.vertex[2]) );
brw_MOV(p, get_addr_reg(plane_ptr), brw_clip_plane0_address(c));
struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */
GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_HPOS);
+ VARYING_SLOT_POS);
brw_MOV(p, get_addr_reg(vt0), brw_address(c->reg.vertex[0]));
brw_MOV(p, get_addr_reg(vt1), brw_address(c->reg.vertex[1]));
struct brw_reg e = c->reg.tmp0;
struct brw_reg f = c->reg.tmp1;
GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_HPOS);
+ VARYING_SLOT_POS);
struct brw_reg v0 = byte_offset(c->reg.vertex[0], hpos_offset);
struct brw_reg v1 = byte_offset(c->reg.vertex[1], hpos_offset);
struct brw_reg v2 = byte_offset(c->reg.vertex[2], hpos_offset);
/* Do we have any colors to copy?
*/
- if (!(brw_clip_have_vert_result(c, VERT_RESULT_COL0) &&
- brw_clip_have_vert_result(c, VERT_RESULT_BFC0)) &&
- !(brw_clip_have_vert_result(c, VERT_RESULT_COL1) &&
- brw_clip_have_vert_result(c, VERT_RESULT_BFC1)))
+ if (!(brw_clip_have_vert_result(c, VARYING_SLOT_COL0) &&
+ brw_clip_have_vert_result(c, VARYING_SLOT_BFC0)) &&
+ !(brw_clip_have_vert_result(c, VARYING_SLOT_COL1) &&
+ brw_clip_have_vert_result(c, VARYING_SLOT_BFC1)))
return;
/* In some wierd degnerate cases we can end up testing the
GLuint i;
for (i = 0; i < 3; i++) {
- if (brw_clip_have_vert_result(c, VERT_RESULT_COL0) &&
- brw_clip_have_vert_result(c, VERT_RESULT_BFC0))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_COL0) &&
+ brw_clip_have_vert_result(c, VARYING_SLOT_BFC0))
brw_MOV(p,
byte_offset(c->reg.vertex[i],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL0)),
+ VARYING_SLOT_COL0)),
byte_offset(c->reg.vertex[i],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC0)));
+ VARYING_SLOT_BFC0)));
- if (brw_clip_have_vert_result(c, VERT_RESULT_COL1) &&
- brw_clip_have_vert_result(c, VERT_RESULT_BFC1))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_COL1) &&
+ brw_clip_have_vert_result(c, VARYING_SLOT_BFC1))
brw_MOV(p,
byte_offset(c->reg.vertex[i],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL1)),
+ VARYING_SLOT_COL1)),
byte_offset(c->reg.vertex[i],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC1)));
+ VARYING_SLOT_BFC1)));
}
}
brw_ENDIF(p);
brw_AND(p, vec1(brw_null_reg()), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<8));
brw_MOV(p, byte_offset(c->reg.vertex[0],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_EDGE)),
+ VARYING_SLOT_EDGE)),
brw_imm_f(0));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
brw_AND(p, vec1(brw_null_reg()), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<9));
brw_MOV(p, byte_offset(c->reg.vertex[2],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_EDGE)),
+ VARYING_SLOT_EDGE)),
brw_imm_f(0));
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
}
{
struct brw_compile *p = &c->func;
GLuint ndc_offset = brw_vert_result_to_offset(&c->vue_map,
- BRW_VERT_RESULT_NDC);
+ BRW_VARYING_SLOT_NDC);
struct brw_reg z = deref_1f(vert, ndc_offset +
2 * type_sz(BRW_REGISTER_TYPE_F));
brw_CMP(p,
vec1(brw_null_reg()), BRW_CONDITIONAL_NZ,
deref_1f(v0, brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_EDGE)),
+ VARYING_SLOT_EDGE)),
brw_imm_f(0));
brw_IF(p, BRW_EXECUTE_1);
{
brw_CMP(p,
vec1(brw_null_reg()), BRW_CONDITIONAL_NZ,
deref_1f(v0, brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_EDGE)),
+ VARYING_SLOT_EDGE)),
brw_imm_f(0));
brw_IF(p, BRW_EXECUTE_1);
{
brw_clip_tri_init_vertices(c);
brw_clip_init_ff_sync(c);
- assert(brw_clip_have_vert_result(c, VERT_RESULT_EDGE));
+ assert(brw_clip_have_vert_result(c, VARYING_SLOT_EDGE));
if (c->key.fill_ccw == CLIP_CULL &&
c->key.fill_cw == CLIP_CULL) {
struct brw_compile *p = &c->func;
struct brw_reg tmp = get_tmp(c);
GLuint hpos_offset = brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_HPOS);
+ VARYING_SLOT_POS);
GLuint ndc_offset = brw_vert_result_to_offset(&c->vue_map,
- BRW_VERT_RESULT_NDC);
+ BRW_VARYING_SLOT_NDC);
/* Fixup position. Extract from the original vertex and re-project
* to screen space:
int vert_result = c->vue_map.slot_to_vert_result[slot];
GLuint delta = brw_vue_slot_to_offset(slot);
- if (vert_result == VERT_RESULT_EDGE) {
+ if (vert_result == VARYING_SLOT_EDGE) {
if (force_edgeflag)
brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(1));
else
brw_MOV(p, deref_4f(dest_ptr, delta), deref_4f(v0_ptr, delta));
- } else if (vert_result == VERT_RESULT_PSIZ ||
- vert_result == VERT_RESULT_CLIP_DIST0 ||
- vert_result == VERT_RESULT_CLIP_DIST1) {
+ } else if (vert_result == VARYING_SLOT_PSIZ ||
+ vert_result == VARYING_SLOT_CLIP_DIST0 ||
+ vert_result == VARYING_SLOT_CLIP_DIST1) {
/* PSIZ doesn't need interpolation because it isn't used by the
* fragment shader. CLIP_DIST0 and CLIP_DIST1 don't need
* intepolation because on pre-GEN6, these are just placeholder VUE
* slots that don't perform any action.
*/
- } else if (vert_result < VERT_RESULT_MAX) {
+ } else if (vert_result < VARYING_SLOT_MAX) {
/* This is a true vertex result (and not a special value for the VUE
* header), so interpolate:
*
{
struct brw_compile *p = &c->func;
- if (brw_clip_have_vert_result(c, VERT_RESULT_COL0))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_COL0))
brw_MOV(p,
byte_offset(c->reg.vertex[to],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL0)),
+ VARYING_SLOT_COL0)),
byte_offset(c->reg.vertex[from],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL0)));
+ VARYING_SLOT_COL0)));
- if (brw_clip_have_vert_result(c, VERT_RESULT_COL1))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_COL1))
brw_MOV(p,
byte_offset(c->reg.vertex[to],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL1)),
+ VARYING_SLOT_COL1)),
byte_offset(c->reg.vertex[from],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_COL1)));
+ VARYING_SLOT_COL1)));
- if (brw_clip_have_vert_result(c, VERT_RESULT_BFC0))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_BFC0))
brw_MOV(p,
byte_offset(c->reg.vertex[to],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC0)),
+ VARYING_SLOT_BFC0)),
byte_offset(c->reg.vertex[from],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC0)));
+ VARYING_SLOT_BFC0)));
- if (brw_clip_have_vert_result(c, VERT_RESULT_BFC1))
+ if (brw_clip_have_vert_result(c, VARYING_SLOT_BFC1))
brw_MOV(p,
byte_offset(c->reg.vertex[to],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC1)),
+ VARYING_SLOT_BFC1)),
byte_offset(c->reg.vertex[from],
brw_vert_result_to_offset(&c->vue_map,
- VERT_RESULT_BFC1)));
+ VARYING_SLOT_BFC1)));
}
/**
* Enum representing the i965-specific vertex results that don't correspond
- * exactly to any element of gl_vert_result. The values of this enum are
- * assigned such that they don't conflict with gl_vert_result.
+ * exactly to any element of gl_varying_slot. The values of this enum are
+ * assigned such that they don't conflict with gl_varying_slot.
*/
typedef enum
{
- BRW_VERT_RESULT_NDC = VERT_RESULT_MAX,
- BRW_VERT_RESULT_HPOS_DUPLICATE,
- BRW_VERT_RESULT_PAD,
+ BRW_VARYING_SLOT_NDC = VARYING_SLOT_MAX,
+ BRW_VARYING_SLOT_POS_DUPLICATE,
+ BRW_VARYING_SLOT_PAD,
/*
* It's actually not a vert_result but just a _mark_ to let sf aware that
* he need do something special to handle gl_PointCoord builtin variable
* correctly. see compile_sf_prog() for more info.
*/
- BRW_VERT_RESULT_PNTC,
- BRW_VERT_RESULT_MAX
-} brw_vert_result;
+ BRW_VARYING_SLOT_PNTC,
+ BRW_VARYING_SLOT_MAX
+} brw_varying_slot;
/**
- * Data structure recording the relationship between the gl_vert_result enum
+ * Data structure recording the relationship between the gl_varying_slot enum
* and "slots" within the vertex URB entry (VUE). A "slot" is defined as a
* single octaword within the VUE (128 bits).
*
*/
struct brw_vue_map {
/**
- * Map from gl_vert_result value to VUE slot. For gl_vert_results that are
+ * Map from gl_varying_slot value to VUE slot. For gl_varying_slots that are
* not stored in a slot (because they are not written, or because
* additional processing is applied before storing them in the VUE), the
* value is -1.
*/
- int vert_result_to_slot[BRW_VERT_RESULT_MAX];
+ int vert_result_to_slot[BRW_VARYING_SLOT_MAX];
/**
- * Map from VUE slot to gl_vert_result value. For slots that do not
- * directly correspond to a gl_vert_result, the value comes from
- * brw_vert_result.
+ * Map from VUE slot to gl_varying_slot value. For slots that do not
+ * directly correspond to a gl_varying_slot, the value comes from
+ * brw_varying_slot.
*
- * For slots that are not in use, the value is BRW_VERT_RESULT_MAX (this
+ * For slots that are not in use, the value is BRW_VARYING_SLOT_MAX (this
* simplifies code that uses the value stored in slot_to_vert_result to
* create a bit mask).
*/
- int slot_to_vert_result[BRW_VERT_RESULT_MAX];
+ int slot_to_vert_result[BRW_VARYING_SLOT_MAX];
/**
* Total number of VUE slots in use
}
/**
- * Convert a vert_result into a byte offset within the VUE.
+ * Convert a vertex output (brw_varying_slot) into a byte offset within the
+ * VUE.
*/
static inline GLuint brw_vert_result_to_offset(struct brw_vue_map *vue_map,
GLuint vert_result)
}
} else {
/* FINISHME: The sf doesn't map VS->FS inputs for us very well. */
- for (unsigned int i = 0; i < VERT_RESULT_MAX; i++) {
+ for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) {
/* Point size is packed into the header, not as a general attribute */
- if (i == VERT_RESULT_PSIZ)
+ if (i == VARYING_SLOT_PSIZ)
continue;
if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) {
- int fp_index = _mesa_vert_result_to_frag_attrib((gl_vert_result) i);
+ int fp_index = _mesa_vert_result_to_frag_attrib((gl_varying_slot) i);
/* The back color slot is skipped when the front color is
* also written to. In addition, some slots can be
key.proj_attrib_mask |= BITFIELD64_BIT(i);
if (intel->gen < 6) {
- int vp_index = _mesa_vert_result_to_frag_attrib((gl_vert_result) i);
+ int vp_index = _mesa_vert_result_to_frag_attrib((gl_varying_slot) i);
if (vp_index >= 0)
key.vp_outputs_written |= BITFIELD64_BIT(vp_index);
/* Make sure that the VUE slots won't overflow the unsigned chars in
* key->transform_feedback_bindings[].
*/
- STATIC_ASSERT(BRW_VERT_RESULT_MAX <= 256);
+ STATIC_ASSERT(BRW_VARYING_SLOT_MAX <= 256);
/* Make sure that we don't need more binding table entries than we've
* set aside for use in transform feedback. (We shouldn't, since we
/**
* Map from the index of a transform feedback binding table entry to the
- * gl_vert_result that should be streamed out through that binding table
+ * gl_varying_slot that should be streamed out through that binding table
* entry.
*/
unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
struct brw_reg vertex_slot = c->reg.vertex[vertex];
vertex_slot.nr += slot / 2;
vertex_slot.subnr = (slot % 2) * 16;
- /* gl_PointSize is stored in VERT_RESULT_PSIZ.w. */
- vertex_slot.dw1.bits.swizzle = vert_result == VERT_RESULT_PSIZ
+ /* gl_PointSize is stored in VARYING_SLOT_PSIZ.w. */
+ vertex_slot.dw1.bits.swizzle = vert_result == VARYING_SLOT_PSIZ
? BRW_SWIZZLE_WWWW : key->transform_feedback_swizzles[binding];
brw_set_access_mode(p, BRW_ALIGN_16);
brw_MOV(p, stride(c->reg.header, 4, 4, 1),
* it manually to let SF shader generate the needed interpolation
* coefficient for FS shader.
*/
- c.vue_map.vert_result_to_slot[BRW_VERT_RESULT_PNTC] = c.vue_map.num_slots;
- c.vue_map.slot_to_vert_result[c.vue_map.num_slots++] = BRW_VERT_RESULT_PNTC;
+ c.vue_map.vert_result_to_slot[BRW_VARYING_SLOT_PNTC] = c.vue_map.num_slots;
+ c.vue_map.slot_to_vert_result[c.vue_map.num_slots++] = BRW_VARYING_SLOT_PNTC;
}
c.urb_entry_read_offset = brw_sf_compute_urb_entry_read_offset(intel);
c.nr_attr_regs = (c.vue_map.num_slots + 1)/2 - c.urb_entry_read_offset;
* edgeflag testing here, it is already done in the clip
* program.
*/
- if (key.attrs & BITFIELD64_BIT(VERT_RESULT_EDGE))
+ if (key.attrs & BITFIELD64_BIT(VARYING_SLOT_EDGE))
key.primitive = SF_UNFILLED_TRIS;
else
key.primitive = SF_TRIANGLES;
GLuint i;
for (i = 0; i < 2; i++) {
- if (have_attr(c, VERT_RESULT_COL0+i) &&
- have_attr(c, VERT_RESULT_BFC0+i))
+ if (have_attr(c, VARYING_SLOT_COL0+i) &&
+ have_attr(c, VARYING_SLOT_BFC0+i))
brw_MOV(p,
- get_vert_result(c, vert, VERT_RESULT_COL0+i),
- get_vert_result(c, vert, VERT_RESULT_BFC0+i));
+ get_vert_result(c, vert, VARYING_SLOT_COL0+i),
+ get_vert_result(c, vert, VARYING_SLOT_BFC0+i));
}
}
* for user-supplied vertex programs, as t_vp_build.c always does
* the right thing.
*/
- if (!(have_attr(c, VERT_RESULT_COL0) && have_attr(c, VERT_RESULT_BFC0)) &&
- !(have_attr(c, VERT_RESULT_COL1) && have_attr(c, VERT_RESULT_BFC1)))
+ if (!(have_attr(c, VARYING_SLOT_COL0) && have_attr(c, VARYING_SLOT_BFC0)) &&
+ !(have_attr(c, VARYING_SLOT_COL1) && have_attr(c, VARYING_SLOT_BFC1)))
return;
/* Need to use BRW_EXECUTE_4 and also do an 4-wide compare in order
* Flat shading
*/
-#define VERT_RESULT_COLOR_BITS (BITFIELD64_BIT(VERT_RESULT_COL0) | \
- BITFIELD64_BIT(VERT_RESULT_COL1))
+#define VARYING_SLOT_COLOR_BITS (BITFIELD64_BIT(VARYING_SLOT_COL0) | \
+ BITFIELD64_BIT(VARYING_SLOT_COL1))
static void copy_colors( struct brw_sf_compile *c,
struct brw_reg dst,
struct brw_compile *p = &c->func;
GLuint i;
- for (i = VERT_RESULT_COL0; i <= VERT_RESULT_COL1; i++) {
+ for (i = VARYING_SLOT_COL0; i <= VARYING_SLOT_COL1; i++) {
if (have_attr(c,i))
brw_MOV(p,
get_vert_result(c, dst, i),
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
struct brw_reg ip = brw_ip_reg();
- GLuint nr = _mesa_bitcount_64(c->key.attrs & VERT_RESULT_COLOR_BITS);
+ GLuint nr = _mesa_bitcount_64(c->key.attrs & VARYING_SLOT_COLOR_BITS);
GLuint jmpi = 1;
if (!nr)
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
struct brw_reg ip = brw_ip_reg();
- GLuint nr = _mesa_bitcount_64(c->key.attrs & VERT_RESULT_COLOR_BITS);
+ GLuint nr = _mesa_bitcount_64(c->key.attrs & VARYING_SLOT_COLOR_BITS);
GLuint jmpi = 1;
if (!nr)
GLbitfield64 linear_mask;
if (c->key.do_flat_shading)
- persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS) |
- BITFIELD64_BIT(VERT_RESULT_COL0) |
- BITFIELD64_BIT(VERT_RESULT_COL1));
+ persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VARYING_SLOT_POS) |
+ BITFIELD64_BIT(VARYING_SLOT_COL0) |
+ BITFIELD64_BIT(VARYING_SLOT_COL1));
else
- persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS));
+ persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VARYING_SLOT_POS));
if (c->key.do_flat_shading)
- linear_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_COL0) |
- BITFIELD64_BIT(VERT_RESULT_COL1));
+ linear_mask = c->key.attrs & ~(BITFIELD64_BIT(VARYING_SLOT_COL0) |
+ BITFIELD64_BIT(VARYING_SLOT_COL1));
else
linear_mask = c->key.attrs;
/* Maybe only processs one attribute on the final round:
*/
- if (vert_reg_to_vert_result(c, reg, 1) != BRW_VERT_RESULT_MAX) {
+ if (vert_reg_to_vert_result(c, reg, 1) != BRW_VARYING_SLOT_MAX) {
*pc |= 0xf0;
if (persp_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 1)))
uint16_t pc = 0;
vert_result1 = vert_reg_to_vert_result(c, reg, 0);
- if (vert_result1 >= VERT_RESULT_TEX0 && vert_result1 <= VERT_RESULT_TEX7) {
- if (c->key.point_sprite_coord_replace & (1 << (vert_result1 - VERT_RESULT_TEX0)))
+ if (vert_result1 >= VARYING_SLOT_TEX0 && vert_result1 <= VARYING_SLOT_TEX7) {
+ if (c->key.point_sprite_coord_replace & (1 << (vert_result1 - VARYING_SLOT_TEX0)))
pc |= 0x0f;
}
- if (vert_result1 == BRW_VERT_RESULT_PNTC)
+ if (vert_result1 == BRW_VARYING_SLOT_PNTC)
pc |= 0x0f;
vert_result2 = vert_reg_to_vert_result(c, reg, 1);
- if (vert_result2 >= VERT_RESULT_TEX0 && vert_result2 <= VERT_RESULT_TEX7) {
+ if (vert_result2 >= VARYING_SLOT_TEX0 && vert_result2 <= VARYING_SLOT_TEX7) {
if (c->key.point_sprite_coord_replace & (1 << (vert_result2 -
- VERT_RESULT_TEX0)))
+ VARYING_SLOT_TEX0)))
pc |= 0xf0;
}
- if (vert_result2 == BRW_VERT_RESULT_PNTC)
+ if (vert_result2 == BRW_VARYING_SLOT_PNTC)
pc |= 0xf0;
return pc;
/* Regs for vertex results. Generated at ir_variable visiting time
* for the ir->location's used.
*/
- dst_reg output_reg[BRW_VERT_RESULT_MAX];
- const char *output_reg_annotation[BRW_VERT_RESULT_MAX];
+ dst_reg output_reg[BRW_VARYING_SLOT_MAX];
+ const char *output_reg_annotation[BRW_VARYING_SLOT_MAX];
int uniform_size[MAX_UNIFORMS];
int uniform_vector_size[MAX_UNIFORMS];
int uniforms;
vec4_visitor::emit_ndc_computation()
{
/* Get the position */
- src_reg pos = src_reg(output_reg[VERT_RESULT_HPOS]);
+ src_reg pos = src_reg(output_reg[VARYING_SLOT_POS]);
/* Build ndc coords, which are (x/w, y/w, z/w, 1/w) */
dst_reg ndc = dst_reg(this, glsl_type::vec4_type);
- output_reg[BRW_VERT_RESULT_NDC] = ndc;
+ output_reg[BRW_VARYING_SLOT_NDC] = ndc;
current_annotation = "NDC";
dst_reg ndc_w = ndc;
vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
{
if (intel->gen < 6 &&
- ((c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) ||
+ ((c->prog_data.outputs_written & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) ||
c->key.userclip_active || brw->has_negative_rhw_bug)) {
dst_reg header1 = dst_reg(this, glsl_type::uvec4_type);
dst_reg header1_w = header1;
emit(MOV(header1, 0u));
- if (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
- src_reg psiz = src_reg(output_reg[VERT_RESULT_PSIZ]);
+ if (c->prog_data.outputs_written & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
+ src_reg psiz = src_reg(output_reg[VARYING_SLOT_PSIZ]);
current_annotation = "Point size";
emit(MUL(header1_w, psiz, src_reg((float)(1 << 11))));
for (i = 0; i < c->key.nr_userclip_plane_consts; i++) {
vec4_instruction *inst;
- inst = emit(DP4(dst_null_f(), src_reg(output_reg[VERT_RESULT_HPOS]),
+ inst = emit(DP4(dst_null_f(), src_reg(output_reg[VARYING_SLOT_POS]),
src_reg(this->userplane[i])));
inst->conditional_mod = BRW_CONDITIONAL_L;
* clipped against all fixed planes.
*/
if (brw->has_negative_rhw_bug) {
- src_reg ndc_w = src_reg(output_reg[BRW_VERT_RESULT_NDC]);
+ src_reg ndc_w = src_reg(output_reg[BRW_VARYING_SLOT_NDC]);
ndc_w.swizzle = BRW_SWIZZLE_WWWW;
emit(CMP(dst_null_f(), ndc_w, src_reg(0.0f), BRW_CONDITIONAL_L));
vec4_instruction *inst;
inst = emit(OR(header1_w, src_reg(header1_w), src_reg(1u << 6)));
inst->predicate = BRW_PREDICATE_NORMAL;
- inst = emit(MOV(output_reg[BRW_VERT_RESULT_NDC], src_reg(0.0f)));
+ inst = emit(MOV(output_reg[BRW_VARYING_SLOT_NDC], src_reg(0.0f)));
inst->predicate = BRW_PREDICATE_NORMAL;
}
emit(MOV(retype(reg, BRW_REGISTER_TYPE_UD), 0u));
} else {
emit(MOV(retype(reg, BRW_REGISTER_TYPE_D), src_reg(0)));
- if (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
+ if (c->prog_data.outputs_written & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
emit(MOV(brw_writemask(reg, WRITEMASK_W),
- src_reg(output_reg[VERT_RESULT_PSIZ])));
+ src_reg(output_reg[VARYING_SLOT_PSIZ])));
}
}
}
* gl_ClipDistance. Accordingly, we use gl_ClipVertex to perform clipping
* if the user wrote to it; otherwise we use gl_Position.
*/
- gl_vert_result clip_vertex = VERT_RESULT_CLIP_VERTEX;
+ gl_varying_slot clip_vertex = VARYING_SLOT_CLIP_VERTEX;
if (!(c->prog_data.outputs_written
- & BITFIELD64_BIT(VERT_RESULT_CLIP_VERTEX))) {
- clip_vertex = VERT_RESULT_HPOS;
+ & BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX))) {
+ clip_vertex = VARYING_SLOT_POS;
}
for (int i = 0; i + offset < c->key.nr_userclip_plane_consts && i < 4;
void
vec4_visitor::emit_generic_urb_slot(dst_reg reg, int vert_result)
{
- assert (vert_result < VERT_RESULT_MAX);
+ assert (vert_result < VARYING_SLOT_MAX);
reg.type = output_reg[vert_result].type;
current_annotation = output_reg_annotation[vert_result];
/* Copy the register, saturating if necessary */
vec4_instruction *inst = emit(MOV(reg,
src_reg(output_reg[vert_result])));
- if ((vert_result == VERT_RESULT_COL0 ||
- vert_result == VERT_RESULT_COL1 ||
- vert_result == VERT_RESULT_BFC0 ||
- vert_result == VERT_RESULT_BFC1) &&
+ if ((vert_result == VARYING_SLOT_COL0 ||
+ vert_result == VARYING_SLOT_COL1 ||
+ vert_result == VARYING_SLOT_BFC0 ||
+ vert_result == VARYING_SLOT_BFC1) &&
c->key.clamp_vertex_color) {
inst->saturate = true;
}
reg.type = BRW_REGISTER_TYPE_F;
switch (vert_result) {
- case VERT_RESULT_PSIZ:
+ case VARYING_SLOT_PSIZ:
/* PSIZ is always in slot 0, and is coupled with other flags. */
current_annotation = "indices, point width, clip flags";
emit_psiz_and_flags(hw_reg);
break;
- case BRW_VERT_RESULT_NDC:
+ case BRW_VARYING_SLOT_NDC:
current_annotation = "NDC";
- emit(MOV(reg, src_reg(output_reg[BRW_VERT_RESULT_NDC])));
+ emit(MOV(reg, src_reg(output_reg[BRW_VARYING_SLOT_NDC])));
break;
- case BRW_VERT_RESULT_HPOS_DUPLICATE:
- case VERT_RESULT_HPOS:
+ case BRW_VARYING_SLOT_POS_DUPLICATE:
+ case VARYING_SLOT_POS:
current_annotation = "gl_Position";
- emit(MOV(reg, src_reg(output_reg[VERT_RESULT_HPOS])));
+ emit(MOV(reg, src_reg(output_reg[VARYING_SLOT_POS])));
break;
- case VERT_RESULT_CLIP_DIST0:
- case VERT_RESULT_CLIP_DIST1:
+ case VARYING_SLOT_CLIP_DIST0:
+ case VARYING_SLOT_CLIP_DIST1:
if (this->c->key.uses_clip_distance) {
emit_generic_urb_slot(reg, vert_result);
} else {
current_annotation = "user clip distances";
- emit_clip_distances(hw_reg, (vert_result - VERT_RESULT_CLIP_DIST0) * 4);
+ emit_clip_distances(hw_reg, (vert_result - VARYING_SLOT_CLIP_DIST0) * 4);
}
break;
- case VERT_RESULT_EDGE:
+ case VARYING_SLOT_EDGE:
/* This is present when doing unfilled polygons. We're supposed to copy
* the edge flag from the user-provided vertex array
* (glEdgeFlagPointer), or otherwise we'll copy from the current value
emit(MOV(reg, src_reg(dst_reg(ATTR, VERT_ATTRIB_EDGEFLAG,
glsl_type::float_type, WRITEMASK_XYZW))));
break;
- case BRW_VERT_RESULT_PAD:
+ case BRW_VARYING_SLOT_PAD:
/* No need to write to this slot */
break;
default:
/* PROGRAM_OUTPUT */
for (int slot = 0; slot < c->prog_data.vue_map.num_slots; slot++) {
int vert_result = c->prog_data.vue_map.slot_to_vert_result[slot];
- if (vert_result == VERT_RESULT_PSIZ)
+ if (vert_result == VARYING_SLOT_PSIZ)
output_reg[vert_result] = dst_reg(this, glsl_type::float_type);
else
output_reg[vert_result] = dst_reg(this, glsl_type::vec4_type);
int i;
vue_map->num_slots = 0;
- for (i = 0; i < BRW_VERT_RESULT_MAX; ++i) {
+ for (i = 0; i < BRW_VARYING_SLOT_MAX; ++i) {
vue_map->vert_result_to_slot[i] = -1;
- vue_map->slot_to_vert_result[i] = BRW_VERT_RESULT_MAX;
+ vue_map->slot_to_vert_result[i] = BRW_VARYING_SLOT_MAX;
}
/* VUE header: format depends on chip generation and whether clipping is
* dword 4-7 is ndc position
* dword 8-11 is the first vertex data.
*/
- assign_vue_slot(vue_map, VERT_RESULT_PSIZ);
- assign_vue_slot(vue_map, BRW_VERT_RESULT_NDC);
- assign_vue_slot(vue_map, VERT_RESULT_HPOS);
+ assign_vue_slot(vue_map, VARYING_SLOT_PSIZ);
+ assign_vue_slot(vue_map, BRW_VARYING_SLOT_NDC);
+ assign_vue_slot(vue_map, VARYING_SLOT_POS);
break;
case 5:
/* There are 20 DWs (D0-D19) in VUE header on Ironlake:
* contiguous with the other vert_results, so we make dword 24-27 a
* duplicate copy of the 4D space position.
*/
- assign_vue_slot(vue_map, VERT_RESULT_PSIZ);
- assign_vue_slot(vue_map, BRW_VERT_RESULT_NDC);
- assign_vue_slot(vue_map, BRW_VERT_RESULT_HPOS_DUPLICATE);
- assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST0);
- assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST1);
- assign_vue_slot(vue_map, BRW_VERT_RESULT_PAD);
- assign_vue_slot(vue_map, VERT_RESULT_HPOS);
+ assign_vue_slot(vue_map, VARYING_SLOT_PSIZ);
+ assign_vue_slot(vue_map, BRW_VARYING_SLOT_NDC);
+ assign_vue_slot(vue_map, BRW_VARYING_SLOT_POS_DUPLICATE);
+ assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST0);
+ assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST1);
+ assign_vue_slot(vue_map, BRW_VARYING_SLOT_PAD);
+ assign_vue_slot(vue_map, VARYING_SLOT_POS);
break;
case 6:
case 7:
* enabled.
* dword 8-11 or 16-19 is the first vertex element data we fill.
*/
- assign_vue_slot(vue_map, VERT_RESULT_PSIZ);
- assign_vue_slot(vue_map, VERT_RESULT_HPOS);
+ assign_vue_slot(vue_map, VARYING_SLOT_PSIZ);
+ assign_vue_slot(vue_map, VARYING_SLOT_POS);
if (c->key.userclip_active) {
- assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST0);
- assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST1);
+ assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST0);
+ assign_vue_slot(vue_map, VARYING_SLOT_CLIP_DIST1);
}
/* front and back colors need to be consecutive so that we can use
* ATTRIBUTE_SWIZZLE_INPUTATTR_FACING to swizzle them when doing
* two-sided color.
*/
- if (outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0))
- assign_vue_slot(vue_map, VERT_RESULT_COL0);
- if (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0))
- assign_vue_slot(vue_map, VERT_RESULT_BFC0);
- if (outputs_written & BITFIELD64_BIT(VERT_RESULT_COL1))
- assign_vue_slot(vue_map, VERT_RESULT_COL1);
- if (outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC1))
- assign_vue_slot(vue_map, VERT_RESULT_BFC1);
+ if (outputs_written & BITFIELD64_BIT(VARYING_SLOT_COL0))
+ assign_vue_slot(vue_map, VARYING_SLOT_COL0);
+ if (outputs_written & BITFIELD64_BIT(VARYING_SLOT_BFC0))
+ assign_vue_slot(vue_map, VARYING_SLOT_BFC0);
+ if (outputs_written & BITFIELD64_BIT(VARYING_SLOT_COL1))
+ assign_vue_slot(vue_map, VARYING_SLOT_COL1);
+ if (outputs_written & BITFIELD64_BIT(VARYING_SLOT_BFC1))
+ assign_vue_slot(vue_map, VARYING_SLOT_BFC1);
break;
default:
assert (!"VUE map not known for this chip generation");
* assign them contiguously. Don't reassign outputs that already have a
* slot.
*
- * Also, prior to Gen6, don't assign a slot for VERT_RESULT_CLIP_VERTEX,
- * since it is unsupported. In Gen6 and above, VERT_RESULT_CLIP_VERTEX may
+ * Also, prior to Gen6, don't assign a slot for VARYING_SLOT_CLIP_VERTEX,
+ * since it is unsupported. In Gen6 and above, VARYING_SLOT_CLIP_VERTEX may
* be needed for transform feedback; since we don't want to have to
* recompute the VUE map (and everything that depends on it) when transform
* feedback is enabled or disabled, just go ahead and assign a slot for it.
*/
- for (int i = 0; i < VERT_RESULT_MAX; ++i) {
- if (intel->gen < 6 && i == VERT_RESULT_CLIP_VERTEX)
+ for (int i = 0; i < VARYING_SLOT_MAX; ++i) {
+ if (intel->gen < 6 && i == VARYING_SLOT_CLIP_VERTEX)
continue;
if ((outputs_written & BITFIELD64_BIT(i)) &&
vue_map->vert_result_to_slot[i] == -1) {
c.prog_data.inputs_read = vp->program.Base.InputsRead;
if (c.key.copy_edgeflag) {
- c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_EDGE);
+ c.prog_data.outputs_written |= BITFIELD64_BIT(VARYING_SLOT_EDGE);
c.prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
}
*/
for (i = 0; i < 8; i++) {
if (c.key.point_coord_replace & (1 << i))
- c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_TEX0 + i);
+ c.prog_data.outputs_written |= BITFIELD64_BIT(VARYING_SLOT_TEX0 + i);
}
}
}
/**
- * Return the size (1,2,3 or 4) of the output/result for VERT_RESULT_idx.
+ * Return the size (1,2,3 or 4) of the output/result for VARYING_SLOT_idx.
*/
static GLubyte get_output_size( struct tracker *t,
GLuint idx )
{
GLubyte active;
- assert(idx < VERT_RESULT_MAX);
+ assert(idx < VARYING_SLOT_MAX);
active = t->active[PROGRAM_OUTPUT][idx];
if (active & (1<<3)) return 4;
if (active & (1<<2)) return 3;
GLint vertRes;
if (t->twoside) {
- t->active[PROGRAM_OUTPUT][VERT_RESULT_COL0] |=
- t->active[PROGRAM_OUTPUT][VERT_RESULT_BFC0];
+ t->active[PROGRAM_OUTPUT][VARYING_SLOT_COL0] |=
+ t->active[PROGRAM_OUTPUT][VARYING_SLOT_BFC0];
- t->active[PROGRAM_OUTPUT][VERT_RESULT_COL1] |=
- t->active[PROGRAM_OUTPUT][VERT_RESULT_BFC1];
+ t->active[PROGRAM_OUTPUT][VARYING_SLOT_COL1] |=
+ t->active[PROGRAM_OUTPUT][VARYING_SLOT_BFC1];
}
/* Examine vertex program output sizes to set the size_masks[] info
* which describes the fragment program input sizes.
*/
- for (vertRes = 0; vertRes < VERT_RESULT_MAX; vertRes++) {
+ for (vertRes = 0; vertRes < VARYING_SLOT_MAX; vertRes++) {
/* map vertex program output index to fragment program input index */
GLint fragAttrib = _mesa_vert_result_to_frag_attrib(vertRes);
int fs_attr, bool two_side_color, uint32_t *max_source_attr)
{
int vs_attr = _mesa_frag_attrib_to_vert_result(fs_attr);
- if (vs_attr < 0 || vs_attr == VERT_RESULT_HPOS) {
+ if (vs_attr < 0 || vs_attr == VARYING_SLOT_POS) {
/* These attributes will be overwritten by the fragment shader's
* interpolation code (see emit_interp() in brw_wm_fp.c), so just let
* them reference the first available attribute.
/* If there was only a back color written but not front, use back
* as the color instead of undefined
*/
- if (slot == -1 && vs_attr == VERT_RESULT_COL0)
- slot = vue_map->vert_result_to_slot[VERT_RESULT_BFC0];
- if (slot == -1 && vs_attr == VERT_RESULT_COL1)
- slot = vue_map->vert_result_to_slot[VERT_RESULT_BFC1];
+ if (slot == -1 && vs_attr == VARYING_SLOT_COL0)
+ slot = vue_map->vert_result_to_slot[VARYING_SLOT_BFC0];
+ if (slot == -1 && vs_attr == VARYING_SLOT_COL1)
+ slot = vue_map->vert_result_to_slot[VARYING_SLOT_BFC1];
if (slot == -1) {
/* This attribute does not exist in the VUE--that means that the vertex
* do back-facing swizzling.
*/
bool swizzling = two_side_color &&
- ((vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL0 &&
- vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC0) ||
- (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
- vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1));
+ ((vue_map->slot_to_vert_result[slot] == VARYING_SLOT_COL0 &&
+ vue_map->slot_to_vert_result[slot+1] == VARYING_SLOT_BFC0) ||
+ (vue_map->slot_to_vert_result[slot] == VARYING_SLOT_COL1 &&
+ vue_map->slot_to_vert_result[slot+1] == VARYING_SLOT_BFC1));
/* Update max_source_attr. If swizzling, the SF will read this slot + 1. */
if (*max_source_attr < source_attr + swizzling)
unsigned component_mask =
(1 << linked_xfb_info->Outputs[i].NumComponents) - 1;
- /* gl_PointSize is stored in VERT_RESULT_PSIZ.w. */
- if (vert_result == VERT_RESULT_PSIZ) {
+ /* gl_PointSize is stored in VARYING_SLOT_PSIZ.w. */
+ if (vert_result == VARYING_SLOT_PSIZ) {
assert(linked_xfb_info->Outputs[i].NumComponents == 1);
component_mask <<= 3;
} else {
rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
- assert(vp_out & BITFIELD64_BIT(VERT_RESULT_HPOS));
+ assert(vp_out & BITFIELD64_BIT(VARYING_SLOT_POS));
out_compsel = R200_OUTPUT_XYZW;
- if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL0)) {
+ if (vp_out & BITFIELD64_BIT(VARYING_SLOT_COL0)) {
out_compsel |= R200_OUTPUT_COLOR_0;
}
- if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL1)) {
+ if (vp_out & BITFIELD64_BIT(VARYING_SLOT_COL1)) {
out_compsel |= R200_OUTPUT_COLOR_1;
}
- if (vp_out & BITFIELD64_BIT(VERT_RESULT_FOGC)) {
+ if (vp_out & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
out_compsel |= R200_OUTPUT_DISCRETE_FOG;
}
- if (vp_out & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
+ if (vp_out & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
out_compsel |= R200_OUTPUT_PT_SIZE;
}
- for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) {
+ for (i = VARYING_SLOT_TEX0; i < VARYING_SLOT_TEX6; i++) {
if (vp_out & BITFIELD64_BIT(i)) {
- out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0);
+ out_compsel |= R200_OUTPUT_TEX_0 << (i - VARYING_SLOT_TEX0);
}
}
if (rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] != out_compsel) {
| R200_VSF_OUT_CLASS_TMP);
case PROGRAM_OUTPUT:
switch (dst->Index) {
- case VERT_RESULT_HPOS:
+ case VARYING_SLOT_POS:
return R200_VSF_OUT_CLASS_RESULT_POS;
- case VERT_RESULT_COL0:
+ case VARYING_SLOT_COL0:
return R200_VSF_OUT_CLASS_RESULT_COLOR;
- case VERT_RESULT_COL1:
+ case VARYING_SLOT_COL1:
return ((1 << R200_VPI_OUT_REG_INDEX_SHIFT)
| R200_VSF_OUT_CLASS_RESULT_COLOR);
- case VERT_RESULT_FOGC:
+ case VARYING_SLOT_FOGC:
return R200_VSF_OUT_CLASS_RESULT_FOGC;
- case VERT_RESULT_TEX0:
- case VERT_RESULT_TEX1:
- case VERT_RESULT_TEX2:
- case VERT_RESULT_TEX3:
- case VERT_RESULT_TEX4:
- case VERT_RESULT_TEX5:
- return (((dst->Index - VERT_RESULT_TEX0) << R200_VPI_OUT_REG_INDEX_SHIFT)
+ case VARYING_SLOT_TEX0:
+ case VARYING_SLOT_TEX1:
+ case VARYING_SLOT_TEX2:
+ case VARYING_SLOT_TEX3:
+ case VARYING_SLOT_TEX4:
+ case VARYING_SLOT_TEX5:
+ return (((dst->Index - VARYING_SLOT_TEX0) << R200_VPI_OUT_REG_INDEX_SHIFT)
| R200_VSF_OUT_CLASS_RESULT_TEXC);
- case VERT_RESULT_PSIZ:
+ case VARYING_SLOT_PSIZ:
return R200_VSF_OUT_CLASS_RESULT_POINTSIZE;
default:
fprintf(stderr, "problem in %s, unknown dst output reg %d\n", __FUNCTION__, dst->Index);
#endif
if ((mesa_vp->Base.OutputsWritten &
- ~((1 << VERT_RESULT_HPOS) | (1 << VERT_RESULT_COL0) | (1 << VERT_RESULT_COL1) |
- (1 << VERT_RESULT_FOGC) | (1 << VERT_RESULT_TEX0) | (1 << VERT_RESULT_TEX1) |
- (1 << VERT_RESULT_TEX2) | (1 << VERT_RESULT_TEX3) | (1 << VERT_RESULT_TEX4) |
- (1 << VERT_RESULT_TEX5) | (1 << VERT_RESULT_PSIZ))) != 0) {
+ ~((1 << VARYING_SLOT_POS) | (1 << VARYING_SLOT_COL0) | (1 << VARYING_SLOT_COL1) |
+ (1 << VARYING_SLOT_FOGC) | (1 << VARYING_SLOT_TEX0) | (1 << VARYING_SLOT_TEX1) |
+ (1 << VARYING_SLOT_TEX2) | (1 << VARYING_SLOT_TEX3) | (1 << VARYING_SLOT_TEX4) |
+ (1 << VARYING_SLOT_TEX5) | (1 << VARYING_SLOT_PSIZ))) != 0) {
if (R200_DEBUG & RADEON_FALLBACKS) {
fprintf(stderr, "can't handle vert prog outputs 0x%llx\n",
(unsigned long long) mesa_vp->Base.OutputsWritten);
/* FIXME: is changing the prog safe to do here? */
if (mesa_vp->IsPositionInvariant &&
/* make sure we only do this once */
- !(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) {
+ !(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
_mesa_insert_mvp_code(ctx, mesa_vp);
}
/* for fogc, can't change mesa_vp, as it would hose swtnl, and exp with
base e isn't directly available neither. */
- if ((mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) && !vp->fogpidx) {
+ if ((mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_FOGC)) && !vp->fogpidx) {
struct gl_program_parameter_list *paramList;
gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
paramList = mesa_vp->Base.Parameters;
}
}
- if (!(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) {
+ if (!(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
if (R200_DEBUG & RADEON_FALLBACKS) {
fprintf(stderr, "can't handle vert prog without position output\n");
}
dst = vpi->DstReg;
if (dst.File == PROGRAM_OUTPUT &&
- dst.Index == VERT_RESULT_FOGC &&
+ dst.Index == VARYING_SLOT_FOGC &&
dst.WriteMask & WRITEMASK_X) {
fog_temp_i = u_temp_i;
dst.File = PROGRAM_TEMPORARY;
gl_frag_result fr = FRAG_RESULT_DEPTH;
gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX;
gl_vert_attrib va = VERT_ATTRIB_POS;
- gl_vert_result vr = VERT_RESULT_HPOS;
+ gl_varying_slot vs = VARYING_SLOT_POS;
gl_geom_attrib ga = GEOM_ATTRIB_POSITION;
gl_geom_result gr = GEOM_RESULT_POS;
(void) fr;
(void) ti;
(void) va;
- (void) vr;
+ (void) vs;
(void) ga;
(void) gr;
}
check_context_limits(struct gl_context *ctx)
{
/* check that we don't exceed the size of various bitfields */
- assert(VERT_RESULT_MAX <=
+ assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
assert(FRAG_ATTRIB_MAX <=
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
#define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0)
-#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0)
/**
* Identify all possible varying inputs. The fragment program will
if (ctx->Point.PointSprite)
vp_outputs |= FRAG_BITS_TEX_ANY;
- if (vp_outputs & (1 << VERT_RESULT_COL0))
+ if (vp_outputs & (1 << VARYING_SLOT_COL0))
fp_inputs |= FRAG_BIT_COL0;
- if (vp_outputs & (1 << VERT_RESULT_COL1))
+ if (vp_outputs & (1 << VARYING_SLOT_COL1))
fp_inputs |= FRAG_BIT_COL1;
- fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0)
+ fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0)
<< FRAG_ATTRIB_TEX0);
}
/**
- * \param input one of VERT_RESULT_x tokens.
+ * \param input one of VARYING_SLOT_x tokens.
*/
static struct ureg register_output( struct tnl_program *p, GLuint output )
{
static void build_hpos( struct tnl_program *p )
{
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
- struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
+ struct ureg hpos = register_output( p, VARYING_SLOT_POS );
struct ureg mvp[4];
if (p->mvp_with_dp4) {
/* If no lights, still need to emit the scenecolor.
*/
{
- struct ureg res0 = register_output( p, VERT_RESULT_COL0 );
+ struct ureg res0 = register_output( p, VARYING_SLOT_COL0 );
emit_op1(p, OPCODE_MOV, res0, 0, _col0);
}
if (separate) {
- struct ureg res1 = register_output( p, VERT_RESULT_COL1 );
+ struct ureg res1 = register_output( p, VARYING_SLOT_COL1 );
emit_op1(p, OPCODE_MOV, res1, 0, _col1);
}
if (twoside) {
- struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
+ struct ureg res0 = register_output( p, VARYING_SLOT_BFC0 );
emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
}
if (twoside && separate) {
- struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
+ struct ureg res1 = register_output( p, VARYING_SLOT_BFC1 );
emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
}
if (separate) {
mask0 = WRITEMASK_XYZ;
mask1 = WRITEMASK_XYZ;
- res0 = register_output( p, VERT_RESULT_COL0 );
- res1 = register_output( p, VERT_RESULT_COL1 );
+ res0 = register_output( p, VARYING_SLOT_COL0 );
+ res1 = register_output( p, VARYING_SLOT_COL1 );
}
else {
mask0 = 0;
mask1 = WRITEMASK_XYZ;
res0 = _col0;
- res1 = register_output( p, VERT_RESULT_COL0 );
+ res1 = register_output( p, VARYING_SLOT_COL0 );
}
}
else {
if (separate) {
mask0 = WRITEMASK_XYZ;
mask1 = WRITEMASK_XYZ;
- res0 = register_output( p, VERT_RESULT_BFC0 );
- res1 = register_output( p, VERT_RESULT_BFC1 );
+ res0 = register_output( p, VARYING_SLOT_BFC0 );
+ res1 = register_output( p, VARYING_SLOT_BFC1 );
}
else {
mask0 = 0;
mask1 = WRITEMASK_XYZ;
res0 = _bfc0;
- res1 = register_output( p, VERT_RESULT_BFC0 );
+ res1 = register_output( p, VARYING_SLOT_BFC0 );
}
}
else {
static void build_fog( struct tnl_program *p )
{
- struct ureg fog = register_output(p, VERT_RESULT_FOGC);
+ struct ureg fog = register_output(p, VARYING_SLOT_FOGC);
struct ureg input;
if (p->state->fog_source_is_depth) {
p->state->unit[i].texmat_enabled) {
GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
- struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
+ struct ureg out = register_output(p, VARYING_SLOT_TEX0 + i);
struct ureg out_texgen = undef;
if (p->state->unit[i].texgen_enabled) {
release_temps(p);
}
else {
- emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
+ emit_passthrough(p, VERT_ATTRIB_TEX0+i, VARYING_SLOT_TEX0+i);
}
}
}
struct ureg eye = get_eye_position_z(p);
struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED);
struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
- struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ struct ureg out = register_output(p, VARYING_SLOT_PSIZ);
struct ureg ut = get_temp(p);
/* dist = |eyez| */
static void build_array_pointsize( struct tnl_program *p )
{
struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE);
- struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ struct ureg out = register_output(p, VARYING_SLOT_PSIZ);
emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in);
}
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
- emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
+ emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
- emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
+ emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1);
}
}
/*@}*/
-/**
- * Indexes for vertex program result attributes. Note that
- * _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() make
- * assumptions about the layout of this enum.
- */
-typedef enum
-{
- VERT_RESULT_HPOS = VARYING_SLOT_POS,
- VERT_RESULT_COL0 = VARYING_SLOT_COL0,
- VERT_RESULT_COL1 = VARYING_SLOT_COL1,
- VERT_RESULT_FOGC = VARYING_SLOT_FOGC,
- VERT_RESULT_TEX0 = VARYING_SLOT_TEX0,
- VERT_RESULT_TEX1 = VARYING_SLOT_TEX1,
- VERT_RESULT_TEX2 = VARYING_SLOT_TEX2,
- VERT_RESULT_TEX3 = VARYING_SLOT_TEX3,
- VERT_RESULT_TEX4 = VARYING_SLOT_TEX4,
- VERT_RESULT_TEX5 = VARYING_SLOT_TEX5,
- VERT_RESULT_TEX6 = VARYING_SLOT_TEX6,
- VERT_RESULT_TEX7 = VARYING_SLOT_TEX7,
- VERT_RESULT_PSIZ = VARYING_SLOT_PSIZ,
- VERT_RESULT_BFC0 = VARYING_SLOT_BFC0,
- VERT_RESULT_BFC1 = VARYING_SLOT_BFC1,
- VERT_RESULT_EDGE = VARYING_SLOT_EDGE,
- VERT_RESULT_CLIP_VERTEX = VARYING_SLOT_CLIP_VERTEX,
- VERT_RESULT_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0,
- VERT_RESULT_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1,
- VERT_RESULT_VAR0 = VARYING_SLOT_VAR0, /**< shader varying */
- VERT_RESULT_MAX = VARYING_SLOT_MAX
-} gl_vert_result;
-
-
/*********************************************/
/**
/**
- * Convert from a gl_vert_result value to the corresponding gl_frag_attrib.
+ * Convert from a gl_varying_slot value for a vertex output to the
+ * corresponding gl_frag_attrib.
*
- * VERT_RESULT_HPOS is converted to FRAG_ATTRIB_WPOS.
- *
- * gl_vert_result values which have no corresponding gl_frag_attrib
- * (VERT_RESULT_PSIZ, VERT_RESULT_BFC0, VERT_RESULT_BFC1, and
- * VERT_RESULT_EDGE) are converted to a value of -1.
+ * Varying output values which have no corresponding gl_frag_attrib
+ * (VARYING_SLOT_PSIZ, VARYING_SLOT_BFC0, VARYING_SLOT_BFC1, and
+ * VARYING_SLOT_EDGE) are converted to a value of -1.
*/
static inline int
-_mesa_vert_result_to_frag_attrib(gl_vert_result vert_result)
+_mesa_vert_result_to_frag_attrib(gl_varying_slot vert_result)
{
- if (vert_result <= VERT_RESULT_TEX7)
+ if (vert_result <= VARYING_SLOT_TEX7)
return vert_result;
- else if (vert_result < VERT_RESULT_CLIP_DIST0)
+ else if (vert_result < VARYING_SLOT_CLIP_DIST0)
return -1;
- else if (vert_result <= VERT_RESULT_CLIP_DIST1)
- return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
- else if (vert_result < VERT_RESULT_VAR0)
+ else if (vert_result <= VARYING_SLOT_CLIP_DIST1)
+ return vert_result - VARYING_SLOT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
+ else if (vert_result < VARYING_SLOT_VAR0)
return -1;
else
- return vert_result - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0;
+ return vert_result - VARYING_SLOT_VAR0 + FRAG_ATTRIB_VAR0;
}
/**
- * Convert from a gl_frag_attrib value to the corresponding gl_vert_result.
- *
- * FRAG_ATTRIB_WPOS is converted to VERT_RESULT_HPOS.
+ * Convert from a gl_frag_attrib value to the corresponding gl_varying_slot
+ * for a vertex output.
*
- * gl_frag_attrib values which have no corresponding gl_vert_result
+ * gl_frag_attrib values which have no corresponding vertex output
* (FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC) are converted to a value of -1.
*/
static inline int
else if (frag_attrib < FRAG_ATTRIB_CLIP_DIST0)
return -1;
else if (frag_attrib <= FRAG_ATTRIB_CLIP_DIST1)
- return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0;
+ return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VARYING_SLOT_CLIP_DIST0;
else /* frag_attrib >= FRAG_ATTRIB_VAR0 */
- return frag_attrib - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0;
+ return frag_attrib - FRAG_ATTRIB_VAR0 + VARYING_SLOT_VAR0;
}
arb_output_attrib_string(GLint index, GLenum progType)
{
/*
- * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens.
+ * These strings should match the VARYING_SLOT_x and FRAG_RESULT_x tokens.
*/
static const char *const vertResults[] = {
"result.position",
"result.texcoord[5]",
"result.texcoord[6]",
"result.texcoord[7]",
- "result.pointsize", /* VERT_RESULT_PSIZ */
- "result.(thirteen)", /* VERT_RESULT_BFC0 */
- "result.(fourteen)", /* VERT_RESULT_BFC1 */
- "result.(fifteen)", /* VERT_RESULT_EDGE */
- "result.(sixteen)", /* VERT_RESULT_CLIP_VERTEX */
- "result.(seventeen)", /* VERT_RESULT_CLIP_DIST0 */
- "result.(eighteen)", /* VERT_RESULT_CLIP_DIST1 */
+ "result.pointsize", /* VARYING_SLOT_PSIZ */
+ "result.(thirteen)", /* VARYING_SLOT_BFC0 */
+ "result.(fourteen)", /* VARYING_SLOT_BFC1 */
+ "result.(fifteen)", /* VARYING_SLOT_EDGE */
+ "result.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */
+ "result.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */
+ "result.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */
"result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
"result.(twenty)", /* VARYING_SLOT_LAYER */
"result.(twenty-one)", /* VARYING_SLOT_FACE */
};
/* sanity checks */
- STATIC_ASSERT(Elements(vertResults) == VERT_RESULT_MAX);
+ STATIC_ASSERT(Elements(vertResults) == VARYING_SLOT_MAX);
STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX);
- assert(strcmp(vertResults[VERT_RESULT_HPOS], "result.position") == 0);
- assert(strcmp(vertResults[VERT_RESULT_VAR0], "result.varying[0]") == 0);
+ assert(strcmp(vertResults[VARYING_SLOT_POS], "result.position") == 0);
+ assert(strcmp(vertResults[VARYING_SLOT_VAR0], "result.varying[0]") == 0);
assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
switch (shaderType) {
case MESA_SHADER_VERTEX:
- return index < VERT_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying;
+ return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying;
case MESA_SHADER_FRAGMENT:
return index < FRAG_RESULT_DATA0 + (GLint) ctx->Const.MaxDrawBuffers;
case MESA_SHADER_GEOMETRY:
* set in fragment program mode, so it is somewhat irrelevant.
*/
if (state->option.PositionInvariant
- && ($$.Index == VERT_RESULT_HPOS)) {
+ && ($$.Index == VARYING_SLOT_POS)) {
yyerror(& @1, state, "position-invariant programs cannot "
"write position");
YYERROR;
resultBinding: RESULT POSITION
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_HPOS;
+ $$ = VARYING_SLOT_POS;
} else {
yyerror(& @2, state, "invalid program result name");
YYERROR;
| RESULT FOGCOORD
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_FOGC;
+ $$ = VARYING_SLOT_FOGC;
} else {
yyerror(& @2, state, "invalid program result name");
YYERROR;
| RESULT POINTSIZE
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_PSIZ;
+ $$ = VARYING_SLOT_PSIZ;
} else {
yyerror(& @2, state, "invalid program result name");
YYERROR;
| RESULT TEXCOORD optTexCoordUnitNum
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_TEX0 + $3;
+ $$ = VARYING_SLOT_TEX0 + $3;
} else {
yyerror(& @2, state, "invalid program result name");
YYERROR;
optResultFaceType:
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_COL0;
+ $$ = VARYING_SLOT_COL0;
} else {
if (state->option.DrawBuffers)
$$ = FRAG_RESULT_DATA0;
| FRONT
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_COL0;
+ $$ = VARYING_SLOT_COL0;
} else {
yyerror(& @1, state, "invalid program result name");
YYERROR;
| BACK
{
if (state->mode == ARB_vertex) {
- $$ = VERT_RESULT_BFC0;
+ $$ = VARYING_SLOT_BFC0;
} else {
yyerror(& @1, state, "invalid program result name");
YYERROR;
for (i = 0; i < 4; i++) {
newInst[i].Opcode = OPCODE_DP4;
newInst[i].DstReg.File = PROGRAM_OUTPUT;
- newInst[i].DstReg.Index = VERT_RESULT_HPOS;
+ newInst[i].DstReg.Index = VARYING_SLOT_POS;
newInst[i].DstReg.WriteMask = (WRITEMASK_X << i);
newInst[i].SrcReg[0].File = PROGRAM_STATE_VAR;
newInst[i].SrcReg[0].Index = mvpRef[i];
vprog->Base.Instructions = newInst;
vprog->Base.NumInstructions = newLen;
vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
+ vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
newInst[3].Opcode = OPCODE_MAD;
newInst[3].DstReg.File = PROGRAM_OUTPUT;
- newInst[3].DstReg.Index = VERT_RESULT_HPOS;
+ newInst[3].DstReg.Index = VARYING_SLOT_POS;
newInst[3].DstReg.WriteMask = WRITEMASK_XYZW;
newInst[3].SrcReg[0].File = PROGRAM_INPUT;
newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS;
vprog->Base.Instructions = newInst;
vprog->Base.NumInstructions = newLen;
vprog->Base.InputsRead |= VERT_BIT_POS;
- vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS);
+ vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
{
GLuint i;
- GLint outputMap[VERT_RESULT_MAX];
+ GLint outputMap[VARYING_SLOT_MAX];
GLuint numVaryingReads = 0;
GLboolean usedTemps[MAX_PROGRAM_TEMPS];
GLuint firstTemp = 0;
assert(type == PROGRAM_OUTPUT);
- for (i = 0; i < VERT_RESULT_MAX; i++)
+ for (i = 0; i < VARYING_SLOT_MAX; i++)
outputMap[i] = -1;
/* look for instructions which read from varying vars */
/* insert new MOV instructions here */
inst = prog->Instructions + endPos;
- for (var = 0; var < VERT_RESULT_MAX; var++) {
+ for (var = 0; var < VARYING_SLOT_MAX; var++) {
if (outputMap[var] >= 0) {
/* MOV VAR[var], TEMP[tmp]; */
inst->Opcode = OPCODE_MOV;
inst[0].Opcode = OPCODE_MOV;
inst[0].DstReg.File = PROGRAM_OUTPUT;
- inst[0].DstReg.Index = VERT_RESULT_COL0;
+ inst[0].DstReg.Index = VARYING_SLOT_COL0;
inst[0].SrcReg[0].File = PROGRAM_INPUT;
if (prog->Base.InputsRead & VERT_BIT_COLOR0)
inputAttr = VERT_ATTRIB_COLOR0;
prog->Base.Instructions = inst;
prog->Base.NumInstructions = 2;
prog->Base.InputsRead = BITFIELD64_BIT(inputAttr);
- prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0);
+ prog->Base.OutputsWritten = BITFIELD64_BIT(VARYING_SLOT_COL0);
/*
* Now insert code to do standard modelview/projection transformation.
*/
if (vertProg) {
if (vertProg->Base.Id == 0) {
- if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) {
+ if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
/* generated program which emits point size */
raster->point_size_per_vertex = TRUE;
}
* color and texcoord attribs to use here.
*/
- slot = st->vertex_result_to_slot[VERT_RESULT_COL0];
+ slot = st->vertex_result_to_slot[VARYING_SLOT_COL0];
if (slot != ~0U)
color = v->data[slot];
else
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- slot = st->vertex_result_to_slot[VERT_RESULT_TEX0];
+ slot = st->vertex_result_to_slot[VARYING_SLOT_TEX0];
if (slot != ~0U)
texcoord = v->data[slot];
else
/* update other raster attribs */
update_attrib(ctx, outputMapping, prim->v[0],
ctx->Current.RasterColor,
- VERT_RESULT_COL0, VERT_ATTRIB_COLOR0);
+ VARYING_SLOT_COL0, VERT_ATTRIB_COLOR0);
update_attrib(ctx, outputMapping, prim->v[0],
ctx->Current.RasterSecondaryColor,
- VERT_RESULT_COL1, VERT_ATTRIB_COLOR1);
+ VARYING_SLOT_COL1, VERT_ATTRIB_COLOR1);
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
update_attrib(ctx, outputMapping, prim->v[0],
ctx->Current.RasterTexCoords[i],
- VERT_RESULT_TEX0 + i, VERT_ATTRIB_TEX0 + i);
+ VARYING_SLOT_TEX0 + i, VERT_ATTRIB_TEX0 + i);
}
if (ctx->RenderMode == GL_SELECT) {
GLboolean missing_textures;
GLboolean vertdata_edgeflags;
- /** Mapping from VERT_RESULT_x to post-transformed vertex slot */
+ /** Mapping from VARYING_SLOT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
struct st_vertex_program *vp; /**< Currently bound vertex program */
case PROGRAM_OUTPUT:
if (t->procType == TGSI_PROCESSOR_VERTEX)
- assert(index < VERT_RESULT_MAX);
+ assert(index < VARYING_SLOT_MAX);
else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
assert(index < FRAG_RESULT_MAX);
else
case TGSI_PROCESSOR_VERTEX:
/* XXX if the geometry shader is present, this must be done there
* instead of here. */
- if (dst_reg->index == VERT_RESULT_COL0 ||
- dst_reg->index == VERT_RESULT_COL1 ||
- dst_reg->index == VERT_RESULT_BFC0 ||
- dst_reg->index == VERT_RESULT_BFC1) {
+ if (dst_reg->index == VARYING_SLOT_COL0 ||
+ dst_reg->index == VARYING_SLOT_COL1 ||
+ dst_reg->index == VARYING_SLOT_BFC0 ||
+ dst_reg->index == VARYING_SLOT_BFC1) {
dst = ureg_saturate(dst);
}
break;
emit_edgeflags(struct st_translate *t)
{
struct ureg_program *ureg = t->ureg;
- struct ureg_dst edge_dst = t->outputs[t->outputMapping[VERT_RESULT_EDGE]];
+ struct ureg_dst edge_dst = t->outputs[t->outputMapping[VARYING_SLOT_EDGE]];
struct ureg_src edge_src = t->inputs[t->inputMapping[VERT_ATTRIB_EDGEFLAG]];
ureg_MOV(ureg, edge_dst, edge_src);
case PROGRAM_OUTPUT:
if (t->procType == TGSI_PROCESSOR_VERTEX)
- assert(index < VERT_RESULT_MAX);
+ assert(index < VARYING_SLOT_MAX);
else if (t->procType == TGSI_PROCESSOR_FRAGMENT)
assert(index < FRAG_RESULT_MAX);
else
case TGSI_PROCESSOR_VERTEX:
/* XXX if the geometry shader is present, this must be done there
* instead of here. */
- if (DstReg->Index == VERT_RESULT_COL0 ||
- DstReg->Index == VERT_RESULT_COL1 ||
- DstReg->Index == VERT_RESULT_BFC0 ||
- DstReg->Index == VERT_RESULT_BFC1) {
+ if (DstReg->Index == VARYING_SLOT_COL0 ||
+ DstReg->Index == VARYING_SLOT_COL1 ||
+ DstReg->Index == VARYING_SLOT_BFC0 ||
+ DstReg->Index == VARYING_SLOT_BFC1) {
dst = ureg_saturate(dst);
}
break;
const struct gl_program *program )
{
struct ureg_program *ureg = t->ureg;
- struct ureg_dst edge_dst = t->outputs[t->outputMapping[VERT_RESULT_EDGE]];
+ struct ureg_dst edge_dst = t->outputs[t->outputMapping[VARYING_SLOT_EDGE]];
struct ureg_src edge_src = t->inputs[t->inputMapping[VERT_ATTRIB_EDGEFLAG]];
ureg_MOV( ureg, edge_dst, edge_src );
/**
* Translate a Mesa vertex shader into a TGSI shader.
- * \param outputMapping to map vertex program output registers (VERT_RESULT_x)
+ * \param outputMapping to map vertex program output registers (VARYING_SLOT_x)
* to TGSI output slots
* \param tokensOut destination for TGSI tokens
* \return pointer to cached pipe_shader object.
/* Compute mapping of vertex program outputs to slots.
*/
- for (attr = 0; attr < VERT_RESULT_MAX; attr++) {
+ for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if ((stvp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) {
stvp->result_to_output[attr] = ~0;
}
stvp->result_to_output[attr] = slot;
switch (attr) {
- case VERT_RESULT_HPOS:
+ case VARYING_SLOT_POS:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_COL0:
+ case VARYING_SLOT_COL0:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_COL1:
+ case VARYING_SLOT_COL1:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
stvp->output_semantic_index[slot] = 1;
break;
- case VERT_RESULT_BFC0:
+ case VARYING_SLOT_BFC0:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_BFC1:
+ case VARYING_SLOT_BFC1:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR;
stvp->output_semantic_index[slot] = 1;
break;
- case VERT_RESULT_FOGC:
+ case VARYING_SLOT_FOGC:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_FOG;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_PSIZ:
+ case VARYING_SLOT_PSIZ:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_CLIP_DIST0:
+ case VARYING_SLOT_CLIP_DIST0:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_CLIP_DIST1:
+ case VARYING_SLOT_CLIP_DIST1:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
stvp->output_semantic_index[slot] = 1;
break;
- case VERT_RESULT_EDGE:
+ case VARYING_SLOT_EDGE:
assert(0);
break;
- case VERT_RESULT_CLIP_VERTEX:
+ case VARYING_SLOT_CLIP_VERTEX:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
stvp->output_semantic_index[slot] = 0;
break;
- case VERT_RESULT_TEX0:
- case VERT_RESULT_TEX1:
- case VERT_RESULT_TEX2:
- case VERT_RESULT_TEX3:
- case VERT_RESULT_TEX4:
- case VERT_RESULT_TEX5:
- case VERT_RESULT_TEX6:
- case VERT_RESULT_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:
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stvp->output_semantic_index[slot] = attr - VERT_RESULT_TEX0;
+ stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
break;
- case VERT_RESULT_VAR0:
+ case VARYING_SLOT_VAR0:
default:
- assert(attr < VERT_RESULT_MAX);
+ assert(attr < VARYING_SLOT_MAX);
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 -
FRAG_ATTRIB_TEX0 +
attr -
- VERT_RESULT_VAR0);
+ VARYING_SLOT_VAR0);
break;
}
}
}
/* similar hack to above, presetup potentially unused edgeflag output */
- stvp->result_to_output[VERT_RESULT_EDGE] = stvp->num_outputs;
+ stvp->result_to_output[VARYING_SLOT_EDGE] = stvp->num_outputs;
stvp->output_semantic_name[stvp->num_outputs] = TGSI_SEMANTIC_EDGEFLAG;
stvp->output_semantic_index[stvp->num_outputs] = 0;
}
GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
GLuint num_inputs;
- /** Maps VERT_RESULT_x to slot */
- GLuint result_to_output[VERT_RESULT_MAX];
- ubyte output_semantic_name[VERT_RESULT_MAX];
- ubyte output_semantic_index[VERT_RESULT_MAX];
+ /** Maps VARYING_SLOT_x to slot */
+ GLuint result_to_output[VARYING_SLOT_MAX];
+ ubyte output_semantic_name[VARYING_SLOT_MAX];
+ ubyte output_semantic_index[VARYING_SLOT_MAX];
GLuint num_outputs;
/** List of translated variants of this vertex program.
if (vp) {
GLuint i;
for (i = 0; i < MAX_VARYING; i++) {
- if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
+ if (vp->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i));
}
}
_TNL_ATTRIB_MAT_FRONT_INDEXES = 27,
_TNL_ATTRIB_MAT_BACK_INDEXES = 28,
- /* This is really a VERT_RESULT, not an attrib. Need to fix
+ /* This is really a VARYING_SLOT, not an attrib. Need to fix
* tnl to understand the difference.
*/
_TNL_ATTRIB_POINTSIZE = 16,
#if 0
TNLcontext *tnl = TNL_CONTEXT(ctx);
- for (i = 0; i < VERT_RESULT_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
if (tnl->vb.ResultPtr[i]->size != tnl->last_result_size[i] ||
tnl->vb.ResultPtr[i]->stride != tnl->last_result_stride[i]) {
tnl->last_result_size[i] = tnl->vb.ResultPtr[i]->size;
*/
struct vp_stage_data {
/** The results of running the vertex program go into these arrays. */
- GLvector4f results[VERT_RESULT_MAX];
+ GLvector4f results[VARYING_SLOT_MAX];
GLvector4f ndcCoords; /**< normalized device coords */
GLubyte *clipmask; /**< clip flags */
struct vertex_buffer *VB = &tnl->vb;
struct gl_vertex_program *program = ctx->VertexProgram._Current;
struct gl_program_machine *machine = &store->machine;
- GLuint outputs[VERT_RESULT_MAX], numOutputs;
+ GLuint outputs[VARYING_SLOT_MAX], numOutputs;
GLuint i, j;
if (!program)
/* make list of outputs to save some time below */
numOutputs = 0;
- for (i = 0; i < VERT_RESULT_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) {
outputs[numOutputs++] = i;
}
* memory that would never be used if we don't run the software tnl pipeline.
*/
if (!store->results[0].storage) {
- for (i = 0; i < VERT_RESULT_MAX; i++) {
+ for (i = 0; i < VARYING_SLOT_MAX; i++) {
assert(!store->results[i].storage);
_mesa_vector4f_alloc( &store->results[i], 0, VB->Size, 32 );
store->results[i].size = 4;
}
/* FOGC is a special case. Fragment shader expects (f,0,0,1) */
- if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_FOGC)) {
- store->results[VERT_RESULT_FOGC].data[i][1] = 0.0;
- store->results[VERT_RESULT_FOGC].data[i][2] = 0.0;
- store->results[VERT_RESULT_FOGC].data[i][3] = 1.0;
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
+ store->results[VARYING_SLOT_FOGC].data[i][1] = 0.0;
+ store->results[VARYING_SLOT_FOGC].data[i][2] = 0.0;
+ store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0;
}
#ifdef NAN_CHECK
ASSERT(machine->Outputs[0][3] != 0.0F);
/* Setup the VB pointers so that the next pipeline stages get
* their data from the right place (the program output arrays).
*/
- VB->ClipPtr = &store->results[VERT_RESULT_HPOS];
+ VB->ClipPtr = &store->results[VARYING_SLOT_POS];
VB->ClipPtr->size = 4;
VB->ClipPtr->count = VB->Count;
}
- VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0];
- VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1];
- VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VERT_RESULT_FOGC];
- VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ];
- VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0];
- VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1];
+ VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VARYING_SLOT_COL0];
+ VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VARYING_SLOT_COL1];
+ VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VARYING_SLOT_FOGC];
+ VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VARYING_SLOT_PSIZ];
+ VB->BackfaceColorPtr = &store->results[VARYING_SLOT_BFC0];
+ VB->BackfaceSecondaryColorPtr = &store->results[VARYING_SLOT_BFC1];
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]
- = &store->results[VERT_RESULT_TEX0 + i];
+ = &store->results[VARYING_SLOT_TEX0 + i];
}
for (i = 0; i < ctx->Const.MaxVarying; i++) {
- if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) {
+ if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
/* Note: varying results get put into the generic attributes */
VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
- = &store->results[VERT_RESULT_VAR0 + i];
+ = &store->results[VARYING_SLOT_VAR0 + i];
}
}
GLuint i;
/* free the vertex program result arrays */
- for (i = 0; i < VERT_RESULT_MAX; i++)
+ for (i = 0; i < VARYING_SLOT_MAX; i++)
_mesa_vector4f_free( &store->results[i] );
/* free misc arrays */