Skip to content

Gracefully Deal With Attempting to Initialize Graphics Before a Context is Available #386

Open
@ilexp

Description

@ilexp

Summary

As outlined here, Duality will crash when attempting to create graphics resources before the graphics window has been opened. A typical example is inside the CorePlugin.InitPlugin method.

How to reproduce

  • Implement a CorePlugin like this:
    public class SomeCorePlugin : CorePlugin
    {
        protected override void InitPlugin()
        {
            base.InitPlugin();
            new Texture();
        }
    }

Workaround

  • Instead of using the plugin's InitPlugin method, perform the required operations in the first BeforeUpdate call.

Analysis

  • The graphics backend should check whether there is a graphics context available when attempting to create native resources and throw an exception if not, alerting users about the issue and allowing them to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendArea: Backend core / editor plugins (OpenTK, etc.)TaskToDo that's neither a Bug, nor a Feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions