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

shader
test_varying_index_varying_int (output color Cout = color(0,0,0))
{
    // Test array referencing with varying index
    int rarray[3] = { int(10*u), 20, 30 };
    int garray[3] = { 20, int(40*P[0]), int(60*P[1]) };
    int barray[3] = { 30, 50, int(80*v) };
    
    int varyingIndex = int(clamp(P[0]*3, 0, 2));
    int indirectR = rarray[varyingIndex];
    int indirectG = garray[varyingIndex];
    int indirectB = barray[varyingIndex];
    
    Cout = color(indirectR/100.0,indirectG/100.0,indirectB/100.0);
}
