cs_fast_linear_gradient.glsl (812B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include shared 6 7 varying highp float vPos; 8 flat varying mediump vec4 vColor0; 9 flat varying mediump vec4 vColor1; 10 11 #ifdef WR_VERTEX_SHADER 12 13 PER_INSTANCE in vec4 aTaskRect; 14 PER_INSTANCE in vec4 aColor0; 15 PER_INSTANCE in vec4 aColor1; 16 PER_INSTANCE in float aAxisSelect; 17 18 void main(void) { 19 vPos = mix(0.0, 1.0, mix(aPosition.x, aPosition.y, aAxisSelect)); 20 21 vColor0 = aColor0; 22 vColor1 = aColor1; 23 24 gl_Position = uTransform * vec4(mix(aTaskRect.xy, aTaskRect.zw, aPosition.xy), 0.0, 1.0); 25 } 26 #endif 27 28 #ifdef WR_FRAGMENT_SHADER 29 void main(void) { 30 oFragColor = mix(vColor0, vColor1, vPos); 31 } 32 #endif