Brian Paul wrote: > Rune Petersen wrote: >> Keith Whitwell wrote: >>> Rune Petersen wrote: >>> >>> Rune, >>> >>> I don't quite understand what you want to do here. Can you show me >>> the code you'd like to have (ignoring the ctx argument issue)? I >>> would have thought that we could determine the state statically and >>> just rely on the driver to set that state in ctx->NewState when >>> necessary. >>> >> >> >> I am trying to make generic state vars that the drivers can use. >> >> the way I read these functions: >> make_state_flags() - returns the state flags should trigger an update >> of the state var. >> >> _mesa_fetch_state() - fetches the state var. >> >> In order to make generic state vars. >> - I need to get the flags via a callback to the driver from >> make_state_flags(). >> >> I need to fetch the vars via a callback to the driver from >> _mesa_fetch_state(). >> >> >> make_state_flags() >> { >> ..... >> case STATE_INTERNAL: >> { >> switch (state[1]) { >> case STATE_NORMAL_SCALE: >> ..... >> break; >> case STATE_TEXRECT_SCALE: >> ..... >> break; >> case STATE_GENERIC1: >> assert(ctx->Driver.FetchGenericState); >> ctx->Driver.FetchGenericState(ctx, state, value); >> break; >> } >> } >> } >> >> _mesa_fetch_state() >> { >> ..... >> case STATE_INTERNAL: >> switch (state[1]) { >> case STATE_NORMAL_SCALE: >> return _NEW_MODELVIEW; >> case STATE_TEXRECT_SCALE: >> return _NEW_TEXTURE; >> case STATE_GENERIC1: >> assert(ctx->Driver.GetGenericStateFlags); >> return ctx->Driver.GetGenericStateFlags(state); >> } >> >> } > > It seems to me that in ctx->Driver.ProgramStringNotify() you can add any > extra parameters you need to the program's parameters list.
I would prefer to make driver specific version of _mesa_add_state_reference() for internal state vars. No matter how this is done, the driver needs to call add_parameter() to safely add to the parameter list. Would it be all right if I made add_parameter non static? > > Then, during state validation in the driver you can load/update any > parameters you might have added. I think it is a good idea. > In _mesa_fetch_state() we could change the default case for switch > (state[i]) to be silent when it sees any state tokens it doesn't > understand (rather than call _mesa_problem()). Provided it is only done for STATE_INTERNAL, it should be pretty safe. Also I was thinking adding something like STATE_INTERNAL_DRIVER or some such so the drivers have a safe place to start adding there own vars. > > Does that sound feasible? yes, and it would be less intrusive. Rune Petersen ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel