#include "draw/draw_context.h"
#include "draw/draw_gs.h"
+#include "draw/draw_tess.h"
#include "draw/draw_private.h"
#include "draw/draw_pt.h"
#include "draw/draw_vbuf.h"
#include "tgsi/tgsi_dump.h"
#include "util/u_math.h"
#include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_draw.h"
*/
{
unsigned first, incr;
- draw_pt_split_prim(prim, &first, &incr);
+
+ if (prim == PIPE_PRIM_PATCHES) {
+ first = draw->pt.vertices_per_patch;
+ incr = draw->pt.vertices_per_patch;
+ } else
+ draw_pt_split_prim(prim, &first, &incr);
count = draw_pt_trim_count(count, first, incr);
if (count < first)
return TRUE;
}
if (!draw->force_passthrough) {
- unsigned gs_out_prim = (draw->gs.geometry_shader ?
- draw->gs.geometry_shader->output_primitive :
- prim);
+ unsigned out_prim = prim;
+
+ if (draw->gs.geometry_shader)
+ out_prim = draw->gs.geometry_shader->output_primitive;
+ else if (draw->tes.tess_eval_shader)
+ out_prim = get_tes_output_prim(draw->tes.tess_eval_shader);
if (!draw->render) {
opt |= PT_PIPELINE;
if (draw_need_pipeline(draw,
draw->rasterizer,
- gs_out_prim)) {
+ out_prim)) {
opt |= PT_PIPELINE;
}
if (!draw->pt.middle.general)
return FALSE;
-#if HAVE_LLVM
+#ifdef LLVM_AVAILABLE
if (draw->llvm)
draw->pt.middle.llvm = draw_pt_fetch_pipeline_or_emit_llvm( draw );
#endif
}
else {
/* Non-indexed prims (draw_arrays).
- * Primitive restart should have been handled in the state tracker.
+ * Primitive restart should have been handled in gallium frontends.
*/
draw_pt_arrays(draw, prim, start, count);
}
struct draw_so_target *target =
(struct draw_so_target *)info->count_from_stream_output;
assert(vertex_buffer != NULL);
- info->count = target->internal_offset / vertex_buffer->stride;
+ info->count = vertex_buffer->stride == 0 ? 0 :
+ target->internal_offset / vertex_buffer->stride;
/* Stream output draw can not be indexed */
- debug_assert(!info->indexed);
+ debug_assert(!info->index_size);
info->max_index = info->count - 1;
}
}
unsigned fpstate = util_fpstate_get();
struct pipe_draw_info resolved_info;
+ if (info->instance_count == 0)
+ return;
+
/* Make sure that denorms are treated like zeros. This is
* the behavior required by D3D10. OpenGL doesn't care.
*/
resolve_draw_info(info, &resolved_info, &(draw->pt.vertex_buffer[0]));
info = &resolved_info;
- assert(info->instance_count > 0);
- if (info->indexed)
+ if (info->index_size)
assert(draw->pt.user.elts);
count = info->count;
draw->pt.user.eltBias = info->index_bias;
draw->pt.user.min_index = info->min_index;
draw->pt.user.max_index = info->max_index;
- draw->pt.user.eltSize = info->indexed ? draw->pt.user.eltSizeIB : 0;
+ draw->pt.user.eltSize = info->index_size ? draw->pt.user.eltSizeIB : 0;
+ draw->pt.user.drawid = info->drawid;
+
+ draw->pt.vertices_per_patch = info->vertices_per_patch;
if (0)
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",
draw->pt.vertex_element,
draw->pt.nr_vertex_elements,
info);
-#if HAVE_LLVM
+#ifdef LLVM_AVAILABLE
if (!draw->llvm)
#endif
{
/*
* TODO: We could use draw->pt.max_index to further narrow
- * the min_index/max_index hints given by the state tracker.
+ * the min_index/max_index hints given by gallium frontends.
*/
for (instance = 0; instance < info->instance_count; instance++) {