Sign in to follow this  
tokaplan

Alpha source

Recommended Posts

Demirug    884
No because the spec say that X in the texture formats have to be ignored from the GPU. Why don’t you use the A8R8G8B8 Format?

Share this post


Link to post
Share on other sites
S1CA    1418
Quote:
Original post by tokaplan
Is there any way of making D3D interpret X8 value of X8R8G8B8 surface format as an alpha value while alpha-blending?
Thank you


With D3D10 you could probably create a typeless resource and then create view(s) of the required type.

With D3D9, not possible. You could LockRect() it and those bits might be valid - if you're lucky. Specifying a format with an 'X' when you created the resource means you have agreed with D3D that there are absolutely no guarantees that those bits will contain anything of any use.

As Demirug said: is there any reason why you create the resource as A8R8G8B8 and ignore the alpha channel when you don't need it (having it around doesn't affect performance compared to X8R8G8B8, and doesn't imply anything about device state).

Share this post


Link to post
Share on other sites
tokaplan    122
Actually, I need GetDC() on this texture, and of course, it doesn't work on alpha surfaces. I just wanted to use GDI's BitBlt to avoid accesing the memory directly. But it looks pretty much as if I can't help it)).
Thanks guys

Share this post


Link to post
Share on other sites
S1CA    1418
Quote:
Original post by tokaplan
Actually, I need GetDC() on this texture, and of course, it doesn't work on alpha surfaces. I just wanted to use GDI's BitBlt to avoid accesing the memory directly. But it looks pretty much as if I can't help it)).
Thanks guys


Ah, right, that explains a lot.

I should mention that although GDI does provide some hardware acceleration paths, GetDC() on a Direct3D/DirectDraw surface tends to do the equivilent of [at least] a LockRect() to get the surface bits anyway (particularly if locking a surface that's part of a texture, since it'll usually be stored swizzled/tiled rather than linear).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this