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
feat(core): Explicitly set stepMode in Attribute layout #8858
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned out really nice, you took what seemingly would be a hack and turned it into a significant code cleanup!
if (stepMode === 'dynamic') { | ||
// If model info is provided, use isInstanced flag to determine step mode | ||
// If no model info is provided, assume it's an instanced model (most common use case) | ||
result.stepMode = modelInfo ? (modelInfo.isInstanced ? 'instance' : 'vertex') : 'instance'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth logging a warning here if falling back to assumptions? We generally want to reduce the amount of magic we rely on...
Or is it too common / convenient to let layers omit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every layer calls attributeManager.getBufferLayouts()
when constructing their models. Even if the layer does not contain any attribute with stepMode: 'dynamic'
, it may be used with an extension that does. Unless you think getBufferLayouts
should always be called with a isInstanced
argument (which is quite verbose), I'd prefer a quiet fallback.
I am personally not a fan of the noisy luma warnings in v9. Users should not be shown warnings that they cannot do anything about. Log levels should be used for development purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you think getBufferLayouts should always be called with a isInstanced argument (which is quite verbose), I'd prefer a quiet fallback.
Understood. For the longer term. I am suspecting that AttributeManager is perhaps doing too much. One the one had it is a binary table generator and on the other hand it is used to map that binary table to different attribute sets. I suspect that further separating these two steps at some point (e.g. remove addInstanced()
) might make it easier to generate precise layouts for each model.That is, whether the binary columns in the table is instanced seems like a technicality that the binary table management shouldn't need to worry about, but should be applied when a layout is requested. So in this sense, all attributes should be dynamic.
I haven't touched this code in a long time so it would probably take some discussion to work it through.
I am personally not a fan of the noisy luma warnings in v9. Users should not be shown warnings that they cannot do anything about. Log levels should be used for development purpose.
Sure, whether those logs are shown at debug level 0 or level 1 is a reasonable separate discussion.
Though in my view that doesn't solve anything. Relying on warnings being suppressed doesn't seem right, and showing them in debug mode even though they are "intentional" isn't helpful either, so I still I feel that until we find a way for deck to generate more precise layouts, we still need options for deck to turn them off.
Happy to see the number of #ifdefs dropping in the shaders as a result |
Closes #8849
This proposed fix adds a
stepMode
attribute setting. If set todynamic
, it will be resolved to one ofvertex
andinstance
based on whether the target model is instanced. With this change I'm able to remove much redundancy from layers/extensions where the same buffer is shared between instanced and non-instanced models.Change List
divisor
from attribute and shader attribute settings. While this is a breaking change,AttributeManager.add
andAttributeManager.addInstanced
instead of explicitly settingdivisor
, so the impact will be lowstepMode
to attribute settings