Example #1
0
        // Loads all available entry points for the current API.
        // Note: we prefer IGraphicsContextInternal.GetAddress over
        // this.GetAddress to improve loading performance (less
        // validation necessary.)
        internal override void LoadEntryPoints()
        {
            Debug.Print("Loading entry points for {0}", GetType().FullName);

            IGraphicsContext context = GraphicsContext.CurrentContext;

            if (context == null)
            {
                throw new GraphicsContextMissingException();
            }

            IGraphicsContextInternal context_internal = context as IGraphicsContextInternal;

            unsafe
            {
                fixed(byte *name = _EntryPointNamesInstance)
                {
                    for (int i = 0; i < _EntryPointsInstance.Length; i++)
                    {
                        _EntryPointsInstance[i] = context_internal.GetAddress(
                            new IntPtr(name + _EntryPointNameOffsetsInstance[i]));
                    }
                }
            }
        }
Example #2
0
        // Loads all available entry points for the current API.
        // Note: we prefer IGraphicsContextInternal.GetAddress over
        // this.GetAddress to improve loading performance (less
        // validation necessary.)
        internal override void LoadEntryPoints()
        {
            IGraphicsContext context = GraphicsContext.CurrentContext;

            if (context == null)
            {
                throw new GraphicsContextMissingException();
            }

            IGraphicsContextInternal context_internal = context as IGraphicsContextInternal;

            for (int i = 0; i < EntryPointsInstance.Length; i++)
            {
                EntryPointsInstance[i] = context_internal.GetAddress(EntryPointNamesInstance[i]);
            }
        }
Example #3
0
        static void MustGet <T>(IGraphicsContextInternal context, string name, out T result) where T : class
        {
            IntPtr pointer = context.GetAddress(name);

            result = (T)(object)Marshal.GetDelegateForFunctionPointer(pointer, typeof(T));
        }