summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-08-22 21:54:50 +0000
committerAapo Tahkola <[email protected]>2006-08-22 21:54:50 +0000
commitcafb0617eaacf09d9d19b75a5596b4dd2a1f85ba (patch)
treee61c28b936aa186f861626b6c3647b6c88ac21a4 /src/mesa
parent50eae3af7a34e1b4a75e4aeec5c57b578e06850f (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')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c7
-rw-r--r--src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c36
3 files changed, 39 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 48677909519..1acb6a6c944 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -847,6 +847,8 @@ extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
__DRIcontextPrivate * driContextPriv,
void *sharedContextPrivate);
+extern int r300_get_num_verts(r300ContextPtr rmesa, int num_verts, int prim);
+
void r300_translate_vertex_shader(struct r300_vertex_program *vp);
extern void r300InitShaderFuncs(struct dd_function_table *functions);
extern int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp, float *dst);
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 0f1e567a910..c49567d69e9 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -113,10 +113,7 @@ static int r300_get_primitive_type(r300ContextPtr rmesa, GLcontext *ctx, int pri
return type;
}
-static int r300_get_num_verts(r300ContextPtr rmesa,
- GLcontext *ctx,
- int num_verts,
- int prim)
+int r300_get_num_verts(r300ContextPtr rmesa, int num_verts, int prim)
{
int verts_off=0;
char *name="UNKNOWN";
@@ -286,7 +283,7 @@ static void r300_render_vb_primitive(r300ContextPtr rmesa,
int type, num_verts;
type=r300_get_primitive_type(rmesa, ctx, prim);
- num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim);
+ num_verts=r300_get_num_verts(rmesa, end-start, prim);
if(type<0 || num_verts <= 0)return;
diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c
index cbd837fa725..7f539b43776 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");