summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c47
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.h25
4 files changed, 48 insertions, 42 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index f8ab9b63a81..9a4bbd892e7 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1415,7 +1415,7 @@ vec4_visitor::run()
}
base_ir = NULL;
- if (c->key.userclip_active && !c->key.uses_clip_distance)
+ if (c->key.base.userclip_active && !c->key.base.uses_clip_distance)
setup_uniform_clipplane_values();
emit_urb_writes();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index bfa33b60e4d..250c3741458 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -632,7 +632,7 @@ vec4_visitor::setup_uniform_clipplane_values()
*/
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;
@@ -648,7 +648,7 @@ vec4_visitor::setup_uniform_clipplane_values()
/* 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;
@@ -2294,7 +2294,7 @@ vec4_visitor::visit(ir_texture *ir)
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);
@@ -2409,7 +2409,7 @@ vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
{
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;
@@ -2426,7 +2426,7 @@ vec4_visitor::emit_psiz_and_flags(struct brw_reg reg)
}
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]),
@@ -2497,7 +2497,7 @@ vec4_visitor::emit_clip_distances(struct brw_reg reg, int offset)
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]),
@@ -2518,7 +2518,7 @@ vec4_visitor::emit_generic_urb_slot(dst_reg reg, int varying)
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;
}
}
@@ -2547,7 +2547,7 @@ vec4_visitor::emit_urb_slot(int mrf, int varying)
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";
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index c0a3baedaf2..2d0849a3700 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -286,7 +286,7 @@ do_vs_prog(struct brw_context *brw,
}
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,
@@ -360,7 +360,7 @@ brw_vs_debug_recompile(struct brw_context *brw,
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;
}
}
@@ -381,25 +381,26 @@ brw_vs_debug_recompile(struct brw_context *brw,
}
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");
@@ -422,17 +423,17 @@ static void brw_upload_vs_prog(struct brw_context *brw)
/* 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;
}
}
@@ -444,7 +445,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
}
/* _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) {
@@ -455,7 +456,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
}
/* _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) {
@@ -541,17 +542,17 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
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;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index c2b4bc69f25..e1c6ed0bba2 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -50,14 +50,9 @@
#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.
@@ -85,6 +80,20 @@ struct brw_vs_prog_key {
*/
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;
/**
@@ -96,10 +105,6 @@ struct brw_vs_prog_key {
* 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;
};