@@ -34,7 +34,7 @@ float3 BlurPixels( float3 a, float3 b, float3 c, float3 d, float3 e, float3 f, f
34
34
return Weights[0 ]*e + Weights[1 ]*(d+f) + Weights[2 ]*(c+g) + Weights[3 ]*(b+h) + Weights[4 ]*(a+i);
35
35
}
36
36
37
- // 16x16 pixels with an 8x8 center that we will be blurring writing out. Each uint is two color channels packed together
37
+ // 16x16 pixels with an 8x8 center that we will be blurring writing out. Each uint is two color channels packed together
38
38
groupshared uint CacheR[128 ];
39
39
groupshared uint CacheG[128 ];
40
40
groupshared uint CacheB[128 ];
@@ -67,7 +67,7 @@ void Load1Pixel( uint index, out float3 pixel )
67
67
pixel = asfloat ( uint3 (CacheR[index], CacheG[index], CacheB[index]) );
68
68
}
69
69
70
- // Blur two pixels horizontally. This reduces LDS reads and pixel unpacking.
70
+ // Blur two pixels horizontally. This reduces LDS reads and pixel unpacking.
71
71
void BlurHorizontally ( uint outIndex, uint leftMostIndex )
72
72
{
73
73
float3 s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
@@ -77,6 +77,9 @@ void BlurHorizontally( uint outIndex, uint leftMostIndex )
77
77
Load2Pixels ( leftMostIndex + 3 , s6, s7 );
78
78
Load2Pixels ( leftMostIndex + 4 , s8, s9 );
79
79
80
+ // Be sure to finish loading values before we rewrite them.
81
+ GroupMemoryBarrierWithGroupSync ();
82
+
80
83
Store1Pixel (outIndex , BlurPixels (s0, s1, s2, s3, s4, s5, s6, s7, s8));
81
84
Store1Pixel (outIndex+1 , BlurPixels (s1, s2, s3, s4, s5, s6, s7, s8, s9));
82
85
}
@@ -104,8 +107,8 @@ void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID, uint3 DTid : S
104
107
//
105
108
// Load 4 pixels per thread into LDS
106
109
//
107
- int2 GroupUL = (Gid.xy << 3 ) - 4 ; // Upper-left pixel coordinate of group read location
108
- int2 ThreadUL = (GTid.xy << 1 ) + GroupUL; // Upper-left pixel coordinate of quad that this thread will read
110
+ int2 GroupUL = (Gid.xy << 3 ) - 4 ; // Upper-left pixel coordinate of group read location
111
+ int2 ThreadUL = (GTid.xy << 1 ) + GroupUL; // Upper-left pixel coordinate of quad that this thread will read
109
112
110
113
//
111
114
// Store 4 unblurred pixels in LDS
0 commit comments