Jump to content
  • Advertisement
Sign in to follow this  

Dxt1 textures no mip levels

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

Hello everbody!

Im trying to create a texture that has Dxt1 compressed data. So basically the format Format.Dxt1 from SlimDX.Direct3D9.Format enumeration. In order to do this im using BC1_UNorm in D3D11 as a format as thats what i could read is the correct format in D3D11. Well, there is a problem with that format:
My texture has several mip levels already defined but when i set a mip level other to 1 the texture creation fails with D3DERR_INVALID_ARG, including 0 which is supposed by the MSDN for a full set of mip maps.
[source lang="csharp"] Texture2DDescription desc = new Texture2DDescription()
Usage = ResourceUsage.Dynamic,
SampleDescription = new SampleDescription(1, 0),
OptionFlags = ResourceOptionFlags.None,
MipLevels = levelCount,
Width = width,
Height = height,
Format = texFmt,
CpuAccessFlags = CpuAccessFlags.Write,
BindFlags = BindFlags.ShaderResource,
ArraySize = 1

levelCount in a particular case is 9, width and height are 256, texFmt is BC1_UNorm.

How do i create a texture with S3TC and several mip levels?

Greetings and thanks in advance
Plerion Edited by Plerion

Share this post

Link to post
Share on other sites
You're trying to make it a dynamic texture, and dynamic textures don't support mip maps. Do you actually need it to be dynamic?

FYI if you create the device with the DEBUG flag it will output messages about errors like this. It will output them to the native debugging stream, so you need to have native debugging enabled or use a program like DebugView to see the messages in a managed app. Edited by MJP

Share this post

Link to post
Share on other sites
Well it seems ive misunderstood some of the concepts with the CpuAccessFlags and/or ResourceUsages. After ive read the section about resources in my book i assumed that for UpdateSubresource i need to specify CpuAccessFlags.Write and thus i need to use Dynamic as usage. But obviously this is not needed. Changed it to Default and CpuAccessFlags.None, now it works and also UpdateSubresource works which i dont understand to be honest...

Share this post

Link to post
Share on other sites
View the CPU Access Flags member as being relevant to a Map call - you need a CPU access that will allow for the map type you're using. This is specifically called out by the documentation for D3D11_CPU_ACCESS_FLAG (see http://msdn.microsof...6(v=vs.85).aspx) where each flag is defined in terms of the resource being mappable.

You can still use UpdateSubresource on USAGE_DEFAULT resources. Here you're not actually accessing the resource data directly yourself, instead you're shoving a chunk of data to the driver and telling the driver to use it to update the resource. So the general rule is - if D3D gives you a pointer via a Map operation then you need CPU access, if you provide the pointer yourself and send data to D3D then you don't. Edited by mhagain

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!