Quellcode durchsuchen

now works with qt

Nicolas Winkler vor 5 Jahren
Ursprung
Commit
e48e26b244
5 geänderte Dateien mit 22 neuen und 7 gelöschten Zeilen
  1. 3 1
      Almond.pro
  2. 2 0
      MandelVideoGenerator.cpp
  3. 1 1
      MandelWidget.h
  4. 7 2
      libmandel/include/Mandel.h
  5. 9 3
      libmandel/src/Mandel.cpp

+ 3 - 1
Almond.pro

@@ -132,9 +132,11 @@ unix|win32: LIBS += -L$$PWD/libmandel/ -lmandel -lqd
 
 INCLUDEPATH += $$PWD/libmandel/include $$PWD/libmandel/qd-2.3.22/include
 DEPENDPATH += $$PWD/libmandel/include $$PWD/libmandel/qd-2.3.22/include
+INCLUDEPATH += $$PWD/libmandel/include $$PWD/libmandel/asmjit/src
+DEPENDPATH += $$PWD/libmandel/include $$PWD/libmandel/asmjit/stc
 
 win32:!win32-g++: PRE_TARGETDEPS += $$PWD/libmandel/mandel.lib  $$PWD/libmandel/qd.lib
-else:unix|win32-g++: PRE_TARGETDEPS += $$PWD/libmandel/libmandel.a $$PWD/libmandel/libqd.a
+else:unix|win32-g++: PRE_TARGETDEPS += $$PWD/libmandel/libmandel.a $$PWD/libmandel/libqd.a $$PWD/libmandel/libasmjit.a
 
 
 win32:CONFIG(release, debug|release): LIBS += -L$$PWD/'../../../../../Program Files (x86)/OCL_SDK_Light/lib/x86_64/' -lopencl

+ 2 - 0
MandelVideoGenerator.cpp

@@ -1,6 +1,8 @@
 #include "MandelVideoGenerator.h"
 #include "VideoStream.h"
 #include <thread>
+#include <omp.h>
+
 #include <cmath>
 
 MandelVideoGenerator::MandelVideoGenerator(const ExportVideoInfo& evi) :

+ 1 - 1
MandelWidget.h

@@ -10,10 +10,10 @@
 //#include <qopengl.h>
 //#include <qopenglfunctions.h>
 //#include <qopenglcontext.h>
+#include <Mandel.h>
 
 #include "Bitmap.h"
 #include "Gradient.h"
-#include <Mandel.h>
 
 #include <atomic>
 #include <tuple>

+ 7 - 2
libmandel/include/Mandel.h

@@ -1,12 +1,15 @@
 #ifndef MANDEL_MANDEL_H
 #define MANDEL_MANDEL_H
 
+// don't expose this library interface as it clashes with qt
+//#include <asmjit/asmjit.h>
+namespace asmjit { class JitRuntime; }
+
 #include <vector>
 #include <map>
 #include <string>
 #include <memory>
 
-#include <asmjit/asmjit.h>
 
 #include "MandelUtil.h"
 #include "Generators.h"
@@ -88,7 +91,7 @@ private:
     friend MandelContext mnd::initializeContext(void);
 
     CpuInfo cpuInfo;
-    asmjit::JitRuntime jitRuntime;
+    std::unique_ptr<asmjit::JitRuntime> jitRuntime;
 
     std::map<GeneratorType, std::unique_ptr<MandelGenerator>> cpuGenerators;
 
@@ -102,6 +105,7 @@ private:
     std::unique_ptr<AdaptiveGenerator> createAdaptiveGenerator(void);
     std::vector<MandelDevice> createDevices(void);
 public:
+    ~MandelContext(void);
     MandelContext(const MandelContext&) = delete;
     MandelContext(MandelContext&&) = default;
     MandelContext& operator=(const MandelContext&) = delete;
@@ -122,3 +126,4 @@ public:
 
 
 #endif // MANDEL_MANDEL_H
+

+ 9 - 3
libmandel/src/Mandel.cpp

@@ -5,6 +5,8 @@
 #include "JuliaGenerators.h"
 #include "ClGenerators.h"
 
+#include <asmjit/asmjit.h>
+
 #include <map>
 
 using mnd::MandelDevice;
@@ -72,8 +74,7 @@ namespace mnd
 
 MandelContext mnd::initializeContext(void)
 {
-    MandelContext context = MandelContext();
-    return context;
+    return MandelContext();
 }
 
 
@@ -309,6 +310,11 @@ std::vector<MandelDevice> MandelContext::createDevices(void)
 }
 
 
+MandelContext::~MandelContext(void)
+{
+}
+
+
 AdaptiveGenerator& MandelContext::getDefaultGenerator(void)
 {
     return *adaptiveGenerator;
@@ -323,7 +329,7 @@ const std::vector<MandelDevice>& MandelContext::getDevices(void)
 
 asmjit::JitRuntime& MandelContext::getJitRuntime(void)
 {
-    return jitRuntime;
+    return *jitRuntime;
 }