#include "pipe/p_context.h"
#include "util/u_inlines.h"
#include "util/u_prim.h"
-#include "util/u_draw_quad.h"
#include "sp_context.h"
#include "sp_query.h"
/* Note: leave drawing surfaces mapped */
sp->dirty_render_cache = TRUE;
}
-
-static void
-softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned minIndex,
- unsigned maxIndex,
- unsigned mode,
- unsigned start,
- unsigned count,
- unsigned startInstance,
- unsigned instanceCount)
-{
- struct softpipe_context *sp = softpipe_context(pipe);
- struct pipe_draw_info info;
- struct pipe_index_buffer saved_ib, ib;
-
- util_draw_init_info(&info);
- info.mode = mode;
- info.start = start;
- info.count = count;
- info.start_instance = startInstance;
- info.instance_count = instanceCount;
- info.index_bias = indexBias;
- info.min_index = minIndex;
- info.max_index = maxIndex;
-
- if (indexBuffer) {
- info.indexed = TRUE;
-
- saved_ib = sp->index_buffer;
- ib.buffer = indexBuffer;
- ib.offset = 0;
- ib.index_size = indexSize;
- pipe->set_index_buffer(pipe, &ib);
- }
-
- softpipe_draw_vbo(pipe, &info);
-
- if (indexBuffer)
- pipe->set_index_buffer(pipe, &saved_ib);
-}
-
-
-void
-softpipe_draw_range_elements(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned min_index,
- unsigned max_index,
- unsigned mode, unsigned start, unsigned count)
-{
- softpipe_draw_range_elements_instanced(pipe,
- indexBuffer,
- indexSize,
- indexBias,
- min_index,
- max_index,
- mode,
- start,
- count,
- 0,
- 1);
-}
-
-
-void
-softpipe_draw_elements(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize, int indexBias,
- unsigned mode, unsigned start, unsigned count)
-{
- softpipe_draw_range_elements_instanced(pipe,
- indexBuffer,
- indexSize,
- indexBias,
- 0,
- 0xffffffff,
- mode,
- start,
- count,
- 0,
- 1);
-}
-
-void
-softpipe_draw_arrays_instanced(struct pipe_context *pipe,
- unsigned mode,
- unsigned start,
- unsigned count,
- unsigned startInstance,
- unsigned instanceCount)
-{
- softpipe_draw_range_elements_instanced(pipe,
- NULL,
- 0,
- 0,
- 0,
- 0xffffffff,
- mode,
- start,
- count,
- startInstance,
- instanceCount);
-}
-
-void
-softpipe_draw_elements_instanced(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned mode,
- unsigned start,
- unsigned count,
- unsigned startInstance,
- unsigned instanceCount)
-{
- softpipe_draw_range_elements_instanced(pipe,
- indexBuffer,
- indexSize,
- indexBias,
- 0,
- 0xffffffff,
- mode,
- start,
- count,
- startInstance,
- instanceCount);
-}
-
-void
-softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
- unsigned start, unsigned count)
-{
- softpipe_draw_range_elements_instanced(pipe,
- NULL,
- 0,
- 0,
- 0,
- 0xffffffff,
- mode,
- start,
- count,
- 0,
- 1);
-}
-