diff options
author | Aapo Tahkola <[email protected]> | 2006-03-13 20:40:46 +0000 |
---|---|---|
committer | Aapo Tahkola <[email protected]> | 2006-03-13 20:40:46 +0000 |
commit | e9484e40858ffd4474571b27136e7ea0f2b682db (patch) | |
tree | 19944ff0a701dbc5b37e67ee39e69729b75315b9 | |
parent | a0cf4ceb36cf3604fb035276efef4b640ab38c24 (diff) |
Clean build.
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_cmdbuf.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 83 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_ioctl.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_maos.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_render.c | 274 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_shader.c | 22 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_tex.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texstate.c | 725 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertexprog.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_lock.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_mm.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | 47 |
18 files changed, 103 insertions, 1125 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 32bd82ed103..09f7669bd71 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -93,10 +93,10 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) cmd.nbox = r300->radeon.numClipRects; cmd.boxes = (drm_clip_rect_t *)r300->radeon.pClipRects; } - + ret = drmCommandWrite(r300->radeon.dri.fd, DRM_RADEON_CMDBUF, &cmd, sizeof(cmd)); - + if (RADEON_DEBUG & DEBUG_SYNC) { fprintf(stderr, "Syncing in %s (from %s)\n\n", __FUNCTION__, caller); radeonWaitForIdleLocked(&r300->radeon); diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 46d64443c35..69a32700c03 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -58,6 +58,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "r300_ioctl.h" #include "r300_tex.h" +#include "r300_maos.h" #ifdef USER_BUFFERS #include "radeon_mm.h" diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 53b689e00b0..f948752e750 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -47,8 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "colormac.h" #include "radeon_context.h" -#define USE_ARB_F_P 1 - /* PPC doesnt support 16 bit elts ... */ #ifndef MESA_BIG_ENDIAN #define USER_BUFFERS @@ -95,11 +93,7 @@ typedef GLubyte uint8_t; and pixel_shader structure later on */ #define CARD32 GLuint #include "vertex_shader.h" -#if USE_ARB_F_P == 1 #include "r300_fragprog.h" -#else -#include "pixel_shader.h" -#endif #undef CARD32 static __inline__ uint32_t r300PackFloat32(float fl) @@ -120,6 +114,7 @@ struct r300_dma_buffer { drmBufPtr buf; int id; }; +#undef GET_START #ifdef USER_BUFFERS #define GET_START(rvb) (r300GartOffsetFromVirtual(rmesa, (rvb)->address+(rvb)->start)) #else @@ -619,7 +614,6 @@ struct r300_vertex_program { int use_ref_count; }; -#if USE_ARB_F_P == 1 #define PFS_MAX_ALU_INST 64 #define PFS_MAX_TEX_INST 64 #define PFS_MAX_TEX_INDIRECT 4 @@ -710,74 +704,6 @@ struct r300_fragment_program { int max_temp_idx; }; -#else -/* 64 appears to be the maximum */ -#define PSF_MAX_PROGRAM_LENGTH 64 - -struct r300_pixel_shader_program { - struct { - int length; - GLuint inst[PSF_MAX_PROGRAM_LENGTH]; - } tex; - - /* ALU intructions (logic and integer) */ - struct { - int length; - struct { - GLuint inst0; - GLuint inst1; - GLuint inst2; - GLuint inst3; - } inst[PSF_MAX_PROGRAM_LENGTH]; - } alu; - - /* node information */ - /* nodes are used to synchronize ALU and TEX streams */ - /* There could be up to 4 nodes each consisting of - a number of TEX instructions followed by some ALU - instructions */ - /* the last node of a program should always be node3 */ - struct { - int tex_offset; - int tex_end; - int alu_offset; - int alu_end; - } node[4]; - - int active_nodes; /* must be between 1 and 4, inclusive */ - int first_node_has_tex; /* other nodes always have it */ - - int temp_register_count; /* magic value goes into PFS_CNTL_1 */ - - /* entire program */ - int tex_offset; - int tex_end; - int alu_offset; - int alu_end; - - }; - -#define MAX_PIXEL_SHADER_PARAMS 32 -struct r300_pixel_shader_state { - struct r300_pixel_shader_program program; - - int translated; - int have_sample; - GLuint color_reg; - GLuint src_previous; - - /* parameters */ - int param_length; /* to limit the number of unnecessary writes */ - struct { - float x; - float y; - float z; - float w; - } param[MAX_PIXEL_SHADER_PARAMS]; - }; -#endif // USE_ARB_F_P - -/* 8 is somewhat bogus... it is probably something like 24 */ #define R300_MAX_AOS_ARRAYS 16 #define AOS_FORMAT_FLOAT 1 @@ -830,11 +756,7 @@ struct r300_state { struct r300_texture_state texture; struct r300_vap_reg_state vap_reg; struct r300_vertex_shader_state vertex_shader; -#if USE_ARB_F_P == 0 - struct r300_pixel_shader_state pixel_shader; -#else struct r300_pfs_compile_state pfs_compile; -#endif struct r300_dma_region aos[R300_MAX_AOS_ARRAYS]; int aos_count; #ifdef USER_BUFFERS @@ -922,13 +844,14 @@ extern GLboolean r300CreateContext(const __GLcontextModes * glVisual, __DRIcontextPrivate * driContextPriv, void *sharedContextPrivate); -void translate_vertex_shader(struct r300_vertex_program *vp); +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); extern GLboolean r300Fallback(GLcontext *ctx); #ifdef RADEON_VTXFMT_A extern void radeon_init_vtxfmt_a(r300ContextPtr rmesa); +extern GLboolean r300_run_vb_render_vtxfmt_a(GLcontext *ctx, struct tnl_pipeline_stage *stage); #endif #ifdef HW_VBOS diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index c82d9e98856..c784519c60a 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -319,6 +319,7 @@ static pfs_reg_t emit_param4fv(struct r300_fragment_program *rp, return r; } +#if 0 static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp) { pfs_reg_t r = undef; @@ -335,6 +336,7 @@ static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp) r.valid = GL_TRUE; return r; } +#endif static __inline pfs_reg_t negate(pfs_reg_t r) { @@ -494,7 +496,9 @@ static pfs_reg_t t_src(struct r300_fragment_program *rp, struct prog_src_register fpsrc) { pfs_reg_t r = undef; +#if 0 pfs_reg_t n = undef; +#endif switch (fpsrc.File) { case PROGRAM_TEMPORARY: @@ -1011,6 +1015,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op, return; }; +#if 0 static pfs_reg_t get_attrib(struct r300_fragment_program *rp, GLuint attr) { struct fragment_program *mp = &rp->mesa_program; @@ -1026,6 +1031,7 @@ static pfs_reg_t get_attrib(struct r300_fragment_program *rp, GLuint attr) r.valid = GL_TRUE; return r; } +#endif static GLboolean parse_program(struct r300_fragment_program *rp) { diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index f0aa0fc6c7c..a6c93bd3607 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -78,6 +78,11 @@ typedef struct r300_fragment_program_swizzle { ((0 | SRC_CONST) << R300_FPI3_SRC1A_SHIFT) | \ ((0 | SRC_CONST) << R300_FPI3_SRC2A_SHIFT)) +#include "r300_context.h" + +struct r300_fragment_program; + +extern void r300_translate_fragment_shader(struct r300_fragment_program *rp); #endif diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 73725fcba95..cad11e85a7b 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -601,11 +601,6 @@ void r300Flush(GLcontext * ctx) void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) { struct r300_dma_buffer *dmabuf; - int fd = rmesa->radeon.dri.fd; - int index = 0; - int size = 0; - drmDMAReq dma; - int ret; if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) fprintf(stderr, "%s\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r300/r300_maos.c b/src/mesa/drivers/dri/r300/r300_maos.c index 447cd026d5f..d9f8c031751 100644 --- a/src/mesa/drivers/dri/r300/r300_maos.c +++ b/src/mesa/drivers/dri/r300/r300_maos.c @@ -568,7 +568,7 @@ void r300EmitArraysVtx(GLcontext * ctx, GLboolean immd) GLuint i; GLuint inputs = 0; - +#undef CONFIGURE_AOS #define CONFIGURE_AOS(r, f, v, sz, cn) { \ if (RADEON_DEBUG & DEBUG_STATE) \ fprintf(stderr, "Enabling "#v "\n"); \ diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index f739b38651b..ee24f14f615 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -192,221 +192,7 @@ static int r300_get_num_verts(r300ContextPtr rmesa, return num_verts - verts_off; } -/* This function compiles GL context into state registers that - describe data routing inside of R300 pipeline. - - In particular, it programs input_route, output_vtx_fmt, texture - unit configuration and gb_output_vtx_fmt - - This function encompasses setup_AOS() from r300_lib.c -*/ - - - - -/* Immediate implementation - vertex data is sent via command stream */ - -static GLfloat default_vector[4]={0.0, 0.0, 0.0, 1.0}; - -#define output_vector(v, i) { \ - int _i; \ - for(_i=0;_i<v->size;_i++){ \ - if(VB->Elts){ \ - efloat(VEC_ELT(v, GLfloat, VB->Elts[i])[_i]); \ - }else{ \ - efloat(VEC_ELT(v, GLfloat, i)[_i]); \ - } \ - } \ - for(_i=v->size;_i<4;_i++){ \ - efloat(default_vector[_i]); \ - } \ -} - -/* Immediate implementation - vertex data is sent via command stream */ - -static void r300_render_immediate_primitive(r300ContextPtr rmesa, - GLcontext *ctx, - int start, - int end, - int prim) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i, render_inputs; - int k, type, num_verts; - LOCAL_VARS - - type=r300_get_primitive_type(rmesa, ctx, prim); - num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim); - -#if 0 - fprintf(stderr,"ObjPtr: size=%d stride=%d\n", - VB->ObjPtr->size, VB->ObjPtr->stride); - fprintf(stderr,"ColorPtr[0]: size=%d stride=%d\n", - VB->ColorPtr[0]->size, VB->ColorPtr[0]->stride); - fprintf(stderr,"TexCoordPtr[0]: size=%d stride=%d\n", - VB->TexCoordPtr[0]->size, VB->TexCoordPtr[0]->stride); -#endif - - if(type<0 || num_verts <= 0)return; - - if(!VB->ObjPtr){ - WARN_ONCE("FIXME: Don't know how to handle GL_ARB_vertex_buffer_object correctly\n"); - return; - } - /* A packet cannot have more than 16383 data words.. */ - if((num_verts*4*rmesa->state.aos_count)>16380){ - WARN_ONCE("Too many vertices to paint. Fix me !\n"); - return; - } - - //fprintf(stderr, "aos_count=%d start=%d end=%d\n", rmesa->state.aos_count, start, end); - - if(rmesa->state.aos_count==0){ - WARN_ONCE("Aeiee ! aos_count==0, while it shouldn't. Skipping rendering\n"); - return; - } - - render_inputs = rmesa->state.render_inputs; - - if(!render_inputs){ - WARN_ONCE("Aeiee ! render_inputs==0. Skipping rendering.\n"); - return; - } - - - start_immediate_packet(num_verts, type, 4*rmesa->state.aos_count); - - for(i=start;i<start+num_verts;i++){ -#if 0 - fprintf(stderr, "* (%f %f %f %f) (%f %f %f %f)\n", - VEC_ELT(VB->ObjPtr, GLfloat, i)[0], - VEC_ELT(VB->ObjPtr, GLfloat, i)[1], - VEC_ELT(VB->ObjPtr, GLfloat, i)[2], - VEC_ELT(VB->ObjPtr, GLfloat, i)[3], - - VEC_ELT(VB->ColorPtr[0], GLfloat, i)[0], - VEC_ELT(VB->ColorPtr[0], GLfloat, i)[1], - VEC_ELT(VB->ColorPtr[0], GLfloat, i)[2], - VEC_ELT(VB->ColorPtr[0], GLfloat, i)[3] - ); -#endif - - - /* coordinates */ - if(render_inputs & _TNL_BIT_POS) - output_vector(VB->ObjPtr, i); - if(render_inputs & _TNL_BIT_NORMAL) - output_vector(VB->NormalPtr, i); - - /* color components */ - if(render_inputs & _TNL_BIT_COLOR0) - output_vector(VB->ColorPtr[0], i); - if(render_inputs & _TNL_BIT_COLOR1) - output_vector(VB->SecondaryColorPtr[0], i); - -/* if(render_inputs & _TNL_BIT_FOG) // Causes lock ups when immediate mode is on - output_vector(VB->FogCoordPtr, i);*/ - - /* texture coordinates */ - for(k=0;k < ctx->Const.MaxTextureUnits;k++) - if(render_inputs & (_TNL_BIT_TEX0<<k)) - output_vector(VB->TexCoordPtr[k], i); - - if(render_inputs & _TNL_BIT_INDEX) - output_vector(VB->IndexPtr[0], i); - if(render_inputs & _TNL_BIT_POINTSIZE) - output_vector(VB->PointSizePtr, i); - } - -} - - -static GLboolean r300_run_immediate_render(GLcontext *ctx, - struct tnl_pipeline_stage *stage) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - LOCAL_VARS - - - /* Update texture state - needs to be done only when actually changed.. - All the time for now.. */ - - - if (RADEON_DEBUG == DEBUG_PRIMS) - fprintf(stderr, "%s\n", __FUNCTION__); - -#if 1 /* we need this, somehow */ - /* Flush state - make sure command buffer is nice and large */ - r300Flush(ctx); - /* Make sure we have enough space */ -#else - /* Count is very imprecize, but should be good upper bound */ - r300EnsureCmdBufSpace(rmesa, rmesa->hw.max_state_size + 4+2+30 - +VB->PrimitiveCount*(1+8)+VB->Count*4*rmesa->state.texture.tc_count+4, __FUNCTION__); -#endif - - /* needed before starting 3d operation .. */ - reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); - e32(0x0000000a); - - reg_start(0x4f18,0); - e32(0x00000003); - - -#if 0 /* looks like the Z offset issue got fixed */ - rmesa->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA - | R300_VPORT_X_OFFSET_ENA - | R300_VPORT_Y_SCALE_ENA - | R300_VPORT_Y_OFFSET_ENA - | R300_VTX_W0_FMT; - R300_STATECHANGE(rmesa, vte); -#endif - - - - /* Magic register - note it is right after 20b0 */ - - - if(rmesa->state.texture.tc_count>0){ - reg_start(0x20b4,0); - e32(0x0000000c); - - } - - r300EmitState(rmesa); - -/* Setup INPUT_ROUTE and INPUT_CNTL */ - r300EmitArrays(ctx, GL_TRUE); - -/* Why do we need this for immediate mode?? Vertex processor needs it to know proper regs */ -// r300EmitLOAD_VBPNTR(rmesa, 0); -/* Okay, it seems I misunderstood something, EmitAOS does the same thing */ - r300EmitAOS(rmesa, rmesa->state.aos_count, 0); - - for(i=0; i < VB->PrimitiveCount; i++){ - GLuint prim = VB->Primitive[i].mode; - GLuint start = VB->Primitive[i].start; - GLuint length = VB->Primitive[i].count; - - r300_render_immediate_primitive(rmesa, ctx, start, start + length, prim); - } - - /* This sequence is required after any 3d drawing packet - I suspect it work arounds a bug (or deficiency) in hardware */ - - reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); - e32(0x0000000a); - - reg_start(0x4f18,0); - e32(0x00000003); - - return GL_FALSE; -} - +/* Immediate implementation has been removed from CVS. */ /* vertex buffer implementation */ @@ -549,7 +335,6 @@ static GLboolean r300_run_vb_render(GLcontext *ctx, r300EmitArrays(ctx, GL_FALSE); r300UpdateShaderStates(rmesa); -// LOCK_HARDWARE(&(rmesa->radeon)); reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); @@ -577,13 +362,7 @@ static GLboolean r300_run_vb_render(GLcontext *ctx, #ifdef USER_BUFFERS r300UseArrays(ctx); #endif -// end_3d(PASS_PREFIX_VOID); - /* Flush state - we are done drawing.. */ -// r300FlushCmdBufLocked(rmesa, __FUNCTION__); -// radeonWaitForIdleLocked(&(rmesa->radeon)); - -// UNLOCK_HARDWARE(&(rmesa->radeon)); return GL_FALSE; } @@ -596,11 +375,6 @@ static void r300_render_vb_primitive_vtxfmt_a(r300ContextPtr rmesa, int prim) { int type, num_verts; - radeonScreenPtr rsp=rmesa->radeon.radeonScreen; - LOCAL_VARS - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - int i; type=r300_get_primitive_type(rmesa, ctx, prim); num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim); @@ -610,6 +384,8 @@ static void r300_render_vb_primitive_vtxfmt_a(r300ContextPtr rmesa, if(rmesa->state.VB.Elts){ r300EmitAOS(rmesa, rmesa->state.aos_count, /*0*/start); #if 0 + LOCAL_VARS + int i; start_index32_packet(num_verts, type); for(i=0; i < num_verts; i++) e32(((unsigned long *)rmesa->state.VB.Elts)[i]/*rmesa->state.Elts[start+i]*/); /* start ? */ @@ -634,6 +410,7 @@ static void r300_render_vb_primitive_vtxfmt_a(r300ContextPtr rmesa, } } +#if 0 void dump_array(struct r300_dma_region *rvb, int count) { int *out = (int *)(rvb->address + rvb->start); @@ -672,11 +449,12 @@ void dump_dt(struct dt *dt, int count) fprintf(stderr, "%d ", ((unsigned char *)out)[ci]); fprintf(stderr, "}"); - out = (char *)out + dt->stride; + out = (int *)((char *)out + dt->stride); } fprintf(stderr, "\n"); } +#endif /*static */GLboolean r300_run_vb_render_vtxfmt_a(GLcontext *ctx, struct tnl_pipeline_stage *stage) @@ -684,14 +462,14 @@ void dump_dt(struct dt *dt, int count) r300ContextPtr rmesa = R300_CONTEXT(ctx); //TNLcontext *tnl = TNL_CONTEXT(ctx); struct radeon_vertex_buffer *VB = &rmesa->state.VB; //&tnl->vb; - int i, j; + int i; LOCAL_VARS if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); r300UpdateShaders(rmesa); - if (rmesa->state.VB.LockCount == 0) { + if (rmesa->state.VB.LockCount == 0 || 1) { r300ReleaseArrays(ctx); r300EmitArraysVtx(ctx, GL_FALSE); @@ -728,8 +506,6 @@ void dump_dt(struct dt *dt, int count) #endif } -// LOCK_HARDWARE(&(rmesa->radeon)); - reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); @@ -758,13 +534,6 @@ void dump_dt(struct dt *dt, int count) #ifdef USER_BUFFERS r300UseArrays(ctx); #endif -// end_3d(PASS_PREFIX_VOID); - - /* Flush state - we are done drawing.. */ -// r300FlushCmdBufLocked(rmesa, __FUNCTION__); -// radeonWaitForIdleLocked(&(rmesa->radeon)); - -// UNLOCK_HARDWARE(&(rmesa->radeon)); return GL_FALSE; } #endif @@ -781,7 +550,7 @@ do { \ GLboolean r300Fallback(GLcontext *ctx) { - FALLBACK_IF(ctx->RenderMode != GL_RENDER); // We do not do SELECT or FEEDBACK (yet ?) + //FALLBACK_IF(ctx->RenderMode != GL_RENDER); // We do not do SELECT or FEEDBACK (yet ?) #if 0 /* These should work now.. */ FALLBACK_IF(ctx->Color.DitherFlag); @@ -826,11 +595,8 @@ static GLboolean r300_run_render(GLcontext *ctx, if (r300Fallback(ctx)) return GL_TRUE; -#if 0 - return r300_run_immediate_render(ctx, stage); -#else - return r300_run_vb_render(ctx, stage); -#endif + + return r300_run_vb_render(ctx, stage); } const struct tnl_pipeline_stage _r300_render_stage = { @@ -861,7 +627,7 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, return GL_TRUE; } - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) /* XXX: Needs to be part of r300Fallback */ if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_RECT_BIT) { hw_tcl_on = GL_FALSE; return GL_TRUE; @@ -875,6 +641,22 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, vp->native &= 1; //vp->native = GL_FALSE; #endif + +#if 0 /* You dont want to know what this does... */ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_cache *cache; + struct tnl_cache_item *c; + + cache = tnl->vp_cache; + c = cache->items[0xc000cc0e % cache->size]; + + if(c && c->data == vp) + vp->native = GL_FALSE; + +#endif +#if 0 + vp->native = GL_FALSE; +#endif if (vp->native == GL_FALSE) { hw_tcl_on = GL_FALSE; return GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 582cb2cf982..f32e86065dd 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -4,10 +4,7 @@ #include "program.h" #include "r300_context.h" -#include "program_instruction.h" -#if USE_ARB_F_P == 1 #include "r300_fragprog.h" -#endif static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog) { @@ -18,7 +15,7 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog) switch(target){ case GL_VERTEX_PROGRAM_ARB: - rmesa->curr_vp = vp; + rmesa->curr_vp = (struct vertex_program *)vp; vp->ref_count++; #if 0 if((vp->ref_count % 1500) == 0) { @@ -39,7 +36,6 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id) { struct r300_vertex_program *vp; struct r300_fragment_program *fp; - struct ati_fragment_shader *afs; switch(target){ case GL_VERTEX_STATE_PROGRAM_NV: @@ -53,12 +49,6 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id) case GL_FRAGMENT_PROGRAM_NV: fp=CALLOC_STRUCT(r300_fragment_program); return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id); -#if 00 - /* _mesa_new_ati_fragment_shader() is now called instead */ - case GL_FRAGMENT_SHADER_ATI: - afs=CALLOC_STRUCT(ati_fragment_shader); - return _mesa_init_ati_fragment_shader(ctx, afs, target, id); -#endif default: _mesa_problem(ctx, "Bad target in r300NewProgram"); } @@ -69,12 +59,14 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id) static void r300DeleteProgram(GLcontext *ctx, struct program *prog) { +#if 0 r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program *vp=(void *)prog; - /*if(rmesa->curr_vp == vp) - rmesa->curr_vp = NULL;*/ - + if(rmesa->curr_vp == vp) + rmesa->curr_vp = NULL; +#endif + _mesa_delete_program(ctx, prog); } @@ -88,7 +80,7 @@ static void r300ProgramStringNotify(GLcontext *ctx, GLenum target, case GL_VERTEX_PROGRAM_ARB: vp->translated = GL_FALSE; memset(&vp->translated, 0, sizeof(struct r300_vertex_program) - sizeof(struct vertex_program)); - /*translate_vertex_shader(vp);*/ + /*r300_translate_vertex_shader(vp);*/ break; case GL_FRAGMENT_PROGRAM_ARB: fp->translated = GL_FALSE; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 575e53c4cb8..728ff40ad39 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1046,7 +1046,7 @@ void r300_setup_textures(GLcontext *ctx) struct r300_tex_obj *t; r300ContextPtr r300 = R300_CONTEXT(ctx); int hw_tmu=0; - int first_hw_tmu=0, last_hw_tmu=-1; /* -1 translates into no setup costs for fields */ + int last_hw_tmu=-1; /* -1 translates into no setup costs for fields */ int tmu_mappings[R300_MAX_TEXTURE_UNITS] = { -1 }; struct r300_fragment_program *rp = (struct r300_fragment_program *) @@ -1561,10 +1561,9 @@ void r300UpdateShaders(r300ContextPtr rmesa) vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); if (vp->translated == GL_FALSE) - translate_vertex_shader(vp); + r300_translate_vertex_shader(vp); if (vp->translated == GL_FALSE) { fprintf(stderr, "Failing back to sw-tcl\n"); -// debug_vp(ctx, &vp->mesa_program); hw_tcl_on = future_hw_tcl_on = 0; r300ResetHwState(rmesa); diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index 9262a14bc4f..f6a50655d1b 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -63,7 +63,9 @@ extern void r300ResetHwState(r300ContextPtr r300); extern void r300InitState(r300ContextPtr r300); extern void r300InitStateFuncs(struct dd_function_table* functions); +extern void r300UpdateViewportOffset( GLcontext *ctx ); extern void r300UpdateWindow(GLcontext * ctx); +extern void r300UpdateDrawBuffer(GLcontext *ctx); extern void r300SetupVertexShader(r300ContextPtr rmesa); extern void r300SetupPixelShader(r300ContextPtr rmesa); diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index d20c9a82caf..7aa30275b49 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -919,9 +919,6 @@ r300TexSubImage3D(GLcontext * ctx, GLenum target, GLint level, static void r300TexEnv(GLcontext * ctx, GLenum target, GLenum pname, const GLfloat * param) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint unit = ctx->Texture.CurrentUnit; - if (RADEON_DEBUG & DEBUG_STATE) { fprintf(stderr, "%s( %s )\n", __FUNCTION__, _mesa_lookup_enum_by_nr(pname)); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 74220d370ea..ee2515c32ef 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -44,9 +44,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "r300_ioctl.h" #include "radeon_ioctl.h" -//#include "r300_swtcl.h" #include "r300_tex.h" -//#include "r300_tcl.h" #include "r300_reg.h" #define R200_TXFORMAT_A8 R200_TXFORMAT_I8 @@ -178,9 +176,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, t->format &= ~(R200_TXFORMAT_FORMAT_MASK | R200_TXFORMAT_ALPHA_IN_MAP); -#if 0 - t->filter &= ~R200_YUV_TO_RGB; -#endif + if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) { t->format = tx_table[baseImage->TexFormat->MesaFormat].format; @@ -348,10 +344,6 @@ static void r300SetTexImages(r300ContextPtr rmesa, /* Hardware state: */ #if 0 - t->filter &= ~R200_MAX_MIP_LEVEL_MASK; - t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT; -#endif -#if 0 t->format &= ~(R200_TXFORMAT_WIDTH_MASK | R200_TXFORMAT_HEIGHT_MASK | R200_TXFORMAT_CUBIC_MAP_ENABLE | @@ -410,556 +402,11 @@ static void r300SetTexImages(r300ContextPtr rmesa, /* FYI: r300UploadTexImages( rmesa, t ) used to be called here */ } -/* ================================================================ - * Texture combine functions - */ - -/* GL_ARB_texture_env_combine support - */ - -/* The color tables have combine functions for GL_SRC_COLOR, - * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. - */ -static GLuint r300_register_color[][R200_MAX_TEXTURE_UNITS] = { - { - R200_TXC_ARG_A_R0_COLOR, - R200_TXC_ARG_A_R1_COLOR, - R200_TXC_ARG_A_R2_COLOR, - R200_TXC_ARG_A_R3_COLOR, - R200_TXC_ARG_A_R4_COLOR, - R200_TXC_ARG_A_R5_COLOR}, - { - R200_TXC_ARG_A_R0_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R1_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R2_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R3_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R4_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R5_COLOR | R200_TXC_COMP_ARG_A}, - { - R200_TXC_ARG_A_R0_ALPHA, - R200_TXC_ARG_A_R1_ALPHA, - R200_TXC_ARG_A_R2_ALPHA, - R200_TXC_ARG_A_R3_ALPHA, - R200_TXC_ARG_A_R4_ALPHA, - R200_TXC_ARG_A_R5_ALPHA}, - { - R200_TXC_ARG_A_R0_ALPHA | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R1_ALPHA | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R2_ALPHA | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R3_ALPHA | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R4_ALPHA | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_R5_ALPHA | R200_TXC_COMP_ARG_A}, -}; - -static GLuint r300_tfactor_color[] = { - R200_TXC_ARG_A_TFACTOR_COLOR, - R200_TXC_ARG_A_TFACTOR_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_TFACTOR_ALPHA, - R200_TXC_ARG_A_TFACTOR_ALPHA | R200_TXC_COMP_ARG_A -}; - -static GLuint r300_primary_color[] = { - R200_TXC_ARG_A_DIFFUSE_COLOR, - R200_TXC_ARG_A_DIFFUSE_COLOR | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_DIFFUSE_ALPHA, - R200_TXC_ARG_A_DIFFUSE_ALPHA | R200_TXC_COMP_ARG_A -}; - -/* GL_ZERO table - indices 0-3 - * GL_ONE table - indices 1-4 - */ -static GLuint r300_zero_color[] = { - R200_TXC_ARG_A_ZERO, - R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_ZERO, - R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A, - R200_TXC_ARG_A_ZERO -}; - -/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. - */ -static GLuint r300_register_alpha[][R200_MAX_TEXTURE_UNITS] = { - { - R200_TXA_ARG_A_R0_ALPHA, - R200_TXA_ARG_A_R1_ALPHA, - R200_TXA_ARG_A_R2_ALPHA, - R200_TXA_ARG_A_R3_ALPHA, - R200_TXA_ARG_A_R4_ALPHA, - R200_TXA_ARG_A_R5_ALPHA}, - { - R200_TXA_ARG_A_R0_ALPHA | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_R1_ALPHA | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_R2_ALPHA | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_R3_ALPHA | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_R4_ALPHA | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_R5_ALPHA | R200_TXA_COMP_ARG_A}, -}; - -static GLuint r300_tfactor_alpha[] = { - R200_TXA_ARG_A_TFACTOR_ALPHA, - R200_TXA_ARG_A_TFACTOR_ALPHA | R200_TXA_COMP_ARG_A -}; - -static GLuint r300_primary_alpha[] = { - R200_TXA_ARG_A_DIFFUSE_ALPHA, - R200_TXA_ARG_A_DIFFUSE_ALPHA | R200_TXA_COMP_ARG_A -}; - -/* GL_ZERO table - indices 0-1 - * GL_ONE table - indices 1-2 - */ -static GLuint r300_zero_alpha[] = { - R200_TXA_ARG_A_ZERO, - R200_TXA_ARG_A_ZERO | R200_TXA_COMP_ARG_A, - R200_TXA_ARG_A_ZERO, -}; - -/* Extract the arg from slot A, shift it into the correct argument slot - * and set the corresponding complement bit. - */ -#define R200_COLOR_ARG( n, arg ) \ -do { \ - color_combine |= \ - ((color_arg[n] & R200_TXC_ARG_A_MASK) \ - << R200_TXC_ARG_##arg##_SHIFT); \ - color_combine |= \ - ((color_arg[n] >> R200_TXC_COMP_ARG_A_SHIFT) \ - << R200_TXC_COMP_ARG_##arg##_SHIFT); \ -} while (0) - -#define R200_ALPHA_ARG( n, arg ) \ -do { \ - alpha_combine |= \ - ((alpha_arg[n] & R200_TXA_ARG_A_MASK) \ - << R200_TXA_ARG_##arg##_SHIFT); \ - alpha_combine |= \ - ((alpha_arg[n] >> R200_TXA_COMP_ARG_A_SHIFT) \ - << R200_TXA_COMP_ARG_##arg##_SHIFT); \ -} while (0) /* ================================================================ * Texture unit state management */ -static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint color_combine, alpha_combine; - -#if 0 /* disable for now.. */ - GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] & - ~(R200_TXC_SCALE_MASK); - GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] & - ~(R200_TXA_DOT_ALPHA | R200_TXA_SCALE_MASK); -#endif - - GLuint color_scale=0, alpha_scale=0; - - /* texUnit->_Current can be NULL if and only if the texture unit is - * not actually enabled. - */ - assert((texUnit->_ReallyEnabled == 0) - || (texUnit->_Current != NULL)); - - if (RADEON_DEBUG & DEBUG_TEXTURE) { - fprintf(stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, - unit); - } - - /* Set the texture environment state. Isn't this nice and clean? - * The chip will automagically set the texture alpha to 0xff when - * the texture format does not include an alpha component. This - * reduces the amount of special-casing we have to do, alpha-only - * textures being a notable exception. - */ - /* Don't cache these results. - */ -#if 0 - rmesa->state.texture.unit[unit].format = 0; -#endif - rmesa->state.texture.unit[unit].envMode = 0; - - - if (!texUnit->_ReallyEnabled) { - if (unit == 0) { - color_combine = - R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO | - R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD; - alpha_combine = - R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO | - R200_TXA_ARG_C_DIFFUSE_ALPHA | R200_TXA_OP_MADD; - } else { - color_combine = - R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO | - R200_TXC_ARG_C_R0_COLOR | R200_TXC_OP_MADD; - alpha_combine = - R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO | - R200_TXA_ARG_C_R0_ALPHA | R200_TXA_OP_MADD; - } - } else { - GLuint color_arg[3], alpha_arg[3]; - GLuint i; - const GLuint numColorArgs = - texUnit->_CurrentCombine->_NumArgsRGB; - const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA; - GLuint RGBshift = texUnit->_CurrentCombine->ScaleShiftRGB; - GLuint Ashift = texUnit->_CurrentCombine->ScaleShiftA; - - /* Step 1: - * Extract the color and alpha combine function arguments. - */ - for (i = 0; i < numColorArgs; i++) { - const GLint op = - texUnit->_CurrentCombine->OperandRGB[i] - - GL_SRC_COLOR; - assert(op >= 0); - assert(op <= 3); - switch (texUnit->_CurrentCombine->SourceRGB[i]) { - case GL_TEXTURE: - color_arg[i] = r300_register_color[op][unit]; - break; - case GL_CONSTANT: - color_arg[i] = r300_tfactor_color[op]; - break; - case GL_PRIMARY_COLOR: - color_arg[i] = r300_primary_color[op]; - break; - case GL_PREVIOUS: - if (unit == 0) - color_arg[i] = r300_primary_color[op]; - else - color_arg[i] = - r300_register_color[op][0]; - break; - case GL_ZERO: - color_arg[i] = r300_zero_color[op]; - break; - case GL_ONE: - color_arg[i] = r300_zero_color[op + 1]; - break; - default: - return GL_FALSE; - } - } - - for (i = 0; i < numAlphaArgs; i++) { - const GLint op = - texUnit->_CurrentCombine->OperandA[i] - - GL_SRC_ALPHA; - assert(op >= 0); - assert(op <= 1); - switch (texUnit->_CurrentCombine->SourceA[i]) { - case GL_TEXTURE: - alpha_arg[i] = r300_register_alpha[op][unit]; - break; - case GL_CONSTANT: - alpha_arg[i] = r300_tfactor_alpha[op]; - break; - case GL_PRIMARY_COLOR: - alpha_arg[i] = r300_primary_alpha[op]; - break; - case GL_PREVIOUS: - if (unit == 0) - alpha_arg[i] = r300_primary_alpha[op]; - else - alpha_arg[i] = - r300_register_alpha[op][0]; - break; - case GL_ZERO: - alpha_arg[i] = r300_zero_alpha[op]; - break; - case GL_ONE: - alpha_arg[i] = r300_zero_alpha[op + 1]; - break; - default: - return GL_FALSE; - } - } - - /* Step 2: - * Build up the color and alpha combine functions. - */ - switch (texUnit->_CurrentCombine->ModeRGB) { - case GL_REPLACE: - color_combine = (R200_TXC_ARG_A_ZERO | - R200_TXC_ARG_B_ZERO | - R200_TXC_OP_MADD); - R200_COLOR_ARG(0, C); - break; - case GL_MODULATE: - color_combine = (R200_TXC_ARG_C_ZERO | - R200_TXC_OP_MADD); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, B); - break; - case GL_ADD: - color_combine = (R200_TXC_ARG_B_ZERO | - R200_TXC_COMP_ARG_B | - R200_TXC_OP_MADD); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - break; - case GL_ADD_SIGNED: - color_combine = (R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B | R200_TXC_BIAS_ARG_C | /* new */ - R200_TXC_OP_MADD); /* was ADDSIGNED */ - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - break; - case GL_SUBTRACT: - color_combine = (R200_TXC_ARG_B_ZERO | - R200_TXC_COMP_ARG_B | - R200_TXC_NEG_ARG_C | R200_TXC_OP_MADD); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - break; - case GL_INTERPOLATE: - color_combine = (R200_TXC_OP_LERP); - R200_COLOR_ARG(0, B); - R200_COLOR_ARG(1, A); - R200_COLOR_ARG(2, C); - break; - - case GL_DOT3_RGB_EXT: - case GL_DOT3_RGBA_EXT: - /* The EXT version of the DOT3 extension does not support the - * scale factor, but the ARB version (and the version in OpenGL - * 1.3) does. - */ - RGBshift = 0; - /* FALLTHROUGH */ - - case GL_DOT3_RGB: - case GL_DOT3_RGBA: - /* DOT3 works differently on R200 than on R100. On R100, just - * setting the DOT3 mode did everything for you. On R200, the - * driver has to enable the biasing and scale in the inputs to - * put them in the proper [-1,1] range. This is what the 4x and - * the -0.5 in the DOT3 spec do. The post-scale is then set - * normally. - */ - - color_combine = (R200_TXC_ARG_C_ZERO | - R200_TXC_OP_DOT3 | - R200_TXC_BIAS_ARG_A | - R200_TXC_BIAS_ARG_B | - R200_TXC_SCALE_ARG_A | - R200_TXC_SCALE_ARG_B); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, B); - break; - - case GL_MODULATE_ADD_ATI: - color_combine = (R200_TXC_OP_MADD); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - R200_COLOR_ARG(2, B); - break; - case GL_MODULATE_SIGNED_ADD_ATI: - color_combine = (R200_TXC_BIAS_ARG_C | /* new */ - R200_TXC_OP_MADD); /* was ADDSIGNED */ - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - R200_COLOR_ARG(2, B); - break; - case GL_MODULATE_SUBTRACT_ATI: - color_combine = (R200_TXC_NEG_ARG_C | R200_TXC_OP_MADD); - R200_COLOR_ARG(0, A); - R200_COLOR_ARG(1, C); - R200_COLOR_ARG(2, B); - break; - default: - return GL_FALSE; - } - - switch (texUnit->_CurrentCombine->ModeA) { - case GL_REPLACE: - alpha_combine = (R200_TXA_ARG_A_ZERO | - R200_TXA_ARG_B_ZERO | - R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, C); - break; - case GL_MODULATE: - alpha_combine = (R200_TXA_ARG_C_ZERO | - R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, B); - break; - case GL_ADD: - alpha_combine = (R200_TXA_ARG_B_ZERO | - R200_TXA_COMP_ARG_B | - R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - break; - case GL_ADD_SIGNED: - alpha_combine = (R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B | R200_TXA_BIAS_ARG_C | /* new */ - R200_TXA_OP_MADD); /* was ADDSIGNED */ - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - break; - case GL_SUBTRACT: - alpha_combine = (R200_TXA_ARG_B_ZERO | - R200_TXA_COMP_ARG_B | - R200_TXA_NEG_ARG_C | R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - break; - case GL_INTERPOLATE: - alpha_combine = (R200_TXA_OP_LERP); - R200_ALPHA_ARG(0, B); - R200_ALPHA_ARG(1, A); - R200_ALPHA_ARG(2, C); - break; - - case GL_MODULATE_ADD_ATI: - alpha_combine = (R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - R200_ALPHA_ARG(2, B); - break; - case GL_MODULATE_SIGNED_ADD_ATI: - alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */ - R200_TXA_OP_MADD); /* was ADDSIGNED */ - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - R200_ALPHA_ARG(2, B); - break; - case GL_MODULATE_SUBTRACT_ATI: - alpha_combine = (R200_TXA_NEG_ARG_C | R200_TXA_OP_MADD); - R200_ALPHA_ARG(0, A); - R200_ALPHA_ARG(1, C); - R200_ALPHA_ARG(2, B); - break; - default: - return GL_FALSE; - } - - if ((texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT) - || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA)) { - alpha_scale |= R200_TXA_DOT_ALPHA; - Ashift = RGBshift; - } - - /* Step 3: - * Apply the scale factor. - */ - color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT); - alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT); - - /* All done! - */ - } - -#if 0 - fprintf(stderr, "color_combine=%08x alpha_combine=%08x color_scale=%08x alpha_scale=%08x\n", - color_combine, alpha_combine, color_scale, alpha_scale); -#endif - -#if 0 - if (rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine || - rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] != alpha_combine || - rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] != color_scale || - rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] != alpha_scale) { - R300_STATECHANGE(rmesa, pix[unit]); - rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] = color_combine; - rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] = alpha_combine; - rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] = color_scale; - rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale; - } - -#endif - - return GL_TRUE; -} - -#define TEXOBJ_TXFILTER_MASK (R200_MAX_MIP_LEVEL_MASK | \ - R200_MIN_FILTER_MASK | \ - R200_MAG_FILTER_MASK | \ - R200_MAX_ANISO_MASK | \ - R200_YUV_TO_RGB | \ - R200_YUV_TEMPERATURE_MASK | \ - R200_CLAMP_S_MASK | \ - R200_CLAMP_T_MASK | \ - R200_BORDER_MODE_D3D ) - -#define TEXOBJ_TXFORMAT_MASK (R200_TXFORMAT_WIDTH_MASK | \ - R200_TXFORMAT_HEIGHT_MASK | \ - R200_TXFORMAT_FORMAT_MASK | \ - R200_TXFORMAT_F5_WIDTH_MASK | \ - R200_TXFORMAT_F5_HEIGHT_MASK | \ - R200_TXFORMAT_ALPHA_IN_MAP | \ - R200_TXFORMAT_CUBIC_MAP_ENABLE | \ - R200_TXFORMAT_NON_POWER2) - -#define TEXOBJ_TXFORMAT_X_MASK (R200_DEPTH_LOG2_MASK | \ - R200_TEXCOORD_MASK | \ - R200_CLAMP_Q_MASK | \ - R200_VOLUME_FILTER_MASK) - -static void disable_tex(GLcontext * ctx, int unit) -{ -#if 0 /* This needs to be redone.. or done elsewhere */ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - - if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit)) { - /* Texture unit disabled */ - if (rmesa->state.texture.unit[unit].texobj != NULL) { - /* The old texture is no longer bound to this texture unit. - * Mark it as such. - */ - - rmesa->state.texture.unit[unit].texobj->base.bound &= - ~(1UL << unit); - rmesa->state.texture.unit[unit].texobj = NULL; - } - - R300_STATECHANGE(rmesa, ctx); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~((R200_TEX_0_ENABLE | - R200_TEX_BLEND_0_ENABLE) << - unit); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_BLEND_0_ENABLE; - - R300_STATECHANGE(rmesa, tcl); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= - ~(7 << (unit * 3)); - - if (rmesa->radeon.TclFallback & (RADEON_TCL_FALLBACK_TEXGEN_0 << unit)) { - TCL_FALLBACK(ctx, (RADEON_TCL_FALLBACK_TEXGEN_0 << unit), - GL_FALSE); - } - - /* Actually want to keep all units less than max active texture - * enabled, right? Fix this for >2 texunits. - */ - /* FIXME: What should happen here if r300UpdateTextureEnv fails? */ - if (unit == 0) - r300UpdateTextureEnv(ctx, unit); - - { - GLuint inputshift = - R200_TEXGEN_0_INPUT_SHIFT + unit * 4; - GLuint tmp = rmesa->TexGenEnabled; - - rmesa->TexGenEnabled &= - ~(R200_TEXGEN_TEXMAT_0_ENABLE << unit); - rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE << unit); - rmesa->TexGenEnabled &= - ~(R200_TEXGEN_INPUT_MASK << inputshift); - rmesa->TexGenNeedNormals[unit] = 0; - rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit); - rmesa->TexGenInputs &= - ~(R200_TEXGEN_INPUT_MASK << inputshift); - - if (tmp != rmesa->TexGenEnabled) { - rmesa->recheck_texgen[unit] = GL_TRUE; - rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } - } - } -#endif -} - static GLboolean enable_tex_2d(GLcontext * ctx, int unit) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -967,15 +414,6 @@ static GLboolean enable_tex_2d(GLcontext * ctx, int unit) struct gl_texture_object *tObj = texUnit->_Current; r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData; - /* Need to load the 2d images associated with this unit. - */ -#if 0 - if (t->format & R200_TXFORMAT_NON_POWER2) { - t->format &= ~R200_TXFORMAT_NON_POWER2; - t->base.dirty_images[0] = ~0; - } -#endif - ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D); if (t->base.dirty_images[0]) { @@ -1075,13 +513,6 @@ static GLboolean enable_tex_rect(GLcontext * ctx, int unit) struct gl_texture_object *tObj = texUnit->_Current; r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData; -#if 0 - if (!(t->format & R200_TXFORMAT_NON_POWER2)) { - t->format |= R200_TXFORMAT_NON_POWER2; - t->base.dirty_images[0] = ~0; - } -#endif - ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV); if (t->base.dirty_images[0]) { @@ -1101,7 +532,6 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *tObj = texUnit->_Current; r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData; - GLenum format; /* Fallback if there's a texture border */ if (tObj->Image[0][tObj->BaseLevel]->Border > 0) @@ -1126,46 +556,6 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */ } -#if 0 /* do elsewhere ? */ - /* Newly enabled? - */ - if (1 - || !(rmesa->hw.ctx. - cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit))) { - R300_STATECHANGE(rmesa, ctx); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_0_ENABLE | - R200_TEX_BLEND_0_ENABLE) << - unit; - - R300_STATECHANGE(rmesa, vtx); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] |= 4 << (unit * 3); - - rmesa->recheck_texgen[unit] = GL_TRUE; - } - - if (t->dirty_state & (1 << unit)) { - import_tex_obj_state(rmesa, unit, t); - } - - if (rmesa->recheck_texgen[unit]) { - GLboolean fallback = !r300_validate_texgen(ctx, unit); - TCL_FALLBACK(ctx, (RADEON_TCL_FALLBACK_TEXGEN_0 << unit), - fallback); - rmesa->recheck_texgen[unit] = 0; - rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } -#endif -#if 0 - format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - if (rmesa->state.texture.unit[unit].format != format || - rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode) { - //rmesa->state.texture.unit[unit].format = format; - rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode; - if (!r300UpdateTextureEnv(ctx, unit)) { - return GL_FALSE; - } - } -#endif #if R200_MERGED FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback); #endif @@ -1196,18 +586,12 @@ static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit) } else if (texUnit->_ReallyEnabled) { return GL_FALSE; } else { - disable_tex(ctx, unit); return GL_TRUE; - } + } } void r300UpdateTextureState(GLcontext * ctx) { -#if 0 - r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint dbg; - int i; -#endif GLboolean ok; ok = (r300UpdateTextureUnit(ctx, 0) && @@ -1223,109 +607,4 @@ void r300UpdateTextureState(GLcontext * ctx) #if R200_MERGED FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok); #endif - - /* This needs correction, or just be done elsewhere - if (rmesa->radeon.TclFallback) - r300ChooseVertexState(ctx); - */ - -#if 0 /* Workaround - disable.. */ - if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) { - /* - * T0 hang workaround ------------- - * not needed for r200 derivatives? - */ - if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) == - R200_TEX_0_ENABLE - && (rmesa->hw.tex[0]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) > - R200_MIN_FILTER_LINEAR) { - - R300_STATECHANGE(rmesa, ctx); - R300_STATECHANGE(rmesa, tex[1]); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_1_ENABLE; - rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= - ~TEXOBJ_TXFORMAT_MASK; - rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= 0x08000000; - } else { - if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) - && (rmesa->hw.tex[1]. - cmd[TEX_PP_TXFORMAT] & 0x08000000)) { - R300_STATECHANGE(rmesa, tex[1]); - rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= - ~0x08000000; - } - } - - /* maybe needs to be done pairwise due to 2 parallel (physical) tex units ? - looks like that's not the case, if 8500/9100 owners don't complain remove this... - for ( i = 0; i < ctx->Const.MaxTextureUnits; i += 2) { - if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & ((R200_TEX_0_ENABLE | - R200_TEX_1_ENABLE ) << i)) == (R200_TEX_0_ENABLE << i)) && - ((rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) > - R200_MIN_FILTER_LINEAR)) { - R300_STATECHANGE(rmesa, ctx); - R300_STATECHANGE(rmesa, tex[i+1]); - rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_1_ENABLE << i); - rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK; - rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] |= 0x08000000; - } - else { - if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE << i)) && - (rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] & 0x08000000)) { - R300_STATECHANGE(rmesa, tex[i+1]); - rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~0x08000000; - } - } - } */ - - /* - * Texture cache LRU hang workaround ------------- - * not needed for r200 derivatives? - */ - dbg = 0x0; - - if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE)) && - ((((rmesa->hw.tex[0]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) - == 0)) - || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_2_ENABLE) - && - ((((rmesa->hw.tex[2]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & - 0x04) == 0)) - || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_4_ENABLE) - && - ((((rmesa->hw.tex[4]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & - 0x04) == 0))) { - dbg |= 0x02; - } - - if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE)) && - ((((rmesa->hw.tex[1]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04) - == 0)) - || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_3_ENABLE) - && - ((((rmesa->hw.tex[3]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & - 0x04) == 0)) - || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_5_ENABLE) - && - ((((rmesa->hw.tex[5]. - cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & - 0x04) == 0))) { - dbg |= 0x04; - } - - if (dbg != rmesa->hw.tam.cmd[TAM_DEBUG3]) { - R300_STATECHANGE(rmesa, tam); - rmesa->hw.tam.cmd[TAM_DEBUG3] = dbg; - if (0) - printf("TEXCACHE LRU HANG WORKAROUND %x\n", - dbg); - } - } -#endif } diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c index c5c979ea223..2f45625d6a8 100644 --- a/src/mesa/drivers/dri/r300/r300_vertexprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c @@ -32,8 +32,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glheader.h" #include "macros.h" #include "enums.h" - #include "program.h" +#include "nvvertexec.h" + #include "r300_context.h" #include "r300_program.h" #include "program_instruction.h" @@ -81,25 +82,7 @@ static struct{ OPN(END, 0, 0), }; #undef OPN -#define OPN(rf) {#rf, PROGRAM_##rf} - -static struct{ - char *name; - int id; -}register_file_names[]={ - OPN(TEMPORARY), - OPN(INPUT), - OPN(OUTPUT), - OPN(LOCAL_PARAM), - OPN(ENV_PARAM), - OPN(NAMED_PARAM), - OPN(STATE_VAR), - OPN(WRITE_ONLY), - OPN(ADDRESS), -}; -static char *dst_mask_names[4]={ "X", "Y", "Z", "W" }; - int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp, float *dst) { int pi; @@ -238,6 +221,7 @@ static unsigned long t_swizzle(GLubyte swizzle) } } +#if 0 static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) { int i; @@ -253,6 +237,7 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) fprintf(stderr, ">\n"); } +#endif static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src_register *src) { @@ -390,7 +375,7 @@ static unsigned long op_operands(enum prog_opcode opcode) u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \ } while (0) -void translate_vertex_shader(struct r300_vertex_program *vp) +void r300_translate_vertex_shader(struct r300_vertex_program *vp) { struct vertex_program *mesa_vp=(void *)vp; struct prog_instruction *vpi; diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index b2abbaf7a68..0a957816dbf 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -53,6 +53,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_reg.h" #include "r200_state.h" +#include "r300_state.h" + #include "utils.h" #include "vblank.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c index 2209d890033..893b4b4e7ef 100644 --- a/src/mesa/drivers/dri/r300/radeon_lock.c +++ b/src/mesa/drivers/dri/r300/radeon_lock.c @@ -42,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_ioctl.h" #include "radeon_state.h" #include "r300_context.h" +#include "r300_state.h" #include "framebuffer.h" diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c index 394c59b3a98..d46629a508d 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/radeon_mm.c @@ -29,9 +29,11 @@ * Authors: * Aapo Tahkola <[email protected]> */ +#include <unistd.h> #include "r300_context.h" #include "r300_cmdbuf.h" +#include "r300_ioctl.h" #include "radeon_mm.h" #ifdef USER_BUFFERS @@ -54,7 +56,6 @@ void *radeon_mm_ptr(r300ContextPtr rmesa, int id) int radeon_mm_find(r300ContextPtr rmesa, void *ptr) { int i; - int id = 0; for (i=1; i < rmesa->rmm->u_size+1; i++) if(rmesa->rmm->u_list[i].ptr && @@ -77,8 +78,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size) int i, free=-1; int done_age; drm_radeon_mem_free_t memfree; - int tries=0, tries2=0; - static int t=0; + int tries=0; static int bytes_wasted=0, allocated=0; if(size < 4096) @@ -87,6 +87,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size) allocated += size; #if 0 + static int t=0; if (t != time(NULL)) { t = time(NULL); fprintf(stderr, "slots used %d, wasted %d kb, allocated %d\n", rmesa->rmm->u_last, bytes_wasted/1024, allocated/1024); @@ -145,7 +146,6 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size) } } } - done: rmesa->rmm->u_head = i; if (free == -1) { @@ -203,7 +203,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size) } #include "r300_emit.h" -void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long src, unsigned long size) +static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long src, unsigned long size) { LOCAL_VARS int cp_size; @@ -259,7 +259,7 @@ void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long src, uns void radeon_mm_use(r300ContextPtr rmesa, int id) { - unsigned long long ull; + uint64_t ull; #ifdef MM_DEBUG fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]); #endif @@ -301,14 +301,14 @@ void radeon_mm_use(r300ContextPtr rmesa, int id) }*/ #endif - cmd = r300AllocCmdBuf(rmesa, 2 + sizeof(ull) / 4, __FUNCTION__); + cmd = (drm_r300_cmd_header_t *)r300AllocCmdBuf(rmesa, 2 + sizeof(ull) / 4, __FUNCTION__); cmd[0].scratch.cmd_type = R300_CMD_SCRATCH; cmd[0].scratch.reg = RADEON_MM_SCRATCH; cmd[0].scratch.n_bufs = 1; cmd[0].scratch.flags = 0; cmd ++; - ull = (unsigned long long)&rmesa->rmm->u_list[id].age; + ull = (uint64_t)(intptr_t)&rmesa->rmm->u_list[id].age; _mesa_memcpy(cmd, &ull, sizeof(ull)); cmd += sizeof(ull) / 4; diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c index bff64ac0662..053af1ac661 100644 --- a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c +++ b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c @@ -33,15 +33,25 @@ #include "context.h" #include "r300_context.h" #include "r300_cmdbuf.h" +#include "r300_ioctl.h" +#include "r300_maos.h" +#include "r300_state.h" #include "radeon_mm.h" +#include "hash.h" #include "dispatch.h" +#include "bufferobj.h" +#include "vtxfmt.h" +#include "api_validate.h" +#include "state.h" #ifdef RADEON_VTXFMT_A +extern void _tnl_array_init( GLcontext *ctx ); + #define CONV(a, b) rmesa->state.VB.AttribPtr[(a)].size = ctx->Array.b.Size, \ rmesa->state.VB.AttribPtr[(a)].data = ctx->Array.b.BufferObj->Name ? \ - ADD_POINTERS(ctx->Array.b.Ptr, ctx->Array.b.BufferObj->Data) : ctx->Array.b.Ptr, \ + (void *)ADD_POINTERS(ctx->Array.b.Ptr, ctx->Array.b.BufferObj->Data) : (void *)ctx->Array.b.Ptr, \ rmesa->state.VB.AttribPtr[(a)].stride = ctx->Array.b.StrideB, \ rmesa->state.VB.AttribPtr[(a)].type = ctx->Array.b.Type @@ -138,7 +148,7 @@ static int setup_arrays(r300ContextPtr rmesa, GLint start) void radeon_init_vtxfmt_a(r300ContextPtr rmesa); -void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *c_indices ) +static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *c_indices ) { GET_CURRENT_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -148,7 +158,7 @@ void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid * struct tnl_prim prim; static void *ptr = NULL; static struct r300_dma_region rvb; - GLvoid *indices = c_indices; + const GLvoid *indices = c_indices; if (count > 65535) { WARN_ONCE("Too many verts!\n"); @@ -318,7 +328,7 @@ void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid * _mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt ); } -void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *c_indices) +static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, GLenum type, const GLvoid *c_indices) { GET_CURRENT_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -327,7 +337,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, int i; void *ptr = NULL; static struct r300_dma_region rvb; - GLvoid *indices = c_indices; + const GLvoid *indices = c_indices; if (count > 65535) { WARN_ONCE("Too many verts!\n"); @@ -482,7 +492,7 @@ void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei count, _mesa_install_exec_vtxfmt( ctx, &TNL_CONTEXT(ctx)->exec_vtxfmt ); } -void radeonDrawArrays( GLenum mode, GLint start, GLsizei count ) +static void radeonDrawArrays( GLenum mode, GLint start, GLsizei count ) { GET_CURRENT_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -578,7 +588,7 @@ void radeon_init_vtxfmt_a(r300ContextPtr rmesa) GLvertexformat *vfmt; ctx = rmesa->radeon.glCtx; - vfmt = ctx->TnlModule.Current; + vfmt = (GLvertexformat *)ctx->TnlModule.Current; vfmt->DrawElements = radeonDrawElements; vfmt->DrawArrays = radeonDrawArrays; @@ -589,10 +599,10 @@ void radeon_init_vtxfmt_a(r300ContextPtr rmesa) #ifdef HW_VBOS -void radeonLockArraysEXT(GLcontext *ctx, GLint first, GLsizei count) +#if 0 +static void radeonLockArraysEXT(GLcontext *ctx, GLint first, GLsizei count) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - int i; /* Only when CB_DPATH is defined. r300Clear tampers over the aos setup without it. @@ -614,7 +624,7 @@ void radeonLockArraysEXT(GLcontext *ctx, GLint first, GLsizei count) rmesa->state.VB.lock_uptodate = GL_FALSE; } -void radeonUnlockArraysEXT(GLcontext *ctx) +static void radeonUnlockArraysEXT(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -622,8 +632,9 @@ void radeonUnlockArraysEXT(GLcontext *ctx) rmesa->state.VB.LockCount = 0; rmesa->state.VB.lock_uptodate = GL_FALSE; } +#endif -struct gl_buffer_object * +static struct gl_buffer_object * r300NewBufferObject(GLcontext *ctx, GLuint name, GLenum target ) { struct r300_buffer_object *obj; @@ -635,13 +646,11 @@ r300NewBufferObject(GLcontext *ctx, GLuint name, GLenum target ) return &obj->mesa_obj; } -void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, +static void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_buffer_object *r300_obj = (struct r300_buffer_object *)obj; - drm_radeon_mem_alloc_t alloc; - int offset, ret; /* Free previous buffer */ if (obj->OnCard) { @@ -681,7 +690,7 @@ void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size, obj->Usage = usage; } -void r300BufferSubData(GLcontext *ctx, GLenum target, GLintptrARB offset, +static void r300BufferSubData(GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -702,7 +711,7 @@ void r300BufferSubData(GLcontext *ctx, GLenum target, GLintptrARB offset, } } -void *r300MapBuffer(GLcontext *ctx, GLenum target, GLenum access, +static void *r300MapBuffer(GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -745,7 +754,7 @@ void *r300MapBuffer(GLcontext *ctx, GLenum target, GLenum access, return bufObj->Pointer; } -GLboolean r300UnmapBuffer(GLcontext *ctx, GLenum target, struct gl_buffer_object *bufObj) +static GLboolean r300UnmapBuffer(GLcontext *ctx, GLenum target, struct gl_buffer_object *bufObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_buffer_object *r300_obj = (struct r300_buffer_object *)bufObj; @@ -764,7 +773,7 @@ GLboolean r300UnmapBuffer(GLcontext *ctx, GLenum target, struct gl_buffer_object return GL_TRUE; } -void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj) +static void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_buffer_object *r300_obj = (struct r300_buffer_object *)obj; @@ -779,7 +788,7 @@ void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj) void r300_evict_vbos(GLcontext *ctx, int amount) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - const struct _mesa_HashTable *hash = ctx->Shared->BufferObjects; + struct _mesa_HashTable *hash = ctx->Shared->BufferObjects; GLuint k = _mesa_HashFirstEntry(hash); struct gl_buffer_object *obj; struct r300_buffer_object *r300_obj; |