コード例 #1
0
ファイル: Context.cs プロジェクト: ByteChkR/Byt3
        /// <summary>
        /// Retrieves the specified information about the program build.
        /// </summary>
        /// <typeparam name="T">The type of the data that is to be returned.</param>
        /// <param name="program">The handle to the program for which the build information is to be retrieved.</param>
        /// <param name="device">The device for which the build information is to be retrieved.</param>
        /// <param name="programBuildInformation">The kind of information that is to be retrieved.</param>
        /// <exception cref="OpenClException">If the information could not be retrieved, then an <see cref="OpenClException"/> is thrown.</exception>
        /// <returns>Returns the specified information.</returns>
        private T GetProgramBuildInformation <T>(IntPtr program, Device device,
                                                 ProgramBuildInformation programBuildInformation)
        {
            // Retrieves the size of the return value in bytes, this is used to later get the full information
            Result result = ProgramsNativeApi.GetProgramBuildInformation(program, device.Handle,
                                                                         programBuildInformation,
                                                                         UIntPtr.Zero, null, out UIntPtr returnValueSize);

            if (result != Result.Success)
            {
                throw new OpenClException("The program build information could not be retrieved.", result);
            }

            // Allocates enough memory for the return value and retrieves it
            byte[] output = new byte[returnValueSize.ToUInt32()];
            result = ProgramsNativeApi.GetProgramBuildInformation(program, device.Handle, programBuildInformation,
                                                                  new UIntPtr((uint)output.Length), output, out returnValueSize);
            if (result != Result.Success)
            {
                throw new OpenClException("The program build information could not be retrieved.", result);
            }

            // Returns the output
            return(InteropConverter.To <T>(output));
        }
コード例 #2
0
 public static extern Result GetProgramBuildInformation(
     [In] IntPtr program,
     [In] IntPtr device,
     [In][MarshalAs(UnmanagedType.U4)] ProgramBuildInformation parameterName,
     [In] UIntPtr parameterValueSize,
     [Out] byte[] parameterValue,
     [Out] out UIntPtr parameterValueSizeReturned
     );