@@ -181,7 +181,7 @@ KERNEL void SampleSurface(
181
181
// Ray batch
182
182
GLOBAL ray const * rays ,
183
183
// Intersection data
184
- GLOBAL Intersection const * isects ,
184
+ GLOBAL Intersection const * intersections ,
185
185
// Hit indices
186
186
GLOBAL int const * hit_indices ,
187
187
// Pixel indices
@@ -253,7 +253,7 @@ KERNEL void SampleSurface(
253
253
// Fetch index
254
254
int hit_idx = hit_indices [global_id ];
255
255
int pixel_idx = pixel_indices [global_id ];
256
- Intersection isect = isects [hit_idx ];
256
+ Intersection isect = intersections [hit_idx ];
257
257
258
258
GLOBAL Path * path = paths + pixel_idx ;
259
259
@@ -404,7 +404,7 @@ KERNEL void SampleSurface(
404
404
}
405
405
}
406
406
407
- __kernel void ConnectDirect (
407
+ KERNEL void ConnectDirect (
408
408
int eye_vertex_index ,
409
409
int num_rays ,
410
410
GLOBAL int const * pixel_indices ,
@@ -508,8 +508,8 @@ KERNEL void SampleSurface(
508
508
509
509
bool singular_light = Light_IsSingular (& scene .lights [light_idx ]);
510
510
bool singular_bxdf = Bxdf_IsSingular (& diffgeo );
511
- lightweight = 1 ; // singular_light ? 1.f : BalanceHeuristic(1, lightpdf, 1, lightbxdfpdf);
512
- bxdfweight = 1 ; // singular_bxdf ? 1.f : BalanceHeuristic(1, bxdfpdf, 1, bxdflightpdf);
511
+ lightweight = singular_light ? 1.f : BalanceHeuristic (1 , lightpdf , 1 , lightbxdfpdf );
512
+ bxdfweight = singular_bxdf ? 1.f : BalanceHeuristic (1 , bxdfpdf , 1 , bxdflightpdf );
513
513
514
514
float3 radiance = 0.f ;
515
515
float3 wo ;
@@ -770,45 +770,42 @@ KERNEL void GenerateTileDomain(
770
770
}
771
771
772
772
///< Restore pixel indices after compaction
773
- __kernel void FilterPathStream (
774
- // Intersections
775
- __global Intersection const * isects ,
773
+ KERNEL void FilterPathStream (
774
+ GLOBAL Intersection const * restrict intersections ,
776
775
// Number of compacted indices
777
- __global int const * numitems ,
778
- // Pixel indices
779
- __global int const * pixelindices ,
780
- // Paths
781
- __global Path * paths ,
782
- // Predicate
783
- __global int * predicate
776
+ GLOBAL int const * restrict num_items ,
777
+ GLOBAL int const * restrict pixel_indices ,
778
+ GLOBAL Path * restrict paths ,
779
+ // 1 or 0 for each item (include or exclude)
780
+ GLOBAL int * restrict predicate
784
781
)
785
782
{
786
- int globalid = get_global_id (0 );
783
+ int global_id = get_global_id (0 );
787
784
788
785
// Handle only working subset
789
- if (globalid < * numitems )
786
+ if (global_id < * num_items )
790
787
{
791
- int pixelidx = pixelindices [ globalid ];
788
+ int pixelidx = pixel_indices [ global_id ];
792
789
793
- __global Path * path = paths + pixelidx ;
790
+ GLOBAL Path * path = paths + pixelidx ;
794
791
795
792
if (Path_IsAlive (path ))
796
793
{
797
794
bool kill = (length (Path_GetThroughput (path )) < CRAZY_LOW_THROUGHPUT );
798
795
799
796
if (!kill )
800
797
{
801
- predicate [globalid ] = isects [ globalid ].shapeid >= 0 ? 1 : 0 ;
798
+ predicate [global_id ] = intersections [ global_id ].shapeid >= 0 ? 1 : 0 ;
802
799
}
803
800
else
804
801
{
805
802
Path_Kill (path );
806
- predicate [globalid ] = 0 ;
803
+ predicate [global_id ] = 0 ;
807
804
}
808
805
}
809
806
else
810
807
{
811
- predicate [globalid ] = 0 ;
808
+ predicate [global_id ] = 0 ;
812
809
}
813
810
}
814
811
}
@@ -838,7 +835,7 @@ KERNEL void GatherContributions(
838
835
int num_rays ,
839
836
GLOBAL int const * restrict pixel_indices ,
840
837
// Shadow rays hits
841
- GLOBAL int const * restrict shadowhits ,
838
+ GLOBAL int const * restrict shadow_hits ,
842
839
// Light samples
843
840
GLOBAL float3 const * restrict contributions ,
844
841
// Radiance sample buffer
@@ -856,7 +853,7 @@ KERNEL void GatherContributions(
856
853
// Start collecting samples
857
854
{
858
855
// If shadow ray global_id't hit anything and reached skydome
859
- if (shadowhits [global_id ] == -1 )
856
+ if (shadow_hits [global_id ] == -1 )
860
857
{
861
858
// Add its contribution to radiance accumulator
862
859
radiance += contributions [global_id ];
@@ -866,46 +863,46 @@ KERNEL void GatherContributions(
866
863
}
867
864
}
868
865
869
- ///< Restore pixel indices after compaction
870
- __kernel void RestorePixelIndices (
866
+ // Restore pixel indices after compaction
867
+ KERNEL void RestorePixelIndices (
871
868
// Compacted indices
872
- __global int const * compacted_indices ,
869
+ GLOBAL int const * restrict compacted_indices ,
873
870
// Number of compacted indices
874
- __global int * numitems ,
871
+ GLOBAL int * restrict num_items ,
875
872
// Previous pixel indices
876
- __global int const * previndices ,
873
+ GLOBAL int const * restrict prev_indices ,
877
874
// New pixel indices
878
- __global int * newindices
875
+ GLOBAL int * restrict new_indices
879
876
)
880
877
{
881
- int globalid = get_global_id (0 );
878
+ int global_id = get_global_id (0 );
882
879
883
880
// Handle only working subset
884
- if (globalid < * numitems )
881
+ if (global_id < * num_items )
885
882
{
886
- newindices [ globalid ] = previndices [compacted_indices [globalid ]];
883
+ new_indices [ global_id ] = prev_indices [compacted_indices [global_id ]];
887
884
}
888
885
}
889
886
890
887
// Copy data to interop texture if supported
891
- __kernel void ApplyGammaAndCopyData (
892
- __global float4 const * data ,
893
- int imgwidth ,
894
- int imgheight ,
888
+ KERNEL void ApplyGammaAndCopyData (
889
+ //
890
+ GLOBAL float4 const * data ,
891
+ int width ,
892
+ int height ,
895
893
float gamma ,
896
894
write_only image2d_t img
897
895
)
898
896
{
899
- int gid = get_global_id (0 );
900
-
901
- int gidx = gid % imgwidth ;
902
- int gidy = gid / imgwidth ;
897
+ int global_id = get_global_id (0 );
898
+ int x = global_id % width ;
899
+ int y = global_id / width ;
903
900
904
- if (gidx < imgwidth && gidy < imgheight )
901
+ if (x < width && y < height )
905
902
{
906
- float4 v = data [gid ];
903
+ float4 v = data [global_id ];
907
904
float4 val = clamp (native_powr (v / v .w , 1.f / gamma ), 0.f , 1.f );
908
- write_imagef (img , make_int2 (gidx , gidy ), val );
905
+ write_imagef (img , make_int2 (x , y ), val );
909
906
}
910
907
}
911
908
0 commit comments