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

2009-08-31 Thread Tony Wasserka
> > You are right, but it would be neat to have them all grouped like they > are in d3dx9tex.h. > Not sure about that, assuming we ever support all possible filters and conversions in D3DXLoadSurfaceFromMemory, we probably don't want to have the texture stuff starting suddenly at line 3k or some

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

2009-08-31 Thread Philip Nilsson
On Sun, Aug 30, 2009 at 12:56:26PM +0200, Tony Wasserka wrote: > > I think it would be better to store this in surface.c since I can't > > think of anything else that would need this. > > > D3DXCheckTextureRequirements in texture.c will make use of the format > table, since it also needs informa

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

2009-08-30 Thread James McKenzie
Henri Verbeet wrote: > I suspect having branches at all inside the loop hurts, but just see > what you can come up with. > I don't think that branching inside the loop is a bad thing, branching outside of the loop might cause some serious issues if not handled properly. James McKenzie

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

2009-08-30 Thread Henri Verbeet
2009/8/30 Tony Wasserka : > 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 s

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

2009-08-30 Thread Tony Wasserka
Hi, > If you make those into arrays you will be able to cut down on the code size, > and the compiler might like it better. > While I didn't notice any speedups in the code itself, it's a bit cleaner (especially the format table) now, thanks! (Come to think about it, it wouldn't have made much

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

2009-08-30 Thread Tony Wasserka
Hi, thanks for the feedback, I agree with most of what you said. Just a few comments: > I think the main thing is that you really don't want branches inside the > inner loop. You can handle the cases where a component is unused > by building a mask before entering the loop and just or'ing with th

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

2009-08-26 Thread Philip Nilsson
On Wed, Aug 26, 2009 at 12:10:36PM +0200, Tony Wasserka wrote: > +BYTE abits, rbits, gbits, bbits; > +BYTE ashift, rshift, gshift, bshift; > +DWORD amask, rmask, gmask, bmask; If you make those into arrays you will be able to cut down on the code size, and the compiler might like it be

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

2009-08-26 Thread Henri Verbeet
2009/8/26 Tony Wasserka : > I hope the code is understandable in the other parts, my few main > questions are: > Do you agree that the architecture is the best approach or can you think > of a better one? would using macros be legal here since it could really > help reduce code duplication when imp

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

2009-08-26 Thread Tony Wasserka
Hi everyone, D3DXLoadSurfaceFromMemory is used to load a chunk of pixel data into a surface, performing any pixel format conversion from signed/unsigned ARGB, floating point or FourCC formats to any other format and also performs various types of filtering actions (one of copying, point filtering,