#include "brw_state.h"
#include "brw_gs.h"
-#include "../glsl/ralloc.h"
+#include "glsl/ralloc.h"
static void compile_gs_prog( struct brw_context *brw,
struct brw_gs_prog_key *key )
memset(&c, 0, sizeof(c));
c.key = *key;
- /* Need to locate the two positions present in vertex + header.
- * These are currently hardcoded:
- */
- c.nr_attrs = brw_count_bits(c.key.attrs);
-
- if (intel->gen >= 5)
- c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */
- else
- c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */
-
- c.nr_bytes = c.nr_regs * REG_SIZE;
+ /* The geometry shader needs to access the entire VUE. */
+ struct brw_vue_map vue_map;
+ brw_compute_vue_map(&vue_map, intel, c.key.nr_userclip, c.key.attrs);
+ c.nr_regs = (vue_map.num_slots + 1)/2;
mem_ctx = NULL;
printf("\n");
}
- /* Upload
- */
- drm_intel_bo_unreference(brw->gs.prog_bo);
- brw->gs.prog_bo = brw_upload_cache(&brw->cache, BRW_GS_PROG,
- &c.key, sizeof(c.key),
- program, program_size,
- &c.prog_data, sizeof(c.prog_data),
- &brw->gs.prog_data);
+ brw_upload_cache(&brw->cache, BRW_GS_PROG,
+ &c.key, sizeof(c.key),
+ program, program_size,
+ &c.prog_data, sizeof(c.prog_data),
+ &brw->gs.prog_offset, &brw->gs.prog_data);
ralloc_free(mem_ctx);
}
key->pv_first = GL_TRUE;
}
+ /* _NEW_TRANSFORM */
+ key->nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
+
key->need_gs_prog = (intel->gen >= 6)
? 0
: (brw->primitive == GL_QUADS ||
brw->gs.prog_active = key.need_gs_prog;
}
- drm_intel_bo_unreference(brw->gs.prog_bo);
- brw->gs.prog_bo = NULL;
-
if (brw->gs.prog_active) {
- brw->gs.prog_bo = brw_search_cache(&brw->cache, BRW_GS_PROG,
- &key, sizeof(key),
- &brw->gs.prog_data);
- if (brw->gs.prog_bo == NULL)
+ if (!brw_search_cache(&brw->cache, BRW_GS_PROG,
+ &key, sizeof(key),
+ &brw->gs.prog_offset, &brw->gs.prog_data)) {
compile_gs_prog( brw, &key );
+ }
}
}
const struct brw_tracked_state brw_gs_prog = {
.dirty = {
- .mesa = _NEW_LIGHT,
+ .mesa = (_NEW_LIGHT |
+ _NEW_TRANSFORM),
.brw = BRW_NEW_PRIMITIVE,
.cache = CACHE_NEW_VS_PROG
},