diff options
author | Aapo Tahkola <aet@rasterburn.org> | 2006-01-27 13:21:47 +0000 |
---|---|---|
committer | Aapo Tahkola <aet@rasterburn.org> | 2006-01-27 13:21:47 +0000 |
commit | e797bc8bbe23480c3fca3654ce1c980d103520d1 (patch) | |
tree | 8616b22f82bbd05d19767d720842588ada4fdaeb | |
parent | 7d82d284e3cd8a46dfea8788d090eb58198752ca (diff) |
per vp sw fallbacks
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_reg.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_render.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_shader.c | 28 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertexprog.c | 5 |
5 files changed, 55 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index bfa48d07c8..03c2e6612f 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -583,6 +583,9 @@ extern int hw_tcl_on; #define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current) +/* Should but doesnt work */ +//#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp) + //#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) : // (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))) //#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : @@ -604,6 +607,9 @@ struct r300_vertex_program { int num_temporaries; /* Number of temp vars used by program */ int inputs[VERT_ATTRIB_MAX]; int outputs[VERT_RESULT_MAX]; + int native; + int ref_count; + int use_ref_count; }; #if USE_ARB_F_P == 1 @@ -852,6 +858,7 @@ struct r300_context { struct r300_hw_state hw; struct r300_cmdbuf cmdbuf; struct r300_state state; + struct vertex_program *curr_vp; /* Vertex buffers */ @@ -917,4 +924,9 @@ extern void radeon_init_vtxfmt_a(r300ContextPtr rmesa); extern void r300_init_vbo_funcs(struct dd_function_table *functions); #endif +#define RADEON_D_CAPTURE 0 +#define RADEON_D_PLAYBACK 1 +#define RADEON_D_PLAYBACK_RAW 2 +#define RADEON_D_T 3 + #endif /* __R300_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 0717e731b9..3bed99e456 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1275,6 +1275,8 @@ I am fairly certain that they are correct unless stated otherwise in comments. #define R300_RB3D_ZSTENCIL_FORMAT 0x4F10 # define R300_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) # define R300_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) + /* 16 bit format or some aditional bit ? */ +# define R300_DEPTH_FORMAT_UNK32 (32 << 0) /* gap */ #define R300_RB3D_DEPTHOFFSET 0x4F20 diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index fbd2135884..6a7f126b9e 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -543,7 +543,7 @@ static GLboolean r300_run_vb_render(GLcontext *ctx, fprintf(stderr, "%s\n", __FUNCTION__); - r300UpdateShaders(rmesa); + //r300UpdateShaders(rmesa); r300ReleaseArrays(ctx); r300EmitArrays(ctx, GL_FALSE); @@ -567,13 +567,13 @@ static GLboolean r300_run_vb_render(GLcontext *ctx, r300_render_vb_primitive(rmesa, ctx, start, start + length, prim); } - + reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); reg_start(0x4f18,0); e32(0x00000003); - + #ifdef USER_BUFFERS r300UseArrays(ctx); #endif @@ -690,6 +690,7 @@ void dump_dt(struct dt *dt, int count) if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); + r300UpdateShaders(rmesa); if (rmesa->state.VB.LockCount == 0) { r300ReleaseArrays(ctx); r300EmitArraysVtx(ctx, GL_FALSE); @@ -845,6 +846,7 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) { r300ContextPtr rmesa = R300_CONTEXT(ctx); + struct r300_vertex_program *vp; hw_tcl_on=future_hw_tcl_on; @@ -853,25 +855,23 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, if(hw_tcl_on == GL_FALSE) return GL_TRUE; - //r300UpdateShaders(rmesa); + r300UpdateShaders(rmesa); + + vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); +#if 0 /* Draw every second request with software arb vp */ + vp->native++; + vp->native &= 1; + //vp->native = GL_FALSE; +#endif + if (vp->native == GL_FALSE) { + hw_tcl_on = GL_FALSE; + return GL_TRUE; + } //r300UpdateShaderStates(rmesa); return r300_run_vb_render(ctx, stage); } -static void r300_check_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) -{ - - if (RADEON_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s\n", __FUNCTION__); - - /* We only support rendering in hardware for now */ - if (ctx->RenderMode != GL_RENDER) { - //stage->active = GL_FALSE; - return; - } -} - const struct tnl_pipeline_stage _r300_tcl_stage = { "r300 tcl", NULL, diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index f10b40a222..8f60bb3d00 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -11,13 +11,22 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog) { - /* + r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program *vp=(void *)prog; - */ + switch(target){ case GL_VERTEX_PROGRAM_ARB: + rmesa->curr_vp = vp; + vp->ref_count++; +#if 0 + if((vp->ref_count % 1500) == 0) { + fprintf(stderr, "id %p, ref_count %d\n", vp, vp->ref_count); + _mesa_print_program(&vp->mesa_program.Base); + } +#endif + #if USE_ARB_F_P == 1 case GL_FRAGMENT_PROGRAM_ARB: #endif @@ -77,8 +86,11 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id) static void r300DeleteProgram(GLcontext *ctx, struct program *prog) { - //r300ContextPtr rmesa = R300_CONTEXT(ctx); - //struct r300_vertex_program *vp=(void *)prog; + r300ContextPtr rmesa = R300_CONTEXT(ctx); + struct r300_vertex_program *vp=(void *)prog; + + /*if(rmesa->curr_vp == vp) + rmesa->curr_vp = NULL;*/ _mesa_delete_program(ctx, prog); } @@ -86,16 +98,16 @@ static void r300DeleteProgram(GLcontext *ctx, struct program *prog) static void r300ProgramStringNotify(GLcontext *ctx, GLenum target, struct program *prog) { - /*struct r300_vertex_program *vp=(void *)prog;*/ + struct r300_vertex_program *vp=(void *)prog; #if USE_ARB_F_P == 1 struct r300_fragment_program *fp = (struct r300_fragment_program *) prog; #endif switch(target) { case GL_VERTEX_PROGRAM_ARB: - /*vp->translated=GL_FALSE; - translate_vertex_shader(vp);*/ - //debug_vp(ctx, vp); + vp->translated = GL_FALSE; + memset(&vp->translated, 0, sizeof(struct r300_vertex_program) - sizeof(struct vertex_program)); + /*translate_vertex_shader(vp);*/ break; case GL_FRAGMENT_PROGRAM_ARB: #if USE_ARB_F_P == 1 diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c index b492355142..f45b8cf11b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertexprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c @@ -934,7 +934,10 @@ void translate_vertex_shader(struct r300_vertex_program *vp) if(u_temp_i < vp->num_temporaries){ WARN_ONCE("Ran out of temps, num temps %d, us %d\n", vp->num_temporaries, u_temp_i); vp->translated=GL_TRUE; //GL_FALSE; /* temps exhausted - program cannot be run */ - }else + vp->native = GL_FALSE; + }else{ vp->translated=GL_TRUE; + vp->native = GL_TRUE; + } } |