summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-08-27 18:24:39 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-09-03 22:31:04 -0700
commit4f4b7c4711d98606270133dfd456acabfa8267a6 (patch)
treea2a58f43db646bed0b8bce6720c094ce65f7759a
parent323962182547aeafcdb3bac28434ef81f70eb785 (diff)
i965: Remove the brw_vue_prog_key base class.
The legacy userclip fields are only used for the vertex shader, and at that point there's only program_string_id and the tex struct, which are common to all keys. So there's no need for a "VUE" key base class. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.h32
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h8
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp8
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c22
9 files changed, 45 insertions, 63 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 7100646750..5cb794b5fd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -783,8 +783,8 @@ fs_visitor::emit_fb_writes()
void
fs_visitor::setup_uniform_clipplane_values(gl_clip_plane *clip_planes)
{
- const struct brw_vue_prog_key *key =
- (const struct brw_vue_prog_key *) this->key;
+ const struct brw_vs_prog_key *key =
+ (const struct brw_vs_prog_key *) this->key;
for (int i = 0; i < key->nr_userclip_plane_consts; i++) {
this->userplane[i] = fs_reg(UNIFORM, uniforms);
@@ -806,8 +806,8 @@ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes)
{
struct brw_vue_prog_data *vue_prog_data =
(struct brw_vue_prog_data *) prog_data;
- const struct brw_vue_prog_key *key =
- (const struct brw_vue_prog_key *) this->key;
+ const struct brw_vs_prog_key *key =
+ (const struct brw_vs_prog_key *) this->key;
/* Bail unless some sort of legacy clipping is enabled */
if (key->nr_userclip_plane_consts == 0)
@@ -1076,8 +1076,10 @@ fs_visitor::fs_visitor(const struct brw_compiler *compiler, void *log_data,
key_tex = &((const brw_wm_prog_key *) key)->tex;
break;
case MESA_SHADER_VERTEX:
+ key_tex = &((const brw_vs_prog_key *) key)->tex;
+ break;
case MESA_SHADER_GEOMETRY:
- key_tex = &((const brw_vue_prog_key *) key)->tex;
+ key_tex = &((const brw_gs_prog_key *) key)->tex;
break;
case MESA_SHADER_COMPUTE:
key_tex = &((const brw_cs_prog_key*) key)->tex;
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index f1da63543c..1c1a0953bb 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -300,11 +300,11 @@ brw_gs_populate_key(struct brw_context *brw,
memset(key, 0, sizeof(*key));
- key->base.program_string_id = gp->id;
+ key->program_string_id = gp->id;
/* _NEW_TEXTURE */
brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count,
- &key->base.tex);
+ &key->tex);
/* BRW_NEW_VUE_MAP_VS */
key->input_varyings = brw->vue_map_vs.slots_valid;
@@ -381,7 +381,8 @@ brw_gs_precompile(struct gl_context *ctx,
memset(&key, 0, sizeof(key));
- brw_vue_setup_prog_key_for_precompile(ctx, &key.base, bgp->id, &gp->Base);
+ brw_setup_tex_for_precompile(brw, &key.tex, prog);
+ key.program_string_id = bgp->id;
/* Assume that the set of varyings coming in from the vertex shader exactly
* matches what the geometry shader requires.
diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index 5ebf9226cd..00e8f3f370 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -78,24 +78,9 @@ struct brw_sampler_prog_key_data {
};
-struct brw_vue_prog_key {
- unsigned program_string_id;
-
- /**
- * How many user clipping planes are being uploaded to the vertex shader as
- * push constants.
- *
- * These are used for lowering legacy gl_ClipVertex/gl_Position clipping to
- * clip distances.
- */
- unsigned nr_userclip_plane_consts:4;
-
- struct brw_sampler_prog_key_data tex;
-};
-
/** The program key for Vertex Shaders. */
struct brw_vs_prog_key {
- struct brw_vue_prog_key base;
+ unsigned program_string_id;
/*
* Per-attribute workaround flags
@@ -107,6 +92,15 @@ struct brw_vs_prog_key {
bool clamp_vertex_color:1;
/**
+ * How many user clipping planes are being uploaded to the vertex shader as
+ * push constants.
+ *
+ * These are used for lowering legacy gl_ClipVertex/gl_Position clipping to
+ * clip distances.
+ */
+ unsigned nr_userclip_plane_consts:4;
+
+ /**
* For pre-Gen6 hardware, a bitfield indicating which texture coordinates
* are going to be replaced with point coordinates (as a consequence of a
* call to glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE)). Because
@@ -115,14 +109,18 @@ struct brw_vs_prog_key {
* the VUE, even if they aren't written by the vertex shader.
*/
uint8_t point_coord_replace;
+
+ struct brw_sampler_prog_key_data tex;
};
/** The program key for Geometry Shaders. */
struct brw_gs_prog_key
{
- struct brw_vue_prog_key base;
+ unsigned program_string_id;
uint64_t input_varyings;
+
+ struct brw_sampler_prog_key_data tex;
};
/** The program key for Fragment/Pixel Shaders. */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 073e90beb6..24b2be916a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -2011,16 +2011,4 @@ brw_vs_emit(struct brw_context *brw,
return assembly;
}
-
-void
-brw_vue_setup_prog_key_for_precompile(struct gl_context *ctx,
- struct brw_vue_prog_key *key,
- GLuint id, struct gl_program *prog)
-{
- struct brw_context *brw = brw_context(ctx);
- key->program_string_id = id;
-
- brw_setup_tex_for_precompile(brw, &key->tex, prog);
-}
-
} /* extern "C" */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 7df87b5d84..01c6e8492c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -52,11 +52,6 @@ extern "C" {
extern "C" {
#endif
-void
-brw_vue_setup_prog_key_for_precompile(struct gl_context *ctx,
- struct brw_vue_prog_key *key,
- GLuint id, struct gl_program *prog);
-
#ifdef __cplusplus
} /* extern "C" */
@@ -76,7 +71,7 @@ public:
vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
struct gl_program *prog,
- const struct brw_vue_prog_key *key,
+ const struct brw_sampler_prog_key_data *key,
struct brw_vue_prog_data *prog_data,
struct gl_shader_program *shader_prog,
gl_shader_stage stage,
@@ -100,7 +95,6 @@ public:
return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
}
- const struct brw_vue_prog_key * const key;
const struct brw_sampler_prog_key_data * const key_tex;
struct brw_vue_prog_data * const prog_data;
unsigned int sanity_param_count;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 4fd626f52c..b9694f6778 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -42,7 +42,7 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
bool no_spills,
int shader_time_index)
: vec4_visitor(compiler, log_data,
- &c->gp->program.Base, &c->key.base,
+ &c->gp->program.Base, &c->key.tex,
&c->prog_data.base, prog, MESA_SHADER_GEOMETRY, mem_ctx,
no_spills, shader_time_index),
c(c)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 034286fbf2..0ff298ed0e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3692,7 +3692,7 @@ vec4_visitor::resolve_bool_comparison(ir_rvalue *rvalue, src_reg *reg)
vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
struct gl_program *prog,
- const struct brw_vue_prog_key *key,
+ const struct brw_sampler_prog_key_data *key_tex,
struct brw_vue_prog_data *prog_data,
struct gl_shader_program *shader_prog,
gl_shader_stage stage,
@@ -3701,8 +3701,7 @@ vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
int shader_time_index)
: backend_shader(compiler, log_data, mem_ctx,
shader_prog, prog, &prog_data->base, stage),
- key(key),
- key_tex(&key->tex),
+ key_tex(key_tex),
prog_data(prog_data),
sanity_param_count(0),
fail_msg(NULL),
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index 442cefd6c4..f4b50ba9d9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -247,7 +247,7 @@ vec4_vs_visitor::emit_clip_distances(dst_reg reg, int offset)
clip_vertex = VARYING_SLOT_POS;
}
- for (int i = 0; i + offset < key->base.nr_userclip_plane_consts && i < 4;
+ for (int i = 0; i + offset < key->nr_userclip_plane_consts && i < 4;
++i) {
reg.writemask = 1 << i;
emit(DP4(reg,
@@ -260,7 +260,7 @@ vec4_vs_visitor::emit_clip_distances(dst_reg reg, int offset)
void
vec4_vs_visitor::setup_uniform_clipplane_values()
{
- for (int i = 0; i < key->base.nr_userclip_plane_consts; ++i) {
+ for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
assert(this->uniforms < uniform_array_size);
this->uniform_vector_size[this->uniforms] = 4;
this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
@@ -280,7 +280,7 @@ vec4_vs_visitor::emit_thread_end()
setup_uniform_clipplane_values();
/* Lower legacy ff and ClipVertex clipping to clip distances */
- if (key->base.nr_userclip_plane_consts > 0) {
+ if (key->nr_userclip_plane_consts > 0) {
current_annotation = "user clip distances";
output_reg[VARYING_SLOT_CLIP_DIST0] = dst_reg(this, glsl_type::vec4_type);
@@ -309,7 +309,7 @@ vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler *compiler,
int shader_time_index,
bool use_legacy_snorm_formula)
: vec4_visitor(compiler, log_data,
- &vp->Base, &key->base, &vs_prog_data->base, prog,
+ &vp->Base, &key->tex, &vs_prog_data->base, prog,
MESA_SHADER_VERTEX,
mem_ctx, false /* no_spills */,
shader_time_index),
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 365396825d..df7e5314d6 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -130,7 +130,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
/* vec4_visitor::setup_uniform_clipplane_values() also uploads user clip
* planes as uniforms.
*/
- param_count += key->base.nr_userclip_plane_consts * 4;
+ param_count += key->nr_userclip_plane_consts * 4;
stage_prog_data->param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
@@ -172,7 +172,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
* distance varying slots whenever clipping is enabled, even if the vertex
* shader doesn't write to gl_ClipDistance.
*/
- if (key->base.nr_userclip_plane_consts > 0) {
+ if (key->nr_userclip_plane_consts > 0) {
outputs_written |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0);
outputs_written |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1);
}
@@ -237,7 +237,7 @@ brw_vs_debug_recompile(struct brw_context *brw,
if (c->cache_id == BRW_CACHE_VS_PROG) {
old_key = c->key;
- if (old_key->base.program_string_id == key->base.program_string_id)
+ if (old_key->program_string_id == key->program_string_id)
break;
}
}
@@ -258,8 +258,8 @@ brw_vs_debug_recompile(struct brw_context *brw,
}
found |= key_debug(brw, "legacy user clipping",
- old_key->base.nr_userclip_plane_consts,
- key->base.nr_userclip_plane_consts);
+ old_key->nr_userclip_plane_consts,
+ key->nr_userclip_plane_consts);
found |= key_debug(brw, "copy edgeflag",
old_key->copy_edgeflag, key->copy_edgeflag);
@@ -268,8 +268,7 @@ brw_vs_debug_recompile(struct brw_context *brw,
found |= key_debug(brw, "vertex color clamping",
old_key->clamp_vertex_color, key->clamp_vertex_color);
- found |= brw_debug_recompile_sampler_key(brw, &old_key->base.tex,
- &key->base.tex);
+ found |= brw_debug_recompile_sampler_key(brw, &old_key->tex, &key->tex);
if (!found) {
perf_debug(" Something else\n");
@@ -306,11 +305,11 @@ brw_vs_populate_key(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->base.program_string_id = vp->id;
+ key->program_string_id = vp->id;
if (ctx->Transform.ClipPlanesEnabled != 0 &&
!vp->program.Base.UsesClipDistanceOut) {
- key->base.nr_userclip_plane_consts =
+ key->nr_userclip_plane_consts =
_mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
}
@@ -336,7 +335,7 @@ brw_vs_populate_key(struct brw_context *brw,
/* _NEW_TEXTURE */
brw_populate_sampler_prog_key_data(ctx, prog, brw->vs.base.sampler_count,
- &key->base.tex);
+ &key->tex);
/* BRW_NEW_VS_ATTRIB_WORKAROUNDS */
memcpy(key->gl_attrib_wa_flags, brw->vb.attrib_wa_flags,
@@ -398,7 +397,8 @@ brw_vs_precompile(struct gl_context *ctx,
memset(&key, 0, sizeof(key));
- brw_vue_setup_prog_key_for_precompile(ctx, &key.base, bvp->id, &vp->Base);
+ brw_setup_tex_for_precompile(brw, &key.tex, prog);
+ key.program_string_id = bvp->id;
key.clamp_vertex_color =
(prog->OutputsWritten & (VARYING_BIT_COL0 | VARYING_BIT_COL1 |
VARYING_BIT_BFC0 | VARYING_BIT_BFC1));