*/
int compacted_clipplane_index = 0;
for (int i = 0; i < MAX_CLIP_PLANES; ++i) {
- if (!(c->key.userclip_planes_enabled_gen_4_5 & (1 << i)))
+ if (!(c->key.base.userclip_planes_enabled_gen_4_5 & (1 << i)))
continue;
this->uniform_vector_size[this->uniforms] = 4;
/* In Gen6 and later, we don't compact clip planes, because this
* simplifies the implementation of gl_ClipDistance.
*/
- for (int i = 0; i < c->key.nr_userclip_plane_consts; ++i) {
+ for (int i = 0; i < c->key.base.nr_userclip_plane_consts; ++i) {
this->uniform_vector_size[this->uniforms] = 4;
this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
this->userplane[i].type = BRW_REGISTER_TYPE_F;
void
vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
{
- int s = c->key.tex.swizzles[sampler];
+ int s = c->key.base.tex.swizzles[sampler];
this->result = src_reg(this, ir->type);
dst_reg swizzled_result(this->result);
{
if (intel->gen < 6 &&
((prog_data->vue_map.slots_valid & VARYING_BIT_PSIZ) ||
- c->key.userclip_active || brw->has_negative_rhw_bug)) {
+ c->key.base.userclip_active || brw->has_negative_rhw_bug)) {
dst_reg header1 = dst_reg(this, glsl_type::uvec4_type);
dst_reg header1_w = header1;
header1_w.writemask = WRITEMASK_W;
}
current_annotation = "Clipping flags";
- for (i = 0; i < c->key.nr_userclip_plane_consts; i++) {
+ for (i = 0; i < c->key.base.nr_userclip_plane_consts; i++) {
vec4_instruction *inst;
inst = emit(DP4(dst_null_f(), src_reg(output_reg[VARYING_SLOT_POS]),
clip_vertex = VARYING_SLOT_POS;
}
- for (int i = 0; i + offset < c->key.nr_userclip_plane_consts && i < 4;
+ for (int i = 0; i + offset < c->key.base.nr_userclip_plane_consts && i < 4;
++i) {
emit(DP4(dst_reg(brw_writemask(reg, 1 << i)),
src_reg(output_reg[clip_vertex]),
varying == VARYING_SLOT_COL1 ||
varying == VARYING_SLOT_BFC0 ||
varying == VARYING_SLOT_BFC1) &&
- c->key.clamp_vertex_color) {
+ c->key.base.clamp_vertex_color) {
inst->saturate = true;
}
}
break;
case VARYING_SLOT_CLIP_DIST0:
case VARYING_SLOT_CLIP_DIST1:
- if (this->c->key.uses_clip_distance) {
+ if (this->c->key.base.uses_clip_distance) {
emit_generic_urb_slot(reg, varying);
} else {
current_annotation = "user clip distances";
}
brw_compute_vue_map(brw, &prog_data.vue_map, outputs_written,
- c.key.userclip_active);
+ c.key.base.userclip_active);
if (0) {
_mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG,
if (c->cache_id == BRW_VS_PROG) {
old_key = c->key;
- if (old_key->program_string_id == key->program_string_id)
+ if (old_key->base.program_string_id == key->base.program_string_id)
break;
}
}
}
found |= key_debug(intel, "user clip flags",
- old_key->userclip_active, key->userclip_active);
+ old_key->base.userclip_active, key->base.userclip_active);
found |= key_debug(intel, "user clipping planes as push constants",
- old_key->nr_userclip_plane_consts,
- key->nr_userclip_plane_consts);
+ old_key->base.nr_userclip_plane_consts,
+ key->base.nr_userclip_plane_consts);
found |= key_debug(intel, "clip distance enable",
- old_key->uses_clip_distance, key->uses_clip_distance);
+ old_key->base.uses_clip_distance, key->base.uses_clip_distance);
found |= key_debug(intel, "clip plane enable bitfield",
- old_key->userclip_planes_enabled_gen_4_5,
- key->userclip_planes_enabled_gen_4_5);
+ old_key->base.userclip_planes_enabled_gen_4_5,
+ key->base.userclip_planes_enabled_gen_4_5);
found |= key_debug(intel, "copy edgeflag",
old_key->copy_edgeflag, key->copy_edgeflag);
found |= key_debug(intel, "PointCoord replace",
old_key->point_coord_replace, key->point_coord_replace);
found |= key_debug(intel, "vertex color clamping",
- old_key->clamp_vertex_color, key->clamp_vertex_color);
+ old_key->base.clamp_vertex_color, key->base.clamp_vertex_color);
- found |= brw_debug_recompile_sampler_key(intel, &old_key->tex, &key->tex);
+ found |= brw_debug_recompile_sampler_key(intel, &old_key->base.tex,
+ &key->base.tex);
if (!found) {
perf_debug(" Something else\n");
/* Just upload the program verbatim for now. Always send it all
* the inputs it asks for, whether they are varying or not.
*/
- key.program_string_id = vp->id;
- key.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
- key.uses_clip_distance = vp->program.UsesClipDistance;
- if (key.userclip_active && !key.uses_clip_distance) {
+ key.base.program_string_id = vp->id;
+ key.base.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
+ key.base.uses_clip_distance = vp->program.UsesClipDistance;
+ if (key.base.userclip_active && !key.base.uses_clip_distance) {
if (intel->gen < 6) {
- key.nr_userclip_plane_consts
+ key.base.nr_userclip_plane_consts
= _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
- key.userclip_planes_enabled_gen_4_5
+ key.base.userclip_planes_enabled_gen_4_5
= ctx->Transform.ClipPlanesEnabled;
} else {
- key.nr_userclip_plane_consts
+ key.base.nr_userclip_plane_consts
= _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
}
}
}
/* _NEW_LIGHT | _NEW_BUFFERS */
- key.clamp_vertex_color = ctx->Light._ClampVertexColor;
+ key.base.clamp_vertex_color = ctx->Light._ClampVertexColor;
/* _NEW_POINT */
if (intel->gen < 6 && ctx->Point.PointSprite) {
}
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, &key.tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key.base.tex);
/* BRW_NEW_VERTICES */
if (intel->gen < 8 && !intel->is_haswell) {
memset(&key, 0, sizeof(key));
- key.program_string_id = bvp->id;
- key.clamp_vertex_color = true;
+ key.base.program_string_id = bvp->id;
+ key.base.clamp_vertex_color = true;
for (int i = 0; i < MAX_SAMPLERS; i++) {
if (vp->Base.ShadowSamplers & (1 << i)) {
/* Assume DEPTH_TEXTURE_MODE is the default: X, X, X, 1 */
- key.tex.swizzles[i] =
+ key.base.tex.swizzles[i] =
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE);
} else {
/* Color sampler: assume no swizzling. */
- key.tex.swizzles[i] = SWIZZLE_XYZW;
+ key.base.tex.swizzles[i] = SWIZZLE_XYZW;
}
}
#define BRW_ATTRIB_WA_SIGN 32 /* interpret as signed in shader */
#define BRW_ATTRIB_WA_SCALE 64 /* interpret as scaled in shader */
-struct brw_vs_prog_key {
+struct brw_vec4_prog_key {
GLuint program_string_id;
- /*
- * Per-attribute workaround flags
- */
- uint8_t gl_attrib_wa_flags[VERT_ATTRIB_MAX];
-
/**
* True if at least one clip flag is enabled, regardless of whether the
* shader uses clip planes or gl_ClipDistance.
*/
GLuint userclip_planes_enabled_gen_4_5:MAX_CLIP_PLANES;
+ GLuint clamp_vertex_color:1;
+
+ struct brw_sampler_prog_key_data tex;
+};
+
+
+struct brw_vs_prog_key {
+ struct brw_vec4_prog_key base;
+
+ /*
+ * Per-attribute workaround flags
+ */
+ uint8_t gl_attrib_wa_flags[VERT_ATTRIB_MAX];
+
GLuint copy_edgeflag:1;
/**
* the VUE, even if they aren't written by the vertex shader.
*/
GLuint point_coord_replace:8;
-
- GLuint clamp_vertex_color:1;
-
- struct brw_sampler_prog_key_data tex;
};