Repository: AvaloniaUI/Avalonia
File: src/Avalonia.OpenGL/Controls/OpenGlControlBase.cs (C#)

Code before:
                    typeof(IOpenGlTextureSharingRenderInterfaceContextFeature));
            var interop = await gpuInteropTask;

            if (interop == null)
            {
                Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
                    "Compositor backend doesn't support GPU interop");
                return false;
            }

            if (!EnsureInitializedCore(interop, contextSharingFeature))
            {
                DoCleanup();
                return false;
            }

            using (_resources.Context.MakeCurrent())
                OnOpenGlInit(_resources.Context.GlInterface);
            
            return true;
        }

        /// <summary>
        /// Requests that the control be rendered on the next frame.
        /// </summary>
        public void RequestNextFrameRendering()
        {
            if ((_initialization == null || IsInitializedSuccessfully) &&
                !_updateQueued && _compositor != null)
            {
                _updateQueued = true;
                _compositor.RequestCompositionUpdate(_update);
            }
        }

        private PixelSize GetPixelSize(IRenderRoot visualRoot)
        {
            var scaling = visualRoot.RenderScaling;
            return new PixelSize(Math.Max(1, (int)(Bounds.Width * scaling)),
                Math.Max(1, (int)(Bounds.Height * scaling)));
        }

        /// <summary>
        /// Called when the OpenGL context is first created.
        /// </summary>
        /// <param name="gl">The interface for making OpenGL calls. Use <see cref="GlInterface.GetProcAddress"/> to access additional APIs not covered by <see cref="GlInterface"/>.</param>
        protected virtual void OnOpenGlInit(GlInterface gl)
        {
            
        }


Review comment (performance):
Not sure if this one can/should be removed.
With no `new void InvalidateVisual` - users will be able to call standard `Visual.InvalidateVisual`, and get ineffective results.

This obsoletion was meant to notify users about more efficient method.

Code after:
                    typeof(IOpenGlTextureSharingRenderInterfaceContextFeature));
            var interop = await gpuInteropTask;

            if (interop == null)
            {
                Logger.TryGet(LogEventLevel.Error, "OpenGL")?.Log("OpenGlControlBase",
                    "Compositor backend doesn't support GPU interop");
                return false;
            }

            if (!EnsureInitializedCore(interop, contextSharingFeature))
            {
                DoCleanup();
                return false;
            }

            using (_resources.Context.MakeCurrent())
                OnOpenGlInit(_resources.Context.GlInterface);
            
            return true;
        }

        /// <inheritdoc cref="Visual.InvalidateVisual"/>
        [Obsolete("Use RequestNextFrameRendering()"), EditorBrowsable(EditorBrowsableState.Never)]
        // ReSharper disable once MemberCanBeProtected.Global
        public new void InvalidateVisual() => RequestNextFrameRendering();

        /// <summary>
        /// Requests that the control be rendered on the next frame.
        /// </summary>
        public void RequestNextFrameRendering()
        {
            if ((_initialization == null || IsInitializedSuccessfully) &&
                !_updateQueued && _compositor != null)
            {
                _updateQueued = true;
                _compositor.RequestCompositionUpdate(_update);
            }
        }

        private PixelSize GetPixelSize(IRenderRoot visualRoot)
        {
            var scaling = visualRoot.RenderScaling;
            return new PixelSize(Math.Max(1, (int)(Bounds.Width * scaling)),
                Math.Max(1, (int)(Bounds.Height * scaling)));
        }

        /// <summary>
        /// Called when the OpenGL context is first created.
        /// </summary>
        /// <param name="gl">The interface for making OpenGL calls. Use <see cref="GlInterface.GetProcAddress"/> to access additional APIs not covered by <see cref="GlInterface"/>.</param>