Holy hell, finally got this working with an R9 390 + Ubuntu.

master
mitchellhansen 7 years ago
parent d3a9c95ef7
commit 2baabf5bc5

@ -14,6 +14,8 @@ if (WIN32)
set(SFML_INCLUDE_DIR ${SFML_ROOT}/include) set(SFML_INCLUDE_DIR ${SFML_ROOT}/include)
endif() endif()
set(OPENGL_LIBRARIES "/opt/amdgpu-pro/lib/x86_64-linux-gnu")
set(SFML_COMPONENTS graphics window system network audio) set(SFML_COMPONENTS graphics window system network audio)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(SFML 2.1 COMPONENTS ${SFML_COMPONENTS} REQUIRED) 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 # beignet only supports EGL and not GLX for the cl_khr_gl_sharing extension
if (UNIX) if (UNIX)
find_package(EGL REQUIRED) # find_package(EGL REQUIRED)
message(STATUS "EGL found: ${EGL_FOUND}") #message(STATUS "EGL found: ${EGL_FOUND}")
endif (UNIX) endif (UNIX)
# Include the directories for the main program, GL, CL and SFML's headers # 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(${OpenCL_INCLUDE_DIRS})
include_directories(${OpenGL_INCLUDE_DIRS}) include_directories(${OpenGL_INCLUDE_DIRS})
if (UNIX) if (UNIX)
include_directories(${EGL_INCLUDE_DIRS}) # include_directories(${EGL_INCLUDE_DIRS})
endif() endif()
include_directories(include) include_directories(include)
@ -127,7 +129,7 @@ target_link_libraries (${PNAME} ${OpenCL_LIBRARY})
target_link_libraries (${PNAME} ${OPENGL_LIBRARIES}) target_link_libraries (${PNAME} ${OPENGL_LIBRARIES})
if (UNIX) if (UNIX)
target_link_libraries (${PNAME} ${EGL_LIBRARIES}) # target_link_libraries (${PNAME} ${EGL_LIBRARIES})
endif() endif()
if (WIN32) if (WIN32)

@ -44,9 +44,9 @@ public:
static const int WINDOW_X = 1600; static const int WINDOW_X = 1600;
static const int WINDOW_Y = 900; static const int WINDOW_Y = 900;
static const int MAP_X = 32; static const int MAP_X;
static const int MAP_Y = 32; static const int MAP_Y;
static const int MAP_Z = 32; static const int MAP_Z;
Application(); Application();
~Application(); ~Application();
@ -92,4 +92,4 @@ private:
delta_time = 0.0, delta_time = 0.0,
accumulator_time = 0.0, accumulator_time = 0.0,
current_time = 0.0; current_time = 0.0;
}; };

@ -3,10 +3,11 @@
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <GL/glew.h>
#include <string.h> #include <string.h>
#include "LightController.h" #include "LightController.h"
#include "Camera.h" #include "Camera.h"
#include <GL/glew.h> //#include <GL/glew.h>
#include <Application.h> #include <Application.h>
#include <unordered_map> #include <unordered_map>
#include "Logger.h" #include "Logger.h"
@ -16,7 +17,10 @@
#ifdef linux #ifdef linux
#include <CL/cl.h> #include <CL/cl.h>
#include <CL/opencl.h> #include <CL/opencl.h>
#include <EGL/egl.h> #include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glu.h>
//#include <EGL/egl.h>
//#include <GL/glx.h> //#include <GL/glx.h>
#elif defined _WIN32 #elif defined _WIN32

@ -20,7 +20,7 @@ public:
// =========== DEBUG =========== // // =========== DEBUG =========== //
char* getDataPtr(); char* getDataPtr();
std::vector<std::tuple<sf::Vector3i, char>> ArrayMap::CastRayCharArray( std::vector<std::tuple<sf::Vector3i, char>> CastRayCharArray(
char* map, char* map,
sf::Vector3i* map_dim, sf::Vector3i* map_dim,
sf::Vector2f* cam_dir, sf::Vector2f* cam_dir,
@ -32,4 +32,4 @@ private:
char *voxel_data; char *voxel_data;
sf::Vector3i dimensions; sf::Vector3i dimensions;
}; };

@ -92,7 +92,7 @@ public:
static const uint64_t contour_pointer_mask = 0xFFFFFF00000000; static const uint64_t contour_pointer_mask = 0xFFFFFF00000000;
static const uint64_t contour_mask = 0xFF00000000000000; static const uint64_t contour_mask = 0xFF00000000000000;
std::vector<std::tuple<sf::Vector3i, char>> Octree::CastRayOctree( std::vector<std::tuple<sf::Vector3i, char>> CastRayOctree(
sf::Vector2f cam_dir, sf::Vector2f cam_dir,
sf::Vector3f cam_pos sf::Vector3f cam_pos
); );

@ -1,5 +1,8 @@
#include "Application.h" #include "Application.h"
const int Application::MAP_X = 32;
const int Application::MAP_Y = 32;
const int Application::MAP_Z = 32;
Application::Application() { Application::Application() {

@ -602,10 +602,10 @@ bool CLCaster::create_shared_context()
#ifdef linux #ifdef linux
cl_context_properties context_properties[] = { cl_context_properties context_properties[] = {
//CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(),
//CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),
CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(), //CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(),
CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(), //CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(),
CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id,
0 0
}; };

Loading…
Cancel
Save