/** Sum of frustum planes and user-defined planes */
#define DRAW_TOTAL_CLIP_PLANES (6 + PIPE_MAX_CLIP_PLANES)
+/**
+ * The largest possible index of a vertex that can be fetched.
+ */
+#define DRAW_MAX_FETCH_IDX 0xffffffff
struct pipe_context;
struct draw_vertex_shader;
struct tgsi_exec_machine;
struct tgsi_sampler;
struct draw_pt_front_end;
+struct draw_assembler;
/**
*/
struct draw_vertex_buffer {
const void *map;
- size_t size;
+ uint32_t size;
};
/**
} extra_shader_outputs;
unsigned instance_id;
+ unsigned start_instance;
+ unsigned start_index;
#ifdef HAVE_LLVM
struct draw_llvm *llvm;
struct pipe_query_data_pipeline_statistics statistics;
boolean collect_statistics;
+ struct draw_assembler *ia;
+
void *driver_private;
};
uint draw_current_shader_viewport_index_output(const struct draw_context *draw);
uint draw_current_shader_clipvertex_output(const struct draw_context *draw);
uint draw_current_shader_clipdistance_output(const struct draw_context *draw, int index);
+uint draw_current_shader_num_written_clipdistances(const struct draw_context *draw);
+uint draw_current_shader_culldistance_output(const struct draw_context *draw, int index);
+uint draw_current_shader_num_written_culldistances(const struct draw_context *draw);
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
uint semantic_name, uint semantic_index);
void draw_remove_extra_vertex_attribs(struct draw_context *draw);
boolean scissor,
boolean flatshade );
+void
+draw_stats_clipper_primitives(struct draw_context *draw,
+ const struct draw_prim_info *prim_info);
/**
* Return index i from the index buffer.
* If the index buffer would overflow we return the
- * index of the first element in the vb.
+ * maximum possible index.
*/
#define DRAW_GET_IDX(_elts, _i) \
- (((_i) >= draw->pt.user.eltMax) ? 0 : (_elts)[_i])
+ (((_i) >= draw->pt.user.eltMax) ? DRAW_MAX_FETCH_IDX : (_elts)[_i])
/**
* Return index of the given viewport clamping it
return ((PIPE_MAX_VIEWPORTS > idx || idx < 0) ? idx : 0);
}
+/**
+ * Adds two unsigned integers and if the addition
+ * overflows then it returns the value from
+ * from the overflow_value variable.
+ */
+static INLINE unsigned
+draw_overflow_uadd(unsigned a, unsigned b,
+ unsigned overflow_value)
+{
+ unsigned res = a + b;
+ if (res < a || res < b) {
+ res = overflow_value;
+ }
+ return res;
+}
#endif /* DRAW_PRIVATE_H */