From a662129a86855e082d8515d318c6a19ef54b4e13 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 13 Jan 2013 14:58:25 +0000 Subject: Debut d'integration OpenCL / GL mais il manque une lib a linker... quelque part dans /opt/AMDAPP ??? git-svn-id: file:///var/svn/2013-gpudataviz/trunk@6 371a6b4a-a258-45f8-9dcc-bdd82ce0ac9d --- src/boring_parts.cc | 22 +++++++++++++++++++++- src/boring_parts.h | 11 +++++++++-- src/compil.sh | 8 ++++---- src/gpudataviz.cc | 2 ++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/boring_parts.cc b/src/boring_parts.cc index 3973c23..54c6863 100644 --- a/src/boring_parts.cc +++ b/src/boring_parts.cc @@ -1,5 +1,10 @@ #include "boring_parts.h" + + +// TODO : only need OpenGL things, not GTK ones for now +//#include "gtk_includes.h" + #define RETURN_IF_FAIL(expr) do { \ int res=(expr); \ if ( res != 0 ) return res; \ @@ -17,7 +22,6 @@ int initLibs() { - // FIXME : unused #ifdef HAS_OPENCL RETURN_IF_FAIL( initOpenCL() ); #endif /*HAS_OPENCL*/ @@ -99,6 +103,22 @@ int initOpenCL() { delete [] devices; delete [] platforms; +/* + if (!clGetGLContextInfoKHR) + { + clGetGLContextInfoKHR = (clGetGLContextInfoKHR_fn) clGetExtensionFunctionAddressForPlatform(platform, "clGetGLContextInfoKHR"); + if (!clGetGLContextInfoKHR) + { + std::cout << "Failed to query proc address for clGetGLContextInfoKHR"; + } + } +*/ + GLXContext gGlCtx = glXGetCurrentContext(); + std::cout << "gGlCtx == " << gGlCtx << std::endl; + cl_context_properties cpsGL[] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, + CL_GLX_DISPLAY_KHR, (intptr_t) glXGetCurrentDisplay(), + CL_GL_CONTEXT_KHR, (intptr_t) gGlCtx, 0 + }; return 0; } #endif /*HAS_OPENCL*/ diff --git a/src/boring_parts.h b/src/boring_parts.h index 4060f67..54fd7b3 100644 --- a/src/boring_parts.h +++ b/src/boring_parts.h @@ -1,6 +1,13 @@ #include -// TODO : only need OpenGL things, not GTK ones for now -#include "gtk_includes.h" + +#include /* Must included before X11/Xlib.h */ +//#include /* Seems included by GL/glxew.h */ +#include /* For GLXContext, must appear before gl.h, includes X11/Xlib.h */ +#include /* Includes a GL/gl.h (the right one ??) */ + +//#include +//#include +//#include int initLibs(); diff --git a/src/compil.sh b/src/compil.sh index bc21245..10cd630 100755 --- a/src/compil.sh +++ b/src/compil.sh @@ -10,11 +10,11 @@ AMDAPP_PATH="/opt/AMDAPP" DEFINES="" INCLUDES="" -LIBS="" +LIBS="-lglew" # OpenCL if [ -d "$AMDAPP_PATH/include" ] -then DEFINES="-DHAS_OPENCL" +then DEFINES="$DEFINES -DHAS_OPENCL" INCLUDES="$INCLUDES -I $AMDAPP_PATH/include" LIBS="$LIBS -lOpenCL" else echo "WARNING : invalid AMDAPP_PATH : '$AMDAPP_PATH'" @@ -32,8 +32,8 @@ fi #set +x function build_cxx() { - echo "$PS4$CXX \$INCLUDES -o $BUILD_PATH/$1 -c $2" - $CXX $INCLUDES -o $BUILD_PATH/$1 -c $2 + echo "$PS4$CXX \$DEFINES \$INCLUDES -o $BUILD_PATH/$1 -c $2" + $CXX $DEFINES $INCLUDES -o $BUILD_PATH/$1 -c $2 } function link_cxx() { diff --git a/src/gpudataviz.cc b/src/gpudataviz.cc index 954ef5e..e6e4ca5 100644 --- a/src/gpudataviz.cc +++ b/src/gpudataviz.cc @@ -2,6 +2,8 @@ #include "gpudataviz.h" #include "boring_parts.h" + +//#include "gtk_includes.h" #include "gtk_win_main.h" #include "my_gtk_gl_scene_widget.h" -- cgit v1.2.3