Monday, March 14, 2011

Xcode - warning: no rule to process file

Update: This post covers how you solve a problem in Xcode 3. If you want to know how it's done in Xcode 4, see here instead

I added 2 new files to my IPhone project today. These are two text files (two glsl files) and they should only be included in my main bundle to be accessed at run time.

However, when I build the project I get the following warnings:

warning: no rule to process file '$(PROJECT_DIR)/Content/Shaders/DistanceField.fsh' of type sourcecode.glsl for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/Content/Shaders/DistanceField.vsh' of type sourcecode.glsl for architecture i386


It seems Xcode are trying to process my files during build. Why is that? I don't want that. I just want the files to be included in my bundle. After doing some detective work I found what the problem was:


Xcode automatically added my files into the "Compile Sources" group, for some reason I don't understand. After moving the files over to "Copy Bundle Resources" everything worked fine

Wednesday, March 2, 2011

POWERVR SGX Optimized Render Order

Basic reference of my understandings of how to batch geometry on the POWERVR SGX chip.


Render Target 1

1. Opaque surfaces

No win to sort by depth.

  1. Shader
  2. Texture & Uniforms
  3. Other states

2. Surfaces using discard (Old Alpha Test)

Same sorting as Opaque Surfaces

3. Transparent surfaces

Sort by depth if necessary
Same sorting as Opaque Surfaces

Render Target 2

Tuesday, March 1, 2011

From Visual Studio to Xcode #2

Consider the following code:

int Test()

{

int a=10;

int c;

// Bug. User meant “=” but unfortunately wrote “==”

c==a;

return c;

}

This piece of code is obviously faulty. c is never assigned the value of a. c is actually never assigned any value.

When we compile this in VS 2008 we get the following warnings:

  • warning C4553: '==' : operator has no effect; did you intend '=' ?
  • warning C4700: uninitialized local variable 'c' used

In Xcode, we get no warnings at all. I just spent 30 minutes tracing this kind of bug in my code, in Xcode. I know I have made the mistake of replacing “=” with “==” several times in the past, but usually VS warns me in these occations. Xcode does not.