Leaving it compiling at least, CL seems to have broken at some point on my thinkpad
This commit is contained in:
@@ -151,9 +151,9 @@ public:
|
|||||||
// Save the chosen device config to a file
|
// Save the chosen device config to a file
|
||||||
void save_config();
|
void save_config();
|
||||||
|
|
||||||
// Set a
|
// Set a define
|
||||||
void
|
void setDefine(std::string name, std::string value);
|
||||||
|
void removeDefine(std::string name);
|
||||||
|
|
||||||
// ================================== DEBUG =======================================
|
// ================================== DEBUG =======================================
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ private:
|
|||||||
// Containers holding the kernels and buffers
|
// Containers holding the kernels and buffers
|
||||||
std::map<std::string, cl_kernel> kernel_map;
|
std::map<std::string, cl_kernel> kernel_map;
|
||||||
std::map<std::string, cl_mem> buffer_map;
|
std::map<std::string, cl_mem> buffer_map;
|
||||||
std::vector<std::pair<std::string, unsigned int>> settings_index_map;
|
std::map<std::string, std::string> defines_map;
|
||||||
std::unordered_map<std::string, std::pair<sf::Sprite, std::unique_ptr<sf::Texture>>> image_map;
|
std::unordered_map<std::string, std::pair<sf::Sprite, std::unique_ptr<sf::Texture>>> image_map;
|
||||||
|
|
||||||
// Hardware caster holds and renders its own textures
|
// Hardware caster holds and renders its own textures
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ __kernel void raycaster(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
constant int vox_dim = OCTDIM;
|
int vox_dim = OCTDIM;
|
||||||
|
|
||||||
// If we hit a voxel
|
// If we hit a voxel
|
||||||
// if (voxel.x < (*map_dim).x && voxel.y < (*map_dim).x && voxel.z < (*map_dim).x){
|
// if (voxel.x < (*map_dim).x && voxel.y < (*map_dim).x && voxel.z < (*map_dim).x){
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ bool Application::init_clcaster() {
|
|||||||
|
|
||||||
// Start up the raycaster
|
// Start up the raycaster
|
||||||
raycaster = std::make_shared<CLCaster>();
|
raycaster = std::make_shared<CLCaster>();
|
||||||
|
raycaster->setDefine("OCTDIM", std::to_string(MAP_X));
|
||||||
if (!raycaster->init())
|
if (!raycaster->init())
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
@@ -41,6 +42,9 @@ bool Application::init_clcaster() {
|
|||||||
raycaster->assign_octree(map);
|
raycaster->assign_octree(map);
|
||||||
raycaster->assign_map(map);
|
raycaster->assign_map(map);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
camera = std::make_shared<Camera>(
|
camera = std::make_shared<Camera>(
|
||||||
sf::Vector3f(3.5f, 3.5f, 3.5f), // Starting position
|
sf::Vector3f(3.5f, 3.5f, 3.5f), // Starting position
|
||||||
sf::Vector2f(1.57f, 0.0f), // Direction
|
sf::Vector2f(1.57f, 0.0f), // Direction
|
||||||
@@ -52,6 +56,7 @@ bool Application::init_clcaster() {
|
|||||||
raycaster->create_viewport(WINDOW_X, WINDOW_Y, 0.625f * 90.0f, 90.0f);
|
raycaster->create_viewport(WINDOW_X, WINDOW_Y, 0.625f * 90.0f, 90.0f);
|
||||||
|
|
||||||
// Initialize the light controller and link it to the GPU
|
// Initialize the light controller and link it to the GPU
|
||||||
|
// TODO: Bad behaviour when raycaster has errors!!!!
|
||||||
light_controller = std::make_shared<LightController>(raycaster);
|
light_controller = std::make_shared<LightController>(raycaster);
|
||||||
|
|
||||||
// Create a light prototype, send it to the controller, and get the handle back
|
// Create a light prototype, send it to the controller, and get the handle back
|
||||||
|
|||||||
@@ -723,11 +723,11 @@ bool CLCaster::compile_kernel(std::string kernel_source, bool is_path, std::stri
|
|||||||
std::stringstream build_string_stream;
|
std::stringstream build_string_stream;
|
||||||
|
|
||||||
// walk the settings index's and add them to the defines
|
// walk the settings index's and add them to the defines
|
||||||
for (auto i: settings_index_map){
|
for (auto const& define : defines_map){
|
||||||
build_string_stream << " -D" << i.first << "=" << std::to_string(i.second);
|
build_string_stream << " -D" << define.first << "=" << define.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
build_string_stream << "-DOCTDIM=" << std::to_string(Application::MAP_X);
|
//build_string_stream << "-DOCTDIM=" << std::to_string(Application::MAP_X);
|
||||||
build_string_stream << " -cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations";
|
build_string_stream << " -cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations";
|
||||||
|
|
||||||
std::string build_string = build_string_stream.str();
|
std::string build_string = build_string_stream.str();
|
||||||
@@ -745,8 +745,8 @@ bool CLCaster::compile_kernel(std::string kernel_source, bool is_path, std::stri
|
|||||||
// Grab the log
|
// Grab the log
|
||||||
clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
|
clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
|
||||||
|
|
||||||
Logger::log("Failed at clBuildProgram() : " + cl_err_lookup(error), Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
Logger::log("Failed at clBuildProgram() with " + cl_err_lookup(error), Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
||||||
Logger::log(log, Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
Logger::log("CL_ERROR -->" + std::string(log), Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1177,6 +1177,14 @@ std::string CLCaster::cl_err_lookup(int error_code) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLCaster::setDefine(std::string name, std::string value) {
|
||||||
|
defines_map[name] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLCaster::removeDefine(std::string name) {
|
||||||
|
defines_map.erase(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CLCaster::device::device(cl_device_id device_id, cl_platform_id platform_id) {
|
CLCaster::device::device(cl_device_id device_id, cl_platform_id platform_id) {
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ VrEventPublisher::~VrEventPublisher() {
|
|||||||
|
|
||||||
// And one by one remove the
|
// And one by one remove the
|
||||||
for (auto subscriber: subscriber_bucket.second){
|
for (auto subscriber: subscriber_bucket.second){
|
||||||
subscriber.
|
//subscriber.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user