Jump to content

  • Log In with Google      Sign In   
  • Create Account

Problem mapping a DXGI_FORMAT_BC3_UNORM texture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 aldofi   Members   -  Reputation: 139

Like
0Likes
Like

Posted 19 December 2013 - 08:25 AM

Hi,

 

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);
assert(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.

 



Sponsor:

#2 pcmaster   Members   -  Reputation: 685

Like
2Likes
Like

Posted 19 December 2013 - 09:50 AM

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, 19 December 2013 - 10:09 AM.


#3 MJP   Moderators   -  Reputation: 11736

Like
2Likes
Like

Posted 19 December 2013 - 03:55 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS