Jump to content
  • Advertisement
Sign in to follow this  

Problem mapping a DXGI_FORMAT_BC3_UNORM texture

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



I'm trying to Map and Umpap mipmap levels of a compressed texture created with the DXGI_FORMAT_BC3_UNORM format.

The problem is that I get an E_INVALIDARG error when I create the texture object with D3D11_CPU_ACCESS_WRITE (even with D3D11_USAGE_DYNAMIC or D3D11_USAGE_DEFAULT flags) using this format, but works ok if i define 1 mipmap level.


This is the code I'm using to create the texture:


D3D11_TEXTURE2D_DESC tex_desc;
tex_desc.Width = 1056;
tex_desc.Height = 1056;
tex_desc.MipLevels = 2;                                        //works with 1 mip level only
tex_desc.ArraySize = 1;
tex_desc.Format = DXGI_FORMAT_BC3_UNORM;
tex_desc.SampleDesc.Count = 1;
tex_desc.SampleDesc.Quality = 0;
tex_desc.Usage = D3D11_USAGE_DYNAMIC;
tex_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
tex_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
tex_desc.MiscFlags = 0;
ID3D11Texture2D * myTexture;
hr = DxEventNotifier::GetD3DDevice()->CreateTexture2D(&tex_desc, NULL, &myTexture);


This problem did not sowed in DX9 using 2 miplevels and D3DFMT_DXT5 format in a line like:


IDirect3DTexture9 *              myTexture;

CreateTexture( 1056, 1056, 2, 0, D3DFMT_DXT5, D3DPOOL_MANAGED, &myTexture, NULL ) );



any suggestions will be appreciated, thanks in advance.


Share this post

Link to post
Share on other sites

First of all, turn on the debug layer (D3D11_CREATE_DEVICE_DEBUG) and see the output for a more specific error!!!


EDIT: I'm getting:

D3D11 ERROR: ID3D11Device::CreateTexture2D: A D3D11_USAGE_DYNAMIC Resource must have MipLevels equal to 1. [ STATE_CREATION ERROR #102: CREATETEXTURE2D_INVALIDMIPLEVELS]

So, you cannot have 2+ mipmap levels for a dynamic resource. Use a default resource for that and update individual mipmaps with UdpateResource, I'd say.

Edited by pcmaster

Share this post

Link to post
Share on other sites

Actually the recommend practice from the hardware vendors is to Map a texture with D3D11_USAGE_STAGING, and then use CopyResource or CopySubresourceRegion to copy the contents to a texture with D3D11_USAGE_DEFAULT.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!