Procházet zdrojové kódy

added a constructor that disables the program cache: used during development

shamanDevel před 9 roky
rodič
revize
e35bb7dcbc

+ 2 - 2
jme3-core/src/main/java/com/jme3/opencl/OpenCLObjectManager.java

@@ -43,8 +43,8 @@ import java.util.logging.Logger;
  */
 public class OpenCLObjectManager {
     private static final Logger LOG = Logger.getLogger(OpenCLObjectManager.class.getName());
-    private static final Level LOG_LEVEL1 = Level.INFO;
-    private static final Level LOG_LEVEL2 = Level.INFO;
+    private static final Level LOG_LEVEL1 = Level.FINER;
+    private static final Level LOG_LEVEL2 = Level.FINE;
     /**
      * Call Runtime.getRuntime().gc() every these frames
      */

+ 15 - 0
jme3-core/src/main/java/com/jme3/opencl/ProgramCache.java

@@ -59,6 +59,21 @@ public class ProgramCache {
     private final Device device;
     private final File tmpFolder;
 
+    /**
+     * Creates a "disabled" program cache, no caching is done.
+     * {@link #loadFromCache(java.lang.String) } will always return {@code null}
+     * and {@link #saveToCache(java.lang.String, com.jme3.opencl.Program) } does
+     * nothing.<br>
+     * Use this during development if you still modify your kernel code.
+     * (Otherwise, you don't see the changes because you are still use the 
+     * cached version of your program)
+     */
+    public ProgramCache() {
+        this.context = null;
+        this.device = null;
+        this.tmpFolder = null;
+    }
+    
     /**
      * Creates a new program cache associated with the specified context and
      * devices.