Implémentation du raytracing pour Global Memory/Shared Memory/Constant Memory
[GPU.git] / WCudaMSE / BilatTools_Cuda / src / core / cudatools / header / device / IndiceTools_GPU.h
index d230aef..f62ddf3 100755 (executable)
@@ -2,6 +2,7 @@
 #define INDICES_TOOLS_GPU_H_\r
 \r
 #include "both_define.h"\r
+#include "cudaType_CPU.h"\r
 \r
 /*----------------------------------------------------------------------*\\r
  |*                    Declaration                                     *|\r
@@ -34,12 +35,24 @@ namespace gpu
             * h = hauteur\r
             */\r
            __BOTH__\r
-           static  void toIJ( int s, int w, int* ptrI, int* ptrJ)\r
+           static void toIJ( int s, int w, int* ptrI, int* ptrJ)\r
                {\r
                *ptrI = s / w;\r
                *ptrJ = s - w * (*ptrI);\r
                }\r
 \r
+            /**\r
+             * s[0,W*H[ --> x[0,W[ y[0,H[\r
+             */\r
+            __BOTH__\r
+            static float2 toPixelFloat(int s, int w)\r
+                {\r
+                const int y = s / w;\r
+                const int x = s - w * y;\r
+                const float2 pixel = { (float)x, (float)y };\r
+                return pixel;\r
+                }\r
+\r
            /**\r
             * i[0,H[ j[0,W[ --> s[0,W*H[\r
             * w = largeur\r
@@ -60,7 +73,7 @@ namespace gpu
        };\r
     }\r
 \r
-#endif \r
+#endif\r
 \r
 /*----------------------------------------------------------------------*\\r
  |*                    End                                             *|\r