- if (intel->gen >= 6) {
- unsigned num_verts;
- bool check_edge_flag;
- /* On Sandybridge, we use the GS for implementing transform feedback
- * (called "Stream Out" in the PRM).
- */
- switch (key->primitive) {
- case _3DPRIM_POINTLIST:
- num_verts = 1;
- check_edge_flag = false;
- break;
- case _3DPRIM_LINELIST:
- case _3DPRIM_LINESTRIP:
- case _3DPRIM_LINELOOP:
- num_verts = 2;
- check_edge_flag = false;
- break;
- case _3DPRIM_TRILIST:
- case _3DPRIM_TRIFAN:
- case _3DPRIM_TRISTRIP:
- case _3DPRIM_RECTLIST:
- num_verts = 3;
- check_edge_flag = false;
- break;
- case _3DPRIM_QUADLIST:
- case _3DPRIM_QUADSTRIP:
- case _3DPRIM_POLYGON:
- num_verts = 3;
- check_edge_flag = true;
- break;
- default:
- assert(!"Unexpected primitive type in Gen6 SOL program.");
- return;
+ prog_data.base.base.param =
+ rzalloc_array(NULL, const gl_constant_value *, param_count);
+ prog_data.base.base.pull_param =
+ rzalloc_array(NULL, const gl_constant_value *, param_count);
+ prog_data.base.base.image_param =
+ rzalloc_array(NULL, struct brw_image_param,
+ gp->program.info.num_images);
+ prog_data.base.base.nr_params = param_count;
+ prog_data.base.base.nr_image_params = gp->program.info.num_images;
+
+ brw_nir_setup_glsl_uniforms(gp->program.nir, &gp->program,
+ &prog_data.base.base,
+ compiler->scalar_stage[MESA_SHADER_GEOMETRY]);
+
+ uint64_t outputs_written = gp->program.info.outputs_written;
+
+ brw_compute_vue_map(devinfo,
+ &prog_data.base.vue_map, outputs_written,
+ gp->program.info.separate_shader);
+
+ int st_index = -1;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+ st_index = brw_get_shader_time_index(brw, &gp->program, ST_GS, true);
+
+ if (unlikely(brw->perf_debug)) {
+ start_busy = brw->batch.last_bo && brw_bo_busy(brw->batch.last_bo);
+ start_time = get_time();
+ }
+
+ void *mem_ctx = ralloc_context(NULL);
+ unsigned program_size;
+ char *error_str;
+ const unsigned *program =
+ brw_compile_gs(brw->screen->compiler, brw, mem_ctx, key,
+ &prog_data, gp->program.nir, &gp->program,
+ st_index, &program_size, &error_str);
+ if (program == NULL) {
+ ralloc_strcat(&gp->program.sh.data->InfoLog, error_str);
+ _mesa_problem(NULL, "Failed to compile geometry shader: %s\n", error_str);
+
+ ralloc_free(mem_ctx);
+ return false;
+ }
+
+ if (unlikely(brw->perf_debug)) {
+ if (gp->compiled_once) {
+ brw_gs_debug_recompile(brw, &gp->program, key);