Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Dxt1 textures no mip levels

4: Adsense

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
3 replies to this topic

#1 Plerion   Members   


Posted 21 September 2012 - 04:24 PM

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 };[/source]

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

Edited by Plerion, 21 September 2012 - 04:26 PM.

#2 MJP   Moderators   


Posted 21 September 2012 - 06:31 PM

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, 21 September 2012 - 06:33 PM.

#3 Plerion   Members   


Posted 22 September 2012 - 06:54 AM

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...

#4 mhagain   Members   


Posted 22 September 2012 - 08:32 AM

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, 22 September 2012 - 08:36 AM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

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.