Creating textures from file

Mar 13, 2015 at 9:52 PM
Edited Mar 13, 2015 at 10:48 PM
Does anyone have the same problem as I have with Creating textures from file ? What it is CreateDDSTextureFromFile method fails when I try to load dds picture witch size is less than
60 x 60 can any one help me with that please


the HRESULT error is E_INVALIDARG One or more arguments are invalid. and I get this when sprite is les than 60x60

when I step through it fails in CreateD3DResources method after call to CreateTexture2D hr is set to E_INVALIDARG

and I'm using paint.net to create my dds files
Mar 13, 2015 at 10:59 PM
It's solved for some reason when image is less than 60x60 and DXT1 (opaque/1bit alfa ) is set it fails but when A8R8G8B8 is set it works fine
Coordinator
Mar 14, 2015 at 5:37 AM
Edited Mar 14, 2015 at 5:45 AM
What exactly was the width & height of the image when it failed? Can you post a link to the DDS? Generally DXT1 should work on any device. BTW, what feature level is your device?

If the image is not a multiple of 4 in each dimension, then Direct3D won't' load it. If it is not a power of 2 in each dimension and had mipmaps, then feature level 9.3 devices won't load it.

Also, if you enable the debug device, you will probably get a detailed debug message explaining exactly why you got an E_INVALIDARG.
Mar 14, 2015 at 2:55 PM
I will post all that when my laptop finally gets through visual studio update
Mar 14, 2015 at 5:42 PM
Edited Mar 14, 2015 at 5:49 PM
ok so my feature level i 10_0 the dds texture is just simple sprite created in paint.net when I save it in size witch is not power of 2 and pixel format is DXT1 (opaque/1bit alfa ) it fails when I change pixel format to A8R8G8B8 it loads and the size than can be any even some fancy like 34 X 77

and here is error message from debug device when DXT1 (opaque/1bit alfa ) pixel format is used



D3D11 ERROR: ID3D11Device::CreateTexture2D: A Texture2D created with the following Format (0x47, BC1_UNORM) experiences aligment restrictions on the dimensions of the Resource. The dimensions, which are (Width: 34, Height: 77), must be multiples of (Width: 4, Height: 4). [ STATE_CREATION ERROR #101: CREATETEXTURE2D_INVALIDDIMENSIONS]
D3D11: BREAK enabled for the previous message, which was: [ ERROR STATE_CREATION #101: CREATETEXTURE2D_INVALIDDIMENSIONS ]
First-chance exception at 0x76922C1A (KernelBase.dll) in SimpleGame.exe: 0x0000087A (parameters: 0x00000001, 0x00C0BAAC, 0x00C0C828).
Unhandled exception at 0x76922C1A (KernelBase.dll) in SimpleGame.exe: 0x0000087A (parameters: 0x00000001, 0x00C0BAAC, 0x00C0C828).

When I load the same dds file with pixel format A8R8G8B8 i works fine