#include "svga_cmd.h"
#include "util/u_inlines.h"
+#include "util/u_prim.h"
#include "indices/u_indices.h"
#include "svga_hw_reg.h"
dst = pipe_buffer_create(pipe->screen, PIPE_BIND_INDEX_BUFFER,
PIPE_USAGE_IMMUTABLE, size);
- if (dst == NULL)
+ if (!dst)
goto fail;
dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &transfer);
- if (dst_map == NULL)
+ if (!dst_map)
goto fail;
generate(0, nr, dst_map);
unsigned prim, unsigned start, unsigned count,
unsigned start_instance, unsigned instance_count)
{
- unsigned gen_prim, gen_size, gen_nr, gen_type;
+ unsigned gen_prim, gen_size, gen_nr;
+ enum indices_mode gen_type;
u_generate_func gen_func;
enum pipe_error ret = PIPE_OK;
unsigned api_pv = hwtnl->api_pv;
* the hardware wants.
*/
api_pv = hwtnl->hw_pv;
+
+ if (hwtnl->api_fillmode == PIPE_POLYGON_MODE_FILL) {
+ /* Do some simple primitive conversions to avoid index buffer
+ * generation below. Note that polygons and quads are not directly
+ * supported by the svga device. Also note, we can only do this
+ * for flat/constant-colored rendering because of provoking vertex.
+ */
+ if (prim == PIPE_PRIM_POLYGON) {
+ prim = PIPE_PRIM_TRIANGLE_FAN;
+ }
+ else if (prim == PIPE_PRIM_QUADS && count == 4) {
+ prim = PIPE_PRIM_TRIANGLE_FAN;
+ }
+ }
}
if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL &&
if (ret != PIPE_OK)
goto done;
+ pipe_debug_message(&svga->debug.callback, PERF_INFO,
+ "generating temporary index buffer for drawing %s",
+ u_prim_name(prim));
+
ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
gen_buf,
gen_size,