"Texture2DMS < float4 > PassSrg_m_texture0ms : register ( t0 , space0 ) ;"
"Texture2D < float4 > PassSrg_m_texture1 : register ( t1 , space0 ) ;"
"Texture2DMS < float4 > PassSrg_m_texture2ms : register ( t2 , space0 ) ;"
"Texture2DMSArray < float4 > PassSrg_m_textureArray0ms : register ( t3 , space0 ) ;"
"Texture2DArray < float4 > PassSrg_m_textureArray1 : register ( t4 , space0 ) ;"
"float4 PassSrg_Load ( int2 texelLoc , int2 texelLocDelta , int element , int sampleIndex )"
"{"
"float4 color = float4 ( 0 , 0 , 0 , 0 ) ;"
"color += :: PassSrg_m_texture0ms . Load ( texelLoc , sampleIndex ) ;"
"color -= :: PassSrg_m_texture0ms . Load ( texelLoc + texelLocDelta , sampleIndex + sampleIndex ) ;"
"color += :: PassSrg_m_texture0ms . Load ( texelLoc + texelLocDelta , sampleIndex + sampleIndex , int2 ( 0 , 2 ) ) ;"
"color -= :: PassSrg_m_texture1 . Load ( int3 ( texelLoc , 0 ) ) ;"
"color += :: PassSrg_m_texture1 . Load ( int3 ( texelLoc , 1 ) ) ;"
"color -= :: PassSrg_m_texture2ms . Load ( texelLoc - 2 . 0 * texelLocDelta , sampleIndex + 1 , int2 ( 1 , 1 ) ) ;"
"color += :: PassSrg_m_textureArray0ms . Load ( int3 ( texelLoc , element ) , sampleIndex / 2 ) - :: PassSrg_m_textureArray1 . Load ( int4 ( texelLoc , element , 3 ) ) ;"
"return color ;"
"}"
"float2 PassSrg_GetSamplePosition ( int sampleIndex )"
"{"
"return :: PassSrg_m_texture0ms . GetSamplePosition ( 2 * sampleIndex ) + :: PassSrg_m_texture2ms . GetSamplePosition ( sampleIndex ) + :: PassSrg_m_textureArray0ms . GetSamplePosition ( ( sampleIndex + 7 ) / 3 ) ;"
"}"
"void PassSrg_GetDimensions ( out uint width , out uint height , out uint elements , out uint numSamples )"
"{"
"uint tmpWidth ;"
"uint tmpHeight ;"
"uint tmpElements ;"
"uint tmpNumSamples ;"
"width = 0 ;"
"height = 0 ;"
"elements = 0 ;"
"numSamples = 0 ;"
":: PassSrg_m_texture0ms . GetDimensions ( tmpWidth , tmpHeight , tmpNumSamples ) ;"
"width += tmpWidth ;"
"height += tmpHeight ;"
"numSamples += tmpNumSamples ;"
":: PassSrg_m_texture1 . GetDimensions ( tmpWidth , tmpHeight ) ;"
"width += tmpWidth ;"
"height += tmpHeight ;"
":: PassSrg_m_texture2ms . GetDimensions ( tmpWidth , tmpHeight , tmpNumSamples ) ;"
"width += tmpWidth ;"
"height += tmpHeight ;"
"numSamples += tmpNumSamples ;"
":: PassSrg_m_textureArray0ms . GetDimensions ( tmpWidth , tmpHeight , tmpElements , tmpNumSamples ) ;"
"width += tmpWidth ;"
"height += tmpHeight ;"
"elements += tmpElements ;"
"numSamples += tmpNumSamples ;"
":: PassSrg_m_textureArray1 . GetDimensions ( tmpWidth , tmpHeight , tmpElements ) ;"
"width += tmpWidth ;"
"height += tmpHeight ;"
"elements += tmpElements ;"
"width /= 5 ;"
"height /= 5 ;"
"elements /= 2 ;"
"numSamples /= 3 ;"
"}"
"float4 Load ( int2 texelLoc , int2 texelLocDelta , int element , int sampleIndex , Texture2DMS < float4 > tex0ms , Texture2D < float4 > tex1 , Texture2DMS < float4 > tex2ms , Texture2DMSArray < float4 > texArray0ms , Texture2DArray < float4 > texArray1 )"
"{"
"float4 color = float4 ( 0 , 0 , 0 , 0 ) ;"
"color += tex0ms . Load ( texelLoc , sampleIndex ) ;"
"color -= tex0ms . Load ( texelLoc + texelLocDelta , sampleIndex + sampleIndex ) ;"
"color += tex0ms . Load ( texelLoc + texelLocDelta , sampleIndex + sampleIndex , int2 ( 0 , 2 ) ) ;"
"color -= tex1 . Load ( int3 ( texelLoc , 0 ) ) ;"
"color += tex1 . Load ( int3 ( texelLoc , 1 ) ) ;"
"color -= tex2ms . Load ( texelLoc - 2 . 0 * texelLocDelta , sampleIndex + 1 , int2 ( 1 , 1 ) ) ;"
"color += texArray0ms . Load ( int3 ( texelLoc , element ) , sampleIndex / 2 ) - texArray1 . Load ( int4 ( texelLoc , element , 3 ) ) ;"
"return color ;"
"}"
"struct VSOutput"
"{"
"float4 m_position : SV_Position ;"
"float2 m_texCoord : TEXCOORD0 ;"
"} ;"
"struct PSOutput"
"{"
"float4 m_color : SV_Target0 ;"
"} ;"
":: PSOutput PSMain ( :: VSOutput IN , in uint sampleIndex : SV_SampleIndex )"
"{"
"PSOutput OUT ;"
"int2 texelCoord = int2 ( IN . m_position . xy ) ;"
"float4 color1 = :: PassSrg_Load ( texelCoord , int2 ( 0 , 0 ) , 1 , sampleIndex ) ;"
"float4 color2 = Load ( texelCoord , int2 ( 0 , 0 ) , 1 , sampleIndex , :: PassSrg_m_texture0ms , :: PassSrg_m_texture1 , :: PassSrg_m_texture2ms , :: PassSrg_m_textureArray0ms , :: PassSrg_m_textureArray1 ) ;"
"float2 samplePos = :: PassSrg_GetSamplePosition ( sampleIndex ) ;"
"uint width ;"
"uint height ;"
"uint elements ;"
"uint numSamples ;"
":: PassSrg_GetDimensions ( width , height , elements , numSamples ) ;"
"if ( ( samplePos . x == samplePos . y ) && ( width == height ) && ( elements != numSamples ) ) {"
"OUT . m_color = color1 ;"
"} else {"
"OUT . m_color = color2 ;"
"} return OUT ;"
"}"
":: PSOutput PSMainCoverage ( :: VSOutput IN , inout uint coverage : SV_Coverage )"
"{"
"PSOutput OUT ;"
"int2 texelCoord = int2 ( IN . m_position . xy ) ;"
"uint width ;"
"uint height ;"
"uint elements ;"
"uint numSamples ;"
":: PassSrg_GetDimensions ( width , height , elements , numSamples ) ;"
"for ( uint sampleIndex = 0 ;"
"sampleIndex < numSamples ;"
"++ sampleIndex ) {"
"if ( ! ( coverage & ( 1 < < sampleIndex ) ) ) {"
"continue ;"
"} float4 color1 = :: PassSrg_Load ( texelCoord , int2 ( 0 , 0 ) , 1 , sampleIndex ) ;"
"float4 color2 = Load ( texelCoord , int2 ( 0 , 0 ) , 1 , sampleIndex , :: PassSrg_m_texture0ms , :: PassSrg_m_texture1 , :: PassSrg_m_texture2ms , :: PassSrg_m_textureArray0ms , :: PassSrg_m_textureArray1 ) ;"
"float2 samplePos = :: PassSrg_GetSamplePosition ( sampleIndex ) ;"
"if ( ( samplePos . x == samplePos . y ) && ( width == height ) && ( elements != numSamples ) ) {"
"OUT . m_color += color1 ;"
"coverage &= ~ ( 1 < < sampleIndex ) ;"
"} else {"
"OUT . m_color -= color2 ;"
"} } return OUT ;"
"}"
"struct VSOutputWithSampleIndex"
"{"
"float4 m_position : SV_Position ;"
"float2 m_texCoord : TEXCOORD0 ;"
"uint m_sampleIndex : SV_SampleIndex ;"
"} ;"
":: PSOutput PSMain2 ( :: VSOutputWithSampleIndex IN )"
"{"
"PSOutput OUT ;"
"int2 texelCoord = int2 ( IN . m_position . xy ) ;"
"float4 color1 = :: PassSrg_Load ( texelCoord , int2 ( 0 , 0 ) , 1 , IN . m_sampleIndex ) ;"
"float4 color2 = Load ( texelCoord , int2 ( 0 , 0 ) , 1 , IN . m_sampleIndex , :: PassSrg_m_texture0ms , :: PassSrg_m_texture1 , :: PassSrg_m_texture2ms , :: PassSrg_m_textureArray0ms , :: PassSrg_m_textureArray1 ) ;"
"float2 samplePos = :: PassSrg_GetSamplePosition ( IN . m_sampleIndex ) ;"
"uint width ;"
"uint height ;"
"uint elements ;"
"uint numSamples ;"
":: PassSrg_GetDimensions ( width , height , elements , numSamples ) ;"
"if ( ( samplePos . x == samplePos . y ) && ( width == height ) && ( elements != numSamples ) ) {"
"OUT . m_color = color1 ;"
"} else {"
"OUT . m_color = color2 ;"
"} return OUT ;"
"}"