*/
void
brw_compute_vue_map(struct brw_vue_map *vue_map,
- const struct intel_context *intel, int nr_userclip,
+ const struct intel_context *intel,
+ bool userclip_active,
GLbitfield64 outputs_written)
{
int i;
*/
assign_vue_slot(vue_map, VERT_RESULT_PSIZ);
assign_vue_slot(vue_map, VERT_RESULT_HPOS);
- if (nr_userclip) {
+ if (userclip_active) {
assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST0);
assign_vue_slot(vue_map, VERT_RESULT_CLIP_DIST1);
}
if (0) {
_mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG,
- GL_TRUE);
+ true);
}
/* Emit GEN4 code.
c.prog_data.total_scratch = brw_get_scratch_size(c.last_scratch);
brw_get_scratch_bo(intel, &brw->vs.scratch_bo,
- c.prog_data.total_scratch * brw->vs_max_threads);
+ c.prog_data.total_scratch * brw->max_vs_threads);
}
/* get the program
static void brw_upload_vs_prog(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->intel.ctx;
+ struct intel_context *intel = &brw->intel;
+ struct gl_context *ctx = &intel->ctx;
struct brw_vs_prog_key key;
struct brw_vertex_program *vp =
(struct brw_vertex_program *)brw->vertex_program;
* the inputs it asks for, whether they are varying or not.
*/
key.program_string_id = vp->id;
- key.nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ key.userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
key.uses_clip_distance = vp->program.UsesClipDistance;
- if (!key.uses_clip_distance)
- key.userclip_planes_enabled = ctx->Transform.ClipPlanesEnabled;
+ if (key.userclip_active && !key.uses_clip_distance) {
+ if (intel->gen < 6) {
+ key.nr_userclip_plane_consts
+ = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
+ key.userclip_planes_enabled_gen_4_5
+ = ctx->Transform.ClipPlanesEnabled;
+ } else {
+ key.nr_userclip_plane_consts
+ = _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
+ }
+ }
key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL);
BRW_NEW_VERTICES),
.cache = 0
},
- .prepare = brw_upload_vs_prog
+ .emit = brw_upload_vs_prog
};
bool
{
struct brw_context *brw = brw_context(ctx);
struct brw_vs_prog_key key;
- struct gl_vertex_program *vp = prog->VertexProgram;
- struct brw_vertex_program *bvp = brw_vertex_program(vp);
uint32_t old_prog_offset = brw->vs.prog_offset;
struct brw_vs_prog_data *old_prog_data = brw->vs.prog_data;
bool success;
- if (!vp)
+ if (!prog->_LinkedShaders[MESA_SHADER_VERTEX])
return true;
+ struct gl_vertex_program *vp = (struct gl_vertex_program *)
+ prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
+ struct brw_vertex_program *bvp = brw_vertex_program(vp);
+
memset(&key, 0, sizeof(key));
key.program_string_id = bvp->id;