Shader errors on iOS 7 devices

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Shader errors on iOS 7 devices

Post by SufferinPup » Thu Nov 07, 2013 6:40 pm

I've recompiled Ogre 1.8.1 with the Xcode 5, and my game runs fine on iOS 6 devices. But if I try to run it on iOS 7 devices I get shader compiler errors like this:

Code: Select all

Vertex Program:2693905785_VS Fragment Program:1694536014_FS
GLSL vertex program result : 
Validation Failed: Program does not contain fragment shader. Results will be undefined.
Vertex Program:2693905785_VS Fragment Program:1694536014_FS
GLSL fragment program result : 
Validation Failed: Program does not contain vertex shader. Results will be undefined.
All shaders give this error, whether they are from the RT Shader system or custom made. I'm putting this up on the forums in the hopes someone else has seen this and can point me in the right direction.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: Shader errors on iOS 7 devices

Post by masterfalcon » Thu Nov 07, 2013 7:13 pm

Could you give an example of a shader that gives an error and material for the RTSS? Have you tried the 1.9 branch?
0 x

SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: Shader errors on iOS 7 devices

Post by SufferinPup » Thu Nov 07, 2013 7:41 pm

I haven't tried 1.9, it would take quite a while to update our game to it so I'm waiting for the final version. If 1.9 is known to work on iOS 7 devices I may have to update though...

I can't exactly tell which materials with the RTSS are causing the problem, it looks like all of them, I see the error 5 or 6 times for RTSS materials in the log, and that is about how many we use. They are extremely simple, stuff like this:

Code: Select all

material "barrow_door_stone_barrow_door_stone_mat"
{
	technique
	{
		pass
		{
			ambient 1 1 1 1
			diffuse 1 1 1 1
			specular 0 0 0 0
			emissive 0 0 0

			texture_unit
			{
				texture d_barrow_door_stone.tga
				tex_coord_set 0
				colour_op modulate
				scale 1 1
				scroll 0 0
				rotate 0
			}
		}
	}
}
As for custom shaders, all of them cause the error. Here is an example of a simple one:

Code: Select all

HiddenCharacterVp.glsles

#version 100

precision highp float;

// inputs from Ogre
attribute vec4 vertex;

// inputs from material
uniform mat4 worldViewProj;

void main()
{
	// calculate output position
	gl_Position = worldViewProj * vertex;
}

Code: Select all

HiddenCharacterFp.glsles

#version 100

precision highp float;

void main() 
{	
	gl_FragColor = vec4(0.6,0.6,0.6,1);
}

Code: Select all

HiddenCharacter.material
vertex_program HiddenCharacterVPCg cg
{
	source HiddenCharacter.cg
	entry_point hiddencharacter_vp
	profiles vs_4_0 vs_1_1 arbvp1
}

vertex_program HiddenCharacterVPGLSLES glsles
{
	source HiddenCharacterVp.glsles
	profiles glsles
}

vertex_program HiddenCharacterVP unified
{
	delegate HiddenCharacterVPGLSLES
	delegate HiddenCharacterVPCg
}

fragment_program HiddenCharacterFPCg cg
{
	source HiddenCharacter.cg
	entry_point hiddencharacter_fp
	profiles ps_4_0 ps_2_0 arbfp1 fp20
}

fragment_program HiddenCharacterFPGLSLES glsles
{
	source HiddenCharacterFp.glsles
	profiles glsles
}

fragment_program HiddenCharacterFP unified
{	
	delegate HiddenCharacterFPGLSLES
	delegate HiddenCharacterFPCg
}
Was there any changes to Ogre in 1.9 related to shader binding? For the sake of making this build I'm going to attempt to recompile ogre and our game with an older SDK version and see if that solves it, but if there is a code change in 1.9 I could port back that would be an ideal solution. I'm just not sure where to look.
0 x

SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: Shader errors on iOS 7 devices

Post by SufferinPup » Fri Nov 08, 2013 12:27 am

Quick update, I attempted to compile with iOS 6.1 SDK and the validations still fail. I also compiled samplebrowser and got the same results, so it isn't something I'm doing in my own code.

This may be a driver issue in iOS 7? My next step is to download 1.9 and see if it happens there too.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: Shader errors on iOS 7 devices

Post by masterfalcon » Fri Nov 08, 2013 12:40 am

Have you tried using the OpenGL ES Analyzer? It should tell you precisely what the errors are with the shaders.
0 x

SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: Shader errors on iOS 7 devices

Post by SufferinPup » Fri Nov 08, 2013 5:42 pm

I've never used the OpenGL ES Analyzer before, I loaded it up and it found a lot of problems but I couldn't find anything related to shaders in there. The docs don't provide any help either, I feel dumb for asking but where does it list shader errors?

As a test I loaded an older version of our game, compiled in Xcode 4, and it did run on an iOS 7 device. So this leads me to believe this is a specific issue with compiling Ogre in Xcode 5 then trying to run on an iOS 7 device. I'm going to install Xcode 4 and try to recompile everything with that just to get this build done, then cross my fingers that Ogre 1.9 doesn't have this issue. :)
0 x

SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: Shader errors on iOS 7 devices

Post by SufferinPup » Fri Nov 08, 2013 9:23 pm

Alright I've figured this out for sure now, it isn't specific to compilers or anything like that. Basically if there is a VET_COLOUR element in a vertex declaration the RTSS can't compile the shader on iOS 7 (or at least the iPhone 5 and iPad Air I tested on). What is inside the material or shader doesn't seem to matter - just that the verts have color info. On iOS 6 they compile fine.

This can be seen in vanilla Ogre in the TextOverlayElement, running the sample browser will result in shader compiler errors in the log and some of the text not visible (not sure why some is visible and some isn't!).

This is a more noticeable issue for me because I modified my version of Ogre to have vert colors on the OverlayPanel element, and a lot of our 3d models use vertex colors for various things.

This is with Ogre 1.8.1, I'm going to download 1.9 and try it out to see if it is fixed there, but I have a bad feeling...
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: Shader errors on iOS 7 devices

Post by masterfalcon » Sat Nov 09, 2013 4:57 am

There are some differences in the drivers between iOS 6 and 7. Particularly with separate shader objects(they are used when available, like on both of those devices). It has been fixed in 1.9.

The biggest difference is that gl_Position needs to be redeclared like so:

out highp vec4 gl_Position

https://bitbucket.org/sinbad/ogre/commi ... 77e3bb098d has all of the fixes(plus a bunch of other stuff unrelated to iOS 7) but that's likely the most relevant one in this case.
0 x

SufferinPup
Greenskin
Posts: 119
Joined: Tue Mar 02, 2010 11:09 pm
x 2

Re: Shader errors on iOS 7 devices

Post by SufferinPup » Sat Nov 09, 2013 6:02 pm

Yep, I set up 1.9 and sure enough it works great. I think with 1.9 being near enough to final I'm just going to bite the bullet and upgrade our game to it. That seems like a better use of time than adding in these fixes to the old creaky 1.8. :)

So the moral of the story here is, if you get shader validation errors in iOS 7, upgrade to Ogre 1.9.
0 x

Post Reply