September Development Report

September 22, 2008

This last month, we encountered another great example of how Cider and Cedega benefit each other. We began working on a new Cider title which made heavy use of sRGB textures. These are graphics which are gamma-corrected to be in the sRGB color space instead of the normal RGB range. While OpenGL has supported sRGB textures for a while now, the way in which OpenGL and D3D treat them is vastly different. In D3D, this feature is treated as a state which can be toggled on or off for any supported texture format. In OpenGL, however, you need to consider a sRGB texture as a standalone texture; i.e., it's not a state setting - it's a whole new texture, just like a RGBA (red, green, blue, alpha) texture is different from an RG (red, green) texture.

Our earlier approach involved keeping two copies of the same D3D texture in sync with each other. A game would create a texture, use it as RGB, then toggle the sRGB state to use it as a sRGB texture. When the game did this, we would have to detect that at run-time and re-upload and bind the correct version of the texture to the video card. If a game toggles between the two modes frequently, then it is a huge performance penalty as well as an extra hit to the video card's RAM.

The title we were working on was being particularly tricky because it wanted to render to a texture image and then be able to read it back with the sRGB state enabled. To do this, we needed to read back from the card and re-upload the same image data in the sRGB format. There are some OpenGL methods that can make this operation a bit faster, but it's still a big performance issue when the game is doing this every frame.

We ended up handling this case by modifying the game's pixel shaders on the fly to perform the sRGB gamma correction directly instead of expecting the underlying hardware to toggle back and forth. This results in a few extra instructions in the pixel shader, but we found that it was a vast improvement over our previous method of downloading and uploading every frame. As a bonus, we realized that many of the Steam Source games were behaving like this in DX9 mode as well (Half Life 2: Episode 2, Team Fortress 2, ...). This change resulted in a 2x performance increase in many scenes with some of our hardware. The final release of Cedega 6.1 has these improvements included.

As is well-known, SPORE has just been released for both the PC and the Mac thanks to Cider. Given how anticipated that title has been, we wanted to ensure that it would work well for our Cedega customers as well. When it is installed, SPORE needs to be validated via an internet connection that requires support for the secure HTTPS protocol. HTTPS support was already available in the Cedega engine code; however it was not normally enabled due to some challenges with the state of libSSL and libcrypto libraries on Linux. The various Linux distributions ship with different versions of libSSL and libcrypto with different names. Thus, supporting the different distributions required researching the various names used for the libraries and modifying the engine to attempt to dynamically load the libraries using each of the different names it might be using. Implementing this mechanism allows SPORE to successfully install and be validated on a wide variety of distributions, and it will also help out other titles which need to use HTTPS.

Finally, a significant amount of work has gone into updating our user interface for the 6.1 release of Cedega. While some of this work has involved streamlining the visible interface, a lot of effort has been put into rebuilding the underlying structure of the interface in preparation for the future Cedega features and releases. A number of improvements will be apparent to current users. In particular, effort has been made to ensure that information for supported titles (in the form of GDDB notes) is more prominent. This ensures that critical information that you need to know in order to get the best experience for supported games is communicated clearly. We have also made it easier to edit common properties of shortcuts without leaving the main window. The new interface should be more consistent, easier to use, and just the beginning of improving the Cedega user experience.

Mark Adams
Development Manager
TransGaming Technologies
Broadening the Playing Field