Revision c1a38ba3
Added by Leszek Koltunski almost 6 years ago
src/main/res/raw/main_fragment_shader.glsl | ||
---|---|---|
18 | 18 |
////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
precision highp float; |
21 |
precision highp int; |
|
21 | 22 |
|
22 | 23 |
in vec3 v_Position; // Interpolated position for this fragment. |
23 | 24 |
in vec3 v_Normal; // Interpolated normal for this fragment. |
... | ... | |
93 | 94 |
} |
94 | 95 |
} |
95 | 96 |
} |
97 |
|
|
98 |
////////////////////////////////////////////////////////////////////////////////////////////// |
|
99 |
|
|
100 |
uint convert(vec4 c) |
|
101 |
{ |
|
102 |
return ((uint(255.0*c.r))<<24u) + ((uint(255.0*c.g))<<16u) + ((uint(255.0*c.b))<<8u) + uint(255.0*c.a); |
|
103 |
} |
|
104 |
|
|
96 | 105 |
#endif // OIT |
97 | 106 |
|
98 | 107 |
////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
118 | 127 |
#endif |
119 | 128 |
|
120 | 129 |
#ifdef OIT |
121 |
if( frag.a > 0.95 )
|
|
130 |
if( color.a > 0.95 )
|
|
122 | 131 |
{ |
123 | 132 |
fragColor= vec4(color.rgb * (1.0 + 7.0*v_Normal.z) * 0.125, color.a); |
124 | 133 |
} |
125 | 134 |
else |
126 | 135 |
{ |
127 |
if( frag.a > 0.0 )
|
|
136 |
if( color.a > 0.0 )
|
|
128 | 137 |
{ |
129 | 138 |
const float S= 2147483647.0; // max signed int. Could probably be max unsigned int but this is enough. |
130 |
insert(v_Pixel, uint(S*(1.0-depth)/2.0), convert(frag) );
|
|
139 |
insert(v_Pixel, uint(S*(1.0-gl_FragCoord.z)/2.0), convert(color) );
|
|
131 | 140 |
} |
132 | 141 |
discard; |
133 | 142 |
} |
Also available in: Unified diff
Progress with non-postprocessed OIT.
Status: compiles, but fails to work on both Adreno and Mali. Crashes the app (Adreno) or the whole system (Mali)