-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Disallow renderables with missing required attributes #1279
Comments
Related PR is #1290 |
Some questions arise when thinking about this:
|
On point 2, the Metal backend can create a small zero-ed out "dummy" buffer for missing vertex attributes and use the In order to do that, the backend needs to know which attributes are "expected" for a given program. I propose we add an |
See also #1663 |
Let me add yet another bullet to my list:
|
It can be extremely useful if you want to change the visual state of an object. You could create a different renderable but this is much easier. |
Creating a new renderable would be super easy if we exposed a clone method. Also, users can always call setParameter on the material instance, the problem arises only when they want a drastic change like the shading model or set of attributes. |
I agree with @prideout my original intent was for all these things to be immutable. |
@pixelflinger I complained about mutability in 2019 but unfortunately the ship has already sailed. We now have several users who swap out materials nowadays. In fact we made VertexBuffer more mutable with the advent of BufferObject, in order to satisfy glTF morphing requirements. Anyway: I feel this bug is obsolete and that we can close it. |
All lit materials implicitly require the tangents attribute. Not including tangents for lit renderables causes undefined behavior in OpenGL and a crash in Metal.
RenderableManager
permits renderables to be created with missing required attributes; however, missing attributes are logged in two places:RenderableManager::Builder::build
FRenderableManager::setMaterialInstanceAt
A better solution would be to somehow disallow renderables with insufficient attributes. Ideally, renderables should be immutable. This way, the checks at
build
andsetMaterialInstanceAt
could be promoted to errors.The text was updated successfully, but these errors were encountered: