Skip to content

NULL render system creates no GpuProgramManager: parsing any .material/.program script asserts #589

Description

@steffen-roemer

Symptom

Under RenderSystem_NULL, parsing any .material or .program script aborts:

Assertion failed: (msSingleton), function getSingleton,
  file OgreGpuProgramManager.cpp, line 52

The script compiler reaches GpuProgramManager::getSingleton() while translating a vertex_program/fragment_program declaration, and there is no instance.

Cause

NULLRenderSystem::_createRenderWindow creates the managers a render system owns:

mHardwareBufferManager = new v1::DefaultHardwareBufferManager();
mVaoManager = OGRE_NEW NULLVaoManager();
mTextureGpuManager = OGRE_NEW NULLTextureGpuManager( mVaoManager, this );

but no GpuProgramManager. Metal and Vulkan create theirs in initialiseFromRenderSystemCapabilities:

mShaderManager = OGRE_NEW MetalGpuProgramManager( &mDevice );   // OgreMetalRenderSystem.mm
mShaderManager = OGRE_NEW VulkanGpuProgramManager( mDevice );   // OgreVulkanRenderSystem.cpp

RenderSystems/NULL/ contains no reference to GpuProgramManager at all, so msSingleton stays null for the whole process lifetime.

Why this is being raised rather than patched

It reads as a design question, not an omission with one obvious answer, and any of these could be what you intend:

  1. A NULLGpuProgramManager that accepts every declaration and produces inert programs — scripts parse, nothing is compiled, and a headless run behaves like the real ones for everything above the shader tier.
  2. An honest refusal — a clear exception ("the NULL render system has no GPU program manager") instead of an assert, so the caller learns what happened.
  3. Out of scope by design — the NULL RS deliberately serves Hlms-only content, and low-level material scripts are simply not part of what it supports. That is a legitimate position; it would just be worth saying so, because today the answer arrives as an assert inside OgreMain.

Happy to send a PR for whichever of these you prefer.

Encountered while making the Ogre-Next backend of orkige run window-less and GPU-less for CI; the media that triggered it was the AtmosphereNpr sky's own .material/.program pair, which the engine now skips registering when it boots deviceless. (Related, from the same exercise: #587 and #588.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions