Pixel Three - Shader code problems

So I keep getting this error on a scene that uses a shader with a texture sampler on my pixel three:

Error: FRAGMENT SHADER ERROR: 0:38: 'sampler2D' : requires extension GL_EXT_gpu_shader5 to be enabled 

I have tried to include that extension but it does not seem to work.

Kinda confused here, as I would figure a pixel three should have some decent support.

@Evgeni_Popov you usually know whats going on with shaders!


I think I figured it out now… I gotta get rid of the texture array reference that uses a dynamic index.

Ew… its not the cleanest work around but I am going to use a #define placeholder and then do a regex replace and add in a switch that will handle the layer loop.

for(int i=0; i<2; i++){
  float frameID;
        case 0 : frameID = texture(tileMaps[0], (tileID + 0.5) / stageSize, 0.).x;
        case 1 : frameID = texture(tileMaps[1], (tileID + 0.5) / stageSize, 0.).x;

Why that?
what about unrolling like creating a function that accepts a frameID and call it twice:


I got it actually :slight_smile: the switch solution adds 1 more calc per frame, but really does nothing to the performance.

I was looking initially at doing it how you just suggested, but it looks like the switch solution ends up fitting into the code structure a little better.

I’ll be submitting a PR to fix the SpriteMap here soon.

1 Like

Nice backgrounds, it reminds me of old Prince of Persia game for some reason :slight_smile:

Ayyy it works!


HEY! congrats