michael@0: typedef float4 rect; michael@0: cbuffer PerLayer { michael@0: rect vTextureCoords; michael@0: rect vLayerQuad; michael@0: rect vMaskQuad; michael@0: float fLayerOpacity; michael@0: float4x4 mLayerTransform; michael@0: } michael@0: michael@0: cbuffer PerOccasionalLayer { michael@0: float4 vRenderTargetOffset; michael@0: float4 fLayerColor; michael@0: } michael@0: michael@0: cbuffer PerLayerManager { michael@0: float4x4 mProjection; michael@0: } michael@0: michael@0: BlendState Premul michael@0: { michael@0: AlphaToCoverageEnable = FALSE; michael@0: BlendEnable[0] = TRUE; michael@0: SrcBlend = One; michael@0: DestBlend = Inv_Src_Alpha; michael@0: BlendOp = Add; michael@0: SrcBlendAlpha = One; michael@0: DestBlendAlpha = Inv_Src_Alpha; michael@0: BlendOpAlpha = Add; michael@0: RenderTargetWriteMask[0] = 0x0F; // All michael@0: }; michael@0: michael@0: BlendState NonPremul michael@0: { michael@0: AlphaToCoverageEnable = FALSE; michael@0: BlendEnable[0] = TRUE; michael@0: SrcBlend = Src_Alpha; michael@0: DestBlend = Inv_Src_Alpha; michael@0: BlendOp = Add; michael@0: SrcBlendAlpha = One; michael@0: DestBlendAlpha = Inv_Src_Alpha; michael@0: BlendOpAlpha = Add; michael@0: RenderTargetWriteMask[0] = 0x0F; // All michael@0: }; michael@0: michael@0: BlendState NoBlendDual michael@0: { michael@0: AlphaToCoverageEnable = FALSE; michael@0: BlendEnable[0] = FALSE; michael@0: BlendEnable[1] = FALSE; michael@0: RenderTargetWriteMask[0] = 0x0F; // All michael@0: RenderTargetWriteMask[1] = 0x0F; // All michael@0: }; michael@0: michael@0: BlendState ComponentAlphaBlend michael@0: { michael@0: AlphaToCoverageEnable = FALSE; michael@0: BlendEnable[0] = TRUE; michael@0: SrcBlend = One; michael@0: DestBlend = Inv_Src1_Color; michael@0: BlendOp = Add; michael@0: SrcBlendAlpha = One; michael@0: DestBlendAlpha = Inv_Src_Alpha; michael@0: BlendOpAlpha = Add; michael@0: RenderTargetWriteMask[0] = 0x0F; // All michael@0: }; michael@0: michael@0: RasterizerState LayerRast michael@0: { michael@0: ScissorEnable = True; michael@0: CullMode = None; michael@0: }; michael@0: michael@0: Texture2D tRGB; michael@0: Texture2D tY; michael@0: Texture2D tCb; michael@0: Texture2D tCr; michael@0: Texture2D tRGBWhite; michael@0: Texture2D tMask; michael@0: michael@0: SamplerState LayerTextureSamplerLinear michael@0: { michael@0: Filter = MIN_MAG_MIP_LINEAR; michael@0: AddressU = Clamp; michael@0: AddressV = Clamp; michael@0: }; michael@0: michael@0: SamplerState LayerTextureSamplerPoint michael@0: { michael@0: Filter = MIN_MAG_MIP_POINT; michael@0: AddressU = Clamp; michael@0: AddressV = Clamp; michael@0: }; michael@0: michael@0: struct VS_INPUT { michael@0: float2 vPosition : POSITION; michael@0: }; michael@0: michael@0: struct VS_OUTPUT { michael@0: float4 vPosition : SV_Position; michael@0: float2 vTexCoords : TEXCOORD0; michael@0: }; michael@0: michael@0: struct VS_MASK_OUTPUT { michael@0: float4 vPosition : SV_Position; michael@0: float2 vTexCoords : TEXCOORD0; michael@0: float2 vMaskCoords : TEXCOORD1; michael@0: }; michael@0: michael@0: struct VS_MASK_3D_OUTPUT { michael@0: float4 vPosition : SV_Position; michael@0: float2 vTexCoords : TEXCOORD0; michael@0: float3 vMaskCoords : TEXCOORD1; michael@0: }; michael@0: michael@0: struct PS_OUTPUT { michael@0: float4 vSrc; michael@0: float4 vAlpha; michael@0: }; michael@0: michael@0: struct PS_DUAL_OUTPUT { michael@0: float4 vOutput1 : SV_Target0; michael@0: float4 vOutput2 : SV_Target1; michael@0: }; michael@0: michael@0: float2 TexCoords(const float2 aPosition) michael@0: { michael@0: float2 result; michael@0: const float2 size = vTextureCoords.zw; michael@0: result.x = vTextureCoords.x + aPosition.x * size.x; michael@0: result.y = vTextureCoords.y + aPosition.y * size.y; michael@0: michael@0: return result; michael@0: } michael@0: michael@0: float4 TransformedPostion(float2 aInPosition) michael@0: { michael@0: // the current vertex's position on the quad michael@0: float4 position = float4(0, 0, 0, 1); michael@0: michael@0: // We use 4 component floats to uniquely describe a rectangle, by the structure michael@0: // of x, y, width, height. This allows us to easily generate the 4 corners michael@0: // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the michael@0: // stream source for our LayerQuad vertex shader. We do this by doing: michael@0: // Xout = x + Xin * width michael@0: // Yout = y + Yin * height michael@0: float2 size = vLayerQuad.zw; michael@0: position.x = vLayerQuad.x + aInPosition.x * size.x; michael@0: position.y = vLayerQuad.y + aInPosition.y * size.y; michael@0: michael@0: position = mul(mLayerTransform, position); michael@0: michael@0: return position; michael@0: } michael@0: michael@0: float4 VertexPosition(float4 aTransformedPosition) michael@0: { michael@0: float4 result; michael@0: result.w = aTransformedPosition.w; michael@0: result.xyz = aTransformedPosition.xyz / aTransformedPosition.w; michael@0: result -= vRenderTargetOffset; michael@0: result.xyz *= result.w; michael@0: michael@0: result = mul(mProjection, result); michael@0: michael@0: return result; michael@0: } michael@0: michael@0: VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex) michael@0: { michael@0: VS_OUTPUT outp; michael@0: float4 position = TransformedPostion(aVertex.vPosition); michael@0: michael@0: outp.vPosition = VertexPosition(position); michael@0: outp.vTexCoords = TexCoords(aVertex.vPosition.xy); michael@0: michael@0: return outp; michael@0: } michael@0: michael@0: VS_MASK_OUTPUT LayerQuadMaskVS(const VS_INPUT aVertex) michael@0: { michael@0: VS_MASK_OUTPUT outp; michael@0: float4 position = TransformedPostion(aVertex.vPosition); michael@0: michael@0: outp.vPosition = VertexPosition(position); michael@0: michael@0: // calculate the position on the mask texture michael@0: outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; michael@0: outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; michael@0: michael@0: outp.vTexCoords = TexCoords(aVertex.vPosition.xy); michael@0: michael@0: return outp; michael@0: } michael@0: michael@0: VS_MASK_3D_OUTPUT LayerQuadMask3DVS(const VS_INPUT aVertex) michael@0: { michael@0: VS_MASK_3D_OUTPUT outp; michael@0: float4 position = TransformedPostion(aVertex.vPosition); michael@0: michael@0: outp.vPosition = VertexPosition(position); michael@0: michael@0: // calculate the position on the mask texture michael@0: position.xyz /= position.w; michael@0: outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z; michael@0: outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w; michael@0: // We use the w coord to do non-perspective correct interpolation: michael@0: // the quad might be transformed in 3D, in which case it will have some michael@0: // perspective. The graphics card will do perspective-correct interpolation michael@0: // of the texture, but our mask is already transformed and so we require michael@0: // linear interpolation. Therefore, we must correct the interpolation michael@0: // ourselves, we do this by multiplying all coords by w here, and dividing by michael@0: // w in the pixel shader (post-interpolation), we pass w in outp.vMaskCoords.z. michael@0: // See http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness michael@0: outp.vMaskCoords.z = 1; michael@0: outp.vMaskCoords *= position.w; michael@0: michael@0: outp.vTexCoords = TexCoords(aVertex.vPosition.xy); michael@0: michael@0: return outp; michael@0: } michael@0: michael@0: float4 RGBAShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target michael@0: { michael@0: float2 maskCoords = aVertex.vMaskCoords; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity * mask; michael@0: } michael@0: michael@0: float4 RGBAShaderLinearMask3D(const VS_MASK_3D_OUTPUT aVertex) : SV_Target michael@0: { michael@0: float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: return tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) * fLayerOpacity * mask; michael@0: } michael@0: michael@0: float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : SV_Target michael@0: { michael@0: float4 result; michael@0: result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; michael@0: result.a = fLayerOpacity; michael@0: michael@0: float2 maskCoords = aVertex.vMaskCoords; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: return result * mask; michael@0: } michael@0: michael@0: float4 CalculateYCbCrColor(const float2 aTexCoords) michael@0: { michael@0: float4 yuv; michael@0: float4 color; michael@0: michael@0: yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; michael@0: yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.0625; michael@0: yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; michael@0: michael@0: color.r = yuv.g * 1.164 + yuv.r * 1.596; michael@0: color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; michael@0: color.b = yuv.g * 1.164 + yuv.b * 2.018; michael@0: color.a = 1.0f; michael@0: michael@0: return color; michael@0: } michael@0: michael@0: float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target michael@0: { michael@0: float2 maskCoords = aVertex.vMaskCoords; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: michael@0: return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity * mask; michael@0: } michael@0: michael@0: PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target michael@0: { michael@0: PS_OUTPUT result; michael@0: michael@0: result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); michael@0: result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; michael@0: result.vSrc.a = result.vAlpha.g; michael@0: michael@0: float2 maskCoords = aVertex.vMaskCoords; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: result.vSrc *= fLayerOpacity * mask; michael@0: result.vAlpha *= fLayerOpacity * mask; michael@0: michael@0: return result; michael@0: } michael@0: michael@0: float4 SolidColorShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target michael@0: { michael@0: float2 maskCoords = aVertex.vMaskCoords; michael@0: float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a; michael@0: return fLayerColor * mask; michael@0: } michael@0: michael@0: /* michael@0: * Un-masked versions michael@0: ************************************************************* michael@0: */ michael@0: float4 RGBAShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target michael@0: { michael@0: return tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; michael@0: } michael@0: michael@0: float4 RGBShader(const VS_OUTPUT aVertex, uniform sampler aSampler) : SV_Target michael@0: { michael@0: float4 result; michael@0: result = tRGB.Sample(aSampler, aVertex.vTexCoords) * fLayerOpacity; michael@0: result.a = fLayerOpacity; michael@0: return result; michael@0: } michael@0: michael@0: float4 YCbCrShader(const VS_OUTPUT aVertex) : SV_Target michael@0: { michael@0: return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity; michael@0: } michael@0: michael@0: PS_OUTPUT ComponentAlphaShader(const VS_OUTPUT aVertex) : SV_Target michael@0: { michael@0: PS_OUTPUT result; michael@0: michael@0: result.vSrc = tRGB.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords); michael@0: result.vAlpha = 1.0 - tRGBWhite.Sample(LayerTextureSamplerLinear, aVertex.vTexCoords) + result.vSrc; michael@0: result.vSrc.a = result.vAlpha.g; michael@0: result.vSrc *= fLayerOpacity; michael@0: result.vAlpha *= fLayerOpacity; michael@0: return result; michael@0: } michael@0: michael@0: float4 SolidColorShader(const VS_OUTPUT aVertex) : SV_Target michael@0: { michael@0: return fLayerColor; michael@0: } michael@0: michael@0: PS_DUAL_OUTPUT AlphaExtractionPrepareShader(const VS_OUTPUT aVertex) michael@0: { michael@0: PS_DUAL_OUTPUT result; michael@0: result.vOutput1 = float4(0, 0, 0, 1); michael@0: result.vOutput2 = float4(1, 1, 1, 1); michael@0: return result; michael@0: } michael@0: michael@0: technique10 RenderRGBLayerPremul michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBLayerPremulPoint michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShader(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerPremul michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerNonPremul michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerPremulPoint michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerNonPremulPoint michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShader(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderYCbCrLayer michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShader() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderComponentAlphaLayer michael@0: { michael@0: Pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShader() ) ); michael@0: } michael@0: michael@0: } michael@0: michael@0: technique10 RenderSolidColorLayer michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderClearLayer michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 PrepareAlphaExtractionTextures michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, AlphaExtractionPrepareShader() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBLayerPremulMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBLayerPremulPointMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBShaderMask(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerPremulMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerPremulMask3D michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMask3DVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderLinearMask3D() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerNonPremulMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerLinear) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerPremulPointMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderRGBALayerNonPremulPointMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( NonPremul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, RGBAShaderMask(LayerTextureSamplerPoint) ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderYCbCrLayerMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, YCbCrShaderMask() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderComponentAlphaLayerMask michael@0: { michael@0: Pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( ComponentAlphaBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, ComponentAlphaShaderMask() ) ); michael@0: } michael@0: } michael@0: michael@0: technique10 RenderSolidColorLayerMask michael@0: { michael@0: pass P0 michael@0: { michael@0: SetRasterizerState( LayerRast ); michael@0: SetBlendState( Premul, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF ); michael@0: SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadMaskVS() ) ); michael@0: SetGeometryShader( NULL ); michael@0: SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShaderMask() ) ); michael@0: } michael@0: } michael@0: