NULL: create a GpuProgramManager, so material scripts can be parsed - #590
Open
steffen-roemer wants to merge 1 commit into
Open
NULL: create a GpuProgramManager, so material scripts can be parsed#590steffen-roemer wants to merge 1 commit into
steffen-roemer wants to merge 1 commit into
Conversation
NULLRenderSystem creates a HardwareBufferManager, a VaoManager and a
TextureGpuManager, but no GpuProgramManager, so msSingleton stays null for
the whole process lifetime and parsing any .material or .program script
aborts:
Assertion failed: (msSingleton), function getSingleton,
file OgreGpuProgramManager.cpp, line 52
reached from the script compiler translating a vertex_program /
fragment_program declaration.
Add NULLGpuProgramManager, created beside the other managers in
_createRenderWindow and destroyed in shutdown(), the way Metal and Vulkan
create theirs. It holds no state of its own: both createImpl overloads
return a NULLGpuProgram, the low level counterpart of OgreMain's own
NullProgram - it accepts any type and syntax code, compiles nothing,
reports isSupported() == false and calculateSize() == 0.
Nothing starts pretending to work. NULL advertises no shader profiles, so
isSyntaxSupported() stays false and the compiler takes the road it already
takes for a program meant for another render system: it reports the
program as unsupported by this render system and registers it. That leaves
the program unloaded, so a program's source is never even read from disk,
and any technique using it is dropped as unsupported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #589. Under
RenderSystem_NULLthere is noGpuProgramManager, so parsingany
.materialor.programscript aborts:NULLRenderSystem::_createRenderWindowcreates the HardwareBuffer, Vao andTextureGpu managers, and nothing creates a
GpuProgramManager, somsSingletonstays null for the whole process lifetime.
This is option 1 from the issue, held to the condition you set there: worth having
only if it stays small in RAM and in maintenance.
The change
NULLGpuProgramManageris created beside the other managers in_createRenderWindowand destroyed inshutdown(). Metal and Vulkan createtheirs in
initialiseFromRenderSystemCapabilities; NULL's implementation of thathook is empty and nothing calls it, so the managers' own creation site is the
equivalent place.
It has no members. Both
createImploverloads return aNULLGpuProgramwith nobranch in between, because type and syntax code only matter to a compiler and
there is none.
NULLGpuProgramis the low level counterpart of theNullProgramOgreMain already carries for high level programs in an unregistered language, and
it is the same handful of lines:
That is the entire implementation. The two new files are 62 and 97 lines
including the license header; wiring them into the render system is 7 lines.
Why it stays small
syntax registry.
D3D11GpuProgramManagerhas exactly this shape today(
D3D11UnsupportedGpuProgram, "D3D11 doesn't support assembly shaders").layouts, syntax codes or capabilities, so a change anywhere else cannot make it
stale or wrong. There is no code path in it that a future feature has to teach.
GpuProgramper declared program, and nothing else. NULLadvertises no shader profiles, so
isSyntaxSupported()is false, the compilertakes the road it already takes for a program meant for another render system,
and the program is never loaded: its source is not read from disk, and
calculateSize()reports 0.Nothing starts pretending to work
Each declaration is reported as unsupported by the render system, the same way a
D3D11 program is reported under GL:
and a material built on such programs is honest about what it became:
isSupported()is overridden rather than left to the syntax lookup, so thatanswer does not depend on what the NULL capabilities happen to advertise later.
If you would rather have the honest refusal (option 2 in the issue) instead, say
so and I will send that one; which of the two to carry is your call.
Verification
macOS 15 / Apple Silicon, clang, Ninja.
RenderSystem_NULLandOgreNextMainbuilt static in Debug from this branch, and a standalone probe linked against them
booted
RootwithNULLPlugin, created a render window throughRoot::createRenderWindow, added a resource location holding one.program(twoasmdeclarations) and one.materialreferencing both, and calledinitialiseAllResourceGroups.Baseline master, same probe, same media:
SIGABRT, exit 134. With this branch:
Exit 0, and the shutdown is clean.
Not covered: the Ogre-Next sample and test suites were not run, and this was built
for macOS with clang only. Nothing outside
RenderSystems/NULLis touched.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/.programpair, which the engine now skips registering when it boots deviceless.