Version 1.8 submitted for review

Despite my earlier post on finding a bug on some devices, I managed to find a workaround, so 1.8 has now been submitted to review.

The problem only seemed to occur on older devices that only supported OpenGL ES2, and it made no sense. The OpenGL driver would crash when performing a certain operation in the fragment shader, reporting gpus_ReturnGuiltyForHardwareRestart. After googling the error, I couldn’t find any solutions, many suggested that it may have been incorrectly setup vertex buffer objects, but this was not the case for me. Others suggest a problem in the latest iOS release that was supposedly fixed in Beta.

For my layers, I combine multiple textures for the layer image, mask and overlay, with seperate texture coord buffers for each texture, all created in the same way that has proved 100% reliable for all previous releases. But this latest update adds another z coord to the texture coords in order to achieve the perspective correction feature, it worked fine for the layer image, but if a mask was introduced, it crashed. If I stopped dividing the xy values by the z, in mask only, it worked again. I hadn’t actually changed the size of the texture coords, I’d been using vec4s to respect apples guidelines on padding coordinates to increase memory access efficiency, just recalculated the z value as appropriate instead of using 0.

How was this problem solved? I did the texture coordinate recalculation in the vertex shader, all exactly the same data, same calculation, but it stopped the crash, for no reason I can fathom. Hopefully it’s a problem in iOS that will be resolved, but I don’t know if I want to go through the hassle of creating a custom project to try and reproduce the error for an apple bug report…