Merge commit 'origin/gallium-draw-retval'

Conflicts:
	src/gallium/drivers/identity/id_context.c
This commit is contained in:
Keith Whitwell 2010-01-05 14:13:40 +00:00
commit c727fa6dbf
27 changed files with 235 additions and 265 deletions

View file

@ -85,7 +85,7 @@ cell_unmap_constant_buffers(struct cell_context *sp)
*
* XXX should the element buffer be specified/bound with a separate function?
*/
static boolean
static void
cell_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
@ -145,29 +145,27 @@ cell_draw_range_elements(struct pipe_context *pipe,
/* Note: leave drawing surfaces mapped */
cell_unmap_constant_buffers(sp);
return TRUE;
}
static boolean
static void
cell_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
return cell_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
cell_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
}
static boolean
static void
cell_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count)
{
return cell_draw_elements(pipe, NULL, 0, mode, start, count);
cell_draw_elements(pipe, NULL, 0, mode, start, count);
}

View file

@ -44,11 +44,19 @@ static void failover_destroy( struct pipe_context *pipe )
}
void failover_fail_over( struct failover_context *failover )
{
failover->dirty = TRUE;
failover->mode = FO_SW;
}
static boolean failover_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
static void failover_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim,
unsigned start,
unsigned count)
{
struct failover_context *failover = failover_context( pipe );
@ -62,24 +70,22 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
/* Try hardware:
*/
if (failover->mode == FO_HW) {
if (!failover->hw->draw_elements( failover->hw,
indexBuffer,
indexSize,
prim,
start,
count )) {
failover->hw->flush( failover->hw, ~0, NULL );
failover->mode = FO_SW;
}
failover->hw->draw_elements( failover->hw,
indexBuffer,
indexSize,
prim,
start,
count );
}
/* Possibly try software:
*/
if (failover->mode == FO_SW) {
if (failover->dirty)
if (failover->dirty) {
failover->hw->flush( failover->hw, ~0, NULL );
failover_state_emit( failover );
}
failover->sw->draw_elements( failover->sw,
indexBuffer,
@ -94,15 +100,13 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
*/
failover->sw->flush( failover->sw, ~0, NULL );
}
return TRUE;
}
static boolean failover_draw_arrays( struct pipe_context *pipe,
static void failover_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
return failover_draw_elements(pipe, NULL, 0, prim, start, count);
failover_draw_elements(pipe, NULL, 0, prim, start, count);
}
static unsigned int

View file

@ -36,10 +36,13 @@
struct pipe_context;
struct failover_context;
struct pipe_context *failover_create( struct pipe_context *hw,
struct pipe_context *sw );
void failover_fail_over( struct failover_context *failover );
#endif /* FO_WINSYS_H */

View file

@ -45,7 +45,7 @@
*/
static boolean
static void
i915_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
@ -106,27 +106,25 @@ i915_draw_range_elements(struct pipe_context *pipe,
pipe_buffer_unmap(pipe->screen, indexBuffer);
draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL);
}
return TRUE;
}
static boolean
static void
i915_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
{
return i915_draw_range_elements(pipe, indexBuffer,
indexSize,
0, 0xffffffff,
prim, start, count);
i915_draw_range_elements(pipe, indexBuffer,
indexSize,
0, 0xffffffff,
prim, start, count);
}
static boolean
static void
i915_draw_arrays(struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
return i915_draw_elements(pipe, NULL, 0, prim, start, count);
i915_draw_elements(pipe, NULL, 0, prim, start, count);
}

View file

@ -45,7 +45,7 @@ identity_destroy(struct pipe_context *_pipe)
free(id_pipe);
}
static boolean
static void
identity_draw_arrays(struct pipe_context *_pipe,
unsigned prim,
unsigned start,
@ -54,13 +54,13 @@ identity_draw_arrays(struct pipe_context *_pipe,
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
return pipe->draw_arrays(pipe,
prim,
start,
count);
pipe->draw_arrays(pipe,
prim,
start,
count);
}
static boolean
static void
identity_draw_elements(struct pipe_context *_pipe,
struct pipe_buffer *_indexBuffer,
unsigned indexSize,
@ -73,15 +73,15 @@ identity_draw_elements(struct pipe_context *_pipe,
struct pipe_context *pipe = id_pipe->pipe;
struct pipe_buffer *indexBuffer = id_buffer->buffer;
return pipe->draw_elements(pipe,
indexBuffer,
indexSize,
prim,
start,
count);
pipe->draw_elements(pipe,
indexBuffer,
indexSize,
prim,
start,
count);
}
static boolean
static void
identity_draw_range_elements(struct pipe_context *_pipe,
struct pipe_buffer *_indexBuffer,
unsigned indexSize,
@ -96,14 +96,14 @@ identity_draw_range_elements(struct pipe_context *_pipe,
struct pipe_context *pipe = id_pipe->pipe;
struct pipe_buffer *indexBuffer = id_buffer->buffer;
return pipe->draw_range_elements(pipe,
indexBuffer,
indexSize,
minIndex,
maxIndex,
mode,
start,
count);
pipe->draw_range_elements(pipe,
indexBuffer,
indexSize,
minIndex,
maxIndex,
mode,
start,
count);
}
static struct pipe_query *

View file

@ -45,11 +45,11 @@
boolean
void
llvmpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count)
{
return llvmpipe_draw_elements(pipe, NULL, 0, mode, start, count);
llvmpipe_draw_elements(pipe, NULL, 0, mode, start, count);
}
@ -58,7 +58,7 @@ llvmpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
* Basically, map the vertex buffers (and drawing surfaces), then hand off
* the drawing to the 'draw' module.
*/
boolean
void
llvmpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
@ -122,20 +122,18 @@ llvmpipe_draw_range_elements(struct pipe_context *pipe,
/* Note: leave drawing surfaces mapped */
lp->dirty_render_cache = TRUE;
return TRUE;
}
boolean
void
llvmpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
return llvmpipe_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
llvmpipe_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
}

View file

@ -197,14 +197,14 @@ void llvmpipe_update_fs(struct llvmpipe_context *lp);
void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe );
boolean llvmpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
void llvmpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count);
boolean llvmpipe_draw_elements(struct pipe_context *pipe,
void llvmpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
boolean
void
llvmpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,

View file

@ -141,9 +141,9 @@ extern void nv04_emit_hw_state(struct nv04_context *nv04);
extern void nv04_state_tex_update(struct nv04_context *nv04);
/* nv04_vbo.c */
extern boolean nv04_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv04_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv04_draw_elements( struct pipe_context *pipe,
extern void nv04_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count);

View file

@ -9,7 +9,7 @@
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
boolean nv04_draw_elements( struct pipe_context *pipe,
void nv04_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
@ -65,15 +65,13 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
pipe_buffer_unmap(pscreen, indexBuffer);
draw_set_mapped_element_buffer(draw, 0, NULL);
}
return TRUE;
}
boolean nv04_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
void nv04_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
printf("coucou in draw arrays\n");
return nv04_draw_elements(pipe, NULL, 0, prim, start, count);
nv04_draw_elements(pipe, NULL, 0, prim, start, count);
}

View file

@ -144,9 +144,9 @@ extern void nv10_emit_hw_state(struct nv10_context *nv10);
extern void nv10_state_tex_update(struct nv10_context *nv10);
/* nv10_vbo.c */
extern boolean nv10_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv10_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv10_draw_elements( struct pipe_context *pipe,
extern void nv10_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count);

View file

@ -9,7 +9,7 @@
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
boolean nv10_draw_elements( struct pipe_context *pipe,
void nv10_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
@ -65,14 +65,12 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
pipe_buffer_unmap(pscreen, indexBuffer);
draw_set_mapped_element_buffer(draw, 0, NULL);
}
return TRUE;
}
boolean nv10_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
void nv10_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
return nv10_draw_elements(pipe, NULL, 0, prim, start, count);
nv10_draw_elements(pipe, NULL, 0, prim, start, count);
}

View file

@ -143,9 +143,9 @@ extern void nv20_emit_hw_state(struct nv20_context *nv20);
extern void nv20_state_tex_update(struct nv20_context *nv20);
/* nv20_vbo.c */
extern boolean nv20_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv20_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv20_draw_elements( struct pipe_context *pipe,
extern void nv20_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count);

View file

@ -9,7 +9,7 @@
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
boolean nv20_draw_elements( struct pipe_context *pipe,
void nv20_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
@ -67,13 +67,12 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
}
draw_flush(nv20->draw);
return TRUE;
}
boolean nv20_draw_arrays( struct pipe_context *pipe,
void nv20_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
return nv20_draw_elements(pipe, NULL, 0, prim, start, count);
nv20_draw_elements(pipe, NULL, 0, prim, start, count);
}

View file

@ -198,9 +198,9 @@ extern struct nv30_state_entry nv30_state_fragtex;
extern struct nv30_state_entry nv30_state_vbo;
/* nv30_vbo.c */
extern boolean nv30_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv30_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv30_draw_elements(struct pipe_context *pipe,
extern void nv30_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start,

View file

@ -163,7 +163,7 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
return TRUE;
}
boolean
void
nv30_draw_arrays(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
@ -175,7 +175,7 @@ nv30_draw_arrays(struct pipe_context *pipe,
if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
/*return nv30_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);*/
return FALSE;
return;
}
while (count) {
@ -362,7 +362,7 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
}
}
static boolean
static void
nv30_draw_elements_inline(struct pipe_context *pipe,
struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
@ -393,10 +393,9 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
}
pipe_buffer_unmap(pscreen, ib);
return TRUE;
}
static boolean
static void
nv30_draw_elements_vbo(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
@ -445,11 +444,9 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
count -= vc;
start = restart;
}
return TRUE;
}
boolean
void
nv30_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
@ -461,7 +458,7 @@ nv30_draw_elements(struct pipe_context *pipe,
if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
/*return nv30_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);*/
return FALSE;
return;
}
if (idxbuf) {
@ -472,7 +469,6 @@ nv30_draw_elements(struct pipe_context *pipe,
}
pipe->flush(pipe, 0, NULL);
return TRUE;
}
static boolean

View file

@ -183,7 +183,7 @@ extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
/* nv40_draw.c */
extern struct draw_stage *nv40_draw_render_stage(struct nv40_context *nv40);
extern boolean nv40_draw_elements_swtnl(struct pipe_context *pipe,
extern void nv40_draw_elements_swtnl(struct pipe_context *pipe,
struct pipe_buffer *idxbuf,
unsigned ib_size, unsigned mode,
unsigned start, unsigned count);
@ -219,9 +219,9 @@ extern struct nv40_state_entry nv40_state_vbo;
extern struct nv40_state_entry nv40_state_vtxfmt;
/* nv40_vbo.c */
extern boolean nv40_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv40_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv40_draw_elements(struct pipe_context *pipe,
extern void nv40_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start,

View file

@ -226,7 +226,7 @@ nv40_draw_render_stage(struct nv40_context *nv40)
return &render->stage;
}
boolean
void
nv40_draw_elements_swtnl(struct pipe_context *pipe,
struct pipe_buffer *idxbuf, unsigned idxbuf_size,
unsigned mode, unsigned start, unsigned count)
@ -237,7 +237,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
void *map;
if (!nv40_state_validate_swtnl(nv40))
return FALSE;
return;
nv40->state.dirty &= ~(1ULL << NV40_STATE_VTXBUF);
nv40_state_emit(nv40);
@ -278,8 +278,6 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
draw_flush(nv40->draw);
pipe->flush(pipe, 0, NULL);
return TRUE;
}
static INLINE void

View file

@ -164,7 +164,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so,
return TRUE;
}
boolean
void
nv40_draw_arrays(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
@ -174,8 +174,9 @@ nv40_draw_arrays(struct pipe_context *pipe,
nv40_vbo_set_idxbuf(nv40, NULL, 0);
if (FORCE_SWTNL || !nv40_state_validate(nv40)) {
return nv40_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
nv40_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
return;
}
while (count) {
@ -221,7 +222,6 @@ nv40_draw_arrays(struct pipe_context *pipe,
}
pipe->flush(pipe, 0, NULL);
return TRUE;
}
static INLINE void
@ -362,7 +362,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib,
}
}
static boolean
static void
nv40_draw_elements_inline(struct pipe_context *pipe,
struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
@ -393,10 +393,9 @@ nv40_draw_elements_inline(struct pipe_context *pipe,
}
pipe_buffer_unmap(pscreen, ib);
return TRUE;
}
static boolean
static void
nv40_draw_elements_vbo(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
@ -445,11 +444,9 @@ nv40_draw_elements_vbo(struct pipe_context *pipe,
count -= vc;
start = restart;
}
return TRUE;
}
boolean
void
nv40_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
@ -459,8 +456,9 @@ nv40_draw_elements(struct pipe_context *pipe,
idxbuf = nv40_vbo_set_idxbuf(nv40, indexBuffer, indexSize);
if (FORCE_SWTNL || !nv40_state_validate(nv40)) {
return nv40_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
nv40_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
return;
}
if (idxbuf) {
@ -471,7 +469,6 @@ nv40_draw_elements(struct pipe_context *pipe,
}
pipe->flush(pipe, 0, NULL);
return TRUE;
}
static boolean

View file

@ -191,9 +191,9 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst,
extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
/* nv50_vbo.c */
extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
extern void nv50_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv50_draw_elements(struct pipe_context *pipe,
extern void nv50_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start,

View file

@ -152,7 +152,7 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
return (hw_type | hw_size);
}
boolean
void
nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
unsigned count)
{
@ -182,7 +182,9 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
return ret;
/* XXX: not sure what to do if ret != TRUE: flush and retry?
*/
assert(ret);
}
static INLINE boolean
@ -275,7 +277,7 @@ nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map,
return TRUE;
}
boolean
void
nv50_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
@ -317,8 +319,10 @@ nv50_draw_elements(struct pipe_context *pipe,
OUT_RING (chan, 0);
pipe_buffer_unmap(pscreen, indexBuffer);
return ret;
/* XXX: what to do if ret != TRUE? Flush and retry?
*/
assert(ret);
}
static INLINE boolean

View file

@ -213,7 +213,7 @@ validate:
}
/* This is the fast-path drawing & emission for HW TCL. */
boolean r300_draw_range_elements(struct pipe_context* pipe,
void r300_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
@ -225,30 +225,33 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
if (!u_trim_pipe_prim(mode, &count)) {
return FALSE;
return;
}
if (count > 65535) {
return FALSE;
/* XXX: use aux/indices functions to split this into smaller
* primitives.
*/
return;
}
if (r300_nothing_to_draw(r300)) {
return TRUE;
return;
}
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
return FALSE;
return;
}
if (!r300->winsys->add_buffer(r300->winsys, indexBuffer,
RADEON_GEM_DOMAIN_GTT, 0)) {
return FALSE;
return;
}
if (!r300->winsys->validate(r300->winsys)) {
return FALSE;
return;
}
r300_emit_dirty_state(r300);
@ -257,41 +260,42 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, maxIndex,
mode, start, count);
return TRUE;
}
/* Simple helpers for context setup. Should probably be moved to util. */
boolean r300_draw_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize, unsigned mode,
unsigned start, unsigned count)
void r300_draw_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize, unsigned mode,
unsigned start, unsigned count)
{
return pipe->draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0,
mode, start, count);
pipe->draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0,
mode, start, count);
}
boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
unsigned start, unsigned count)
{
struct r300_context* r300 = r300_context(pipe);
if (!u_trim_pipe_prim(mode, &count)) {
return FALSE;
return;
}
if (count > 65535) {
return FALSE;
/* XXX: driver needs to handle this -- use the functions in
* aux/indices to split this into several smaller primitives.
*/
return;
}
if (r300_nothing_to_draw(r300)) {
return TRUE;
return;
}
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
return FALSE;
return;
}
r300_emit_dirty_state(r300);
@ -299,8 +303,6 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
r300_emit_aos(r300, start);
r300_emit_draw_arrays(r300, mode, count);
return TRUE;
}
/****************************************************************************
@ -309,7 +311,7 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
***************************************************************************/
/* SW TCL arrays, using Draw. */
boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
void r300_swtcl_draw_arrays(struct pipe_context* pipe,
unsigned mode,
unsigned start,
unsigned count)
@ -318,11 +320,11 @@ boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
int i;
if (!u_trim_pipe_prim(mode, &count)) {
return FALSE;
return;
}
if (r300_nothing_to_draw(r300)) {
return TRUE;
return;
}
for (i = 0; i < r300->vertex_buffer_count; i++) {
@ -346,12 +348,10 @@ boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
pipe_buffer_unmap(pipe->screen, r300->vertex_buffer[i].buffer);
draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
}
return TRUE;
}
/* SW TCL elements, using Draw. */
boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
@ -365,11 +365,11 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
void* indices;
if (!u_trim_pipe_prim(mode, &count)) {
return FALSE;
return;
}
if (r300_nothing_to_draw(r300)) {
return TRUE;
return;
}
for (i = 0; i < r300->vertex_buffer_count; i++) {
@ -400,8 +400,6 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
pipe_buffer_unmap(pipe->screen, indexBuffer);
draw_set_mapped_element_buffer_range(r300->draw, 0, start,
start + count - 1, NULL);
return TRUE;
}
/* Object for rendering using Draw. */

View file

@ -25,35 +25,35 @@
uint32_t r300_translate_primitive(unsigned prim);
boolean r300_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
void r300_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
boolean r300_draw_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize, unsigned mode,
unsigned start, unsigned count);
void r300_draw_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize, unsigned mode,
unsigned start, unsigned count);
boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
unsigned start, unsigned count);
void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
unsigned start, unsigned count);
boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
unsigned mode,
unsigned start,
unsigned count);
void r300_swtcl_draw_arrays(struct pipe_context* pipe,
unsigned mode,
unsigned start,
unsigned count);
boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
#endif /* R300_RENDER_H */

View file

@ -98,11 +98,11 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp)
}
boolean
void
softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count)
{
return softpipe_draw_elements(pipe, NULL, 0, mode, start, count);
softpipe_draw_elements(pipe, NULL, 0, mode, start, count);
}
@ -111,7 +111,7 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
* Basically, map the vertex buffers (and drawing surfaces), then hand off
* the drawing to the 'draw' module.
*/
boolean
void
softpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
@ -181,19 +181,17 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
softpipe_unmap_constant_buffers(sp);
sp->dirty_render_cache = TRUE;
return TRUE;
}
boolean
void
softpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
return softpipe_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
softpipe_draw_range_elements( pipe, indexBuffer,
indexSize,
0, 0xffffffff,
mode, start, count );
}

View file

@ -184,14 +184,14 @@ void softpipe_set_vertex_buffers(struct pipe_context *,
void softpipe_update_derived( struct softpipe_context *softpipe );
boolean softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count);
void softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count);
boolean softpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
boolean
void softpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
void
softpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,

View file

@ -149,7 +149,7 @@ retry:
static boolean
static void
svga_draw_range_elements( struct pipe_context *pipe,
struct pipe_buffer *index_buffer,
unsigned index_size,
@ -162,7 +162,7 @@ svga_draw_range_elements( struct pipe_context *pipe,
enum pipe_error ret = 0;
if (!u_trim_pipe_prim( prim, &count ))
return TRUE;
return;
/*
* Mark currently bound target surfaces as dirty
@ -183,7 +183,7 @@ svga_draw_range_elements( struct pipe_context *pipe,
#ifdef DEBUG
if (svga->curr.vs->base.id == svga->debug.disable_shader ||
svga->curr.fs->base.id == svga->debug.disable_shader)
return 0;
return;
#endif
if (svga->state.sw.need_swtnl)
@ -225,31 +225,29 @@ svga_draw_range_elements( struct pipe_context *pipe,
svga_hwtnl_flush_retry( svga );
svga_context_flush(svga, NULL);
}
return ret == PIPE_OK;
}
static boolean
static void
svga_draw_elements( struct pipe_context *pipe,
struct pipe_buffer *index_buffer,
unsigned index_size,
unsigned prim, unsigned start, unsigned count)
{
return svga_draw_range_elements( pipe, index_buffer,
index_size,
0, 0xffffffff,
prim, start, count );
svga_draw_range_elements( pipe, index_buffer,
index_size,
0, 0xffffffff,
prim, start, count );
}
static boolean
static void
svga_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
return svga_draw_range_elements(pipe, NULL, 0,
start, start + count - 1,
prim,
start, count);
svga_draw_range_elements(pipe, NULL, 0,
start, start + count - 1,
prim,
start, count);
}

View file

@ -161,16 +161,15 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag)
pipe_mutex_unlock(tr_ctx->draw_mutex);
}
static INLINE boolean
static INLINE void
trace_context_draw_arrays(struct pipe_context *_pipe,
unsigned mode, unsigned start, unsigned count)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
return;
trace_context_draw_block(tr_ctx, 1);
@ -181,19 +180,15 @@ trace_context_draw_arrays(struct pipe_context *_pipe,
trace_dump_arg(uint, start);
trace_dump_arg(uint, count);
result = pipe->draw_arrays(pipe, mode, start, count);
trace_dump_ret(bool, result);
pipe->draw_arrays(pipe, mode, start, count);
trace_dump_call_end();
trace_context_draw_block(tr_ctx, 2);
return result;
}
static INLINE boolean
static INLINE void
trace_context_draw_elements(struct pipe_context *_pipe,
struct pipe_buffer *_indexBuffer,
unsigned indexSize,
@ -203,10 +198,9 @@ trace_context_draw_elements(struct pipe_context *_pipe,
struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
return;
trace_context_draw_block(tr_ctx, 1);
@ -221,19 +215,15 @@ trace_context_draw_elements(struct pipe_context *_pipe,
trace_dump_arg(uint, start);
trace_dump_arg(uint, count);
result = pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);
trace_dump_ret(bool, result);
pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);
trace_dump_call_end();
trace_context_draw_block(tr_ctx, 2);
return result;
}
static INLINE boolean
static INLINE void
trace_context_draw_range_elements(struct pipe_context *_pipe,
struct pipe_buffer *_indexBuffer,
unsigned indexSize,
@ -247,10 +237,9 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_buffer *indexBuffer = tr_buf->buffer;
boolean result;
if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
return 0;
return;
trace_context_draw_block(tr_ctx, 1);
@ -267,18 +256,14 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
trace_dump_arg(uint, start);
trace_dump_arg(uint, count);
result = pipe->draw_range_elements(pipe,
indexBuffer,
indexSize, minIndex, maxIndex,
mode, start, count);
trace_dump_ret(bool, result);
pipe->draw_range_elements(pipe,
indexBuffer,
indexSize, minIndex, maxIndex,
mode, start, count);
trace_dump_call_end();
trace_context_draw_block(tr_ctx, 2);
return result;
}

View file

@ -61,27 +61,27 @@ struct pipe_context {
* VBO drawing (return false on fallbacks (temporary??))
*/
/*@{*/
boolean (*draw_arrays)( struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count);
void (*draw_arrays)( struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count);
boolean (*draw_elements)( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
void (*draw_elements)( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
/* XXX: this is (probably) a temporary entrypoint, as the range
* information should be available from the vertex_buffer state.
* Using this to quickly evaluate a specialized path in the draw
* module.
*/
boolean (*draw_range_elements)( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
void (*draw_range_elements)( struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
unsigned mode,
unsigned start,
unsigned count);
/*@}*/
/**