Browse Source

Merge branch 'master' of https://git.winfor.ch/nicolas/Almond

Nicolas Winkler 5 years ago
parent
commit
38aba5405c

+ 2 - 2
Almond.qrc

@@ -1,7 +1,7 @@
 <RCC>
     <qresource prefix="/icons">
-        <file alias="icon">icon.png</file>
-        <file alias="icon@2x">icon.png</file>
+        <file alias="icon">Almond.png</file>
+        <file alias="icon@2x">Almond.png</file>
     </qresource>
     <qresource prefix="/gradients">
         <file alias="default">gradients/default.xml</file>

+ 2 - 0
CMakeLists.txt

@@ -69,6 +69,8 @@ IF (WIN32)
 
 ELSEIF (UNIX AND NOT APPLE)
     install(TARGETS Almond RUNTIME DESTINATION "bin")
+    install(FILES Almond.desktop DESTINATION "share/applications")
+    install(FILES Almond.png DESTINATION "share/pixmaps")
     set(CPACK_GENERATOR "DEB")
     set(CPACK_SOURCE_GENERATOR "DEB")
     set(CPACK_COMPONENTS_ALL Almond)

+ 0 - 9
MandelWidget.cpp

@@ -48,15 +48,6 @@ Texture::Texture(Texture&& other) :
 }
 
 
-Texture& Texture::operator=(Texture&& other)
-{
-    this->id = other.id;
-    this->gl = other.gl;
-    other.id = 0;
-    return *this;
-}
-
-
 void Texture::bind(void) const
 {
     gl.glBindTexture(GL_TEXTURE_2D, id);

+ 1 - 1
MandelWidget.h

@@ -45,7 +45,7 @@ public:
     Texture& operator=(const Texture& other) = delete;
 
     Texture(Texture&& other);
-    Texture& operator=(Texture&& other);
+    Texture& operator=(Texture&& other) = delete;
 
 private:
     void bind(void) const;

BIN
icon.png


+ 3 - 5
libmandel/CMakeLists.txt

@@ -71,6 +71,7 @@ FILE(GLOB QdSources qd-2.3.22/src/*.cpp)
 
 target_compile_definitions(mandel PUBLIC WITH_QD)
 add_library(qd STATIC ${QdSources})
+target_include_directories(mandel PUBLIC "include")
 target_include_directories(qd PUBLIC qd-2.3.22/include qd-2.3.22)
 
 target_link_libraries(mandel PUBLIC qd)
@@ -84,14 +85,11 @@ endif(WITH_ASMJIT)
 
 if(OPENCL_FOUND)
     target_compile_definitions(mandel PUBLIC WITH_OPENCL)
-    target_include_directories(mandel SYSTEM PUBLIC
-        ${OpenCL_INCLUDE_DIRS}
-    )
-    target_include_directories(mandel PUBLIC "include")
+    target_include_directories(mandel SYSTEM PUBLIC ${OpenCL_INCLUDE_DIRS})
+    target_include_directories(mandel SYSTEM PUBLIC "include_cl")
     link_directories(${OpenCL_LIBRARY})
     target_link_libraries(mandel PUBLIC OpenCL::OpenCL)
 else(OPENCL_FOUND)
-    include_directories("include")
 endif(OPENCL_FOUND)
 
 if (APPLE AND OpenCL_FOUND)

+ 2 - 1
libmandel/include/Mandel.h

@@ -43,6 +43,7 @@ class mnd::MandelDevice
 private:
     friend class MandelContext;
 
+    std::string platformName;
     std::string vendor;
     std::string name;
     std::string extensions;
@@ -51,7 +52,7 @@ private:
     std::map<GeneratorType, std::unique_ptr<MandelGenerator>> mandelGenerators;
 
 public:
-    MandelDevice(ClDeviceWrapper);
+    MandelDevice(ClDeviceWrapper, const std::string& platformName);
     MandelDevice(const MandelDevice&) = delete;
     MandelDevice(MandelDevice&&) = default;
     MandelDevice& operator=(const MandelDevice&) = delete;

+ 0 - 0
libmandel/include/CL/cl.hpp → libmandel/include_cl/CL/cl.hpp


+ 0 - 0
libmandel/include/CL/cl2.hpp → libmandel/include_cl/CL/cl2.hpp


+ 18 - 9
libmandel/src/Mandel.cpp

@@ -83,8 +83,9 @@ MandelContext mnd::initializeContext(void)
 }
 
 
-MandelDevice::MandelDevice(mnd::ClDeviceWrapper device) :
-    clDevice{ std::make_unique<ClDeviceWrapper>(std::move(device)) }
+MandelDevice::MandelDevice(mnd::ClDeviceWrapper device, const std::string& platformName) :
+    clDevice{ std::make_unique<ClDeviceWrapper>(std::move(device)) },
+    platformName{ platformName }
 {
     extensions = clDevice->device.getInfo<CL_DEVICE_EXTENSIONS>();
     name = clDevice->device.getInfo<CL_DEVICE_NAME>();
@@ -272,26 +273,34 @@ std::vector<std::unique_ptr<MandelDevice>> MandelContext::createDevices(void)
     //platforms.erase(platforms.begin() + 1);
 
     for (auto& platform : platforms) {
-        std::string name = platform.getInfo<CL_PLATFORM_NAME>();
+        std::string platformName = platform.getInfo<CL_PLATFORM_NAME>();
         std::string profile = platform.getInfo<CL_PLATFORM_PROFILE>();
 
-        //printf("using opencl platform: %s\n", name.c_str());
+        //printf("using opencl platform: %s\n", platformName.c_str());
 
-        //std::string ext = platform.getInfo<CL_PLATFORM_EXTENSIONS>();
+        std::string ext = platform.getInfo<CL_PLATFORM_EXTENSIONS>();
         //printf("Platform extensions: %s\n", ext.c_str());
-        //printf("Platform: %s, %s\n", name.c_str(), profile.c_str());
+        printf("Platform: %s, %s\n", platformName.c_str(), profile.c_str());
 
         std::vector<cl::Device> devices;
         platform.getDevices(CL_DEVICE_TYPE_GPU, &devices);
+        auto onError = [] (const char* errinfo, 
+            const void* private_info,
+            size_t cb, 
+            void* user_data) {
+                printf("opencl error: %s\n", errinfo);
+        };
+        
+        cl::Context context{ devices, nullptr, onError };
         for (auto& device : devices) {
-            //printf("Device: %s\n", device.getInfo<CL_DEVICE_NAME>().c_str());
+            printf("Device: %s\n", device.getInfo<CL_DEVICE_NAME>().c_str());
             //printf("preferred float width: %d\n", device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT>());
-            //printf("vendor: %s\n", device.getInfo<CL_DEVICE_VENDOR>().c_str());
+            printf("vendor: %s\n", device.getInfo<CL_DEVICE_VENDOR>().c_str());
 
 
             //printf("Device extensions: %s\n", ext.c_str());
             auto mandelDevice = std::make_unique<mnd::MandelDevice>(
-                ClDeviceWrapper{ device, cl::Context{ device } });
+                ClDeviceWrapper{ device, context }, platformName);
             MandelDevice& md = *mandelDevice;
 
             auto supportsDouble = md.supportsDouble();