summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2005-10-28 09:28:32 +0000
committerAapo Tahkola <aet@rasterburn.org>2005-10-28 09:28:32 +0000
commita4af1119f5fb9322e1ddaa4808fed7579a758e4f (patch)
tree4750477f33e7fbb907d3203a7eda68d134d02340 /src/mesa
parent9c8f649930a523e8160d36d3971cd4505e73c103 (diff)
Compiled arrays for vtxfmt_a path.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c6
-rw-r--r--src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c103
5 files changed, 85 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 96f4ff6afa..0ece8f8d1f 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -52,6 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//#define RADEON_VTXFMT_A
//#define HW_VBOS
//#define OPTIMIZE_ELTS
+//#define CB_DPATH
struct r300_context;
typedef struct r300_context r300ContextRec;
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index 56a5ec9473..79411e1dba 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -55,8 +55,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vblank.h"
-//#define CB_DPATH
-
#define CLEARBUFFER_COLOR 0x1
#define CLEARBUFFER_DEPTH 0x2
#define CLEARBUFFER_STENCIL 0x4
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index aa9645e163..b8e951d171 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -40,6 +40,7 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
struct ati_fragment_shader *afs;
switch(target){
+ case GL_VERTEX_STATE_PROGRAM_NV:
case GL_VERTEX_PROGRAM_ARB:
vp=CALLOC_STRUCT(r300_vertex_program);
return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 6ab7d97faf..e3aa74b102 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1257,7 +1257,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
r300->hw.rc.cmd[1] = 0
| (cur_reg /* count */ << R300_RS_CNTL_TC_CNT_SHIFT)
- | R300_RS_CNTL_0_UNKNOWN_7
+ | (1 << R300_RS_CNTL_CI_CNT_SHIFT)
| R300_RS_CNTL_0_UNKNOWN_18;
if (r300->state.texture.tc_count > 0) {
@@ -1867,6 +1867,10 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
/* Go inefficiency! */
r300ResetHwState(r300);
+#ifdef HW_VBOS
+ if(new_state & _NEW_ARRAY)
+ r300->state.VB.lock_uptodate = GL_FALSE;
+#endif
}
/**
diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c
index d1f90abfb2..b6292bb00e 100644
--- a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c
+++ b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c
@@ -249,7 +249,7 @@ void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *
radeon_mm_use(rmesa, rvb.buf->id);
}
-void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
+void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *indices)
{
GET_CURRENT_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
@@ -270,7 +270,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei coun
ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) indices);
}
- if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices ))
+ if (!_mesa_validate_DrawRangeElements( ctx, mode, min, max, count, type, indices ))
return;
FLUSH_CURRENT( ctx, 0 );
@@ -288,7 +288,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei coun
ptr = rvb.address + rvb.start;
for(i=0; i < count; i++)
- ((unsigned short int *)ptr)[i] = ((unsigned char *)indices)[i] - start;
+ ((unsigned short int *)ptr)[i] = ((unsigned char *)indices)[i] - min;
break;
case GL_UNSIGNED_SHORT:
@@ -305,7 +305,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei coun
ptr = rvb.address + rvb.start;
for(i=0; i < count; i++)
- ((unsigned short int *)ptr)[i] = ((unsigned short int *)indices)[i] - start;
+ ((unsigned short int *)ptr)[i] = ((unsigned short int *)indices)[i] - min;
break;
case GL_UNSIGNED_INT:
@@ -316,7 +316,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei coun
ptr = rvb.address + rvb.start;
for(i=0; i < count; i++)
- ((unsigned int *)ptr)[i] = ((unsigned int *)indices)[i] - start;
+ ((unsigned int *)ptr)[i] = ((unsigned int *)indices)[i] - min;
break;
default:
@@ -325,26 +325,56 @@ void radeonDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei coun
}
- if(setup_arrays(rmesa, start))
- return;
+ /* XXX: setup_arrays before state update? */
if (ctx->NewState)
_mesa_update_state( ctx );
r300UpdateShaderStates(rmesa);
- rmesa->state.VB.Count = (end - start) + 1;
+ if (rmesa->state.VB.LockCount) {
+ if (rmesa->state.VB.lock_uptodate == GL_FALSE) {
+ if (setup_arrays(rmesa, rmesa->state.VB.LockFirst))
+ return;
+
+ rmesa->state.VB.Count = rmesa->state.VB.LockCount;
+
+ r300ReleaseArrays(ctx);
+ r300EmitArraysVtx(ctx, GL_FALSE);
+
+ rmesa->state.VB.lock_uptodate = GL_TRUE;
+ }
+
+ if (min < rmesa->state.VB.LockFirst) {
+ WARN_ONCE("Out of range min %d vs %d!\n", min, rmesa->state.VB.LockFirst);
+ return;
+ }
+
+ /*if (max >= rmesa->state.VB.LockFirst + rmesa->state.VB.LockCount) {
+ WARN_ONCE("Out of range max %d vs %d!\n", max, rmesa->state.VB.LockFirst +
+ rmesa->state.VB.LockCount);
+ return;
+ }*/
+ } else {
+ if (setup_arrays(rmesa, min))
+ return;
+ rmesa->state.VB.Count = max - min + 1;
+ }
+
rmesa->state.VB.Primitive = &prim;
rmesa->state.VB.PrimitiveCount = 1;
prim.mode = mode | PRIM_BEGIN | PRIM_END;
- prim.start = 0;
+ if (rmesa->state.VB.LockCount)
+ prim.start = min - rmesa->state.VB.LockFirst;
+ else
+ prim.start = 0;
prim.count = count;
rmesa->state.VB.Elts = ptr;
rmesa->state.VB.elt_size = elt_size;
- rmesa->state.VB.elt_min = start;
- rmesa->state.VB.elt_max = end;
+ rmesa->state.VB.elt_min = min;
+ rmesa->state.VB.elt_max = max;
r300_run_vb_render_vtxfmt_a(ctx, NULL);
@@ -366,31 +396,47 @@ void radeonDrawArrays( GLenum mode, GLint start, GLsizei count )
if (ctx->NewState)
_mesa_update_state( ctx );
- if (rmesa->state.VB.LockCount == 0)
- if (setup_arrays(rmesa, start))
- return;
+ /* XXX: setup_arrays before state update? */
r300UpdateShaderStates(rmesa);
-
+
if (rmesa->state.VB.LockCount) {
- start -= rmesa->state.VB.LockFirst;
- if (start < 0) { /* Generate error */
- WARN_ONCE("Out of range!\n");
+ if (rmesa->state.VB.lock_uptodate == GL_FALSE) {
+ if (setup_arrays(rmesa, rmesa->state.VB.LockFirst))
+ return;
+
+ rmesa->state.VB.Count = rmesa->state.VB.LockCount;
+
+ r300ReleaseArrays(ctx);
+ r300EmitArraysVtx(ctx, GL_FALSE);
+
+ rmesa->state.VB.lock_uptodate = GL_TRUE;
+ }
+
+ if (start < rmesa->state.VB.LockFirst) {
+ WARN_ONCE("Out of range min %d vs %d!\n", start, rmesa->state.VB.LockFirst);
return;
}
- }
- if (rmesa->state.VB.LockCount == 0)
+ if (start + count - 1 >= rmesa->state.VB.LockFirst + rmesa->state.VB.LockCount) { /* XXX */
+ WARN_ONCE("Out of range max %d vs %d!\n", start + count - 1, rmesa->state.VB.LockFirst +
+ rmesa->state.VB.LockCount);
+ return;
+ }
+ } else {
+ if (setup_arrays(rmesa, start))
+ return;
rmesa->state.VB.Count = count;
+ }
+
rmesa->state.VB.Primitive = &prim;
rmesa->state.VB.PrimitiveCount = 1;
prim.mode = mode | PRIM_BEGIN | PRIM_END;
- if (ctx->Array.LockCount == 0)
- prim.start = 0;
+ if (rmesa->state.VB.LockCount)
+ prim.start = start - rmesa->state.VB.LockFirst;
else
- prim.start = start;
-
+ prim.start = 0;
prim.count = count;
rmesa->state.VB.Elts = NULL;
@@ -423,12 +469,18 @@ void radeonLockArraysEXT(GLcontext *ctx, GLint first, GLsizei count)
r300ContextPtr rmesa = R300_CONTEXT(ctx);
int i;
- /* Disabled as array changes arent properly handled yet. */
+ /* Only when CB_DPATH is defined.
+ r300Clear tampers over the aos setup without it.
+ (r300ResetHwState cannot call r300EmitArrays)
+ */
+#ifndef CB_DPATH
first = 0; count = 0;
+#endif
if (first < 0 || count <= 0) {
rmesa->state.VB.LockFirst = 0;
rmesa->state.VB.LockCount = 0;
+ rmesa->state.VB.lock_uptodate = GL_FALSE;
return ;
}
@@ -443,6 +495,7 @@ void radeonUnlockArraysEXT(GLcontext *ctx)
rmesa->state.VB.LockFirst = 0;
rmesa->state.VB.LockCount = 0;
+ rmesa->state.VB.lock_uptodate = GL_FALSE;
}
struct gl_buffer_object *