123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- "Texture2D < float4 > PassSrg_m_texture0ms : register ( t0 , space0 ) ;"
- "Texture2D < float4 > PassSrg_m_texture1 : register ( t1 , space0 ) ;"
- "Texture2D < float4 > PassSrg_m_texture2ms : register ( t2 , space0 ) ;"
- "Texture2DArray < 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 ( int3 ( texelLoc , 0 ) ) ;"
- "color -= :: PassSrg_m_texture0ms . Load ( int3 ( texelLoc + texelLocDelta , 0 ) ) ;"
- "color += :: PassSrg_m_texture0ms . Load ( int3 ( texelLoc + texelLocDelta , 0 ) , int2 ( 0 , 2 ) ) ;"
- "color -= :: PassSrg_m_texture1 . Load ( int3 ( texelLoc , 0 ) ) ;"
- "color += :: PassSrg_m_texture1 . Load ( int3 ( texelLoc , 1 ) ) ;"
- "color -= :: PassSrg_m_texture2ms . Load ( int3 ( texelLoc - 2 . 0 * texelLocDelta , 0 ) , int2 ( 1 , 1 ) ) ;"
- "color += :: PassSrg_m_textureArray0ms . Load ( int4 ( int3 ( texelLoc , element ) , 0 ) ) - :: PassSrg_m_textureArray1 . Load ( int4 ( texelLoc , element , 3 ) ) ;"
- "return color ;"
- "}"
- "float2 PassSrg_GetSamplePosition ( int sampleIndex )"
- "{"
- "return float2 ( 0 , 0 ) + float2 ( 0 , 0 ) + float2 ( 0 , 0 ) ;"
- "}"
- "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 = 1 ;"
- "width += tmpWidth ;"
- "height += tmpHeight ;"
- "numSamples += tmpNumSamples ;"
- ":: PassSrg_m_texture1 . GetDimensions ( tmpWidth , tmpHeight ) ;"
- "width += tmpWidth ;"
- "height += tmpHeight ;"
- ":: PassSrg_m_texture2ms . GetDimensions ( tmpWidth , tmpHeight ) ; tmpNumSamples = 1 ;"
- "width += tmpWidth ;"
- "height += tmpHeight ;"
- "numSamples += tmpNumSamples ;"
- ":: PassSrg_m_textureArray0ms . GetDimensions ( tmpWidth , tmpHeight , tmpElements ) ; tmpNumSamples = 1 ;"
- "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 , Texture2D < float4 > tex0ms , Texture2D < float4 > tex1 , Texture2D < float4 > tex2ms , Texture2DArray < float4 > texArray0ms , Texture2DArray < float4 > texArray1 )"
- "{"
- "float4 color = float4 ( 0 , 0 , 0 , 0 ) ;"
- "color += tex0ms . Load ( int3 ( texelLoc , 0 ) ) ;"
- "color -= tex0ms . Load ( int3 ( texelLoc + texelLocDelta , 0 ) ) ;"
- "color += tex0ms . Load ( int3 ( texelLoc + texelLocDelta , 0 ) , int2 ( 0 , 2 ) ) ;"
- "color -= tex1 . Load ( int3 ( texelLoc , 0 ) ) ;"
- "color += tex1 . Load ( int3 ( texelLoc , 1 ) ) ;"
- "color -= tex2ms . Load ( int3 ( texelLoc - 2 . 0 * texelLocDelta , 0 ) , int2 ( 1 , 1 ) ) ;"
- "color += texArray0ms . Load ( int4 ( int3 ( texelLoc , element ) , 0 ) ) - 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 )"
- "{"
- "uint sampleIndex = ( uint ) 0 ;"
- "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 )"
- "{"
- "uint coverage = ( uint ) -1 ;"
- "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 ;"
- "static const uint m_sampleIndex = ( uint ) 0 ;"
- ";"
- "} ;"
- ":: 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 ;"
- "}"
|