- /* Calculate how many VS URB entries fit in the total URB size */
- nr_vs_entries = (brw->urb.size * 1024) / (brw->urb.vs_size * 128);
+ /* Whe using GS to do transform feedback only we use the same VUE layout for
+ * VS outputs and GS outputs (as it's what the SF and Clipper expect), so we
+ * can simply make the GS URB entry size the same as for the VS. This may
+ * technically be too large in cases where we have few vertex attributes and
+ * a lot of varyings, since the VS size is determined by the larger of the
+ * two. For now, it's safe.
+ *
+ * For user-provided GS the assumption above does not hold since the GS
+ * outputs can be different from the VS outputs.
+ */
+ unsigned gs_size = vs_size;
+ if (brw->geometry_program) {
+ gs_size = brw->gs.prog_data->base.urb_entry_size;
+ assert(gs_size >= 1);
+ }
+
+ /* Calculate how many entries fit in each stage's section of the URB */
+ if (gs_present) {
+ nr_vs_entries = (total_urb_size/2) / (vs_size * 128);
+ nr_gs_entries = (total_urb_size/2) / (gs_size * 128);
+ } else {
+ nr_vs_entries = total_urb_size / (vs_size * 128);
+ nr_gs_entries = 0;
+ }