// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

shader
test_varying_index_color (output color Cout = color(0,0,0))
{
    // Test array referencing with varying index
    color carray[3] = { color(.1,.2,.3), 0.2, color(.3,.3,.3) };
    
    int varyingIndex = int(P[0]*256)%3;
    for(int i = 0; i < 50; ++i) {
        carray[varyingIndex] = color(u,v,0);
    }
    
    Cout = carray[0] + carray[1] + carray[2];    
}
