Revision f89a986e
Added by Leszek Koltunski about 6 years ago
src/main/res/raw/blit_depth_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 highp float;
|
|
21 | 21 |
precision highp uint; |
22 | 22 |
|
23 | 23 |
#if __VERSION__ != 100 |
... | ... | |
60 | 60 |
{ |
61 | 61 |
uint ptr = atomicCounterIncrement(u_Counter)-1u; |
62 | 62 |
|
63 |
if( ptr<u_numRecords ) |
|
64 |
{/* |
|
65 |
uint color; |
|
66 |
vec2 c = vec2(0.0,1.0); |
|
67 |
|
|
68 |
uint rgb = ((uint(255.0*c.x))<<16u) + uint(255.0*c.y); |
|
69 |
|
|
70 |
if( rgb == 0u ) color = (255u<<24u) + (255u<<16u) + 255u; |
|
71 |
else if( (rgb&255u) == 0u ) color = (255u<<24u) + 255u; |
|
72 |
else if( (rgb&255u) <= 50u ) color = (255u<<16u) + 255u; |
|
73 |
else if( (rgb&255u) == 255u) color = (255u<<16u) + (255u<< 8u) + 255u; |
|
74 |
else color = (255u<< 8u) + 255u; |
|
75 |
*/ |
|
76 |
vec4 c= vec4(1.0,1.0,0.0,1.0); |
|
77 |
uint color = ((uint(255.0*c.r))<<24u) + ((uint(255.0*c.g))<<16u) + ((uint(255.0*c.b))<<8u) + uint(255.0*c.a); |
|
78 |
|
|
79 |
ptr = 3u*ptr + uint(u_Size.x*u_Size.y); |
|
80 |
|
|
81 |
u_Records[ptr ] = 0u; |
|
82 |
u_Records[ptr+1u] = depth; |
|
83 |
u_Records[ptr+2u] = rgba; |
|
84 |
|
|
85 |
uint index = uint(ij.x + ij.y * float(u_Size.x)); |
|
86 |
|
|
87 |
u_Records[index] = ptr; |
|
88 |
} |
|
89 |
/* |
|
90 |
uint ptr = atomicCounterIncrement(u_Counter)-1u; |
|
91 |
|
|
63 | 92 |
if( ptr<u_numRecords ) |
64 | 93 |
{ |
65 | 94 |
ptr = 3u*ptr + uint(u_Size.x*u_Size.y); |
... | ... | |
76 | 105 |
{ |
77 | 106 |
if ( curr==0u || depth > u_Records[curr+1u] ) // need to insert here |
78 | 107 |
{ |
79 |
*/ |
|
108 |
|
|
80 | 109 |
u_Records[ptr] = curr; // next of new record is curr |
81 | 110 |
memoryBarrier(); |
82 | 111 |
uint res = atomicCompSwap( u_Records[prev], curr, ptr ); |
... | ... | |
91 | 120 |
} |
92 | 121 |
} |
93 | 122 |
*/ |
94 |
} |
|
123 |
// } |
|
124 |
|
|
125 |
|
|
95 | 126 |
} |
96 | 127 |
|
97 | 128 |
////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Order Independent Transparency: some progress