From: Brian Paul Date: Thu, 4 Feb 2010 23:40:47 +0000 (-0700) Subject: mesa: add back-door support for cylindrical texture wrap mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a9f1eed2ba02f2ae2bf92d16f89d10f09b2a21e;p=mesa.git mesa: add back-door support for cylindrical texture wrap mode If the texture priority field is 0.125 set the PROG_PARAM_BIT_CYL_WRAP flag. The gallium state tracker will look for this flag. This feature is only for testing purposes and may be remove at some point. But if it's useful we could write a GL/Mesa extension to expose it properly. --- diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 414607e2288..5cc5fdaebd1 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -113,6 +113,8 @@ struct state_key { GLuint NumArgsA:3; /**< up to MAX_COMBINER_TERMS */ GLuint ModeA:5; /**< MODE_x */ + GLuint texture_cyl_wrap:1; /**< For gallium test/debug only */ + struct mode_opt OptRGB[MAX_COMBINER_TERMS]; struct mode_opt OptA[MAX_COMBINER_TERMS]; } unit[MAX_TEXTURE_UNITS]; @@ -464,6 +466,10 @@ static GLuint make_state_key( GLcontext *ctx, struct state_key *key ) key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR; key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0; } + + /* this is a back-door for enabling cylindrical texture wrap mode */ + if (texObj->Priority == 0.125) + key->unit[i].texture_cyl_wrap = 1; } /* _NEW_LIGHT | _NEW_FOG */ @@ -1302,6 +1308,12 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit ) } else p->src_texture[unit] = get_zero(p); + + if (p->state->unit[unit].texture_cyl_wrap) { + /* set flag which is checked by Mesa->Gallium program translation */ + p->program->Base.InputFlags[0] |= PROG_PARAM_BIT_CYL_WRAP; + } + } } diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 699cb0c7356..1111c859769 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -43,6 +43,7 @@ #define PROG_PARAM_BIT_INVARIANT 0x2 /**< for varying vars (GLSL 1.20) */ #define PROG_PARAM_BIT_FLAT 0x4 /**< for varying vars (GLSL 1.30) */ #define PROG_PARAM_BIT_LINEAR 0x8 /**< for varying vars (GLSL 1.30) */ +#define PROG_PARAM_BIT_CYL_WRAP 0x10 /**< XXX gallium debug */ /*@}*/