Archived

This topic is now archived and is closed to further replies.

goldsword

Speeding Alpha Blending & DrawPrimitive() Question

Recommended Posts

Hi, ok first of all I would like to know how to perform a fast alpha blending... Trips & Trick like! (maybe ASM improvements) My own ABLEND works like this: (DirectDraw 7) *32 Bit 1. Lock you two surfaces you would like to perform the blend on 2. Get the memory pointers for then and their pitch... 3. Pass the data onto BlendBlt and the alpha value 4. Pre calculate the DWORD value for jumping one line for the two surface 5. Get into the loop for(int y = 0; y < height; y++) 6. Get into the loop for(int x = 0; x < width; x++) 7. Get the RGB for dest and src (slow in VRAM?) 8. Get the R,G,B for both theese (6 ANDS... 4 SHIFTS) 9. Perform ablend (3 MULS, 3 SUBS, 3 ADDS, 3 SHIFTS) 10. Write the new RGB to dest (slow in VRAM?) 11. Increase the mem pointers by 1 DWORD each 12. END OF X LOOP 13. Increase the mem pointers by 1 line jump - width 14. Done The problem is: When I alphablend two 640x480 surfaces my FPS drops from 150 to 2... that not acceptable.. it takes about 0.5 or 1 sec to blend them... Any ideas? I was told reading from VRAM is slow... is this true and why? Could I extract 2 DWORD at a time and somehow cut the time loss? Please give me some hints Q2: DrawPrimitive takes an index right, why does it this? Take a look here: DrawPrimite(VBUFFER,INDEX,TRITYPE) isn''t this the same as DrawPrimitive2(VBUFFER[INDEX],TRITYPE)??? Please I''m a little confused here. Thanks in advance

Share this post


Link to post
Share on other sites