d3dx9: Implement converting and copying surface data in D3DXLoadSurfaceFromMemory (review please)

Henri Verbeet hverbeet at gmail.com
Sun Aug 30 14:37:56 CDT 2009

2009/8/30 Tony Wasserka <tony.wasserka at freenet.de>:
> Good point. Not sure whether that eliminates the need for both the
> 'if(DestFormat.bits[x])' AND 'if(SrcFormat.bits[x])', but I can merge
> them into one 'if' at least.
You'd need an AND mask for the DestFormat bits, but it's the same
basic principle.

>> As for the shifts,
>> in the large majority of cases you will only need two shifts. The only
>> time you need more than that is when the destination component is more
>> than two times the size of the source component, so I don't think you
>> want to bother with that in the common function.
> I don't think there's much overhead by doing the for loop since even in
> the cases that need to shifts there's at least one if(SrcFormat.bits <
> DestFormat.bits) necessary. The code inside the for loop will just add
> one assignment and an additional if.
I suspect having branches at all inside the loop hurts, but just see
what you can come up with.

More information about the wine-devel mailing list