diff options
author | Nicolai Haehnle <prefect_@gmx.net> | 2005-02-17 22:07:32 +0000 |
---|---|---|
committer | Nicolai Haehnle <prefect_@gmx.net> | 2005-02-17 22:07:32 +0000 |
commit | 6f37e76272a3a4b3898426b943304d1c5903d0ee (patch) | |
tree | c37b8083a87efc5bbdb225001e4cade9e8c67dbf /src/mesa/drivers | |
parent | 74477b24a8faef4ce0870b4a68270e586d107ff7 (diff) |
Fixing *lots* of warning messages, especially concerning unportable
whitespace before preprocessor commands.
Please, can you try to keep the warnings down? Try running make with
make -s sometime to see just how bad an offender the current code is.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_cmdbuf.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_emit.h | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fixed_pipelines.h | 88 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_maos.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_render.c | 30 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 296 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_tex.c | 42 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texmem.c | 28 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texstate.c | 74 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_span.c | 4 |
10 files changed, 324 insertions, 322 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 0434421a49..7f02434566 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -95,7 +95,7 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) if (cmd.nbox) { ret = drmCommandWrite(r300->radeon.dri.fd, DRM_RADEON_CMDBUF, &cmd, sizeof(cmd)); - + if (RADEON_DEBUG & DEBUG_SYNC) { fprintf(stderr, "Syncing in %s\n\n", __FUNCTION__); radeonWaitForIdleLocked(&r300->radeon); @@ -112,7 +112,7 @@ int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller) return ret; } - + int r300FlushCmdBuf(r300ContextPtr r300, const char* caller) { int ret; @@ -121,7 +121,7 @@ int r300FlushCmdBuf(r300ContextPtr r300, const char* caller) int start; LOCK_HARDWARE(&r300->radeon); - + ret=r300FlushCmdBufLocked(r300, caller); UNLOCK_HARDWARE(&r300->radeon); @@ -294,7 +294,7 @@ void r300InitCmdBuf(r300ContextPtr r300) int size, i, mtu; r300->hw.max_state_size = 0; - + mtu = r300->radeon.glCtx->Const.MaxTextureUnits; fprintf(stderr, "Using %d maximum texture units..\n", mtu); @@ -343,10 +343,10 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.unk4230.cmd[0] = cmducs(0x4230, 3); ALLOC_STATE( lcntl, always, 2, "lcntl", 0 ); r300->hw.lcntl.cmd[0] = cmducs(R300_RE_LINE_CNT, 1); -#ifdef EXP_C +#ifdef EXP_C ALLOC_STATE( lsf, always, 2, "lsf", 0 ); r300->hw.lsf.cmd[0] = cmducs(R300_RE_LINE_STIPPLE_FACTOR, 1); -#endif +#endif ALLOC_STATE( unk4260, always, 4, "unk4260", 0 ); r300->hw.unk4260.cmd[0] = cmducs(0x4260, 3); ALLOC_STATE( unk4274, always, 5, "unk4274", 0 ); @@ -440,25 +440,25 @@ void r300InitCmdBuf(r300ContextPtr r300) /* Textures */ ALLOC_STATE( tex.filter, variable, mtu+1, "tex_filter", 0 ); r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_FILTER_0, 0); - + ALLOC_STATE( tex.unknown1, variable, mtu+1, "tex_unknown1", 0 ); r300->hw.tex.unknown1.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_UNK1_0, 0); - + ALLOC_STATE( tex.size, variable, mtu+1, "tex_size", 0 ); r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_SIZE_0, 0); - + ALLOC_STATE( tex.format, variable, mtu+1, "tex_format", 0 ); r300->hw.tex.format.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_FORMAT_0, 0); - + ALLOC_STATE( tex.offset, variable, mtu+1, "tex_offset", 0 ); r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_OFFSET_0, 0); - + ALLOC_STATE( tex.unknown4, variable, mtu+1, "tex_unknown4", 0 ); r300->hw.tex.unknown4.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_UNK4_0, 0); - + ALLOC_STATE( tex.border_color, variable, mtu+1, "tex_border_color", 0 ); r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmducs(R300_TX_BORDER_COLOR_0, 0); - + /* Setup the atom linked list */ make_empty_list(&r300->hw.atomlist); @@ -486,9 +486,9 @@ void r300InitCmdBuf(r300ContextPtr r300) insert_at_tail(&r300->hw.atomlist, &r300->hw.ps); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4230); insert_at_tail(&r300->hw.atomlist, &r300->hw.lcntl); -#ifdef EXP_C +#ifdef EXP_C insert_at_tail(&r300->hw.atomlist, &r300->hw.lsf); -#endif +#endif insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288); @@ -534,7 +534,7 @@ void r300InitCmdBuf(r300ContextPtr r300) insert_at_tail(&r300->hw.atomlist, &r300->hw.vpp); insert_at_tail(&r300->hw.atomlist, &r300->hw.vps); - insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter); + insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter); insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.unknown1); insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.size); insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.format); diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index cba482f0fb..4c155eb64b 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -45,7 +45,7 @@ #define LOCAL_VARS int cmd_reserved=0;\ int cmd_written=0; \ drm_radeon_cmd_header_t *cmd=NULL; - + #define PREFIX_VOID r300ContextPtr rmesa #define PREFIX PREFIX_VOID , @@ -58,7 +58,7 @@ typedef GLuint CARD32; /* This files defines functions for accessing R300 hardware. It needs to be customized to whatever code r300_lib.c is used in */ - + void static inline check_space(int dwords) { } @@ -184,6 +184,7 @@ static __inline__ uint32_t cmdcpdelay(unsigned short count) void static inline end_3d(PREFIX_VOID) { LOCAL_VARS +(void)cmd_reserved; (void)cmd_written; cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \ 0, \ @@ -195,6 +196,7 @@ cmd[0].header.cmd_type=R300_CMD_END3D; void static inline cp_delay(PREFIX unsigned short count) { LOCAL_VARS +(void)cmd_reserved; (void)cmd_written; cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \ 0, \ @@ -211,7 +213,7 @@ check_space(9); start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0); /* e32(0x840c0024); */ - e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count<<16) | type); + e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count<<16) | type); } /* these are followed by the corresponding data */ @@ -232,9 +234,9 @@ start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0); start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _n); \ e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) | type); \ } - + /* Interestingly enough this ones needs the call to setup_AOS, even thought - some of the data so setup is not needed and some is not as arbitrary + some of the data so setup is not needed and some is not as arbitrary as when used by DRAW_VBUF_2 or DRAW_INDX_2 */ #define start_immediate_packet(vertex_count, type, vertex_size) \ {\ diff --git a/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h b/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h index 1dcb402b9d..65e1836af4 100644 --- a/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h +++ b/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h @@ -11,29 +11,29 @@ static struct r300_vertex_shader_state FLAT_COLOR_VERTEX_SHADER={ VSF_PARAM(3), VSF_ATTR_W(0), EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE), - + EASY_VSF_OP(MUL, 1, ALL, RESULT), VSF_REG(1), VSF_ATTR_UNITY(1), VSF_UNITY(1), - + EASY_VSF_OP(MAD, 0, ALL, TMP), VSF_PARAM(2), VSF_ATTR_Z(0), VSF_TMP(0), - + EASY_VSF_OP(MAD, 0, ALL, TMP), VSF_PARAM(1), VSF_ATTR_Y(0), VSF_TMP(0), - + EASY_VSF_OP(MAD, 0, ALL, RESULT), VSF_PARAM(0), VSF_ATTR_X(0), VSF_TMP(0), } } }, - + matrix:{ { length: 16, @@ -63,7 +63,7 @@ static struct r300_vertex_shader_state FLAT_COLOR_VERTEX_SHADER={ length: 0, } }, - + vector: { { length: 0, @@ -72,22 +72,22 @@ static struct r300_vertex_shader_state FLAT_COLOR_VERTEX_SHADER={ length: 0, } }, - + unknown1: { length: 0 }, - + unknown2: { length: 0 - }, - + }, + program_start: 0, unknown_ptr1: 4, program_end: 4, - + param_offset: 0, param_count: 4, - + unknown_ptr2: 0, unknown_ptr3: 4 }; @@ -99,7 +99,7 @@ static struct r300_pixel_shader_state FLAT_COLOR_PIXEL_SHADER={ }, alu: { length: 1, - /* My understanding is that we need at least 1 instructions for pixel shader, + /* My understanding is that we need at least 1 instructions for pixel shader, in particular because alu_end==0 means there is one instruction */ inst: { PFS_NOP @@ -114,55 +114,55 @@ static struct r300_pixel_shader_state FLAT_COLOR_PIXEL_SHADER={ active_nodes: 1, first_node_has_tex: 0, temp_register_count: 0, - + tex_offset: 0, tex_end: 0, alu_offset: 0, alu_end: 0 }, - + param_length: 0 }; - + /******** Single texture pipeline ***********/ static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={ program: { length: 24, - + body: { d: { EASY_VSF_OP(MUL, 0, ALL, TMP), VSF_PARAM(3), VSF_ATTR_W(0), EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE), - + EASY_VSF_OP(MUL, 2, ALL, RESULT), VSF_REG(2), VSF_ATTR_UNITY(2), VSF_UNITY(2), - + EASY_VSF_OP(MAD, 0, ALL, TMP), VSF_PARAM(2), VSF_ATTR_Z(0), VSF_TMP(0), - + EASY_VSF_OP(MUL, 1, ALL, RESULT), VSF_REG(1), VSF_ATTR_UNITY(1), VSF_UNITY(1), - + EASY_VSF_OP(MAD, 0, ALL, TMP), VSF_PARAM(1), VSF_ATTR_Y(0), VSF_TMP(0), - + EASY_VSF_OP(MAD, 0, ALL, RESULT), VSF_PARAM(0), VSF_ATTR_X(0), VSF_TMP(0), } } }, - + matrix:{ { length: 16, @@ -192,7 +192,7 @@ static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={ length: 0, } }, - + vector: { { length: 0, @@ -201,11 +201,11 @@ static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={ length: 0, } }, - + unknown1: { length: 0 }, - + unknown2: { length: 4, body: { f: { @@ -214,19 +214,19 @@ static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={ 1.0, 0.0 } } - }, - + }, + program_start: 0, unknown_ptr1: 5, program_end: 5, - + param_offset: 0, param_count: 4, - + unknown_ptr2: 0, unknown_ptr3: 5 }; - + static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={ program: { tex: { @@ -235,28 +235,28 @@ static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={ }, alu: { length: 2, - inst: + inst: { /* I get misc problems without this after doing cold-reboot. This would imply that alu programming is buggy. --aet */ #if 1 PFS_NOP, -#endif - +#endif + /* What are 0's ORed with flags ? They are register numbers that just happen to be 0 */ { - EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO), - EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL), - - #if 0 + EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO), + EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL), + +#if 0 /* no alpha in textures */ - EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), + EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), EASY_PFS_INSTR3(0, 1, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) - #endif - +#endif + /* alpha in textures */ - EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO), + EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO), EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT) } } @@ -271,13 +271,13 @@ static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={ active_nodes: 1, first_node_has_tex: 1, temp_register_count: 1, - + tex_offset: 0, tex_end: 0, alu_offset: 0, alu_end: 0 }, - + param_length: 8, param: { { 0.0, 0.0, 0.0, 0.0}, diff --git a/src/mesa/drivers/dri/r300/r300_maos.c b/src/mesa/drivers/dri/r300/r300_maos.c index 20a804d97a..af5d00892a 100644 --- a/src/mesa/drivers/dri/r300/r300_maos.c +++ b/src/mesa/drivers/dri/r300/r300_maos.c @@ -221,41 +221,41 @@ void emit_elts(GLcontext * ctx, GLuint *elts, int dec_found=0; unsigned long *dst; unsigned long magic_tbl2[6]= { 0x3f51eb85, 0x3e99999a, 0x3f1eb852, 0x3e6b851f, 0x3f2b851f, 0x3eb33333 }; - + if(n_elts == 1){ fprintf(stderr, "Dont know how to handle this\n"); exit(-1); } - + hw_elts=malloc(n_fake_elts*sizeof(unsigned short int)); - + for(i=0; i < n_elts; i++) hw_elts[i]=(unsigned short int)elts[i]; - + /* Work around magic_1 problem by filling rest of the data with last idx */ for(; i < n_fake_elts; i++) hw_elts[i]=(unsigned short int)elts[n_elts-1]; - + dst=rsp->gartTextures.map; - + /* Buffer underrun in fgl causes these patterns to appear. Filling these shouldnt be needed in real life. */ for(i=0; i < align; i++) if(dst[i] = magic_tbl2[6-align+i]) - + //memset(dst, 0, align*sizeof(unsigned long)); /*for(i=0; i < align; i++) dst[i]=rand()%(~0);*/ - + dst=&dst[align]; - + memcpy(dst, hw_elts, n_fake_elts*sizeof(unsigned short int)); dst=((char *)dst)+n_fake_elts*sizeof(unsigned short int); - + /*for(i=0; i < 1024/4; i++) dst[i]=rand()%(~0);*/ //memset(dst, 0, 1024); - + //memset(((char *)rsp->gartTextures.map)+ec*sizeof(unsigned short int), 0, 1024); /*emit_vector(ctx, &rmesa->state.elt_ao, (char *)hw_elts, @@ -269,15 +269,15 @@ void emit_elts(GLcontext * ctx, GLuint *elts, inc_found=0; break; } - + dec_found=1; for(i=1; i < oec; i++) if(hw_elts[i-1] != hw_elts[i]-1){ dec_found=0; } - + fprintf(stderr, "elts:"); - + if(inc_found==0 && dec_found==0){ fprintf(stderr, "error found\n"); exit(-1); @@ -287,7 +287,7 @@ void emit_elts(GLcontext * ctx, GLuint *elts, fprintf(stderr, "%d ", hw_elts[i]); fprintf(stderr, "\n");*/ } - + /* Emit vertex data to GART memory (unless immediate mode) * Route inputs to the vertex processor */ @@ -475,12 +475,12 @@ drm_radeon_cmd_header_t *cmd = NULL; /* Mesa assumes that all missing components are from (0, 0, 0, 1) */ - #define ALL_COMPONENTS ((R300_INPUT_ROUTE_SELECT_X<<R300_INPUT_ROUTE_X_SHIFT) \ +#define ALL_COMPONENTS ((R300_INPUT_ROUTE_SELECT_X<<R300_INPUT_ROUTE_X_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_Y<<R300_INPUT_ROUTE_Y_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_Z<<R300_INPUT_ROUTE_Z_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_W<<R300_INPUT_ROUTE_W_SHIFT)) - #define ALL_DEFAULT ((R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_X_SHIFT) \ +#define ALL_DEFAULT ((R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_X_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Y_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Z_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ONE<<R300_INPUT_ROUTE_W_SHIFT)) @@ -524,13 +524,13 @@ drm_radeon_cmd_header_t *cmd = NULL; #if 0 r300->hw.vic.cmd[R300_VIC_CNTL_1]=0; - + if(r300->state.render_inputs & _TNL_BIT_POS) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_POS; - + if(r300->state.render_inputs & _TNL_BIT_NORMAL) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_NORMAL; - + if(r300->state.render_inputs & _TNL_BIT_COLOR0) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_COLOR; diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index f7951c01b1..a02c4176c3 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -326,14 +326,14 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa, type=r300_get_primitive_type(rmesa, ctx, prim); num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim); - #if 0 +#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 +#endif if(type<0 || num_verts <= 0)return; @@ -366,7 +366,7 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa, start_immediate_packet(num_verts, type, 4*rmesa->state.aos_count); for(i=start;i<start+num_verts;i++){ - #if 0 +#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], @@ -378,7 +378,7 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa, VEC_ELT(VB->ColorPtr[0], GLfloat, i)[2], VEC_ELT(VB->ColorPtr[0], GLfloat, i)[3] ); - #endif +#endif /* coordinates */ @@ -430,15 +430,15 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, if (RADEON_DEBUG == DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); - #if 1 /* we need this, somehow */ +#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 +#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 +#endif /* needed before starting 3d operation .. */ reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); @@ -448,14 +448,14 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, e32(0x00000003); - #if 0 /* looks like the Z offset issue got fixed */ +#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 +#endif @@ -470,7 +470,7 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, r300EmitState(rmesa); - #if 0 +#if 0 reg_start(R300_RB3D_COLORMASK, 0); e32(0xf); @@ -485,7 +485,7 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, efloat(0.0); efloat(0.0); efloat(1.0); - #endif +#endif /* Setup INPUT_ROUTE and INPUT_CNTL */ r300EmitArrays(ctx, GL_TRUE); @@ -763,10 +763,10 @@ static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) //FALLBACK_IF(ctx->Color.DitherFlag); /* I'm almost certain I forgot something here */ - #if 0 /* This should work now.. */ +#if 0 /* This should work now.. */ FALLBACK_IF(ctx->Color.AlphaEnabled); // GL_ALPHA_TEST FALLBACK_IF(ctx->Color.BlendEnabled); // GL_BLEND - #endif +#endif //FALLBACK_IF(ctx->Fog.Enabled); // GL_FOG disable as swtcl doesnt seem to support this FALLBACK_IF(ctx->Line.SmoothFlag); // GL_LINE_SMOOTH FALLBACK_IF(ctx->Line.StippleFlag); // GL_LINE_STIPPLE @@ -787,9 +787,9 @@ static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) FALLBACK_IF(ctx->Texture.Unit[i].Enabled); /* let r300_run_render do its job */ - #if 0 +#if 0 stage->active = GL_FALSE; - #endif +#endif } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 2c42ee134b..a811215016 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -110,18 +110,18 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) { GLubyte color[4]; r300ContextPtr rmesa = R300_CONTEXT(ctx); - + R300_STATECHANGE(rmesa, unk4E10); - /* Ordering might be wrong */ + /* Ordering might be wrong */ CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]); CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]); CLAMPED_FLOAT_TO_UBYTE(color[2], cf[2]); CLAMPED_FLOAT_TO_UBYTE(color[3], cf[3]); - + rmesa->hw.unk4E10.cmd[1]=radeonPackColor(4, color[0], color[1], color[2], color[3]); //fprintf(stderr, "%s:%s is not implemented yet. Fixme !\n", __FILE__, __FUNCTION__); - #if 0 +#if 0 R200_STATECHANGE(rmesa, ctx); CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]); CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]); @@ -130,7 +130,7 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) if (rmesa->radeon.radeonScreen->drmSupportsBlendColor) rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCOLOR] = radeonPackColor(4, color[0], color[1], color[2], color[3]); - #endif +#endif } /** @@ -221,16 +221,16 @@ static void r300_set_blend_cntl(r300ContextPtr rmesa, int func, int eqn, int cbi { GLuint new_ablend, new_cblend; - #if 0 +#if 0 fprintf(stderr, "eqnA=%08x funcA=%08x eqn=%08x func=%08x cbits=%08x\n", eqnA, funcA, eqn, func, cbits); - #endif +#endif new_ablend = eqnA | funcA; new_cblend = eqn | func; if(funcA == func){ new_cblend |= R300_BLEND_NO_SEPARATE; } new_cblend |= cbits; - + if((new_ablend != rmesa->hw.bld.cmd[R300_BLD_ABLEND]) || (new_cblend != rmesa->hw.bld.cmd[R300_BLD_CBLEND])){ R300_STATECHANGE(rmesa, bld); @@ -242,11 +242,11 @@ static void r300_set_blend_cntl(r300ContextPtr rmesa, int func, int eqn, int cbi static void r300_set_blend_state(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - #if 0 +#if 0 GLuint cntl = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~(R300_ROP_ENABLE | R300_ALPHA_BLEND_ENABLE | R300_SEPARATE_ALPHA_ENABLE); - #endif +#endif int func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) | (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT); @@ -258,24 +258,24 @@ static void r300_set_blend_state(GLcontext * ctx) if (rmesa->radeon.radeonScreen->drmSupportsBlendColor) { if (ctx->Color._LogicOpEnabled) { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R300_ROP_ENABLE; - #endif +#endif r300_set_blend_cntl(rmesa, func, eqn, 0, func, eqn); return; } else if (ctx->Color.BlendEnabled) { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R300_ALPHA_BLEND_ENABLE | R300_SEPARATE_ALPHA_ENABLE; - #endif +#endif } else { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl; - #endif +#endif r300_set_blend_cntl(rmesa, func, eqn, 0, func, eqn); @@ -283,22 +283,22 @@ static void r300_set_blend_state(GLcontext * ctx) } } else { if (ctx->Color._LogicOpEnabled) { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R300_ROP_ENABLE; rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func; - #endif +#endif return; } else if (ctx->Color.BlendEnabled) { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R300_ALPHA_BLEND_ENABLE; - #endif +#endif } else { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl; rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func; - #endif +#endif r300_set_blend_cntl(rmesa, func, eqn, 0, func, eqn); @@ -345,9 +345,9 @@ static void r300_set_blend_state(GLcontext * ctx) } if (!rmesa->radeon.radeonScreen->drmSupportsBlendColor) { - #if 0 +#if 0 rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func; - #endif +#endif return; } @@ -429,7 +429,7 @@ static void r300UpdateCulling(GLcontext* ctx) if (ctx->Polygon.FrontFace == GL_CW) val |= R300_FRONT_FACE_CW; else - val |= R300_FRONT_FACE_CCW; + val |= R300_FRONT_FACE_CCW; } r300->hw.cul.cmd[R300_CUL_CULL] = val; } @@ -491,7 +491,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) case GL_STENCIL_TEST: WARN_ONCE("Do not know how to enable stencil. Help me !\n"); - + if (r300->state.hw_stencil) { //fprintf(stderr, "Stencil %s\n", state ? "enabled" : "disabled"); R300_STATECHANGE(r300, zs); @@ -510,11 +510,11 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) case GL_CULL_FACE: r300UpdateCulling(ctx); break; - + case GL_POLYGON_OFFSET_POINT: case GL_POLYGON_OFFSET_LINE: WARN_ONCE("Don't know how to enable polygon offset point/line. Help me !\n"); - + /* Something is apparently blocking these from working */ R300_STATECHANGE(r300, unk42B4); if(state){ @@ -523,7 +523,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) r300->hw.unk42B4.cmd[1] &= (3<<0); } break; - + case GL_POLYGON_OFFSET_FILL: R300_STATECHANGE(r300, unk42B4); if(state){ @@ -532,7 +532,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) r300->hw.unk42B4.cmd[1] &= ~(3<<0); } break; - + case GL_VERTEX_PROGRAM_ARB: //TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, state); break; @@ -652,19 +652,19 @@ static void r300ColorMask(GLcontext* ctx, static void r300PointSize(GLcontext * ctx, GLfloat size) { r300ContextPtr r300 = R300_CONTEXT(ctx); - + size = ctx->Point._Size; - + R300_STATECHANGE(r300, ps); r300->hw.ps.cmd[R300_PS_POINTSIZE] = ((int)(size * 6) << R300_POINTSIZE_X_SHIFT) | ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT); - + #if 0 /* r200 reg? */ /* This might need fixing later */ R300_STATECHANGE(r300, vps); r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0); -#endif +#endif } /* ============================================================= @@ -673,9 +673,9 @@ static void r300PointSize(GLcontext * ctx, GLfloat size) static void r300LineWidth(GLcontext *ctx, GLfloat widthf) { r300ContextPtr r300 = R300_CONTEXT(ctx); - + widthf = ctx->Line._Width; - + R300_STATECHANGE(r300, lcntl); r300->hw.lcntl.cmd[1] = (int)(widthf * 6.0); /* Doesnt look very good without this... */ @@ -706,10 +706,10 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) { r300ContextPtr r300 = R300_CONTEXT(ctx); unsigned long hw_mode=0; - + //hw_mode=r300->hw.unk4288.cmd[1]; hw_mode |= 1; /* enables point mode by default */ - + switch (ctx->Polygon.FrontMode) { case GL_LINE: hw_mode &= ~PM_NOT_FRONT; @@ -723,7 +723,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) case GL_FILL: break; } - + switch (ctx->Polygon.BackMode) { case GL_LINE: hw_mode &= ~PM_NOT_BACK; @@ -736,11 +736,11 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) case GL_FILL: break; } - + if(hw_mode == 1) hw_mode = 0; - -#if 0 + +#if 0 switch (face) { case GL_FRONT: //fprintf(stderr, "front\n"); @@ -756,7 +756,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) break; } break; - + case GL_BACK: //fprintf(stderr, "back\n"); hw_mode &= ~PM_NOT_BACK; @@ -771,7 +771,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) break; } break; - + case GL_FRONT_AND_BACK: //fprintf(stderr, "front and back\n"); hw_mode &= ~PM_NOT_FRONT; @@ -792,9 +792,9 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) break; } #endif - + //if( front and back fill) hw_mode=0; - + if(r300->hw.unk4288.cmd[1] != hw_mode){ R300_STATECHANGE(r300, unk4288); r300->hw.unk4288.cmd[1] = hw_mode; @@ -985,8 +985,8 @@ static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLfloat constant = units * /*rmesa->state.depth.scale*/4; - - factor *= 12; + + factor *= 12; /* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */ @@ -1015,7 +1015,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) /* Note: immediate vertex data includes all coordinates. To save bandwidth use either VBUF or state-based vertex generation */ - #define CONFIGURE_AOS(v, o, r, f) \ +#define CONFIGURE_AOS(v, o, r, f) \ {\ if (RADEON_DEBUG & DEBUG_STATE)fprintf(stderr, "Enabling "#r "\n"); \ r300->state.aos[count].aos_size=4; \ @@ -1035,7 +1035,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) /* VERT_ATTRIB_WEIGHT, VERT_ATTRIB_SIX, VERT_ATTRIB_SEVEN, VERT_ATTRIB_GENERIC0, VERT_ATTRIB_GENERIC1, VERT_ATTRIB_GENERIC2, VERT_ATTRIB_GENERIC3 */ r300->state.render_inputs = 0; - + if(r300->current_vp->inputs[VERT_ATTRIB_POS] != -1){ reg=r300->current_vp->inputs[VERT_ATTRIB_POS]; CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT); @@ -1061,7 +1061,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) CONFIGURE_AOS(VB->FogCoordPtr, 0, i_fog, AOS_FORMAT_FLOAT); r300->state.render_inputs |= _TNL_BIT_FOG; } - for(i=0;i < ctx->Const.MaxTextureUnits;i++) // tex 7 is last + for(i=0;i < ctx->Const.MaxTextureUnits;i++) // tex 7 is last if(r300->current_vp->inputs[VERT_ATTRIB_TEX0+i] != -1){ reg=r300->current_vp->inputs[VERT_ATTRIB_TEX0+i]; CONFIGURE_AOS(VB->TexCoordPtr[i], 0, i_tex[i], AOS_FORMAT_FLOAT); @@ -1070,42 +1070,42 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) #if 0 if((tnl->render_inputs & _TNL_BIT_INDEX)) CONFIGURE_AOS(VB->IndexPtr[0], 0, i_index, AOS_FORMAT_FLOAT); - + if((tnl->render_inputs & _TNL_BIT_POINTSIZE)) CONFIGURE_AOS(VB->PointSizePtr, 0, i_pointsize, AOS_FORMAT_FLOAT); -#endif +#endif }else{ - + r300->state.render_inputs = tnl->render_inputs; - + if(tnl->render_inputs & _TNL_BIT_POS) CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT); if(tnl->render_inputs & _TNL_BIT_NORMAL) CONFIGURE_AOS(VB->NormalPtr, 0, i_normal, AOS_FORMAT_FLOAT); - + if(tnl->render_inputs & _TNL_BIT_COLOR0) CONFIGURE_AOS(VB->ColorPtr[0], 0, i_color[0], AOS_FORMAT_FLOAT_COLOR); if(tnl->render_inputs & _TNL_BIT_COLOR1) CONFIGURE_AOS(VB->SecondaryColorPtr[0], 0, i_color[1], AOS_FORMAT_FLOAT_COLOR); - + /*if(tnl->render_inputs & _TNL_BIT_FOG) // Causes lock ups when immediate mode is on CONFIGURE_AOS(VB->FogCoordPtr, 0, i_fog, AOS_FORMAT_FLOAT);*/ - + for(i=0;i < ctx->Const.MaxTextureUnits;i++) if(tnl->render_inputs & (_TNL_BIT_TEX0<<i)) CONFIGURE_AOS(VB->TexCoordPtr[i], 0, i_tex[i], AOS_FORMAT_FLOAT); - + if(tnl->render_inputs & _TNL_BIT_INDEX) CONFIGURE_AOS(VB->IndexPtr[0], 0, i_index, AOS_FORMAT_FLOAT); if(tnl->render_inputs & _TNL_BIT_POINTSIZE) CONFIGURE_AOS(VB->PointSizePtr, 0, i_pointsize, AOS_FORMAT_FLOAT); } - + r300->state.aos_count=count; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "aos_count=%d render_inputs=%08x\n", count, r300->state.render_inputs); - + if(count>R300_MAX_AOS_ARRAYS){ fprintf(stderr, "Aieee ! AOS array count exceeded !\n"); @@ -1143,12 +1143,12 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) /* Mesa assumes that all missing components are from (0, 0, 0, 1) */ - #define ALL_COMPONENTS ((R300_INPUT_ROUTE_SELECT_X<<R300_INPUT_ROUTE_X_SHIFT) \ +#define ALL_COMPONENTS ((R300_INPUT_ROUTE_SELECT_X<<R300_INPUT_ROUTE_X_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_Y<<R300_INPUT_ROUTE_Y_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_Z<<R300_INPUT_ROUTE_Z_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_W<<R300_INPUT_ROUTE_W_SHIFT)) - #define ALL_DEFAULT ((R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_X_SHIFT) \ +#define ALL_DEFAULT ((R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_X_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Y_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Z_SHIFT) \ | (R300_INPUT_ROUTE_SELECT_ONE<<R300_INPUT_ROUTE_W_SHIFT)) @@ -1190,13 +1190,13 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate) r300->hw.vic.cmd[R300_VIC_CNTL_0]=0x5555; /* Hard coded value, no idea what it means */ r300->hw.vic.cmd[R300_VIC_CNTL_1]=0; - + if(r300->state.render_inputs & _TNL_BIT_POS) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_POS; - + if(r300->state.render_inputs & _TNL_BIT_NORMAL) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_NORMAL; - + if(r300->state.render_inputs & _TNL_BIT_COLOR0) r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_COLOR; @@ -1270,7 +1270,7 @@ static unsigned long gen_fixed_filter(unsigned long f) { unsigned long mag, min, needs_fixing=0; //return f; - + /* We ignore MIRROR bit so we dont have to do everything twice */ if((f & ((7-1) << R300_TX_WRAP_S_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_S_SHIFT)){ needs_fixing |= 1; @@ -1281,30 +1281,30 @@ static unsigned long gen_fixed_filter(unsigned long f) if((f & ((7-1) << R300_TX_WRAP_Q_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_Q_SHIFT)){ needs_fixing |= 4; } - + if(!needs_fixing) return f; - + mag=f & R300_TX_MAG_FILTER_MASK; min=f & R300_TX_MIN_FILTER_MASK; - + /* TODO: Check for anisto filters too */ if((mag != R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST)) return f; - + /* r300 cant handle these modes hence we force nearest to linear */ if((mag == R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST)){ f &= ~R300_TX_MAG_FILTER_NEAREST; f |= R300_TX_MAG_FILTER_LINEAR; return f; } - + if((min == R300_TX_MIN_FILTER_NEAREST) && (mag != R300_TX_MAG_FILTER_NEAREST)){ f &= ~R300_TX_MIN_FILTER_NEAREST; f |= R300_TX_MIN_FILTER_LINEAR; return f; } - + /* Both are nearest */ if(needs_fixing & 1){ f &= ~((7-1) << R300_TX_WRAP_S_SHIFT); @@ -1414,10 +1414,10 @@ void r300_setup_rs_unit(GLcontext *ctx) r300->hw.ri.cmd[R300_RI_INTERP_2] |= R300_RS_INTERP_2_UNKNOWN; r300->hw.ri.cmd[R300_RI_INTERP_3] |= R300_RS_INTERP_3_UNKNOWN; - #if 1 +#if 1 for(i = 2; i <= 8; ++i) r300->hw.ri.cmd[i] |= 4; - #endif +#endif for(i = 1; i <= 8; ++i) r300->hw.rr.cmd[i] = 0; @@ -1498,12 +1498,12 @@ void r300SetupVertexProgram(r300ContextPtr rmesa); void r300SetupVertexShader(r300ContextPtr rmesa) { GLcontext* ctx = rmesa->radeon.glCtx; - + if(rmesa->current_vp != NULL){ r300SetupVertexProgram(rmesa); return ; - } - + } + /* Reset state, in case we don't use something */ ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0; ((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0; @@ -1527,18 +1527,18 @@ void r300SetupVertexShader(r300ContextPtr rmesa) setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(rmesa->state.vertex_shader.program)); setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(rmesa->state.vertex_shader.matrix[0])); - #if 0 +#if 0 setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX1, &(rmesa->state.vertex_shader.matrix[0])); setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX2, &(rmesa->state.vertex_shader.matrix[0])); setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR0, &(rmesa->state.vertex_shader.vector[0])); setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR1, &(rmesa->state.vertex_shader.vector[1])); - #endif +#endif - #if 0 +#if 0 setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1)); setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2)); - #endif +#endif R300_STATECHANGE(rmesa, pvs); rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(rmesa->state.vertex_shader.program_start << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) @@ -1551,10 +1551,10 @@ void r300SetupVertexShader(r300ContextPtr rmesa) /* This is done for vertex shader fragments, but also needs to be done for vap_pvs, so I leave it as a reminder */ - #if 0 +#if 0 reg_start(R300_VAP_PVS_WAITIDLE,0); e32(0x00000000); - #endif +#endif } void r300SetupVertexProgram(r300ContextPtr rmesa) @@ -1569,19 +1569,19 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) ((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0; r300VertexProgUpdateParams(ctx, rmesa->current_vp); - + setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(rmesa->current_vp->program)); setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(rmesa->current_vp->params)); - - #if 0 + +#if 0 setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1)); setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2)); - #endif - +#endif + inst_count=rmesa->current_vp->program.length/4 - 1; param_count=rmesa->current_vp->params.length/4; - + R300_STATECHANGE(rmesa, pvs); rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | (inst_count/*0*/ << R300_PVS_CNTL_1_UNKNOWN_SHIFT) @@ -1593,10 +1593,10 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) /* This is done for vertex shader fragments, but also needs to be done for vap_pvs, so I leave it as a reminder */ - #if 0 +#if 0 reg_start(R300_VAP_PVS_WAITIDLE,0); e32(0x00000000); - #endif +#endif } @@ -1606,27 +1606,27 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300) int i, mtu; mtu = r300->radeon.glCtx->Const.MaxTextureUnits; GLenum envMode; - + int tex_inst=0, alu_inst=0; - + for(i=0;i<mtu;i++){ /* No need to proliferate {} */ if(! (r300->state.render_inputs & (_TNL_BIT_TEX0<<i)))continue; - + envMode = r300->radeon.glCtx->Texture.Unit[i].EnvMode; //fprintf(stderr, "envMode=%s\n", _mesa_lookup_enum_by_nr(envMode)); - + /* Fetch textured pixel */ - + r300->state.pixel_shader.program.tex.inst[tex_inst]=0x00018000; tex_inst++; - + switch(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeRGB){ case GL_REPLACE: WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n"); r300->state.pixel_shader.program.alu.inst[alu_inst].inst0= EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst1= EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL); break; @@ -1634,10 +1634,10 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300) WARN_ONCE("ModeRGB==GL_MODULATE is possibly broken.\n"); r300->state.pixel_shader.program.alu.inst[alu_inst].inst0= EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst1= EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL); - + break; default: fprintf(stderr, "ModeRGB=%s is not implemented yet !\n", @@ -1645,7 +1645,7 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300) /* PFS_NOP */ r300->state.pixel_shader.program.alu.inst[alu_inst].inst0= EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst1= EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL); } @@ -1654,26 +1654,26 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300) WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n"); r300->state.pixel_shader.program.alu.inst[alu_inst].inst2= EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst3= EASY_PFS_INSTR3(0, 0, 0| PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT); - #if 0 +#if 0 fprintf(stderr, "numArgsA=%d sourceA[0]=%s op=%d\n", r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->_NumArgsA, _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->SourceA[0]), r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->OperandA[0]-GL_SRC_ALPHA); - #endif - break; +#endif + break; case GL_MODULATE: WARN_ONCE("ModeA==GL_MODULATE is possibly broken.\n"); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst2= EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst3= EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT); - + break; default: fprintf(stderr, "ModeA=%s is not implemented yet !\n", @@ -1681,25 +1681,25 @@ void r300GenerateTexturePixelShader(r300ContextPtr r300) /* PFS_NOP */ r300->state.pixel_shader.program.alu.inst[alu_inst].inst2= EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO); - + r300->state.pixel_shader.program.alu.inst[alu_inst].inst3= EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT); } - - alu_inst++; + + alu_inst++; } - + r300->state.pixel_shader.program.tex.length=tex_inst; r300->state.pixel_shader.program.tex_offset=0; r300->state.pixel_shader.program.tex_end=tex_inst-1; - #if 0 +#if 0 /* saturate last instruction, like i915 driver does */ r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst0|=R300_FPI0_OUTC_SAT; r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst2|=R300_FPI2_OUTA_SAT; - #endif - +#endif + r300->state.pixel_shader.program.alu.length=alu_inst; r300->state.pixel_shader.program.alu_offset=0; r300->state.pixel_shader.program.alu_end=alu_inst-1; @@ -1724,7 +1724,7 @@ int i,k; rmesa->hw.fpt.cmd[R300_FPT_INSTR_0+i]=rmesa->state.pixel_shader.program.tex.inst[i]; rmesa->hw.fpt.cmd[R300_FPT_CMD_0]=cmducs(R300_PFS_TEXI_0, rmesa->state.pixel_shader.program.tex.length); - #define OUTPUT_FIELD(st, reg, field) \ +#define OUTPUT_FIELD(st, reg, field) \ R300_STATECHANGE(rmesa, st); \ for(i=0;i<rmesa->state.pixel_shader.program.alu.length;i++) \ rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rmesa->state.pixel_shader.program.alu.inst[i].field;\ @@ -1734,7 +1734,7 @@ int i,k; OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1); OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2); OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3); - #undef OUTPUT_FIELD +#undef OUTPUT_FIELD R300_STATECHANGE(rmesa, fp); for(i=0;i<4;i++){ @@ -1803,11 +1803,11 @@ void r300ResetHwState(r300ContextPtr r300) /* This is a place to initialize registers which have bitfields accessed by different functions and not all bits are used */ - #if 0 +#if 0 r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; r300->hw.zs.cmd[R300_ZS_CNTL_1] = 0; r300->hw.zs.cmd[R300_ZS_CNTL_2] = 0xffff00; - #endif +#endif /* go and compute register values from GL state */ @@ -1826,7 +1826,7 @@ void r300ResetHwState(r300ContextPtr r300) r300UpdateCulling(ctx); r300UpdateTextureState(ctx); - + // r300_setup_routing(ctx, GL_TRUE); r300EmitArrays(ctx, GL_TRUE); /* Just do the routing */ r300_setup_textures(ctx); @@ -1860,7 +1860,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk2140.cmd[1] = 0x00000000; #endif - #if 0 /* Done in setup routing */ +#if 0 /* Done in setup routing */ ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->unchecked_state.count = 1; r300->hw.vir[0].cmd[1] = 0x21030003; @@ -1869,7 +1869,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.vic.cmd[R300_VIR_CNTL_0] = 0x00000001; r300->hw.vic.cmd[R300_VIR_CNTL_1] = 0x00000405; - #endif +#endif r300->hw.unk21DC.cmd[1] = 0xAAAAAAAA; @@ -1885,7 +1885,7 @@ void r300ResetHwState(r300ContextPtr r300) else r300->hw.unk2288.cmd[1] = R300_2288_RV350; - #if 0 +#if 0 r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ @@ -1894,7 +1894,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.pvs.cmd[R300_PVS_CNTL_1] = 0; r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; r300->hw.pvs.cmd[R300_PVS_CNTL_3] = 0; - #endif +#endif r300->hw.gb_enable.cmd[1] = R300_GB_POINT_STUFF_ENABLE | R300_GB_LINE_STUFF_ENABLE @@ -1923,17 +1923,17 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4214.cmd[1] = 0x00050005; r300PointSize(ctx, 0.0); -#if 0 +#if 0 r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) | (6 << R300_POINTSIZE_Y_SHIFT); -#endif - +#endif + r300->hw.unk4230.cmd[1] = 0x01800000; r300->hw.unk4230.cmd[2] = 0x00020006; r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0); - + r300LineWidth(ctx, 0.0); - + #ifdef EXP_C static int foobar=0; r300->hw.lsf.cmd[1] = foobar++; //0x3a088889; @@ -1951,7 +1951,7 @@ void r300ResetHwState(r300ContextPtr r300) r300PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode); #if 0 r300->hw.unk4288.cmd[1] = 0x00000000; -#endif +#endif r300->hw.unk4288.cmd[2] = 0x00000001; r300->hw.unk4288.cmd[3] = 0x00000000; r300->hw.unk4288.cmd[4] = 0x00000000; @@ -1960,19 +1960,19 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk42A0.cmd[1] = 0x00000000; update_zbias(ctx, GL_TRIANGLES);/* FIXME */ -#if 0 +#if 0 r300->hw.unk42B4.cmd[1] = 0x00000000; -#endif +#endif r300->hw.unk42C0.cmd[1] = 0x4B7FFFFF; r300->hw.unk42C0.cmd[2] = 0x00000000; r300->hw.unk43A4.cmd[1] = 0x0000001C; r300->hw.unk43A4.cmd[2] = 0x2DA49525; - + r300->hw.unk43E8.cmd[1] = 0x00FFFFFF; - #if 0 +#if 0 r300->hw.fp.cmd[R300_FP_CNTL0] = 0; r300->hw.fp.cmd[R300_FP_CNTL1] = 0; r300->hw.fp.cmd[R300_FP_CNTL2] = 0; @@ -1980,7 +1980,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.fp.cmd[R300_FP_NODE1] = 0; r300->hw.fp.cmd[R300_FP_NODE2] = 0; r300->hw.fp.cmd[R300_FP_NODE3] = 0; - #endif +#endif r300->hw.unk46A4.cmd[1] = 0x00001B01; r300->hw.unk46A4.cmd[2] = 0x00001B0F; @@ -1988,7 +1988,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk46A4.cmd[4] = 0x00001B0F; r300->hw.unk46A4.cmd[5] = 0x00000001; - #if 0 +#if 0 for(i = 1; i <= 64; ++i) { /* create NOP instructions */ r300->hw.fpi[0].cmd[i] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); @@ -1996,33 +1996,33 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.fpi[2].cmd[i] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); r300->hw.fpi[3].cmd[i] = FP_SELA(0,W,NO,FP_TMP(0),0,0); } - #endif +#endif r300->hw.unk4BC0.cmd[1] = 0; r300->hw.unk4BC8.cmd[1] = 0; r300->hw.unk4BC8.cmd[2] = 0; r300->hw.unk4BC8.cmd[3] = 0; - + //r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); - #if 0 +#if 0 r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0; - #endif +#endif r300->hw.at.cmd[R300_AT_UNKNOWN] = 0; r300->hw.unk4BD8.cmd[1] = 0; r300->hw.unk4E00.cmd[1] = 0; - #if 0 +#if 0 r300->hw.bld.cmd[R300_BLD_CBLEND] = 0; r300->hw.bld.cmd[R300_BLD_ABLEND] = 0; - #endif - +#endif + r300BlendColor(ctx, ctx->Color.BlendColor); #if 0 r300->hw.unk4E10.cmd[1] = 0; -#endif +#endif r300->hw.unk4E10.cmd[2] = 0; r300->hw.unk4E10.cmd[3] = 0; @@ -2069,7 +2069,7 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4F54.cmd[1] = 0; - #if 0 +#if 0 ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->vpu.count = 0; for(i = 1; i < R300_VPI_CMDSIZE; i += 4) { /* MOV t0, t0 */ @@ -2082,7 +2082,7 @@ void r300ResetHwState(r300ContextPtr r300) ((drm_r300_cmd_header_t*)r300->hw.vpp.cmd)->vpu.count = 0; for(i = 1; i < R300_VPP_CMDSIZE; ++i) r300->hw.vpp.cmd[i] = 0; - #endif +#endif r300->hw.vps.cmd[R300_VPS_ZERO_0] = 0; r300->hw.vps.cmd[R300_VPS_ZERO_1] = 0; @@ -2165,7 +2165,7 @@ void r300InitStateFuncs(struct dd_function_table* functions) functions->DepthRange = r300DepthRange; functions->PointSize = r300PointSize; functions->LineWidth = r300LineWidth; - + functions->PolygonOffset = r300PolygonOffset; functions->PolygonMode = r300PolygonMode; } diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 0f3089d4c8..000b7be0b0 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -60,16 +60,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \param swrap Wrap mode for the \a s texture coordinate * \param twrap Wrap mode for the \a t texture coordinate */ - + static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap, GLenum rwrap) { GLboolean is_clamp = GL_FALSE; unsigned long hw_swrap=0, hw_twrap=0, hw_qwrap=0; - + t->filter &= ~(R300_TX_WRAP_S_MASK | R300_TX_WRAP_T_MASK | R300_TX_WRAP_Q_MASK); - + switch (swrap) { case GL_REPEAT: hw_swrap |= R300_TX_REPEAT; @@ -162,20 +162,20 @@ static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap, default: _mesa_problem(NULL, "bad R wrap mode in %s", __FUNCTION__); } - + t->filter |= hw_swrap << R300_TX_WRAP_S_SHIFT; t->filter |= hw_twrap << R300_TX_WRAP_T_SHIFT; t->filter |= hw_qwrap << R300_TX_WRAP_Q_SHIFT; - + #if 0 t->format_x &= ~R200_CLAMP_Q_MASK; t->border_fallback = (is_clamp && is_clamp_to_border); -#endif +#endif } static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max) { - + t->filter &= ~R300_TX_MAX_ANISO_MASK; if (max <= 1.0) { @@ -204,10 +204,10 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf) GLuint anisotropy = (t->filter & R300_TX_MAX_ANISO_MASK); t->filter &= ~(R300_TX_MIN_FILTER_MASK | R300_TX_MAG_FILTER_MASK); -#if 0 +#if 0 //t->format_x &= ~R200_VOLUME_FILTER_MASK; -#endif - +#endif + if (anisotropy == R300_TX_MAX_ANISO_1_TO_1) { switch (minf) { case GL_NEAREST: @@ -316,16 +316,16 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx, const GLboolean force16bpt = (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16); (void)format; - - #if 0 - fprintf(stderr, "InternalFormat=%s(%d) type=%s format=%s\n", + +#if 0 + fprintf(stderr, "InternalFormat=%s(%d) type=%s format=%s\n", _mesa_lookup_enum_by_nr(internalFormat), internalFormat, _mesa_lookup_enum_by_nr(type), _mesa_lookup_enum_by_nr(format)); - fprintf(stderr, "do32bpt=%d force16bpt=%d\n", + fprintf(stderr, "do32bpt=%d force16bpt=%d\n", do32bpt, force16bpt); - #endif - +#endif + switch (internalFormat) { case 4: case GL_RGBA: @@ -809,7 +809,7 @@ static void r300TexEnv(GLcontext * ctx, GLenum target, fprintf(stderr, "%s( %s )\n", __FUNCTION__, _mesa_lookup_enum_by_nr(pname)); } - + /* This is incorrect: Need to maintain this data for each of * GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch * between them according to _ReallyEnabled. @@ -844,12 +844,12 @@ static void r300TexEnv(GLcontext * ctx, GLenum target, driQueryOptionb(&rmesa->radeon.optionCache, "no_neg_lod_bias") ? 0.0 : -16.0; bias = CLAMP(bias, min, 16.0); - + /* 0.0 - 16.0 == 0x0 - 0x1000 */ /* 0.0 - -16.0 == 0x1001 - 0x1fff */ b = 0x1000 / 16.0 * bias; b &= R300_LOD_BIAS_MASK; - + if(b != (rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] & R300_LOD_BIAS_MASK)){ R300_STATECHANGE(rmesa, tex.unknown1); rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] &= ~R300_LOD_BIAS_MASK; @@ -974,10 +974,10 @@ static void r300TexGen(GLcontext * ctx, { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint unit = ctx->Texture.CurrentUnit; - #if 0 /* Disable this for now - looks like we will be recalculating everything +#if 0 /* Disable this for now - looks like we will be recalculating everything anyway */ rmesa->recheck_texgen[unit] = GL_TRUE; - #endif +#endif } /** diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index b32812e4f8..de011d7e39 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -74,16 +74,16 @@ void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t) if (t == rmesa->state.texture.unit[i].texobj) { rmesa->state.texture.unit[i].texobj = NULL; /* This code below is meant to shorten state - pushed to the hardware by not programming + pushed to the hardware by not programming unneeded units. - + This does not appear to be worthwhile on R300 */ - #if 0 +#if 0 remove_from_list(&rmesa->hw.tex[i]); make_empty_list(&rmesa->hw.tex[i]); remove_from_list(&rmesa->hw.cube[i]); make_empty_list(&rmesa->hw.cube[i]); - #endif +#endif } } } @@ -371,9 +371,9 @@ static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, tex.offset = offset; tex.pitch = BLIT_WIDTH_BYTES / 64; tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */ - #if 0 /* I am not sure HOSTDATA_BLT actually works.. Experiment here - V.D */ +#if 0 /* I am not sure HOSTDATA_BLT actually works.. Experiment here - V.D */ tex.format = R200_TXFORMAT_RGBA8888; /* any 4-byte texel format */ - #endif +#endif if (texImage->TexFormat->TexelBytes) { tex.width = imageWidth * texImage->TexFormat->TexelBytes; /* in bytes */ tex.height = imageHeight; @@ -384,19 +384,19 @@ static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, tex.height = 4; } tex.image = &tmp; - #if 0 +#if 0 tex.width /= 4; - #endif +#endif /* copy (x,y,width,height,data) */ memcpy(&tmp, &t->image[face][hwlevel], sizeof(tmp)); - #if 0 +#if 0 tex.image->width /=4; - #endif +#endif - #if 0 +#if 0 sleep(1); - + fprintf(stderr, "*** Uploading texture\n"); fprintf(stderr, " offset=0x%08x\n", offset); fprintf(stderr, " image width=%d height=%d\n", @@ -405,7 +405,7 @@ static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, t->image[face][hwlevel].width, t->image[face][hwlevel].height, t->image[face][hwlevel].data); - #endif +#endif LOCK_HARDWARE(&rmesa->radeon); do { @@ -420,7 +420,7 @@ static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t, } while (ret && errno == EAGAIN); UNLOCK_HARDWARE(&rmesa->radeon); - + if (ret) { fprintf(stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret); fprintf(stderr, " offset=0x%08x\n", offset); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 5da71033ab..01bfe1a16a 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -88,9 +88,9 @@ static const struct { _ALPHA_REV(AL88), _ALPHA(A8), _COLOR(L8), - _ALPHA(I8), - _INVALID(CI8), - _YUV(YCBCR), + _ALPHA(I8), + _INVALID(CI8), + _YUV(YCBCR), _YUV(YCBCR_REV), }; @@ -178,7 +178,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, t->format &= ~(R200_TXFORMAT_FORMAT_MASK | R200_TXFORMAT_ALPHA_IN_MAP); -#if 0 +#if 0 t->filter &= ~R200_YUV_TO_RGB; #endif if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) { @@ -187,7 +187,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, #if 1 t->filter |= tx_table[baseImage->TexFormat->MesaFormat].filter; -#endif +#endif } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); @@ -306,7 +306,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, t->filter &= ~R200_MAX_MIP_LEVEL_MASK; t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT; #endif - #if 0 +#if 0 t->format &= ~(R200_TXFORMAT_WIDTH_MASK | R200_TXFORMAT_HEIGHT_MASK | R200_TXFORMAT_CUBIC_MAP_ENABLE | @@ -314,8 +314,8 @@ static void r300SetTexImages(r300ContextPtr rmesa, R200_TXFORMAT_F5_HEIGHT_MASK); t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) | (log2Height << R200_TXFORMAT_HEIGHT_SHIFT)); - #endif - +#endif + t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK); if (tObj->Target == GL_TEXTURE_3D) { t->format_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT); @@ -335,7 +335,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, (log2Width << R200_FACE_WIDTH_4_SHIFT) | (log2Height << R200_FACE_HEIGHT_4_SHIFT)); } - + t->size = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << R300_TX_WIDTHMASK_SHIFT) |((tObj->Image[0][t->base.firstLevel]->Height - 1) << R300_TX_HEIGHTMASK_SHIFT) |((log2Width>log2Height)?log2Width:log2Height)<<R300_TX_SIZE_SHIFT); @@ -494,16 +494,16 @@ 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.. */ + +#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 - +#endif + GLuint color_scale=0, alpha_scale=0; - + /* texUnit->_Current can be NULL if and only if the texture unit is * not actually enabled. */ @@ -523,12 +523,12 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) */ /* Don't cache these results. */ - #if 0 +#if 0 rmesa->state.texture.unit[unit].format = 0; - #endif +#endif rmesa->state.texture.unit[unit].envMode = 0; - + if (!texUnit->_ReallyEnabled) { if (unit == 0) { color_combine = @@ -799,12 +799,12 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) */ } - #if 0 - fprintf(stderr, "color_combine=%08x alpha_combine=%08x color_scale=%08x alpha_scale=%08x\n", +#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 +#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 || @@ -816,8 +816,8 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale; } - #endif - +#endif + return GL_TRUE; } @@ -848,7 +848,7 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) static void import_tex_obj_state(r300ContextPtr rmesa, int unit, r300TexObjPtr texobj) { - #if 0 /* needs fixing.. or should be done elsewhere */ +#if 0 /* needs fixing.. or should be done elsewhere */ GLuint *cmd = R300_DB_STATE(tex[unit]); cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK; @@ -883,7 +883,7 @@ static void import_tex_obj_state(r300ContextPtr rmesa, } texobj->dirty_state &= ~(1 << unit); - #endif +#endif } static void set_texgen_matrix(r300ContextPtr rmesa, @@ -1051,7 +1051,7 @@ static void disable_tex(GLcontext * ctx, int unit) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - #if 0 /* This needs to be redone.. or done elsewhere */ +#if 0 /* This needs to be redone.. or done elsewhere */ if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit)) { /* Texture unit disabled */ if (rmesa->state.texture.unit[unit].texobj != NULL) { @@ -1107,7 +1107,7 @@ static void disable_tex(GLcontext * ctx, int unit) } } } - #endif +#endif } static GLboolean enable_tex_2d(GLcontext * ctx, int unit) @@ -1272,7 +1272,7 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */ } - #if 0 /* do elsewhere ? */ +#if 0 /* do elsewhere ? */ /* Newly enabled? */ if (1 @@ -1300,7 +1300,7 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) rmesa->recheck_texgen[unit] = 0; rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; } - #endif +#endif format = tObj->Image[0][tObj->BaseLevel]->Format; if (rmesa->state.texture.unit[unit].format != format || @@ -1311,7 +1311,7 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) return GL_FALSE; } } - + FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback); return !t->border_fallback; } @@ -1355,20 +1355,20 @@ void r300UpdateTextureState(GLcontext * ctx) r300UpdateTextureUnit(ctx, 1) && r300UpdateTextureUnit(ctx, 2) && r300UpdateTextureUnit(ctx, 3) && - r300UpdateTextureUnit(ctx, 4) && + r300UpdateTextureUnit(ctx, 4) && r300UpdateTextureUnit(ctx, 5) && - r300UpdateTextureUnit(ctx, 6) && + r300UpdateTextureUnit(ctx, 6) && r300UpdateTextureUnit(ctx, 7) ); FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok); - /* This needs correction, or just be done elsewhere + /* This needs correction, or just be done elsewhere if (rmesa->radeon.TclFallback) r300ChooseVertexState(ctx); */ - - #if 0 /* Workaround - disable.. */ + +#if 0 /* Workaround - disable.. */ if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) { /* * T0 hang workaround ------------- @@ -1466,5 +1466,5 @@ void r300UpdateTextureState(GLcontext * ctx) dbg); } } - #endif +#endif } diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c index 5bb7f832e1..b0cddbb1d3 100644 --- a/src/mesa/drivers/dri/r300/radeon_span.c +++ b/src/mesa/drivers/dri/r300/radeon_span.c @@ -352,10 +352,10 @@ static void radeonSetBuffer(GLcontext * ctx, if (radeon->doPageFlip && radeon->sarea->pfCurrentPage == 1) buffer ^= 1; - #if 0 +#if 0 fprintf(stderr, "%s: using %s buffer\n", __FUNCTION__, buffer ? "back" : "front"); - #endif +#endif if (buffer) { radeon->state.pixel.readOffset = |