1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/d3d10/LayerManagerD3D10.fx Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,594 @@ 1.4 +typedef float4 rect; 1.5 +cbuffer PerLayer { 1.6 + rect vTextureCoords; 1.7 + rect vLayerQuad; 1.8 + rect vMaskQuad; 1.9 + float fLayerOpacity; 1.10 + float4x4 mLayerTransform; 1.11 +} 1.12 + 1.13 +cbuffer PerOccasionalLayer { 1.14 + float4 vRenderTargetOffset; 1.15 + float4 fLayerColor; 1.16 +} 1.17 + 1.18 +cbuffer PerLayerManager { 1.19 + float4x4 mProjection; 1.20 +} 1.21 + 1.22 +BlendState Premul 1.23 +{ 1.24 + AlphaToCoverageEnable = FALSE; 1.25 + BlendEnable[0] = TRUE; 1.26 + SrcBlend = One; 1.27 + DestBlend = Inv_Src_Alpha; 1.28 + BlendOp = Add; 1.29 + SrcBlendAlpha = One; 1.30 + DestBlendAlpha = Inv_Src_Alpha; 1.31 + BlendOpAlpha = Add; 1.32 + RenderTargetWriteMask[0] = 0x0F; // All 1.33 +}; 1.34 + 1.35 +BlendState NonPremul 1.36 +{ 1.37 + AlphaToCoverageEnable = FALSE; 1.38 + BlendEnable[0] = TRUE; 1.39 + SrcBlend = Src_Alpha; 1.40 + DestBlend = Inv_Src_Alpha; 1.41 + BlendOp = Add; 1.42 + SrcBlendAlpha = One; 1.43 + DestBlendAlpha = Inv_Src_Alpha; 1.44 + BlendOpAlpha = Add; 1.45 + RenderTargetWriteMask[0] = 0x0F; // All 1.46 +}; 1.47 + 1.48 +BlendState NoBlendDual 1.49 +{ 1.50 + AlphaToCoverageEnable = FALSE; 1.51 + BlendEnable[0] = FALSE; 1.52 + BlendEnable[1] = FALSE; 1.53 + RenderTargetWriteMask[0] = 0x0F; // All 1.54 + RenderTargetWriteMask[1] = 0x0F; // All 1.55 +}; 1.56 + 1.57 +BlendState ComponentAlphaBlend 1.58 +{ 1.59 + AlphaToCoverageEnable = FALSE; 1.60 + BlendEnable[0] = TRUE; 1.61 + SrcBlend = One; 1.62 + DestBlend = Inv_Src1_Color; 1.63 + BlendOp = Add; 1.64 + SrcBlendAlpha = One; 1.65 + DestBlendAlpha = Inv_Src_Alpha; 1.66 + BlendOpAlpha = Add; 1.67 + RenderTargetWriteMask[0] = 0x0F; // All 1.68 +}; 1.69 + 1.70 +RasterizerState LayerRast 1.71 +{ 1.72 + ScissorEnable = True; 1.73 + CullMode = None; 1.74 +}; 1.75 + 1.76 +Texture2D tRGB; 1.77 +Texture2D tY; 1.78 +Texture2D tCb; 1.79 +Texture2D tCr; 1.80 +Texture2D tRGBWhite; 1.81 +Texture2D tMask; 1.82 + 1.83 +SamplerState LayerTextureSamplerLinear 1.84 +{ 1.85 + Filter = MIN_MAG_MIP_LINEAR; 1.86 + AddressU = Clamp; 1.87 + AddressV = Clamp; 1.88 +}; 1.89 + 1.90 +SamplerState LayerTextureSamplerPoint 1.91 +{ 1.92 + Filter = MIN_MAG_MIP_POINT; 1.93 + AddressU = Clamp; 1.94 + AddressV = Clamp; 1.95 +}; 1.96 + 1.97 +struct VS_INPUT { 1.98 + float2 vPosition : POSITION; 1.99 +}; 1.100 + 1.101 +struct VS_OUTPUT { 1.102 + float4 vPosition : SV_Position; 1.103 + float2 vTexCoords : TEXCOORD0; 1.104 +}; 1.105 + 1.106 +struct VS_MASK_OUTPUT { 1.107 + float4 vPosition : SV_Position; 1.108 + float2 vTexCoords : TEXCOORD0; 1.109 + float2 vMaskCoords : TEXCOORD1; 1.110 +}; 1.111 + 1.112 +struct VS_MASK_3D_OUTPUT { 1.113 + float4 vPosition : SV_Position; 1.114 + float2 vTexCoords : TEXCOORD0; 1.115 + float3 vMaskCoords : TEXCOORD1; 1.116 +}; 1.117 + 1.118 +struct PS_OUTPUT { 1.119 + float4 vSrc; 1.120 + float4 vAlpha; 1.121 +}; 1.122 + 1.123 +struct PS_DUAL_OUTPUT { 1.124 + float4 vOutput1 : SV_Target0; 1.125 + float4 vOutput2 : SV_Target1; 1.126 +}; 1.127 + 1.128 +float2 TexCoords(const float2 aPosition) 1.129 +{ 1.130 + float2 result; 1.131 + const float2 size = vTextureCoords.zw; 1.132 + result.x = vTextureCoords.x + aPosition.x * size.x; 1.133 + result.y = vTextureCoords.y + aPosition.y * size.y; 1.134 + 1.135 + return result; 1.136 +} 1.137 + 1.138 +float4 TransformedPostion(float2 aInPosition) 1.139 +{ 1.140 + // the current vertex's position on the quad 1.141 + float4 position = float4(0, 0, 0, 1); 1.142 + 1.143 + // We use 4 component floats to uniquely describe a rectangle, by the structure 1.144 + // of x, y, width, height. This allows us to easily generate the 4 corners 1.145 + // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the 1.146 + // stream source for our LayerQuad vertex shader. We do this by doing: 1.147 + // Xout = x + Xin * width 1.148 + // Yout = y + Yin * height 1.149 + float2 size = vLayerQuad.zw; 1.150 + position.x = vLayerQuad.x + aInPosition.x * size.x; 1.151 + position.y = vLayerQuad.y + aInPosition.y * size.y; 1.152 + 1.153 + position = mul(mLayerTransform, position); 1.154 + 1.155 + return position; 1.156 +} 1.157 + 1.158 +float4 VertexPosition(float4 aTransformedPosition) 1.159 +{ 1.160 + float4 result; 1.161 + result.w = aTransformedPosition.w; 1.162 + result.xyz = aTransformedPosition.xyz / aTransformedPosition.w; 1.163 + result -= vRenderTargetOffset; 1.164 + result.xyz *= result.w; 1.165 + 1.166 + result = mul(mProjection, result); 1.167 + 1.168 + return result; 1.169 +} 1.170 + 1.171 +VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex) 1.172 +{ 1.173 + VS_OUTPUT outp; 1.174 + float4 position = TransformedPostion(aVertex.vPosition); 1.175 + 1.176 + outp.vPosition = VertexPosition(position); 1.177 + outp.vTexCoords = TexCoords(aVertex.vPosition.xy); 1.178 + 1.179 + return outp; 1.180 +} 1.181 + 1.182 +VS_MASK_OUTPUT LayerQuadMaskVS(const VS_INPUT aVertex) 1.183 +{ 1.184 + VS_MASK_OUTPUT outp; 1.185 + float4 position = TransformedPostion(aVertex.vPosition); 1.186 + 1.187 + outp.vPosition = VertexPosition(position); 1.188 + 1.189 + // calculate the position on the mask texture 1.190 + outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; 1.191 + outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; 1.192 + 1.193 + outp.vTexCoords = TexCoords(aVertex.vPosition.xy); 1.194 + 1.195 + return outp; 1.196 +} 1.197 + 1.198 +VS_MASK_3D_OUTPUT LayerQuadMask3DVS(const VS_INPUT aVertex) 1.199 +{ 1.200 + VS_MASK_3D_OUTPUT outp; 1.201 + float4 position = TransformedPostion(aVertex.vPosition); 1.202 + 1.203 + outp.vPosition = VertexPosition(position); 1.204 + 1.205 + // calculate the position on the mask texture 1.206 + position.xyz /= position.w; 1.207 + outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; 1.208 + outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; 1.209 + // We use the w coord to do non-perspective correct interpolation: 1.210 + // the quad might be transformed in 3D, in which case it will have some 1.211 + // perspective. The graphics card will do perspective-correct interpolation 1.212 + // of the texture, but our mask is already transformed and so we require 1.213 + // linear interpolation. Therefore, we must correct the interpolation 1.214 + // ourselves, we do this by multiplying all coords by w here, and dividing by 1.215 + // w in the pixel shader (post-interpolation), we pass w in outp.vMaskCoords.z. 1.216 + // See http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness 1.217 + outp.vMaskCoords.z = 1; 1.218 + outp.vMaskCoords *= position.w; 1.219 + 1.220 + outp.vTexCoords = TexCoords(aVertex.vPosition.xy); 1.221 + 1.222 + return outp; 1.223 +} 1.224 + 1.225 +float4 RGBAShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target 1.226 +{ 1.227 + float2 maskCoords = aVertex.vMaskCoords; 1.228 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.229 + return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity * mask; 1.230 +} 1.231 + 1.232 +float4 RGBAShaderLinearMask3D(const VS_MASK_3D_OUTPUT aVertex) : SV_Target 1.233 +{ 1.234 + float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z; 1.235 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.236 + return tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) * fLayerOpacity * mask; 1.237 +} 1.238 + 1.239 +float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target 1.240 +{ 1.241 + float4 result; 1.242 + result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; 1.243 + result.a = fLayerOpacity; 1.244 + 1.245 + float2 maskCoords = aVertex.vMaskCoords; 1.246 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.247 + return result * mask; 1.248 +} 1.249 + 1.250 +float4 CalculateYCbCrColor(const float2 aTexCoords) 1.251 +{ 1.252 + float4 yuv; 1.253 + float4 color; 1.254 + 1.255 + yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; 1.256 + yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.0625; 1.257 + yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; 1.258 + 1.259 + color.r = yuv.g * 1.164 + yuv.r * 1.596; 1.260 + color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; 1.261 + color.b = yuv.g * 1.164 + yuv.b * 2.018; 1.262 + color.a = 1.0f; 1.263 + 1.264 + return color; 1.265 +} 1.266 + 1.267 +float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target 1.268 +{ 1.269 + float2 maskCoords = aVertex.vMaskCoords; 1.270 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.271 + 1.272 + return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity * mask; 1.273 +} 1.274 + 1.275 +PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target 1.276 +{ 1.277 + PS_OUTPUT result; 1.278 + 1.279 + result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); 1.280 + result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; 1.281 + result.vSrc.a = result.vAlpha.g; 1.282 + 1.283 + float2 maskCoords = aVertex.vMaskCoords; 1.284 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.285 + result.vSrc *= fLayerOpacity * mask; 1.286 + result.vAlpha *= fLayerOpacity * mask; 1.287 + 1.288 + return result; 1.289 +} 1.290 + 1.291 +float4 SolidColorShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target 1.292 +{ 1.293 + float2 maskCoords = aVertex.vMaskCoords; 1.294 + float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; 1.295 + return fLayerColor * mask; 1.296 +} 1.297 + 1.298 +/* 1.299 + * Un-masked versions 1.300 + ************************************************************* 1.301 + */ 1.302 +float4 RGBAShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target 1.303 +{ 1.304 + return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; 1.305 +} 1.306 + 1.307 +float4 RGBShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target 1.308 +{ 1.309 + float4 result; 1.310 + result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; 1.311 + result.a = fLayerOpacity; 1.312 + return result; 1.313 +} 1.314 + 1.315 +float4 YCbCrShader(const VS_OUTPUT aVertex) : SV_Target 1.316 +{ 1.317 + return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity; 1.318 +} 1.319 + 1.320 +PS_OUTPUT ComponentAlphaShader(const VS_OUTPUT aVertex) : SV_Target 1.321 +{ 1.322 + PS_OUTPUT result; 1.323 + 1.324 + result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); 1.325 + result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; 1.326 + result.vSrc.a = result.vAlpha.g; 1.327 + result.vSrc *= fLayerOpacity; 1.328 + result.vAlpha *= fLayerOpacity; 1.329 + return result; 1.330 +} 1.331 + 1.332 +float4 SolidColorShader(const VS_OUTPUT aVertex) : SV_Target 1.333 +{ 1.334 + return fLayerColor; 1.335 +} 1.336 + 1.337 +PS_DUAL_OUTPUT AlphaExtractionPrepareShader(const VS_OUTPUT aVertex) 1.338 +{ 1.339 + PS_DUAL_OUTPUT result; 1.340 + result.vOutput1 = float4(0, 0, 0, 1); 1.341 + result.vOutput2 = float4(1, 1, 1, 1); 1.342 + return result; 1.343 +} 1.344 + 1.345 +technique10 RenderRGBLayerPremul 1.346 +{ 1.347 + pass P0 1.348 + { 1.349 + SetRasterizerState( LayerRast ); 1.350 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.351 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.352 + SetGeometryShader( NULL ); 1.353 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerLinear) ) ); 1.354 + } 1.355 +} 1.356 + 1.357 +technique10 RenderRGBLayerPremulPoint 1.358 +{ 1.359 + pass P0 1.360 + { 1.361 + SetRasterizerState( LayerRast ); 1.362 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.363 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.364 + SetGeometryShader( NULL ); 1.365 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerPoint) ) ); 1.366 + } 1.367 +} 1.368 + 1.369 +technique10 RenderRGBALayerPremul 1.370 +{ 1.371 + pass P0 1.372 + { 1.373 + SetRasterizerState( LayerRast ); 1.374 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.375 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.376 + SetGeometryShader( NULL ); 1.377 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); 1.378 + } 1.379 +} 1.380 + 1.381 +technique10 RenderRGBALayerNonPremul 1.382 +{ 1.383 + pass P0 1.384 + { 1.385 + SetRasterizerState( LayerRast ); 1.386 + SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.387 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.388 + SetGeometryShader( NULL ); 1.389 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); 1.390 + } 1.391 +} 1.392 + 1.393 +technique10 RenderRGBALayerPremulPoint 1.394 +{ 1.395 + pass P0 1.396 + { 1.397 + SetRasterizerState( LayerRast ); 1.398 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.399 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.400 + SetGeometryShader( NULL ); 1.401 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); 1.402 + } 1.403 +} 1.404 + 1.405 +technique10 RenderRGBALayerNonPremulPoint 1.406 +{ 1.407 + pass P0 1.408 + { 1.409 + SetRasterizerState( LayerRast ); 1.410 + SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.411 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.412 + SetGeometryShader( NULL ); 1.413 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); 1.414 + } 1.415 +} 1.416 + 1.417 +technique10 RenderYCbCrLayer 1.418 +{ 1.419 + pass P0 1.420 + { 1.421 + SetRasterizerState( LayerRast ); 1.422 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.423 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.424 + SetGeometryShader( NULL ); 1.425 + SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShader() ) ); 1.426 + } 1.427 +} 1.428 + 1.429 +technique10 RenderComponentAlphaLayer 1.430 +{ 1.431 + Pass P0 1.432 + { 1.433 + SetRasterizerState( LayerRast ); 1.434 + SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.435 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.436 + SetGeometryShader( NULL ); 1.437 + SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShader() ) ); 1.438 + } 1.439 + 1.440 +} 1.441 + 1.442 +technique10 RenderSolidColorLayer 1.443 +{ 1.444 + pass P0 1.445 + { 1.446 + SetRasterizerState( LayerRast ); 1.447 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.448 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.449 + SetGeometryShader( NULL ); 1.450 + SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); 1.451 + } 1.452 +} 1.453 + 1.454 +technique10 RenderClearLayer 1.455 +{ 1.456 + pass P0 1.457 + { 1.458 + SetRasterizerState( LayerRast ); 1.459 + SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.460 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.461 + SetGeometryShader( NULL ); 1.462 + SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); 1.463 + } 1.464 +} 1.465 + 1.466 +technique10 PrepareAlphaExtractionTextures 1.467 +{ 1.468 + pass P0 1.469 + { 1.470 + SetRasterizerState( LayerRast ); 1.471 + SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.472 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); 1.473 + SetGeometryShader( NULL ); 1.474 + SetPixelShader( CompileShader( ps_4_0_level_9_3, AlphaExtractionPrepareShader() ) ); 1.475 + } 1.476 +} 1.477 + 1.478 +technique10 RenderRGBLayerPremulMask 1.479 +{ 1.480 + pass P0 1.481 + { 1.482 + SetRasterizerState( LayerRast ); 1.483 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.484 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.485 + SetGeometryShader( NULL ); 1.486 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerLinear) ) ); 1.487 + } 1.488 +} 1.489 + 1.490 +technique10 RenderRGBLayerPremulPointMask 1.491 +{ 1.492 + pass P0 1.493 + { 1.494 + SetRasterizerState( LayerRast ); 1.495 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.496 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.497 + SetGeometryShader( NULL ); 1.498 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerPoint) ) ); 1.499 + } 1.500 +} 1.501 + 1.502 +technique10 RenderRGBALayerPremulMask 1.503 +{ 1.504 + pass P0 1.505 + { 1.506 + SetRasterizerState( LayerRast ); 1.507 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.508 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.509 + SetGeometryShader( NULL ); 1.510 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); 1.511 + } 1.512 +} 1.513 + 1.514 +technique10 RenderRGBALayerPremulMask3D 1.515 +{ 1.516 + pass P0 1.517 + { 1.518 + SetRasterizerState( LayerRast ); 1.519 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.520 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMask3DVS() ) ); 1.521 + SetGeometryShader( NULL ); 1.522 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderLinearMask3D() ) ); 1.523 + } 1.524 +} 1.525 + 1.526 +technique10 RenderRGBALayerNonPremulMask 1.527 +{ 1.528 + pass P0 1.529 + { 1.530 + SetRasterizerState( LayerRast ); 1.531 + SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.532 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.533 + SetGeometryShader( NULL ); 1.534 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); 1.535 + } 1.536 +} 1.537 + 1.538 +technique10 RenderRGBALayerPremulPointMask 1.539 +{ 1.540 + pass P0 1.541 + { 1.542 + SetRasterizerState( LayerRast ); 1.543 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.544 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.545 + SetGeometryShader( NULL ); 1.546 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); 1.547 + } 1.548 +} 1.549 + 1.550 +technique10 RenderRGBALayerNonPremulPointMask 1.551 +{ 1.552 + pass P0 1.553 + { 1.554 + SetRasterizerState( LayerRast ); 1.555 + SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.556 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.557 + SetGeometryShader( NULL ); 1.558 + SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); 1.559 + } 1.560 +} 1.561 + 1.562 +technique10 RenderYCbCrLayerMask 1.563 +{ 1.564 + pass P0 1.565 + { 1.566 + SetRasterizerState( LayerRast ); 1.567 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.568 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.569 + SetGeometryShader( NULL ); 1.570 + SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShaderMask() ) ); 1.571 + } 1.572 +} 1.573 + 1.574 +technique10 RenderComponentAlphaLayerMask 1.575 +{ 1.576 + Pass P0 1.577 + { 1.578 + SetRasterizerState( LayerRast ); 1.579 + SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.580 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.581 + SetGeometryShader( NULL ); 1.582 + SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShaderMask() ) ); 1.583 + } 1.584 +} 1.585 + 1.586 +technique10 RenderSolidColorLayerMask 1.587 +{ 1.588 + pass P0 1.589 + { 1.590 + SetRasterizerState( LayerRast ); 1.591 + SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); 1.592 + SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); 1.593 + SetGeometryShader( NULL ); 1.594 + SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShaderMask() ) ); 1.595 + } 1.596 +} 1.597 +