Jump to content
  • Advertisement
Sign in to follow this  
domin

D3DUSAGE_RENDERTARGET and power of 2 textures

This topic is 4238 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

Hi, if I create a texture with D3DUSAGE_RENDERTARGET usage it is still needed to keep its dimension of power of two? I have checked MS samples and they once create texture like that - just taking width and height from backbuffer (PostProcess sample):
pd3dDevice->CreateTexture(pBackBufferSurfaceDesc->Width,
                          pBackBufferSurfaceDesc->Height,
                          1,
                          D3DUSAGE_RENDERTARGET,
                          D3DFMT_A8R8G8B8,
                          D3DPOOL_DEFAULT,
                          &pRT[t],
                          NULL);

... but in other sample (VMR9Allocator) they first check if device has D3DPTEXTURECAPS_POW2 set and if yes they rounded tex dimensions to power of two:
if (d3dcaps.TextureCaps & D3DPTEXTURECAPS_POW2)
{
    DWORD dwWidth = 1;
    DWORD dwHeight = 1;

    while( dwWidth < lpAllocInfo->dwWidth )
        dwWidth = dwWidth << 1;

    while( dwHeight < lpAllocInfo->dwHeight )
        dwHeight = dwHeight << 1;

[...]

    lpAllocInfo->dwWidth = dwWidth;
    lpAllocInfo->dwHeight = dwHeight;
}

... and then create the render target text with this dimensions:
m_D3DDev->CreateTexture(lpAllocInfo->dwWidth,
                        lpAllocInfo->dwHeight,
                        1,
                        D3DUSAGE_RENDERTARGET, 
                        dm.Format, 
                        D3DPOOL_DEFAULT, 
                        &m_privateTexture, NULL);

So, I'm little confused with this... Please help.

Share this post


Link to post
Share on other sites
Advertisement
You don't need to respect the power of 2 caps for render-target textures if I recall correctly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!