Commits

Tobias Bohnen committed dbb60b3

Comments (0)

Files changed (3)

         ThreadSafePolicy = 4135,
     }
 
+    public enum NameSpace
+    {
+        Global = 4108,
+        Program = 4109,
+    }
+
     public enum Order
     {
         ColumnMajor = 4121,
         Patch = 4152, /* GetProgramInput and GetProgramOutput */
     }
 
-    public enum ProgramNamespace
-    {
-        Global = 4108,
-        Program = 4109,
-    }
-
     public enum ProgramOutput
     {
         Fragment = 4122, /* GetProgramInput and GetProgramOutput */

CgNet/CgNativeMethods.cs

         // CGDLL_API CGparameter cgGetFirstLeafParameter(CGprogram prog, CGenum name_space);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        internal static extern IntPtr cgGetFirstLeafParameter(IntPtr program, int nameSpace);
+        internal static extern IntPtr cgGetFirstLeafParameter(IntPtr program, NameSpace nameSpace);
 
         /// <summary>
         /// Gets the first parameter in specified program.
         /// <returns>First parameter in specified program.</returns>
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        internal static extern IntPtr cgGetFirstParameter(IntPtr prog, int nameSpace);
+        internal static extern IntPtr cgGetFirstParameter(IntPtr prog, NameSpace nameSpace);
 
         /// <summary>
         /// 
         // CGDLL_API CGparameter cgGetNamedProgramParameter(CGprogram prog,  CGenum name_space,  const char *name);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        internal static extern IntPtr cgGetNamedProgramParameter(IntPtr prog, ProgramNamespace nameSpace, string name);
+        internal static extern IntPtr cgGetNamedProgramParameter(IntPtr prog, NameSpace nameSpace, string name);
 
         // CGDLL_API CGstate cgGetNamedSamplerState(CGcontext, string name);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
             return context.CreateProgram(type, source, profile, entry, args);
         }
 
+        public static Program CreateFromEffect(Effect effect, ProfileType profile, string entry, params string[] args)
+        {
+            return effect.CreateProgram(profile, entry, args);
+        }
+
         public static Program CreateFromFile(Context context, ProgramType type, string file, ProfileType profile, string entry, params string[] args)
         {
             return context.CreateProgramFromFile(type, file, profile, entry, args);
                                                };
         }
 
-        public Parameter GetFirstLeafParameter(int nameSpace)
+        public Parameter GetFirstLeafParameter(NameSpace nameSpace)
         {
             var ptr = CgNativeMethods.cgGetFirstLeafParameter(this.Handle, nameSpace);
             return ptr == IntPtr.Zero ? null : new Parameter(ptr)
                                                };
         }
 
-        public Parameter GetFirstParameter(int nameSpace)
+        public Parameter GetFirstParameter(NameSpace nameSpace)
         {
             var ptr = CgNativeMethods.cgGetFirstParameter(this.Handle, nameSpace);
             return ptr == IntPtr.Zero ? null : new Parameter(ptr)
                                                };
         }
 
-        public Parameter GetNamedParameter(ProgramNamespace nameSpace, string name)
+        public Parameter GetNamedParameter(NameSpace nameSpace, string name)
         {
             var ptr = CgNativeMethods.cgGetNamedProgramParameter(this.Handle, nameSpace, name);
             return ptr == IntPtr.Zero ? null : new Parameter(ptr)