[SlimDX]2x2 surface problem

Started by
2 comments, last by Evil Steve 13 years, 6 months ago
Hi i am creating surfaces with this code :

output = new SlimDX.Direct3D9.Texture(myDevice, mipWidth, mipHeight, 1, SlimDX.Direct3D9.Usage.None,formatoImagen, SlimDX.Direct3D9.Pool.SystemMemory);

it works, but when the surface is 2x2 dimensions it crashes, the dxt format i use is dxt1
Advertisement
Compressed surface formats must be at least 4x4, since the DXT compression works on 4x4 texel blocks.

if it crashes, that means you're not doing error checking correctly (I.e. not catching the exception).

I'm gonna take a guess that it has something to do with DXT compression operating on 4x4 blocks as detailed here. If that's correct, you might want to use a larger surface of at least 4x4 or forego DXT compression for 2x2 surfaces, which might be a bit small to justify compression anyway. Edit - beaten to it again, must type faster [smile]
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
From the documentation (MSDN seems to be down for me?), D3DFORMAT -> DXTn Compressed Texture Formats:
Quote:The runtime will not allow an application to create a surface using a DXTn format unless the surface dimensions are multiples of 4. This applies to offscreen-plain surfaces, render targets, 2D textures, cube textures, and volume textures.

This topic is closed to new replies.

Advertisement