#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))) :
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
struct r300_hw_state hw;
struct r300_cmdbuf cmdbuf;
struct r300_state state;
+ struct vertex_program *curr_vp;
/* Vertex buffers
*/
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__ */
#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
fprintf(stderr, "%s\n", __FUNCTION__);
- r300UpdateShaders(rmesa);
+ //r300UpdateShaders(rmesa);
r300ReleaseArrays(ctx);
r300EmitArrays(ctx, GL_FALSE);
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
if (RADEON_DEBUG & DEBUG_PRIMS)
fprintf(stderr, "%s\n", __FUNCTION__);
+ r300UpdateShaders(rmesa);
if (rmesa->state.VB.LockCount == 0) {
r300ReleaseArrays(ctx);
r300EmitArraysVtx(ctx, GL_FALSE);
struct tnl_pipeline_stage *stage)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ struct r300_vertex_program *vp;
hw_tcl_on=future_hw_tcl_on;
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,
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
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);
}
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
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;
+ }
}