lp_setup_end_query(struct lp_setup_context *setup,
struct llvmpipe_query *pq);
+static INLINE unsigned
+lp_clamp_scissor_idx(int idx)
+{
+ return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0;
+}
+
#endif
nr_planes = 8;
if (setup->viewport_index_slot > 0) {
unsigned *udata = (unsigned*)v1[setup->viewport_index_slot];
- scissor_index = *udata;
+ scissor_index = lp_clamp_scissor_idx(*udata);
}
}
else {
if (setup->viewport_index_slot > 0) {
unsigned *udata = (unsigned*)v0[setup->viewport_index_slot];
- scissor_index = *udata;
+ scissor_index = lp_clamp_scissor_idx(*udata);
}
/* Bounding rectangle (in pixels) */
{
nr_planes = 7;
if (setup->viewport_index_slot > 0) {
unsigned *udata = (unsigned*)v0[setup->viewport_index_slot];
- scissor_index = *udata;
+ scissor_index = lp_clamp_scissor_idx(*udata);
}
}
else {
draw_flush(llvmpipe->draw);
+ debug_assert(start_slot < PIPE_MAX_VIEWPORTS);
+ debug_assert((start_slot + num_scissors) <= PIPE_MAX_VIEWPORTS);
+
memcpy(llvmpipe->scissors + start_slot, scissors,
sizeof(struct pipe_scissor_state) * num_scissors);
+
llvmpipe->dirty |= LP_NEW_SCISSOR;
}