Add ShaderRegisterData.custom.
#68
Open
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.
This allows effect methods to share registers in a safer way. Currently, if you want to use a custom attribute, it might look like this:
Long-ish sample code
Here,
glowRadiusis an extra attribute, with extra vertex data allocated for it.GlowMethodfigures out which buffer indexglowRadiuswill be uploaded to, and it can read from that index to access the color data.But what if a second method wants to know
glowRadius? There is no good way to pass that data. VOs are never shared between methods, and nothing in eitherShaderRegisterCachenorShaderRegisterDatacan store a customShaderRegisterElement.There are several places you could put it. You could make a static variable in
GlowMethod, or make a variable inMySubGeometry, or something. But Away3D always goes out of its way not to do this. I think the concern is that if methods begin reading/writing information outside the control ofShaderCompiler, it might leak between materials.This PR lets methods store arbitrary
ShaderRegisterElements for other methods to access later.ShaderCompilerknows about this data, and clears it each time.