Jump to content
Eternal Lands Official Forums
Torg

s3tc (or any?) decompression bug

Recommended Posts

I just went to fire up my client and it consistently crashed when trying to load the login screen. After tracing it with gdb I discovered this was due to a load_texture() assertion, which in turn is caused by build_texture() erroring due to my card not supporting s3tc compression.

 

However, looking at the dds code, it checks for compatibility and decompresses the image in the code if the card can't handle it.... and it works correctly.

 

I believe the problem is due to a copy and paste error? where the code for checking the image properties in build_texture() is doubled. The first block (texture.c:99-214) checks against the variable image->format, which is set to "uncompressed" in the dds code if compression is not supported. The second block (texture.c:216-311) checks against the original variable "format", which is unchanged (still set to the compressed format), and results in the code thinking that it needs to uncompress the image on the card, which it can't and so returns an error.

 

As far as I can tell, the necessary variables are all set in the first switch block, and the second switch block and the following error tests are either old code, or a copy/paste error. Commenting out that code (texture.c:216-311) stops the client from crashing and appears not to have any adverse effects.

Share this post


Link to post
Share on other sites

The two blocks seem to be there on purpose, given the explicit check for compressed == 0 on line 216, but I will admit that the code confuses the hell out of me and that I'm unable to divine the reason for the second block.

 

xaphier?

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×