@@ -214,7 +214,7 @@ f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, uint imask )
214214 res .Ne = norm ;
215215 res .C = col ;
216216#else
217- res .position = float4 ( gbuf_pack_normal ( norm ), pos .z , gbuf_pack_hemi_mtl ( norm .w , pos .w ) );
217+ res .position = float4 ( gbuf_pack_normal ( norm . xyz ), pos .z , gbuf_pack_hemi_mtl ( norm .w , pos .w ) );
218218 res .C = col ;
219219#endif
220220
@@ -226,14 +226,14 @@ f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, uint imask )
226226}
227227
228228#ifdef GBUFFER_OPTIMIZATION
229- gbuffer_data gbuffer_load_data ( float2 tc , float2 pos2d , int iSample )
229+ gbuffer_data gbuffer_load_data ( float2 tc , float4 pos2d , uint iSample )
230230{
231231 gbuffer_data gbd ;
232232
233233 gbd .P = float3 (0 ,0 ,0 );
234234 gbd .hemi = 0 ;
235235 gbd .mtl = 0 ;
236- gbd .C = 0 ;
236+ gbd .C = float3 ( 0 , 0 , 0 ) ;
237237 gbd .N = float3 (0 ,0 ,0 );
238238
239239#ifndef USE_MSAA
@@ -250,7 +250,7 @@ gbuffer_data gbuffer_load_data( float2 tc, float2 pos2d, int iSample )
250250 // righttop = ( tan(fHorzFOV/2), tan(fVertFOV/2), 1 )
251251 // leftbottom = ( -tan(fHorzFOV/2), -tan(fVertFOV/2), 1 )
252252 // rightbottom = ( tan(fHorzFOV/2), -tan(fVertFOV/2), 1 )
253- gbd .P = float3 ( P .z * ( pos2d * pos_decompression_params .zw - pos_decompression_params .xy ), P .z );
253+ gbd .P = float3 ( P .z * ( pos2d . xy * pos_decompression_params .zw - pos_decompression_params .xy ), P .z );
254254
255255 // reconstruct N
256256 gbd .N = gbuf_unpack_normal ( P .xy );
@@ -273,21 +273,21 @@ gbuffer_data gbuffer_load_data( float2 tc, float2 pos2d, int iSample )
273273 return gbd ;
274274}
275275
276- gbuffer_data gbuffer_load_data ( float2 tc , float2 pos2d )
276+ gbuffer_data gbuffer_load_data ( float2 tc , float4 pos2d )
277277{
278278 return gbuffer_load_data ( tc , pos2d , 0 );
279279}
280280
281- gbuffer_data gbuffer_load_data_offset ( float2 tc , float2 OffsetTC , float2 pos2d )
281+ gbuffer_data gbuffer_load_data_offset ( float2 tc , float2 OffsetTC , float4 pos2d )
282282{
283- float2 delta = ( ( OffsetTC - tc ) * pos_decompression_params2 .xy );
283+ float4 delta = float4 ( ( OffsetTC - tc ) * pos_decompression_params2 .xy , 0 , 0 );
284284
285285 return gbuffer_load_data ( OffsetTC , pos2d + delta , 0 );
286286}
287287
288- gbuffer_data gbuffer_load_data_offset ( float2 tc , float2 OffsetTC , float2 pos2d , uint iSample )
288+ gbuffer_data gbuffer_load_data_offset ( float2 tc , float2 OffsetTC , float4 pos2d , uint iSample )
289289{
290- float2 delta = ( ( OffsetTC - tc ) * pos_decompression_params2 .xy );
290+ float4 delta = float4 ( ( OffsetTC - tc ) * pos_decompression_params2 .xy , 0 , 0 );
291291
292292 return gbuffer_load_data ( OffsetTC , pos2d + delta , iSample );
293293}
0 commit comments