- /* Begin the compilation:
- */
- brw_init_compile(brw, &c.func, mem_ctx);
-
- c.func.single_program_flow = 1;
-
- c.key = *key;
- c.vue_map = brw->vue_map_geom_out;
-
- c.has_flat_shading =
- brw_any_flat_varyings(&key->interpolation_mode);
- c.has_noperspective_shading =
- brw_any_noperspective_varyings(&key->interpolation_mode);
-
- /* nr_regs is the number of registers filled by reading data from the VUE.
- * This program accesses the entire VUE, so nr_regs needs to be the size of
- * the VUE (measured in pairs, since two slots are stored in each
- * register).
- */
- c.nr_regs = (c.vue_map.num_slots + 1)/2;
-
- c.prog_data.clip_mode = c.key.clip_mode; /* XXX */
-
- /* For some reason the thread is spawned with only 4 channels
- * unmasked.
- */
- brw_set_mask_control(&c.func, BRW_MASK_DISABLE);
-
-
- /* Would ideally have the option of producing a program which could
- * do all three:
- */
- switch (key->primitive) {
- case GL_TRIANGLES:
- if (key->do_unfilled)
- brw_emit_unfilled_clip( &c );
- else
- brw_emit_tri_clip( &c );
- break;
- case GL_LINES:
- brw_emit_line_clip( &c );
- break;
- case GL_POINTS:
- brw_emit_point_clip( &c );
- break;
- default:
- assert(0);
- return;
- }
-
- brw_compact_instructions(&c.func);
-
- /* get the program
- */
- program = brw_get_program(&c.func, &program_size);
-
- if (unlikely(INTEL_DEBUG & DEBUG_CLIP)) {
- fprintf(stderr, "clip:\n");
- brw_disassemble(brw, c.func.store, 0, program_size, stderr);
- fprintf(stderr, "\n");
- }
+ struct brw_clip_prog_data prog_data;
+ program = brw_compile_clip(brw->screen->compiler, mem_ctx, key, &prog_data,
+ &brw->vue_map_geom_out, &program_size);