S3TC software decoding in OpenMW

Feedback on past, current, and future development.
User avatar
psi29a
Posts: 3452
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

S3TC software decoding in OpenMW

Post by psi29a » 02 Oct 2017, 08:12

Now that the S3TC patent is expired[1], then it shouldn't be a problem now to include software decoding support for systems where S3TC isn't supported in hardware. It is now being reported on all over[2].

My thought was that during startup, we would check for the S3TC extension and warn the user if not available and that we would fallback to decoding it before handing it off to OSG->GPU. We would either do it every time the textured is asked for and not loaded in the GPU, hold this texture in RAM or we would write it out to disk like we do compiled shaders, I'm not sure which one is the best approach.


[1] http://www.patentcountdown.org
[2] https://www.phoronix.com/scan.php?page= ... -Next-Week

User avatar
lysol
Posts: 726
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: S3TC software decoding in OpenMW

Post by lysol » 02 Oct 2017, 08:16

It's already October?! Wow, time flies... But this is great news. I was actually a little worried that someone would extend the patent.
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

User avatar
scrawl
Posts: 2085
Joined: 18 Feb 2012, 11:51
Contact:

Re: S3TC software decoding in OpenMW

Post by scrawl » 02 Oct 2017, 12:57

Yay! Looks like we're late to the party - Mesa already had a patch up their sleeves they just held it back until the expiry date.

Apart from non-supporting drivers, we have another use case for S3TC software decoding. Morrowind's cursor textures need to be uncompressed to be usable as a hardware cursor for SDL. Currently we do this by rendering the texture on the GPU then downloading it back to main memory. This is slow, not very elegant, relies on deprecated 'PBuffer' extension and appears to also trigger bugs in OS X graphics drivers (=cursors being flipped)
My thought was that during startup, we would check for the S3TC extension and warn the user if not available and that we would fallback to decoding it before handing it off to OSG->GPU. We would either do it every time the textured is asked for and not loaded in the GPU, hold this texture in RAM or we would write it out to disk like we do compiled shaders, I'm not sure which one is the best approach.
With support being added to Mesa now, this is probably not a very important issue but I'd tend towards conversion on the fly as the simplest approach.

Some reference material:
OgreDDSCodec
libsquish

We can push for an implementation in OSG's DDSReader, this is where the file is already parsed so adding the decompression routines there makes the most sense. There was a semi-recent topic on the OSG forum discussing this Edit: found it
Last edited by scrawl on 02 Oct 2017, 13:45, edited 1 time in total.

User avatar
psi29a
Posts: 3452
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: S3TC software decoding in OpenMW

Post by psi29a » 02 Oct 2017, 13:32

I'm wondering how this will effect Raspberry Pi for example, I'll check with Eric Anholt to see. I was worried about none-open-source drivers that didn't support S3TC... but if this is a non-issue, I'm glad for it.

TechNoirMK
Posts: 81
Joined: 19 Aug 2015, 15:58

Re: S3TC software decoding in OpenMW

Post by TechNoirMK » 02 Oct 2017, 13:50

I kinda understood what S3TC is, but how can it affect OpenMW in layman's terms? Spend less GPU memory?

User avatar
scrawl
Posts: 2085
Joined: 18 Feb 2012, 11:51
Contact:

Re: S3TC software decoding in OpenMW

Post by scrawl » 02 Oct 2017, 14:34

If the game is already working fine for you, nothing will change. This mainly affects systems that are unable to run OpenMW currently.

TechNoirMK
Posts: 81
Joined: 19 Aug 2015, 15:58

Re: S3TC software decoding in OpenMW

Post by TechNoirMK » 02 Oct 2017, 14:36

As in potatoes? Nice.

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: S3TC software decoding in OpenMW

Post by AnyOldName3 » 02 Oct 2017, 19:21

Not necessarily just potatoes. The compression format used by Morrowind's textures was covered by a patent, so anyone wanting to write a GPU driver that could handle them would have to pay a licencing fee. Obviously, the big GPU vendors had support in their proprietary drivers, but certain open-source ones did not. Now the patent has expired, anyone can add support for that kind of texture to anything.

User avatar
psi29a
Posts: 3452
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: S3TC software decoding in OpenMW

Post by psi29a » 02 Oct 2017, 20:45

Except for those edge cases where there is only a closed/binary driver or that that closed/binary driver is more performant than the FOSS alternative, in either case, they do not support S3TC. This is the case for some ARM things, but it's getting better.

User avatar
ap0
Posts: 247
Joined: 11 Aug 2011, 18:47
Location: France
Contact:

Re: S3TC software decoding in OpenMW

Post by ap0 » 03 Oct 2017, 01:26

It's worth noting that there are no such things are "software patent" in Europe, this is why the party for the expiration mostly happens on the other side of the ocean.

Post Reply

Who is online

Users browsing this forum: Sartur and 4 guests