|
1 // |
|
2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
|
3 // Use of this source code is governed by a BSD-style license that can be |
|
4 // found in the LICENSE file. |
|
5 // |
|
6 |
|
7 sampler2D tex : s0; |
|
8 |
|
9 uniform float4 mode : c0; |
|
10 |
|
11 // Passthrough Pixel Shader |
|
12 // Outputs texture 0 sampled at texcoord 0. |
|
13 float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR |
|
14 { |
|
15 return tex2D(tex, texcoord.xy); |
|
16 }; |
|
17 |
|
18 // Luminance Conversion Pixel Shader |
|
19 // Outputs sample(tex0, tc0).rrra. |
|
20 // For LA output (pass A) set C0.X = 1, C0.Y = 0. |
|
21 // For L output (A = 1) set C0.X = 0, C0.Y = 1. |
|
22 float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR |
|
23 { |
|
24 float4 tmp = tex2D(tex, texcoord.xy); |
|
25 tmp.w = tmp.w * mode.x + mode.y; |
|
26 return tmp.xxxw; |
|
27 }; |
|
28 |
|
29 // RGB/A Component Mask Pixel Shader |
|
30 // Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1. |
|
31 // To force RGB = 0, set C0.X = 0, otherwise C0.X = 1. |
|
32 // To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0. |
|
33 float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR |
|
34 { |
|
35 float4 tmp = tex2D(tex, texcoord.xy); |
|
36 tmp.xyz = tmp.xyz * mode.x; |
|
37 tmp.w = tmp.w * mode.z + mode.w; |
|
38 return tmp; |
|
39 }; |