CreateTexture2D INVALID_ARG with DXGI_FORMAT_R32G32B32_FLOAT

Started by
2 comments, last by MJP 11 years, 2 months ago

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.

Advertisement

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.

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 ?

What do you need to store in your G-Buffer? There's all kinds of ways to compress the data for your G-Buffer...for most things you do not need full 32-bit float precision.

This topic is closed to new replies.

Advertisement