Revision 2f35828c
Added by Leszek Koltunski about 6 years ago
src/main/res/raw/main_fragment_shader.glsl | ||
---|---|---|
17 | 17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
18 | 18 |
////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 |
precision lowp float;
|
|
20 |
precision mediump float;
|
|
21 | 21 |
|
22 | 22 |
#if __VERSION__ != 100 |
23 | 23 |
in vec3 v_Position; // Interpolated position for this fragment. |
... | ... | |
43 | 43 |
// next describes the Region, i.e. area over which the effect is active. |
44 | 44 |
#endif // NUM_FRAGMENT>0 |
45 | 45 |
|
46 |
layout (std430,binding=0) buffer SSBO // PER-SURFACE count of transparent fragments. |
|
47 |
{ // Can be buffered, i.e. if we are for example |
|
48 |
int ssbocount[]; // triple-buffered, then surfaceID=N uses 3 |
|
49 |
}; // consecutive counts (N,N+1,N+2) during 3 |
|
50 |
// consecutive frames. |
|
51 |
// Cannot be an 'uint' because the Java application that's |
|
52 |
// reading this does not have unsigned types so it's reading |
|
53 |
// this into a signed int... Doesn't matter as things keep on |
|
54 |
// working even when this overflows into negative territory :) |
|
55 |
|
|
56 |
uniform int u_currentIndex; // Index into the count[] array we are supposed to be using |
|
57 |
// during this very invocation. |
|
58 |
|
|
59 | 46 |
////////////////////////////////////////////////////////////////////////////////////////////// |
60 | 47 |
|
61 | 48 |
void main() |
... | ... | |
78 | 65 |
} |
79 | 66 |
#endif |
80 | 67 |
|
81 |
if( color.a < 1.0 && color.a > 0.0 ) atomicAdd(ssbocount[u_currentIndex],1); |
|
82 |
|
|
83 | 68 |
FRAG_COLOR = vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a); |
84 | 69 |
} |
Also available in: Unified diff
- remove counting of transparent pixels from main fragment shader
- remove debugs and tidy up
- some fixes for the Mali GPU