diff options
author | Aapo Tahkola <aet@rasterburn.org> | 2006-08-22 21:54:50 +0000 |
---|---|---|
committer | Aapo Tahkola <aet@rasterburn.org> | 2006-08-22 21:54:50 +0000 |
commit | cafb0617eaacf09d9d19b75a5596b4dd2a1f85ba (patch) | |
tree | e61c28b936aa186f861626b6c3647b6c88ac21a4 /src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | |
parent | 50eae3af7a34e1b4a75e4aeec5c57b578e06850f (diff) |
extend some DrawRangeElements cases to support rendering more than 65535 verts in one blast. ut2k4 cases in other words ...
Diffstat (limited to 'src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c index cbd837fa72..7f539b4377 100644 --- a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c +++ b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c @@ -344,6 +344,22 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G _mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt ); } +static int elt_bytes(GLenum type) +{ + switch (type) { + case GL_UNSIGNED_BYTE: + return 1; + case GL_UNSIGNED_SHORT: + return 2; + case GL_UNSIGNED_INT: + return 4; + default: + _mesa_problem(NULL, "bad elt type in %s", __FUNCTION__); + return 0; + } + return 0; +} + static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *c_indices) { GET_CURRENT_CONTEXT(ctx); @@ -356,6 +372,25 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei const GLvoid *indices = c_indices; if (count > 65535) { + /* TODO */ + if (mode == GL_POINTS || + mode == GL_LINES || + mode == GL_QUADS || + mode == GL_TRIANGLES) { + + if (!_mesa_validate_DrawRangeElements( ctx, mode, min, max, count, type, indices )) + return; + + while (count) { + i = r300_get_num_verts(rmesa, MIN2(count, 65535), mode); + + radeonDrawRangeElements(mode, min, max, i, type, indices); + + indices += i * elt_bytes(type); + count -= i; + } + return ; + } WARN_ONCE("Too many verts!\n"); goto fallback; } @@ -506,7 +541,6 @@ static void radeonDrawArrays( GLenum mode, GLint start, GLsizei count ) GET_CURRENT_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); struct tnl_prim prim; - int i; if (count > 65535) { WARN_ONCE("Too many verts!\n"); |