C# .NET 10 OpenTK - Video Scheduler Internal Error on Resize
I'm using OGL to output a BGRA surface to screen. Nothing else.
OpenTK + Intel ARC iGPU. I'm extending GameWindow.
Behavior is inconsistent. Sometimes it resizes instantly. Sometimes there is a delay. If the delay is too long, then BSOD.
I believe its related to how free the CPU is. For example, silent profile is more likely to crash due to timeout. High fan profile is way less likely to exhibit issues. Original version avoided OGL code directly in favor of SkiaSharp doing the rendering. That was slower and crashed more often.
The resize code is this, done in OnFrameBufferResize event hook,
GL.DeleteTexture(_texture);
_texture = GL.GenTexture();
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, _texture);
// No mipmaps needed for a 1:1 pixel display.
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D,
TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
// Allocate GPU storage with the initial pixel data.
GL.TexImage2D(
TextureTarget.Texture2D,
level: 0,
internalformat: PixelInternalFormat.Rgba8, // GPU stores RGBA8
width: ClientSize.X,
height: ClientSize.Y,
border: 0,
format: PixelFormat.Bgra, // CPU supplies BGRA
type: PixelType.UnsignedByte,
pixels: ptr);
In OnResize hook,
GL.Viewport(0, 0, e.Width, e.Height);