Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:09

0001 
0002 
0003 #include <stdio.h>
0004 #include "qpoly.h"
0005 
0006 __global__ void _QPoly_demo()
0007 {
0008     RectangleV1 r1 ; r1.set_param(10.0, 10.0) ; 
0009     RectangleV2 r2 ; r2.set_param(10.0, 10.0) ; 
0010     TriangleV1 t1  ; t1.set_param(10.0, 10.0) ; 
0011     TriangleV2 t2  ; t2.set_param(10.0, 10.0) ; 
0012 
0013     printf(" r1.area %10.3f  r2.area %10.3f t1.area %10.3f t2.area %10.3f \n", r1.area(), r2.area(), t1.area(), t2.area() );   
0014 }
0015 
0016 extern "C" void QPoly_demo(dim3 numBlocks, dim3 threadsPerBlock ) 
0017 {
0018     _QPoly_demo<<<numBlocks,threadsPerBlock>>>();
0019 } 
0020 
0021 
0022 template <typename R, typename T>
0023  __global__ void _QPoly_tmpl_demo()
0024 {
0025     R rtmpl ; 
0026     rtmpl.set_param(10.0, 10.0) ; 
0027 
0028     T ttmpl ; 
0029     ttmpl.set_param(10.0, 10.0) ; 
0030 
0031     printf(" rtmpl.area %10.3f  ttmpl.area %10.3f \n", rtmpl.area(), ttmpl.area() );   
0032 }
0033 
0034 /**
0035 Looks good, BUT: would not work with optix7 extern "C" __raygen_rg functions ?
0036 
0037 **/
0038 extern "C" void QPoly_tmpl_demo(dim3 numBlocks, dim3 threadsPerBlock ) 
0039 {
0040     _QPoly_tmpl_demo<RectangleV1, TriangleV1><<<numBlocks,threadsPerBlock>>>();
0041     _QPoly_tmpl_demo<RectangleV1, TriangleV2><<<numBlocks,threadsPerBlock>>>();
0042     _QPoly_tmpl_demo<RectangleV2, TriangleV1><<<numBlocks,threadsPerBlock>>>();
0043     _QPoly_tmpl_demo<RectangleV2, TriangleV2><<<numBlocks,threadsPerBlock>>>();
0044 } 
0045 
0046