From d240b29b95573e37baa627650661a2ced109c68d Mon Sep 17 00:00:00 2001 From: Aapo Tahkola Date: Wed, 26 Oct 2005 17:55:28 +0000 Subject: [PATCH] Reduce stderr noise and fix some compiler warnings. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +- src/mesa/drivers/dri/r300/r300_render.c | 71 +++----- src/mesa/drivers/dri/r300/r300_state.c | 74 +------- src/mesa/drivers/dri/r300/r300_state.h | 2 + src/mesa/drivers/dri/r300/r300_tex.c | 23 --- src/mesa/drivers/dri/r300/r300_texstate.c | 202 ---------------------- 7 files changed, 33 insertions(+), 345 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 94c7031baae..c2733f3db3c 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -50,6 +50,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_reg.h" #include "r300_cmdbuf.h" #include "r300_emit.h" +#include "r300_state.h" // Set this to 1 for extremely verbose debugging of command buffers @@ -246,7 +247,6 @@ static int check_##NM( r300ContextPtr r300, \ #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) CHECK( always, atom->cmd_size ) -CHECK( never, 0 ) CHECK( variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0 ) CHECK( vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd)*4) : 0 ) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index f43b50e34df..4236bdbcca5 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -314,7 +314,7 @@ static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp) static pfs_reg_t negate(pfs_reg_t r) { - r.negate = 1; + r.negate = !r.negate; return r; } @@ -911,7 +911,6 @@ static void init_program(struct r300_fragment_program *rp) struct fragment_program *mp = &rp->mesa_program; struct fp_instruction *fpi; GLuint InputsRead = mp->InputsRead; - GLuint fp_reg = 0; GLuint temps_used = 0; /* for rp->temps[] */ int i; @@ -1020,7 +1019,6 @@ static void update_params(struct r300_fragment_program *rp) { void translate_fragment_shader(struct r300_fragment_program *rp) { - int i; if (!rp->translated) { init_program(rp); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 8f74007faa9..1599f0f6af4 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -70,10 +70,7 @@ extern int future_hw_tcl_on; static int r300_get_primitive_type(r300ContextPtr rmesa, GLcontext *ctx, int prim) { - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - int type=-1; + int type=-1; switch (prim & PRIM_MODE_MASK) { case GL_POINTS: @@ -121,11 +118,8 @@ static int r300_get_num_verts(r300ContextPtr rmesa, int num_verts, int prim) { - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - int type=-1, verts_off=0; - char *name="UNKNOWN"; + int verts_off=0; + char *name="UNKNOWN"; switch (prim & PRIM_MODE_MASK) { case GL_POINTS: @@ -184,13 +178,15 @@ static int r300_get_num_verts(r300ContextPtr rmesa, break; } - if(num_verts - verts_off == 0){ - WARN_ONCE("user error: Need more than %d vertices to draw primitive %s !\n", num_verts, name); - return 0; - } + if (RADEON_DEBUG & DEBUG_VERTS) { + if (num_verts - verts_off == 0) { + WARN_ONCE("user error: Need more than %d vertices to draw primitive %s !\n", num_verts, name); + return 0; + } - if(verts_off > 0){ - WARN_ONCE("user error: %d is not a valid number of vertices for primitive %s !\n", num_verts, name); + if (verts_off > 0) { + WARN_ONCE("user error: %d is not a valid number of vertices for primitive %s !\n", num_verts, name); + } } return num_verts - verts_off; @@ -333,9 +329,6 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx, TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLuint i; - /* Only do 2d textures */ - struct gl_texture_object *to=ctx->Texture.Unit[0].Current2D; - r300TexObjPtr t=to->DriverData; LOCAL_VARS @@ -470,6 +463,8 @@ static void inline fire_EB(PREFIX unsigned long addr, int vertex_count, int type exit(1); #endif #else + (void)magic_2, (void)magic_1, (void)t_addr; + addr_a = 0; check_space(6); @@ -501,11 +496,7 @@ static void r300_render_vb_primitive(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); @@ -515,6 +506,7 @@ static void r300_render_vb_primitive(r300ContextPtr rmesa, if(rmesa->state.Elts){ r300EmitAOS(rmesa, rmesa->state.aos_count, 0); #if 0 + int i; start_index32_packet(num_verts, type); for(i=0; i < num_verts; i++) e32(rmesa->state.Elts[start+i]); /* start ? */ @@ -542,11 +534,11 @@ static void r300_render_vb_primitive(r300ContextPtr rmesa, static GLboolean r300_run_vb_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - int i, j; - LOCAL_VARS + r300ContextPtr rmesa = R300_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + int i; + LOCAL_VARS if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); @@ -782,25 +774,15 @@ void dump_dt(struct dt *dt, int count) static GLboolean r300_run_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; if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); - -#if 1 - #if 0 return r300_run_immediate_render(ctx, stage); #else return r300_run_vb_render(ctx, stage); #endif -#else - return GL_TRUE; -#endif } @@ -813,9 +795,8 @@ static GLboolean r300_run_render(GLcontext *ctx, #define FALLBACK_IF(expr) \ do { \ if (expr) { \ - if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \ - fprintf(stderr, "%s: fallback:%s\n", \ - __FUNCTION__, #expr); \ + if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \ + WARN_ONCE("fallback:%s\n", #expr); \ /*stage->active = GL_FALSE*/; \ return; \ } \ @@ -823,8 +804,6 @@ do { \ static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - int i; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); @@ -903,11 +882,7 @@ const struct tnl_pipeline_stage _r300_render_stage = { static GLboolean r300_run_tcl_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; - struct r300_vertex_program *vp; + r300ContextPtr rmesa = R300_CONTEXT(ctx); hw_tcl_on=future_hw_tcl_on; @@ -923,8 +898,6 @@ static GLboolean r300_run_tcl_render(GLcontext *ctx, static void r300_check_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *stage) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - int i; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index e0f357d8c45..90304a05fd3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1015,7 +1015,6 @@ void r300_setup_textures(GLcontext *ctx) struct r300_tex_obj *t; r300ContextPtr r300 = R300_CONTEXT(ctx); int max_texture_unit=-1; /* -1 translates into no setup costs for fields */ - struct gl_texture_unit *texUnit; GLuint OutputsWritten; if(hw_tcl_on) @@ -1433,16 +1432,6 @@ static void r300GenerateSimpleVertexShader(r300ContextPtr r300) void r300SetupVertexShader(r300ContextPtr rmesa) { GLcontext* ctx = rmesa->radeon.glCtx; - struct r300_vertex_shader_fragment unk4={ - length: 4, - body: { f: { - /*0.0*/(rand()%100)/10.0, - /*0.0*/(rand()%100)/10.0, - /*1.0*/(rand()%100)/10.0, - /*0.0*/(rand()%100)/10.0 - } } - }; - LOCAL_VARS /* Reset state, in case we don't use something */ ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0; @@ -1513,7 +1502,6 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) GLcontext* ctx = rmesa->radeon.glCtx; int inst_count; int param_count; - LOCAL_VARS struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); @@ -1553,6 +1541,8 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) #endif } +extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); + extern int future_hw_tcl_on; void r300UpdateShaderStates(r300ContextPtr rmesa) { @@ -1878,66 +1868,16 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) r300ResetHwState(r300); } -/* Checks that r300ResetHwState actually modifies all states. - Should probably be burried in somewhere else as this file is getting longish. */ -static void verify_r300ResetHwState(r300ContextPtr r300, int stage) -{ - struct r300_state_atom* atom; - int i; - drm_r300_cmd_header_t cmd; - - if(stage){ /* mess around with states */ - unsigned long fp1, cb1; - - fp1=r300->hw.fp.cmd[R300_FP_CMD_1]; /* some special cases... */ - cb1=r300->hw.cb.cmd[R300_CB_CMD_1]; - - fprintf(stderr, "verify begin:\n"); - - foreach(atom, &r300->hw.atomlist) { - for(i=1; i < (*atom->check)(r300, atom); i++) - atom->cmd[i]=0xdeadbeef; - } - r300->hw.fp.cmd[R300_FP_CMD_1]=fp1; - r300->hw.cb.cmd[R300_CB_CMD_1]=cb1; - - foreach(atom, &r300->hw.atomlist) { - cmd.u=atom->cmd[0]; - switch(cmd.header.cmd_type){ - case R300_CMD_PACKET0: - case R300_CMD_VPU: - case R300_CMD_PACKET3: - case R300_CMD_END3D: - case R300_CMD_CP_DELAY: - case R300_CMD_DMA_DISCARD: - break; - default: fprintf(stderr, "unknown cmd_type %d in atom %s\n", - cmd.header.cmd_type, atom->name); - } - - } - } else { /* check that they were set */ - foreach(atom, &r300->hw.atomlist) { - for(i=1; i < (*atom->check)(r300, atom); i++) - if(atom->cmd[i]==0xdeadbeef) - fprintf(stderr, "atom %s is untouched\n", atom->name); - } - } -} - /** * Completely recalculates hardware state based on the Mesa state. */ void r300ResetHwState(r300ContextPtr r300) { GLcontext* ctx = r300->radeon.glCtx; - int i; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); - //verify_r300ResetHwState(r300, 1); - /* This is a place to initialize registers which have bitfields accessed by different functions and not all bits are used */ @@ -2259,7 +2199,6 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.vps.cmd[R300_VPS_ZERO_3] = 0; //END: TODO - //verify_r300ResetHwState(r300, 0); r300->hw.all_dirty = GL_TRUE; } @@ -2305,10 +2244,11 @@ void r300InitState(r300ContextPtr r300) static void r300RenderMode( GLcontext *ctx, GLenum mode ) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); - WARN_ONCE("TODO: fallback properly when rendering mode is not GL_RENDER\n" - "\tThe way things are now neither selection nor feedback modes work\n") -// FALLBACK( rmesa, R300_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); + r300ContextPtr rmesa = R300_CONTEXT(ctx); + (void)rmesa; + WARN_ONCE("TODO: fallback properly when rendering mode is not GL_RENDER\n" + "\tThe way things are now neither selection nor feedback modes work\n") +// FALLBACK( rmesa, R300_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); } /** diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index 3e157943711..ee54e4b3eff 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -70,4 +70,6 @@ extern void r300_setup_textures(GLcontext *ctx); extern void r300_setup_rs_unit(GLcontext *ctx); extern void r300UpdateShaderStates(r300ContextPtr rmesa); +extern void r300_print_state_atom(r300ContextPtr r300, struct r300_state_atom *state); + #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 73d16270e32..62f3dcfeef2 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -928,7 +928,6 @@ static void r300TexEnv(GLcontext * ctx, GLenum target, { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; if (RADEON_DEBUG & DEBUG_STATE) { fprintf(stderr, "%s( %s )\n", @@ -1084,27 +1083,6 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) _mesa_delete_texture_object(ctx, texObj); } -/* Need: - * - Same GEN_MODE for all active bits - * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj - * - STRQ presumably all supported (matrix means incoming R values - * can end up in STQ, this has implications for vertex support, - * presumably ok if maos is used, though?) - * - * Basically impossible to do this on the fly - just collect some - * basic info & do the checks from ValidateState(). - */ -static void r300TexGen(GLcontext * ctx, - GLenum coord, GLenum pname, const GLfloat * params) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint unit = ctx->Texture.CurrentUnit; -#if 0 /* Disable this for now - looks like we will be recalculating everything - anyway */ - rmesa->recheck_texgen[unit] = GL_TRUE; -#endif -} - /** * Allocate a new texture object. * Called via ctx->Driver.NewTextureObject. @@ -1156,7 +1134,6 @@ void r300InitTextureFuncs(struct dd_function_table *functions) functions->TexEnv = r300TexEnv; functions->TexParameter = r300TexParameter; - functions->TexGen = r300TexGen; functions->CompressedTexImage2D = r300CompressedTexImage2D; functions->CompressedTexSubImage2D = r300CompressedTexSubImage2D; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 359a0b1b8af..ec1adfebc98 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -863,208 +863,6 @@ static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit) R200_CLAMP_Q_MASK | \ R200_VOLUME_FILTER_MASK) -static void import_tex_obj_state(r300ContextPtr rmesa, - int unit, r300TexObjPtr texobj) -{ -#if 0 /* needs fixing.. or should be done elsewhere */ - GLuint *cmd = R300_DB_STATE(tex[unit]); - - cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK; - cmd[TEX_PP_TXFILTER] |= texobj->filter & TEXOBJ_TXFILTER_MASK; - cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK; - cmd[TEX_PP_TXFORMAT] |= texobj->format & TEXOBJ_TXFORMAT_MASK; - cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK; - cmd[TEX_PP_TXFORMAT_X] |= - texobj->format_x & TEXOBJ_TXFORMAT_X_MASK; - cmd[TEX_PP_TXSIZE] = texobj->size; /* NPOT only! */ - cmd[TEX_PP_TXPITCH] = texobj->pitch; /* NPOT only! */ - cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset; - cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color; - R200_DB_STATECHANGE(rmesa, &rmesa->hw.tex[unit]); - - if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) { - GLuint *cube_cmd = R200_DB_STATE(cube[unit]); - GLuint bytesPerFace = texobj->base.totalSize / 6; - ASSERT(texobj->totalSize % 6 == 0); - cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] = - texobj->pp_txoffset + 1 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] = - texobj->pp_txoffset + 2 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = - texobj->pp_txoffset + 3 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = - texobj->pp_txoffset + 4 * bytesPerFace; - cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = - texobj->pp_txoffset + 5 * bytesPerFace; - R200_DB_STATECHANGE(rmesa, &rmesa->hw.cube[unit]); - } - - texobj->dirty_state &= ~(1 << unit); -#endif -} - -static void set_texgen_matrix(r300ContextPtr rmesa, - GLuint unit, - const GLfloat * s_plane, - const GLfloat * t_plane, const GLfloat * r_plane) -{ - static const GLfloat scale_identity[4] = { 1, 1, 1, 1 }; - - if (!TEST_EQ_4V(s_plane, scale_identity) || - !TEST_EQ_4V(t_plane, scale_identity) || - !TEST_EQ_4V(r_plane, scale_identity)) { - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; - rmesa->TexGenMatrix[unit].m[0] = s_plane[0]; - rmesa->TexGenMatrix[unit].m[4] = s_plane[1]; - rmesa->TexGenMatrix[unit].m[8] = s_plane[2]; - rmesa->TexGenMatrix[unit].m[12] = s_plane[3]; - - rmesa->TexGenMatrix[unit].m[1] = t_plane[0]; - rmesa->TexGenMatrix[unit].m[5] = t_plane[1]; - rmesa->TexGenMatrix[unit].m[9] = t_plane[2]; - rmesa->TexGenMatrix[unit].m[13] = t_plane[3]; - - /* NOTE: r_plane goes in the 4th row, not 3rd! */ - rmesa->TexGenMatrix[unit].m[3] = r_plane[0]; - rmesa->TexGenMatrix[unit].m[7] = r_plane[1]; - rmesa->TexGenMatrix[unit].m[11] = r_plane[2]; - rmesa->TexGenMatrix[unit].m[15] = r_plane[3]; - - //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } -} - -/* Need this special matrix to get correct reflection map coords */ -static void set_texgen_reflection_matrix(r300ContextPtr rmesa, GLuint unit) -{ - static const GLfloat m[16] = { - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 0, -1, - 0, 0, -1, 0 - }; - _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m); - _math_matrix_analyse(&(rmesa->TexGenMatrix[unit])); - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; -} - -/* Need this special matrix to get correct normal map coords */ -static void set_texgen_normal_map_matrix(r300ContextPtr rmesa, GLuint unit) -{ - static const GLfloat m[16] = { - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 0, 1, - 0, 0, 1, 0 - }; - _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m); - _math_matrix_analyse(&(rmesa->TexGenMatrix[unit])); - rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit; -} - -/* Ignoring the Q texcoord for now. - * - * Returns GL_FALSE if fallback required. - */ -static GLboolean r300_validate_texgen(GLcontext * ctx, GLuint unit) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit * 4; - GLuint tmp = rmesa->TexGenEnabled; - - rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit); - rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE << unit); - rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE << unit); - rmesa->TexGenInputs &= ~(R200_TEXGEN_INPUT_MASK << inputshift); - rmesa->TexGenNeedNormals[unit] = 0; - - if (0) - fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit); - - if ((texUnit->TexGenEnabled & (S_BIT | T_BIT | R_BIT)) == 0) { - /* Disabled, no fallback: - */ - rmesa->TexGenInputs |= - (R200_TEXGEN_INPUT_TEXCOORD_0 + unit) << inputshift; - return GL_TRUE; - } else if (texUnit->TexGenEnabled & Q_BIT) { - /* Very easy to do this, in fact would remove a fallback case - * elsewhere, but I haven't done it yet... Fallback: - */ - /*fprintf(stderr, "fallback Q_BIT\n"); */ - return GL_FALSE; - } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT) && - texUnit->GenModeS == texUnit->GenModeT) { - /* OK */ - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - /* continue */ - } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT | R_BIT) && - texUnit->GenModeS == texUnit->GenModeT && - texUnit->GenModeT == texUnit->GenModeR) { - /* OK */ - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - /* continue */ - } else { - /* Mixed modes, fallback: - */ - /* fprintf(stderr, "fallback mixed texgen\n"); */ - return GL_FALSE; - } - - rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit; - - switch (texUnit->GenModeS) { - case GL_OBJECT_LINEAR: - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_OBJ << inputshift; - set_texgen_matrix(rmesa, unit, - texUnit->ObjectPlaneS, - texUnit->ObjectPlaneT, texUnit->ObjectPlaneR); - break; - - case GL_EYE_LINEAR: - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE << inputshift; - set_texgen_matrix(rmesa, unit, - texUnit->EyePlaneS, - texUnit->EyePlaneT, texUnit->EyePlaneR); - break; - - case GL_REFLECTION_MAP_NV: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= - R200_TEXGEN_INPUT_EYE_REFLECT << inputshift; - set_texgen_reflection_matrix(rmesa, unit); - break; - - case GL_NORMAL_MAP_NV: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= - R200_TEXGEN_INPUT_EYE_NORMAL << inputshift; - set_texgen_normal_map_matrix(rmesa, unit); - break; - - case GL_SPHERE_MAP: - rmesa->TexGenNeedNormals[unit] = GL_TRUE; - rmesa->TexGenInputs |= R200_TEXGEN_INPUT_SPHERE << inputshift; - break; - - default: - /* Unsupported mode, fallback: - */ - /* fprintf(stderr, "fallback unsupported texgen\n"); */ - return GL_FALSE; - } - - rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit; - - if (tmp != rmesa->TexGenEnabled) { - //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; - } - - return GL_TRUE; -} - static void disable_tex(GLcontext * ctx, int unit) { #if 0 /* This needs to be redone.. or done elsewhere */ -- 2.30.2