Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | typedef float4 rect; |
michael@0 | 2 | cbuffer PerLayer { |
michael@0 | 3 | rect vTextureCoords; |
michael@0 | 4 | rect vLayerQuad; |
michael@0 | 5 | rect vMaskQuad; |
michael@0 | 6 | float fLayerOpacity; |
michael@0 | 7 | float4x4 mLayerTransform; |
michael@0 | 8 | } |
michael@0 | 9 | |
michael@0 | 10 | cbuffer PerOccasionalLayer { |
michael@0 | 11 | float4 vRenderTargetOffset; |
michael@0 | 12 | float4 fLayerColor; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | cbuffer PerLayerManager { |
michael@0 | 16 | float4x4 mProjection; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | BlendState Premul |
michael@0 | 20 | { |
michael@0 | 21 | AlphaToCoverageEnable = FALSE; |
michael@0 | 22 | BlendEnable[0] = TRUE; |
michael@0 | 23 | SrcBlend = One; |
michael@0 | 24 | DestBlend = Inv_Src_Alpha; |
michael@0 | 25 | BlendOp = Add; |
michael@0 | 26 | SrcBlendAlpha = One; |
michael@0 | 27 | DestBlendAlpha = Inv_Src_Alpha; |
michael@0 | 28 | BlendOpAlpha = Add; |
michael@0 | 29 | RenderTargetWriteMask[0] = 0x0F; // All |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | BlendState NonPremul |
michael@0 | 33 | { |
michael@0 | 34 | AlphaToCoverageEnable = FALSE; |
michael@0 | 35 | BlendEnable[0] = TRUE; |
michael@0 | 36 | SrcBlend = Src_Alpha; |
michael@0 | 37 | DestBlend = Inv_Src_Alpha; |
michael@0 | 38 | BlendOp = Add; |
michael@0 | 39 | SrcBlendAlpha = One; |
michael@0 | 40 | DestBlendAlpha = Inv_Src_Alpha; |
michael@0 | 41 | BlendOpAlpha = Add; |
michael@0 | 42 | RenderTargetWriteMask[0] = 0x0F; // All |
michael@0 | 43 | }; |
michael@0 | 44 | |
michael@0 | 45 | BlendState NoBlendDual |
michael@0 | 46 | { |
michael@0 | 47 | AlphaToCoverageEnable = FALSE; |
michael@0 | 48 | BlendEnable[0] = FALSE; |
michael@0 | 49 | BlendEnable[1] = FALSE; |
michael@0 | 50 | RenderTargetWriteMask[0] = 0x0F; // All |
michael@0 | 51 | RenderTargetWriteMask[1] = 0x0F; // All |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | BlendState ComponentAlphaBlend |
michael@0 | 55 | { |
michael@0 | 56 | AlphaToCoverageEnable = FALSE; |
michael@0 | 57 | BlendEnable[0] = TRUE; |
michael@0 | 58 | SrcBlend = One; |
michael@0 | 59 | DestBlend = Inv_Src1_Color; |
michael@0 | 60 | BlendOp = Add; |
michael@0 | 61 | SrcBlendAlpha = One; |
michael@0 | 62 | DestBlendAlpha = Inv_Src_Alpha; |
michael@0 | 63 | BlendOpAlpha = Add; |
michael@0 | 64 | RenderTargetWriteMask[0] = 0x0F; // All |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | RasterizerState LayerRast |
michael@0 | 68 | { |
michael@0 | 69 | ScissorEnable = True; |
michael@0 | 70 | CullMode = None; |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | Texture2D tRGB; |
michael@0 | 74 | Texture2D tY; |
michael@0 | 75 | Texture2D tCb; |
michael@0 | 76 | Texture2D tCr; |
michael@0 | 77 | Texture2D tRGBWhite; |
michael@0 | 78 | Texture2D tMask; |
michael@0 | 79 | |
michael@0 | 80 | SamplerState LayerTextureSamplerLinear |
michael@0 | 81 | { |
michael@0 | 82 | Filter = MIN_MAG_MIP_LINEAR; |
michael@0 | 83 | AddressU = Clamp; |
michael@0 | 84 | AddressV = Clamp; |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | SamplerState LayerTextureSamplerPoint |
michael@0 | 88 | { |
michael@0 | 89 | Filter = MIN_MAG_MIP_POINT; |
michael@0 | 90 | AddressU = Clamp; |
michael@0 | 91 | AddressV = Clamp; |
michael@0 | 92 | }; |
michael@0 | 93 | |
michael@0 | 94 | struct VS_INPUT { |
michael@0 | 95 | float2 vPosition : POSITION; |
michael@0 | 96 | }; |
michael@0 | 97 | |
michael@0 | 98 | struct VS_OUTPUT { |
michael@0 | 99 | float4 vPosition : SV_Position; |
michael@0 | 100 | float2 vTexCoords : TEXCOORD0; |
michael@0 | 101 | }; |
michael@0 | 102 | |
michael@0 | 103 | struct VS_MASK_OUTPUT { |
michael@0 | 104 | float4 vPosition : SV_Position; |
michael@0 | 105 | float2 vTexCoords : TEXCOORD0; |
michael@0 | 106 | float2 vMaskCoords : TEXCOORD1; |
michael@0 | 107 | }; |
michael@0 | 108 | |
michael@0 | 109 | struct VS_MASK_3D_OUTPUT { |
michael@0 | 110 | float4 vPosition : SV_Position; |
michael@0 | 111 | float2 vTexCoords : TEXCOORD0; |
michael@0 | 112 | float3 vMaskCoords : TEXCOORD1; |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | struct PS_OUTPUT { |
michael@0 | 116 | float4 vSrc; |
michael@0 | 117 | float4 vAlpha; |
michael@0 | 118 | }; |
michael@0 | 119 | |
michael@0 | 120 | struct PS_DUAL_OUTPUT { |
michael@0 | 121 | float4 vOutput1 : SV_Target0; |
michael@0 | 122 | float4 vOutput2 : SV_Target1; |
michael@0 | 123 | }; |
michael@0 | 124 | |
michael@0 | 125 | float2 TexCoords(const float2 aPosition) |
michael@0 | 126 | { |
michael@0 | 127 | float2 result; |
michael@0 | 128 | const float2 size = vTextureCoords.zw; |
michael@0 | 129 | result.x = vTextureCoords.x + aPosition.x * size.x; |
michael@0 | 130 | result.y = vTextureCoords.y + aPosition.y * size.y; |
michael@0 | 131 | |
michael@0 | 132 | return result; |
michael@0 | 133 | } |
michael@0 | 134 | |
michael@0 | 135 | float4 TransformedPostion(float2 aInPosition) |
michael@0 | 136 | { |
michael@0 | 137 | // the current vertex's position on the quad |
michael@0 | 138 | float4 position = float4(0, 0, 0, 1); |
michael@0 | 139 | |
michael@0 | 140 | // We use 4 component floats to uniquely describe a rectangle, by the structure |
michael@0 | 141 | // of x, y, width, height. This allows us to easily generate the 4 corners |
michael@0 | 142 | // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the |
michael@0 | 143 | // stream source for our LayerQuad vertex shader. We do this by doing: |
michael@0 | 144 | // Xout = x + Xin * width |
michael@0 | 145 | // Yout = y + Yin * height |
michael@0 | 146 | float2 size = vLayerQuad.zw; |
michael@0 | 147 | position.x = vLayerQuad.x + aInPosition.x * size.x; |
michael@0 | 148 | position.y = vLayerQuad.y + aInPosition.y * size.y; |
michael@0 | 149 | |
michael@0 | 150 | position = mul(mLayerTransform, position); |
michael@0 | 151 | |
michael@0 | 152 | return position; |
michael@0 | 153 | } |
michael@0 | 154 | |
michael@0 | 155 | float4 VertexPosition(float4 aTransformedPosition) |
michael@0 | 156 | { |
michael@0 | 157 | float4 result; |
michael@0 | 158 | result.w = aTransformedPosition.w; |
michael@0 | 159 | result.xyz = aTransformedPosition.xyz / aTransformedPosition.w; |
michael@0 | 160 | result -= vRenderTargetOffset; |
michael@0 | 161 | result.xyz *= result.w; |
michael@0 | 162 | |
michael@0 | 163 | result = mul(mProjection, result); |
michael@0 | 164 | |
michael@0 | 165 | return result; |
michael@0 | 166 | } |
michael@0 | 167 | |
michael@0 | 168 | VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex) |
michael@0 | 169 | { |
michael@0 | 170 | VS_OUTPUT outp; |
michael@0 | 171 | float4 position = TransformedPostion(aVertex.vPosition); |
michael@0 | 172 | |
michael@0 | 173 | outp.vPosition = VertexPosition(position); |
michael@0 | 174 | outp.vTexCoords = TexCoords(aVertex.vPosition.xy); |
michael@0 | 175 | |
michael@0 | 176 | return outp; |
michael@0 | 177 | } |
michael@0 | 178 | |
michael@0 | 179 | VS_MASK_OUTPUT LayerQuadMaskVS(const VS_INPUT aVertex) |
michael@0 | 180 | { |
michael@0 | 181 | VS_MASK_OUTPUT outp; |
michael@0 | 182 | float4 position = TransformedPostion(aVertex.vPosition); |
michael@0 | 183 | |
michael@0 | 184 | outp.vPosition = VertexPosition(position); |
michael@0 | 185 | |
michael@0 | 186 | // calculate the position on the mask texture |
michael@0 | 187 | outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; |
michael@0 | 188 | outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; |
michael@0 | 189 | |
michael@0 | 190 | outp.vTexCoords = TexCoords(aVertex.vPosition.xy); |
michael@0 | 191 | |
michael@0 | 192 | return outp; |
michael@0 | 193 | } |
michael@0 | 194 | |
michael@0 | 195 | VS_MASK_3D_OUTPUT LayerQuadMask3DVS(const VS_INPUT aVertex) |
michael@0 | 196 | { |
michael@0 | 197 | VS_MASK_3D_OUTPUT outp; |
michael@0 | 198 | float4 position = TransformedPostion(aVertex.vPosition); |
michael@0 | 199 | |
michael@0 | 200 | outp.vPosition = VertexPosition(position); |
michael@0 | 201 | |
michael@0 | 202 | // calculate the position on the mask texture |
michael@0 | 203 | position.xyz /= position.w; |
michael@0 | 204 | outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; |
michael@0 | 205 | outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; |
michael@0 | 206 | // We use the w coord to do non-perspective correct interpolation: |
michael@0 | 207 | // the quad might be transformed in 3D, in which case it will have some |
michael@0 | 208 | // perspective. The graphics card will do perspective-correct interpolation |
michael@0 | 209 | // of the texture, but our mask is already transformed and so we require |
michael@0 | 210 | // linear interpolation. Therefore, we must correct the interpolation |
michael@0 | 211 | // ourselves, we do this by multiplying all coords by w here, and dividing by |
michael@0 | 212 | // w in the pixel shader (post-interpolation), we pass w in outp.vMaskCoords.z. |
michael@0 | 213 | // See http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness |
michael@0 | 214 | outp.vMaskCoords.z = 1; |
michael@0 | 215 | outp.vMaskCoords *= position.w; |
michael@0 | 216 | |
michael@0 | 217 | outp.vTexCoords = TexCoords(aVertex.vPosition.xy); |
michael@0 | 218 | |
michael@0 | 219 | return outp; |
michael@0 | 220 | } |
michael@0 | 221 | |
michael@0 | 222 | float4 RGBAShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target |
michael@0 | 223 | { |
michael@0 | 224 | float2 maskCoords = aVertex.vMaskCoords; |
michael@0 | 225 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 226 | return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity * mask; |
michael@0 | 227 | } |
michael@0 | 228 | |
michael@0 | 229 | float4 RGBAShaderLinearMask3D(const VS_MASK_3D_OUTPUT aVertex) : SV_Target |
michael@0 | 230 | { |
michael@0 | 231 | float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z; |
michael@0 | 232 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 233 | return tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) * fLayerOpacity * mask; |
michael@0 | 234 | } |
michael@0 | 235 | |
michael@0 | 236 | float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target |
michael@0 | 237 | { |
michael@0 | 238 | float4 result; |
michael@0 | 239 | result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; |
michael@0 | 240 | result.a = fLayerOpacity; |
michael@0 | 241 | |
michael@0 | 242 | float2 maskCoords = aVertex.vMaskCoords; |
michael@0 | 243 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 244 | return result * mask; |
michael@0 | 245 | } |
michael@0 | 246 | |
michael@0 | 247 | float4 CalculateYCbCrColor(const float2 aTexCoords) |
michael@0 | 248 | { |
michael@0 | 249 | float4 yuv; |
michael@0 | 250 | float4 color; |
michael@0 | 251 | |
michael@0 | 252 | yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; |
michael@0 | 253 | yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.0625; |
michael@0 | 254 | yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; |
michael@0 | 255 | |
michael@0 | 256 | color.r = yuv.g * 1.164 + yuv.r * 1.596; |
michael@0 | 257 | color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; |
michael@0 | 258 | color.b = yuv.g * 1.164 + yuv.b * 2.018; |
michael@0 | 259 | color.a = 1.0f; |
michael@0 | 260 | |
michael@0 | 261 | return color; |
michael@0 | 262 | } |
michael@0 | 263 | |
michael@0 | 264 | float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target |
michael@0 | 265 | { |
michael@0 | 266 | float2 maskCoords = aVertex.vMaskCoords; |
michael@0 | 267 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 268 | |
michael@0 | 269 | return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity * mask; |
michael@0 | 270 | } |
michael@0 | 271 | |
michael@0 | 272 | PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target |
michael@0 | 273 | { |
michael@0 | 274 | PS_OUTPUT result; |
michael@0 | 275 | |
michael@0 | 276 | result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); |
michael@0 | 277 | result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; |
michael@0 | 278 | result.vSrc.a = result.vAlpha.g; |
michael@0 | 279 | |
michael@0 | 280 | float2 maskCoords = aVertex.vMaskCoords; |
michael@0 | 281 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 282 | result.vSrc *= fLayerOpacity * mask; |
michael@0 | 283 | result.vAlpha *= fLayerOpacity * mask; |
michael@0 | 284 | |
michael@0 | 285 | return result; |
michael@0 | 286 | } |
michael@0 | 287 | |
michael@0 | 288 | float4 SolidColorShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target |
michael@0 | 289 | { |
michael@0 | 290 | float2 maskCoords = aVertex.vMaskCoords; |
michael@0 | 291 | float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; |
michael@0 | 292 | return fLayerColor * mask; |
michael@0 | 293 | } |
michael@0 | 294 | |
michael@0 | 295 | /* |
michael@0 | 296 | * Un-masked versions |
michael@0 | 297 | ************************************************************* |
michael@0 | 298 | */ |
michael@0 | 299 | float4 RGBAShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target |
michael@0 | 300 | { |
michael@0 | 301 | return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; |
michael@0 | 302 | } |
michael@0 | 303 | |
michael@0 | 304 | float4 RGBShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target |
michael@0 | 305 | { |
michael@0 | 306 | float4 result; |
michael@0 | 307 | result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; |
michael@0 | 308 | result.a = fLayerOpacity; |
michael@0 | 309 | return result; |
michael@0 | 310 | } |
michael@0 | 311 | |
michael@0 | 312 | float4 YCbCrShader(const VS_OUTPUT aVertex) : SV_Target |
michael@0 | 313 | { |
michael@0 | 314 | return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity; |
michael@0 | 315 | } |
michael@0 | 316 | |
michael@0 | 317 | PS_OUTPUT ComponentAlphaShader(const VS_OUTPUT aVertex) : SV_Target |
michael@0 | 318 | { |
michael@0 | 319 | PS_OUTPUT result; |
michael@0 | 320 | |
michael@0 | 321 | result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); |
michael@0 | 322 | result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; |
michael@0 | 323 | result.vSrc.a = result.vAlpha.g; |
michael@0 | 324 | result.vSrc *= fLayerOpacity; |
michael@0 | 325 | result.vAlpha *= fLayerOpacity; |
michael@0 | 326 | return result; |
michael@0 | 327 | } |
michael@0 | 328 | |
michael@0 | 329 | float4 SolidColorShader(const VS_OUTPUT aVertex) : SV_Target |
michael@0 | 330 | { |
michael@0 | 331 | return fLayerColor; |
michael@0 | 332 | } |
michael@0 | 333 | |
michael@0 | 334 | PS_DUAL_OUTPUT AlphaExtractionPrepareShader(const VS_OUTPUT aVertex) |
michael@0 | 335 | { |
michael@0 | 336 | PS_DUAL_OUTPUT result; |
michael@0 | 337 | result.vOutput1 = float4(0, 0, 0, 1); |
michael@0 | 338 | result.vOutput2 = float4(1, 1, 1, 1); |
michael@0 | 339 | return result; |
michael@0 | 340 | } |
michael@0 | 341 | |
michael@0 | 342 | technique10 RenderRGBLayerPremul |
michael@0 | 343 | { |
michael@0 | 344 | pass P0 |
michael@0 | 345 | { |
michael@0 | 346 | SetRasterizerState( LayerRast ); |
michael@0 | 347 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 348 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 349 | SetGeometryShader( NULL ); |
michael@0 | 350 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerLinear) ) ); |
michael@0 | 351 | } |
michael@0 | 352 | } |
michael@0 | 353 | |
michael@0 | 354 | technique10 RenderRGBLayerPremulPoint |
michael@0 | 355 | { |
michael@0 | 356 | pass P0 |
michael@0 | 357 | { |
michael@0 | 358 | SetRasterizerState( LayerRast ); |
michael@0 | 359 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 360 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 361 | SetGeometryShader( NULL ); |
michael@0 | 362 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerPoint) ) ); |
michael@0 | 363 | } |
michael@0 | 364 | } |
michael@0 | 365 | |
michael@0 | 366 | technique10 RenderRGBALayerPremul |
michael@0 | 367 | { |
michael@0 | 368 | pass P0 |
michael@0 | 369 | { |
michael@0 | 370 | SetRasterizerState( LayerRast ); |
michael@0 | 371 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 372 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 373 | SetGeometryShader( NULL ); |
michael@0 | 374 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); |
michael@0 | 375 | } |
michael@0 | 376 | } |
michael@0 | 377 | |
michael@0 | 378 | technique10 RenderRGBALayerNonPremul |
michael@0 | 379 | { |
michael@0 | 380 | pass P0 |
michael@0 | 381 | { |
michael@0 | 382 | SetRasterizerState( LayerRast ); |
michael@0 | 383 | SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 384 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 385 | SetGeometryShader( NULL ); |
michael@0 | 386 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); |
michael@0 | 387 | } |
michael@0 | 388 | } |
michael@0 | 389 | |
michael@0 | 390 | technique10 RenderRGBALayerPremulPoint |
michael@0 | 391 | { |
michael@0 | 392 | pass P0 |
michael@0 | 393 | { |
michael@0 | 394 | SetRasterizerState( LayerRast ); |
michael@0 | 395 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 396 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 397 | SetGeometryShader( NULL ); |
michael@0 | 398 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); |
michael@0 | 399 | } |
michael@0 | 400 | } |
michael@0 | 401 | |
michael@0 | 402 | technique10 RenderRGBALayerNonPremulPoint |
michael@0 | 403 | { |
michael@0 | 404 | pass P0 |
michael@0 | 405 | { |
michael@0 | 406 | SetRasterizerState( LayerRast ); |
michael@0 | 407 | SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 408 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 409 | SetGeometryShader( NULL ); |
michael@0 | 410 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); |
michael@0 | 411 | } |
michael@0 | 412 | } |
michael@0 | 413 | |
michael@0 | 414 | technique10 RenderYCbCrLayer |
michael@0 | 415 | { |
michael@0 | 416 | pass P0 |
michael@0 | 417 | { |
michael@0 | 418 | SetRasterizerState( LayerRast ); |
michael@0 | 419 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 420 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 421 | SetGeometryShader( NULL ); |
michael@0 | 422 | SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShader() ) ); |
michael@0 | 423 | } |
michael@0 | 424 | } |
michael@0 | 425 | |
michael@0 | 426 | technique10 RenderComponentAlphaLayer |
michael@0 | 427 | { |
michael@0 | 428 | Pass P0 |
michael@0 | 429 | { |
michael@0 | 430 | SetRasterizerState( LayerRast ); |
michael@0 | 431 | SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 432 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 433 | SetGeometryShader( NULL ); |
michael@0 | 434 | SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShader() ) ); |
michael@0 | 435 | } |
michael@0 | 436 | |
michael@0 | 437 | } |
michael@0 | 438 | |
michael@0 | 439 | technique10 RenderSolidColorLayer |
michael@0 | 440 | { |
michael@0 | 441 | pass P0 |
michael@0 | 442 | { |
michael@0 | 443 | SetRasterizerState( LayerRast ); |
michael@0 | 444 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 445 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 446 | SetGeometryShader( NULL ); |
michael@0 | 447 | SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); |
michael@0 | 448 | } |
michael@0 | 449 | } |
michael@0 | 450 | |
michael@0 | 451 | technique10 RenderClearLayer |
michael@0 | 452 | { |
michael@0 | 453 | pass P0 |
michael@0 | 454 | { |
michael@0 | 455 | SetRasterizerState( LayerRast ); |
michael@0 | 456 | SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 457 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 458 | SetGeometryShader( NULL ); |
michael@0 | 459 | SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); |
michael@0 | 460 | } |
michael@0 | 461 | } |
michael@0 | 462 | |
michael@0 | 463 | technique10 PrepareAlphaExtractionTextures |
michael@0 | 464 | { |
michael@0 | 465 | pass P0 |
michael@0 | 466 | { |
michael@0 | 467 | SetRasterizerState( LayerRast ); |
michael@0 | 468 | SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 469 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); |
michael@0 | 470 | SetGeometryShader( NULL ); |
michael@0 | 471 | SetPixelShader( CompileShader( ps_4_0_level_9_3, AlphaExtractionPrepareShader() ) ); |
michael@0 | 472 | } |
michael@0 | 473 | } |
michael@0 | 474 | |
michael@0 | 475 | technique10 RenderRGBLayerPremulMask |
michael@0 | 476 | { |
michael@0 | 477 | pass P0 |
michael@0 | 478 | { |
michael@0 | 479 | SetRasterizerState( LayerRast ); |
michael@0 | 480 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 481 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 482 | SetGeometryShader( NULL ); |
michael@0 | 483 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerLinear) ) ); |
michael@0 | 484 | } |
michael@0 | 485 | } |
michael@0 | 486 | |
michael@0 | 487 | technique10 RenderRGBLayerPremulPointMask |
michael@0 | 488 | { |
michael@0 | 489 | pass P0 |
michael@0 | 490 | { |
michael@0 | 491 | SetRasterizerState( LayerRast ); |
michael@0 | 492 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 493 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 494 | SetGeometryShader( NULL ); |
michael@0 | 495 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerPoint) ) ); |
michael@0 | 496 | } |
michael@0 | 497 | } |
michael@0 | 498 | |
michael@0 | 499 | technique10 RenderRGBALayerPremulMask |
michael@0 | 500 | { |
michael@0 | 501 | pass P0 |
michael@0 | 502 | { |
michael@0 | 503 | SetRasterizerState( LayerRast ); |
michael@0 | 504 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 505 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 506 | SetGeometryShader( NULL ); |
michael@0 | 507 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); |
michael@0 | 508 | } |
michael@0 | 509 | } |
michael@0 | 510 | |
michael@0 | 511 | technique10 RenderRGBALayerPremulMask3D |
michael@0 | 512 | { |
michael@0 | 513 | pass P0 |
michael@0 | 514 | { |
michael@0 | 515 | SetRasterizerState( LayerRast ); |
michael@0 | 516 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 517 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMask3DVS() ) ); |
michael@0 | 518 | SetGeometryShader( NULL ); |
michael@0 | 519 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderLinearMask3D() ) ); |
michael@0 | 520 | } |
michael@0 | 521 | } |
michael@0 | 522 | |
michael@0 | 523 | technique10 RenderRGBALayerNonPremulMask |
michael@0 | 524 | { |
michael@0 | 525 | pass P0 |
michael@0 | 526 | { |
michael@0 | 527 | SetRasterizerState( LayerRast ); |
michael@0 | 528 | SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 529 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 530 | SetGeometryShader( NULL ); |
michael@0 | 531 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); |
michael@0 | 532 | } |
michael@0 | 533 | } |
michael@0 | 534 | |
michael@0 | 535 | technique10 RenderRGBALayerPremulPointMask |
michael@0 | 536 | { |
michael@0 | 537 | pass P0 |
michael@0 | 538 | { |
michael@0 | 539 | SetRasterizerState( LayerRast ); |
michael@0 | 540 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 541 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 542 | SetGeometryShader( NULL ); |
michael@0 | 543 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); |
michael@0 | 544 | } |
michael@0 | 545 | } |
michael@0 | 546 | |
michael@0 | 547 | technique10 RenderRGBALayerNonPremulPointMask |
michael@0 | 548 | { |
michael@0 | 549 | pass P0 |
michael@0 | 550 | { |
michael@0 | 551 | SetRasterizerState( LayerRast ); |
michael@0 | 552 | SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 553 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 554 | SetGeometryShader( NULL ); |
michael@0 | 555 | SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); |
michael@0 | 556 | } |
michael@0 | 557 | } |
michael@0 | 558 | |
michael@0 | 559 | technique10 RenderYCbCrLayerMask |
michael@0 | 560 | { |
michael@0 | 561 | pass P0 |
michael@0 | 562 | { |
michael@0 | 563 | SetRasterizerState( LayerRast ); |
michael@0 | 564 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 565 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 566 | SetGeometryShader( NULL ); |
michael@0 | 567 | SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShaderMask() ) ); |
michael@0 | 568 | } |
michael@0 | 569 | } |
michael@0 | 570 | |
michael@0 | 571 | technique10 RenderComponentAlphaLayerMask |
michael@0 | 572 | { |
michael@0 | 573 | Pass P0 |
michael@0 | 574 | { |
michael@0 | 575 | SetRasterizerState( LayerRast ); |
michael@0 | 576 | SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 577 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 578 | SetGeometryShader( NULL ); |
michael@0 | 579 | SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShaderMask() ) ); |
michael@0 | 580 | } |
michael@0 | 581 | } |
michael@0 | 582 | |
michael@0 | 583 | technique10 RenderSolidColorLayerMask |
michael@0 | 584 | { |
michael@0 | 585 | pass P0 |
michael@0 | 586 | { |
michael@0 | 587 | SetRasterizerState( LayerRast ); |
michael@0 | 588 | SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); |
michael@0 | 589 | SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); |
michael@0 | 590 | SetGeometryShader( NULL ); |
michael@0 | 591 | SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShaderMask() ) ); |
michael@0 | 592 | } |
michael@0 | 593 | } |
michael@0 | 594 |