From 3c06ab634c7119249d37f808a5a979a5f7776de5 Mon Sep 17 00:00:00 2001
From: Michael Bien <mbien@fh-landshut.de>
Date: Wed, 20 Apr 2011 00:35:22 +0200
Subject: CLProgram.getSource() should not throw CLInvalidValueException if
 program does not have any sources (only happens on certain drivers).

---
 src/com/jogamp/opencl/CLProgram.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/com/jogamp/opencl')

diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java
index bbae75d9..bc3727f8 100644
--- a/src/com/jogamp/opencl/CLProgram.java
+++ b/src/com/jogamp/opencl/CLProgram.java
@@ -584,7 +584,12 @@ public class CLProgram extends CLObject implements CLResource {
      * each call of this method calls into Open
      */
     public String getSource() {
-        return getProgramInfoString(CL_PROGRAM_SOURCE);
+        // some drivers return IVE codes if the program haven't been built from source.
+        try{
+            return getProgramInfoString(CL_PROGRAM_SOURCE);
+        }catch(CLException.CLInvalidValueException ingore) {
+            return "";
+        }
     }
 
     /**
-- 
cgit v1.2.3