-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove GLWrapper
and move implementation to IRenderer
#5332
Conversation
Will need a test on |
|
||
/// <summary> | ||
/// The maximum number of pixels to upload per frame. | ||
/// Defaults to 2 megapixels (8mb alloc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda weird to specify the defaults in the interface when it doesn't guarantee them, but I guess it's okay.
While testing on iOS, I got some crashes: (from the finalizer thread) and System.NullReferenceException: Object reference not set to an instance of an object
at osu.Framework.Graphics.OpenGL.Buffers.FrameBuffer+FrameBufferTexture.set_Width (System.Int32 value) [0x00000] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/OpenGL/Buffers/FrameBuffer.cs:136
at osu.Framework.Graphics.OpenGL.Textures.TextureGL..ctor (osu.Framework.Graphics.OpenGL.OpenGLRenderer renderer, System.Int32 width, System.Int32 height, System.Boolean manualMipmaps, osuTK.Graphics.ES30.All filteringMode, SixLabors.ImageSharp.PixelFormats.Rgba32 initialisationColour) [0x00025] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/OpenGL/Textures/TextureGL.cs:66
at osu.Framework.Graphics.OpenGL.Buffers.FrameBuffer+FrameBufferTexture..ctor (osu.Framework.Graphics.OpenGL.OpenGLRenderer renderer, osuTK.Graphics.ES30.All filteringMode) [0x00000] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/OpenGL/Buffers/FrameBuffer.cs:125
at osu.Framework.Graphics.OpenGL.Buffers.FrameBuffer..ctor (osu.Framework.Graphics.OpenGL.OpenGLRenderer renderer, osuTK.Graphics.ES30.RenderbufferInternalFormat[] renderBufferFormats, osuTK.Graphics.ES30.All filteringMode) [0x00030] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/OpenGL/Buffers/FrameBuffer.cs:27
at osu.Framework.Graphics.OpenGL.OpenGLRenderer.CreateFrameBuffer (osu.Framework.Graphics.Rendering.RenderBufferFormat[] renderBufferFormats, osu.Framework.Graphics.Textures.TextureFilteringMode filteringMode) [0x000a5] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/OpenGL/OpenGLRenderer.cs:855
at osu.Framework.Graphics.BufferedDrawNodeSharedData.Initialise (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x00021] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/BufferedDrawNodeSharedData.cs:92
at osu.Framework.Graphics.BufferedDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x00013] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/BufferedDrawNode.cs:87
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Graphics.Containers.CompositeDrawable+CompositeDrawableDrawNode.Draw (osu.Framework.Graphics.Rendering.IRenderer renderer) [0x0009d] in /Users/dean/Projects/osu-framework/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs:204
at osu.Framework.Platform.GameHost.DrawFrame () [0x00168] in /Users/dean/Projects/osu-framework/osu.Framework/Platform/GameHost.cs:506
at osu.Framework.Threading.GameThread.processFrame () [0x000d9] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/GameThread.cs:454
--- End of stack trace from previous location where exception was thrown ---
at osu.Framework.Platform.GameHost+<>c__DisplayClass133_0.<abortExecutionFromException>b__0 () [0x00002] in /Users/dean/Projects/osu-framework/osu.Framework/Platform/GameHost.cs:390
at osu.Framework.Threading.ScheduledDelegate.InvokeTask () [0x00010] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/ScheduledDelegate.cs:106
at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal () [0x0002b] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/ScheduledDelegate.cs:92
at osu.Framework.Threading.Scheduler.Update () [0x0008a] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/Scheduler.cs:125
at osu.Framework.Threading.GameThread.processFrame () [0x00172] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/GameThread.cs:467
at osu.Framework.Threading.GameThread.RunSingleFrame () [0x00001] in /Users/dean/Projects/osu-framework/osu.Framework/Threading/GameThread.cs:296
at osu.Framework.Platform.ThreadRunner.RunMainLoop () [0x0005f] in /Users/dean/Projects/osu-framework/osu.Framework/Platform/ThreadRunner.cs:114
at osu.Framework.Platform.GameHost.windowUpdate () [0x00026] in /Users/dean/Projects/osu-framework/osu.Framework/Platform/GameHost.cs:850
at osu.Framework.Platform.GameHost.<Run>b__155_2 (System.Object _, osuTK.FrameEventArgs _) [0x00000] in /Users/dean/Projects/osu-framework/osu.Framework/Platform/GameHost.cs:754
at (wrapper delegate-invoke) System.EventHandler`1[osuTK.FrameEventArgs].invoke_void_object_TEventArgs(object,osuTK.FrameEventArgs)
at osuTK.iOS.iOSGameView.OnUpdateFrame (osuTK.FrameEventArgs e) [0x0000a] in <0fc4a59399e2486f977f9fdb230650a4>:0
at osuTK.iOS.iOSGameView.RunIteration (Foundation.NSTimer timer) [0x00042] in <0fc4a59399e2486f977f9fdb230650a4>:0
at osuTK.iOS.CADisplayLinkTimeSource.RunIteration (Foundation.NSObject parameter) [0x00000] in <0fc4a59399e2486f977f9fdb230650a4>:0
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:83
at osu.Framework.Tests.Application.Main (System.String[] args) [0x00001] in /Users/dean/Projects/osu-framework/osu.Framework.Tests.iOS/Application.cs:18 Both of these only started after selecting |
Good catch, came about due to the removal of the null check in the previous PR that wasn't tested in combination with this branch. Fixed. |
I guess the first crash was just triggered as a side-effect of the second and in normal execution won't happen due to the |
That's correct, yeah. |
Prereqs:
TextureGL
and rewriteTexture
to take its role #5330For the most part, this is a 1-1 migration of
GLWrapper
implementation intoOpenGLRenderer
, with appropriate interfaces added toIRenderer
. The rest is passingIRenderer
/OpenGLRenderer
to GL-specific classes (VBOs, Shaders, etc).Important changes of note:
Drawable
DIs in anIRenderer
to disposeDrawNode
s. Somehow,DrawNode
disposal has to be enqueued to run 3 frames behind. There's several ways to do this, and I'm not sure if the way I've chosen here is the best. Alternatives:Drawable.CreateDrawNode()
to take anIRenderer
parameter and constructDrawNode
s with the renderer.IRenderer
fromDrawable.Draw()
/Drawable.DrawOpaqueInteriorSubTree()
.BufferedDrawNode()
callsbase.Draw()
very late.TexturedShaderDrawNode
interface has changed slightly becauseRequiresRoundedShader()
needs anIRenderer
parameter. osu!-side this only results in a changes to one file.TextureUpload
. In InternaliseTextureGL
and rewriteTexture
to take its role #5330 I've moved the check toTexture.SetData()
.vNext
GLWrapper
removed, replaced byIRenderer
The static
GLWrapper
class no longer exists, and all drawing functions should be performed via theDrawNode.Draw()
IRenderer
parameter. There is a 1-1 compatibility between the classes.TexturedShaderDrawNode
interface changed slightlyShader
->GetAppropriateShader(IRenderer)
.RequriesRoundedShader
->RequiresRoundedShader(IRenderer)