Sign in to follow this  
jor1980

[SlimDX]2x2 surface problem

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this