A Fully updated Fire Stick 4K here.
GL_VERSION : GL Version OpenGL ES 3.2 build 1.9@4893595
GL_RENDERER: GL Renderer PowerVR Rogue GE8300
I’ve got a shader that fails to compile. glGetShaderInfoLog() returns a cryptic “Compile failed”. That’s it!
This shader compiles (and works) just fine on many Adreno, Mali & Tegra GPUs. It also compiles (and works) just fine on PowerVR GX6250. Problem only on PowerVR GE8100 and GE 8300.
Vertex shader:
#version 310 es
precision highp float;
precision highp int;
in vec2 a_Position;
out vec2 v_TexCoordinate;
out vec2 v_Pixel;
uniform uvec2 u_Size;
void main()
{
v_TexCoordinate = (a_Position + 0.5);
v_Pixel = (a_Position + 0.5) * vec2(u_Size);
gl_Position = vec4(2.0*a_Position,1.0,1.0);
}
Fragment shader:
#version 310 es
precision highp float;
precision highp int;
out vec4 fragColor; // The output color
in vec2 v_TexCoordinate; // Interpolated texture coordinate per fragment.
in vec2 v_Pixel; // location of the current fragment, in pixels
//////////////////////////////////////////////////////////////////////////////////////////////
// per-pixel linked list. Order Independent Transparency.
uniform uvec2 u_Size;
layout (std430,binding=1) buffer linkedlist // first (u_Size.x*u_Size.y) uints - head pointers,
{ // one for each pixel in the Output rectangle.
uint u_Records[]; //
}; // Next 3*u_numRecords uints - actual linked list, i.e.
// triplets of (pointer,depth,rgba).
//////////////////////////////////////////////////////////////////////////////////////////////
vec4 convert(uint rgba)
{
return vec4( float((rgba>>24u)&255u),float((rgba>>16u)&255u),float((rgba>>8u)&255u),float(rgba&255u) ) / 255.0;
}
//////////////////////////////////////////////////////////////////////////////////////////////
// A over B (https://en.wikipedia.org/wiki/Alpha_compositing)
vec4 blend(vec4 A,vec4 B)
{
float b = B.a * (1.0-A.a);
float a = A.a + b;
return vec4( (A.rgb*A.a + B.rgb*b)/a , a );
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Pass4 of the OIT algorithm - keep traversing the linked list, build the final color and blend it.
void main()
{
uint prev = uint(v_Pixel.x) + uint(v_Pixel.y) * u_Size.x;
uint curr = u_Records[prev];
if (curr != 0u)
{
const float S= 2147483647.0;
gl_FragDepth = 1.0 - 2.0*float(u_Records[curr+1u])/S;
vec4 color = convert(u_Records[curr+2u]);
curr = u_Records[curr];
while (curr != 0u)
{
color = blend( color , convert(u_Records[curr+2u]) );
curr = u_Records[curr];
}
fragColor = color;
}
else discard;
}