Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shader file warning for iPad (1st gen)

I'm currently making an OpenGL ES 2.0 drawing app for the iPad and I keep getting the following warnings regarding the shaders:

Check dependencies

[WARN]warning: no rule to process file '$(PROJECT_DIR)/IdeaStorm/Drawing Engine/Shaders/Shader.fsh' of type sourcecode.glsl for architecture i386

[WARN]warning: no rule to process file '$(PROJECT_DIR)/IdeaStorm/Drawing Engine/Shaders/Shader.vsh' of type sourcecode.glsl for architecture i386

My drawing app currently runs fine on my 2nd gen iPad with iOS 5, with exception of this error and runs in the simulator fine as well.

However, the other day I tried running it on my friends 1st gen iPad with iOS 4.3 and the shaders failed to compile.

Can anyone point my in the right direction regarding both this warning and the failure for the shaders to compile for the 1st gen iPad?

like image 844
robhasacamera Avatar asked Dec 27 '22 11:12

robhasacamera


1 Answers

By default, when you add a vertex and fragment shader to your project, Xcode mistakenly thinks of them as source files to be compiled instead of resources to be bundled. This causes the above errors you're seeing.

Remove your Shader.fsh and Shader.vsh files from your project target's Compile Sources build phase and make sure they're present within your Copy Bundle Resources phase.

It's a little odd that your shaders compile (at runtime, I assume) successfully on an iPad 2, but not on an original iPad. While the iPad 2 has significantly more shader horsepower than an iPad 1, there shouldn't be much that would cause a shader to fail on one when it works on the other. You could try logging out any shader compilation failures using code like the following (during your shader compilation process):

glGetShaderiv(*shader, GL_COMPILE_STATUS, &status);

if (status != GL_TRUE)
{
    GLint logLength;
    glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &logLength);
    if (logLength > 0)
    {
        GLchar *log = (GLchar *)malloc(logLength);
        glGetShaderInfoLog(*shader, logLength, &logLength, log);
        NSLog(@"Shader compile log:\n%s", log);
        free(log);
    }
}   
like image 153
Brad Larson Avatar answered Jan 03 '23 15:01

Brad Larson