[5/5] wined3d: change colorkey fixup for stage 0 alphaop / alphaarg

Stefan Dösinger stefandoesinger at gmx.at
Thu Jan 3 09:27:27 CST 2008

Am Donnerstag, 3. Januar 2008 06:20:26 schrieb Alexander Dorofeyev:
> Oh now I see this case I haven't thought about. For some reason, or maybe
> no reason at all, Moto racer sets alphaop to selectarg1 and alphaarg1 to
> current (diffuse)! That looks kind of strange (if it then gives vertices
> with diffuse alpha = 0), but maybe it's just "optimizing" by setting states
> it will need later. And it expects it to work despite diffuse alpha is 0
> because it disables alpha blending and alpha test. In wine though the
> latter state is overriden by colorkey emulation so the result is bad. But I
> think this can be sorted out by checking ALPHABLENDENABLE, because it's
> probably a reasonable indicator for telling whether the app is going to
> give something meaningful in diffuse alpha or not. Do you think something
> along the lines of attached patch can be an acceptable solution? With it,
> AVP1 game works properly and it also seems to bring back geometry in moto
> racer, at least as far as I can tell.
Yes, I think this idea is quite nice. It makes a bit of a hacky impression, 
but the color keying emulation is a hack after all. Only one small 
suggestion, I think you don't have to call tex_alphaop unconditionally in 
state_blend, I think this is only needed if COLORKEYENABLE is on.

On a sidenode, somewhere I've seen a document stating that the Nvidia Windows 
driver emulates color keying with the alpha test as well:


It implements the alpha setting in a slightly different way, and I am not sure 
if we can emulate that without a fragment shader. Still it's an interesting 

More information about the wine-devel mailing list