Sign in to follow this  
Lumz

CreateTexture2D INVALID_ARG with DXGI_FORMAT_R32G32B32_FLOAT

Recommended Posts

Hi, 

 

I've been trying to change my render target format from DXGI_FORMAT_R32G32B32A32_FLOAT (working) to DXGI_FORMAT_R32G32B32_FLOAT (not working) but i'm getting INVALID_ARG on CreateTexture2D().

 

I can't find anything about it on MSDN. Maybe it's unrelated but i may rather post the whole description.

 

m_tex2d_desc.Width = 1280;
m_tex2d_desc.Height = 720;
m_tex2d_desc.MipLevels = 0; 
m_tex2d_desc.ArraySize = 1;
m_tex2d_desc.Format = DXGI_FORMAT_R32G32B32_FLOAT;
m_tex2d_desc.SampleDesc.Count = 1;
m_tex2d_desc.Usage = D3D11_USAGE_DEFAULT;
m_tex2d_desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
m_tex2d_desc.CPUAccessFlags = 0;
m_tex2d_desc.MiscFlags = 0;

 

Regards.

Share this post


Link to post
Share on other sites

R32G32B32_FLOAT is actually an optional format for FEATURE_LEVEL_11_0. Before using a format you need to check this table to see if it's supported for your feature level. In the case of optional formats, you need to check at runtime using ID3D11Device::CheckFormatSupport.  In this particular case, I don't think there's any hardware that actually supports that format.

In general you should also create your device with D3D11_CREATE_DEVICE_DEBUG so that you get detailed error messages in these kinds of situations.
 

Share this post


Link to post
Share on other sites

Thank you, very helpful. It's my first time with Direct X and i've done this deferred rendering engine. The problem is that it's actually quite slow compared to forward MPML. So i thought maybe i could use a better format for my gbuffer. I'm currently using DXGI_FORMAT_R32G32B32A32_FLOAT and only storing float3 for each pixel. What do you recommend ?

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