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);
{
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)
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;
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;
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.
};
-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
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
* 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. */
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" */
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" */
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,
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;
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)
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,
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),
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,
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);
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);
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),
/* 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);
* 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);
}
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;
}
}
}
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);
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");
/* 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;
}
/* _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,
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));