From 2baabf5bc5b5a48173b4ea8ed64a2477b6441385 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Wed, 15 Nov 2017 23:07:50 -0800 Subject: [PATCH] Holy hell, finally got this working with an R9 390 + Ubuntu. --- CMakeLists.txt | 10 ++++++---- include/Application.h | 8 ++++---- include/CLCaster.h | 8 ++++++-- include/map/ArrayMap.h | 4 ++-- include/map/Octree.h | 2 +- src/Application.cpp | 3 +++ src/CLCaster.cpp | 8 ++++---- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 811d8e7..f86013b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ if (WIN32) set(SFML_INCLUDE_DIR ${SFML_ROOT}/include) endif() +set(OPENGL_LIBRARIES "/opt/amdgpu-pro/lib/x86_64-linux-gnu") + set(SFML_COMPONENTS graphics window system network audio) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) find_package(SFML 2.1 COMPONENTS ${SFML_COMPONENTS} REQUIRED) @@ -36,8 +38,8 @@ endif() # beignet only supports EGL and not GLX for the cl_khr_gl_sharing extension if (UNIX) - find_package(EGL REQUIRED) - message(STATUS "EGL found: ${EGL_FOUND}") +# find_package(EGL REQUIRED) +#message(STATUS "EGL found: ${EGL_FOUND}") endif (UNIX) # Include the directories for the main program, GL, CL and SFML's headers @@ -45,7 +47,7 @@ include_directories(${SFML_INCLUDE_DIR}) include_directories(${OpenCL_INCLUDE_DIRS}) include_directories(${OpenGL_INCLUDE_DIRS}) if (UNIX) - include_directories(${EGL_INCLUDE_DIRS}) + # include_directories(${EGL_INCLUDE_DIRS}) endif() include_directories(include) @@ -127,7 +129,7 @@ target_link_libraries (${PNAME} ${OpenCL_LIBRARY}) target_link_libraries (${PNAME} ${OPENGL_LIBRARIES}) if (UNIX) - target_link_libraries (${PNAME} ${EGL_LIBRARIES}) + # target_link_libraries (${PNAME} ${EGL_LIBRARIES}) endif() if (WIN32) diff --git a/include/Application.h b/include/Application.h index a3cbe53..ffa0841 100644 --- a/include/Application.h +++ b/include/Application.h @@ -44,9 +44,9 @@ public: static const int WINDOW_X = 1600; static const int WINDOW_Y = 900; - static const int MAP_X = 32; - static const int MAP_Y = 32; - static const int MAP_Z = 32; + static const int MAP_X; + static const int MAP_Y; + static const int MAP_Z; Application(); ~Application(); @@ -92,4 +92,4 @@ private: delta_time = 0.0, accumulator_time = 0.0, current_time = 0.0; -}; \ No newline at end of file +}; diff --git a/include/CLCaster.h b/include/CLCaster.h index 1486a17..cefa050 100644 --- a/include/CLCaster.h +++ b/include/CLCaster.h @@ -3,10 +3,11 @@ #include #include #include +#include #include #include "LightController.h" #include "Camera.h" -#include +//#include #include #include #include "Logger.h" @@ -16,7 +17,10 @@ #ifdef linux #include #include -#include +#include +#include +#include +//#include //#include #elif defined _WIN32 diff --git a/include/map/ArrayMap.h b/include/map/ArrayMap.h index fbe9988..54833ad 100644 --- a/include/map/ArrayMap.h +++ b/include/map/ArrayMap.h @@ -20,7 +20,7 @@ public: // =========== DEBUG =========== // char* getDataPtr(); - std::vector> ArrayMap::CastRayCharArray( + std::vector> CastRayCharArray( char* map, sf::Vector3i* map_dim, sf::Vector2f* cam_dir, @@ -32,4 +32,4 @@ private: char *voxel_data; sf::Vector3i dimensions; -}; \ No newline at end of file +}; diff --git a/include/map/Octree.h b/include/map/Octree.h index c5c5b7c..64d9b0e 100644 --- a/include/map/Octree.h +++ b/include/map/Octree.h @@ -92,7 +92,7 @@ public: static const uint64_t contour_pointer_mask = 0xFFFFFF00000000; static const uint64_t contour_mask = 0xFF00000000000000; - std::vector> Octree::CastRayOctree( + std::vector> CastRayOctree( sf::Vector2f cam_dir, sf::Vector3f cam_pos ); diff --git a/src/Application.cpp b/src/Application.cpp index 9d14301..10e0756 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -1,5 +1,8 @@ #include "Application.h" +const int Application::MAP_X = 32; +const int Application::MAP_Y = 32; +const int Application::MAP_Z = 32; Application::Application() { diff --git a/src/CLCaster.cpp b/src/CLCaster.cpp index 4f12501..dc008e6 100644 --- a/src/CLCaster.cpp +++ b/src/CLCaster.cpp @@ -602,10 +602,10 @@ bool CLCaster::create_shared_context() #ifdef linux cl_context_properties context_properties[] = { - //CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), - //CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), - CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(), - CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(), + CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), + CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), + //CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(), + //CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(), CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, 0 };