Skip to content

Update SceneObject to allow binding to a named output #298

Open

Description

@pramsey1234

scene_rdl2: lib/scene/rdl2/SceneObject.{h,cc} need to allow binding of an attribute to a particular output on a shader object.

Some Implementation Thoughts

  • add setBinding version which takes an output name
  • getBinding needs to also return the output key or name
    Should there still be a way to get the binding without accepting a name for backward compatibility?
    If so, what should happen if an old getBinding is called on a binding which isn't the only output and isn't the default output (if there is a default)?
  • add an an array of output name or key to match mBindings array (one entry per attributes index)

List of Possible Functions

template <typename T> void setBinding(AttributeKey<T> key,
                                      SceneObject* sceneObject, ShaderOutputKey<T> outKey);
void setBinding(const Attribute& attr, SceneObject* sceneObject, ShaderOutput& output);
void setBinding(const std::string& name, SceneObject* sceneObject, const std::string& outName);
template <typename T, typename U> SceneObject* SceneObject::getBinding(AttributeKey<T> key,
                                                                       ShaderOutputKey<U>& outputKey) const;
SceneObject* SceneObject::getBinding(const Attribute& attr, ShaderOutput& output) const;

Activity

  1. converted this from a draft issue on Sep 23, 2026
  2. pramsey1234 commented on Sep 23, 2026

    @pramsey1234
    Author

    scene_rdl2: tests/lib/scene/rdl2/TestSceneObject should be updated to test the new functions

  3. self-assigned this
    on Oct 5, 2026
  4. pramsey1234 commented on Oct 5, 2026

    @pramsey1234
    Author

    openmoonray #297 is still in review so I'm working on this as a branch off of that work.

  5. pramsey1234 commented on Oct 5, 2026

    @pramsey1234
    Author

    We need to review how we want to handle existing code which just gets the binding as a return ShaderObject. Some options are:

    1. Force the code to update immediately to reading the bound output in addition to the bound object
    2. Keep a getBinding function which doesn't ask for the bound output and the code will just act like it's an old school binding.
    3. Keep a getBinding function which doesn't ask for the bound output and emit an error message and act as if there is no binding if it is an multi-output shader.
    4. Keep a getBinding function which doesn't ask for the bound output but throw an exception if the this is used with a multi-output shader.

    options 2,3, and 4 could be done as temporary measures until there is time for all code to update. This will allow things to be done in phases and won't matter as long as there aren't any multi-output shaders.

  6. pramsey1234 commented on Oct 6, 2026

    @pramsey1234
    Author

    We've decided to do #2, have calls to legacy getBinding() functions ignore the output part of the binding. This will allow work to move forward all of the task for multi-output shaders and won't matter until there are actually multi-output shaders in use. I've added openmoonray #320 to remove the functions at the end of this process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions