• Advertisement
Sign in to follow this  

Alpha source

This topic is 4318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way of making D3D interpret X8 value of X8R8G8B8 surface format as an alpha value while alpha-blending? Thank you

Share this post


Link to post
Share on other sites
Advertisement
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
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
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
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
Sign in to follow this  

  • Advertisement