diff --git a/src/testshade/simplerend.cpp b/src/testshade/simplerend.cpp index e6d63688d..0fdcc71da 100644 --- a/src/testshade/simplerend.cpp +++ b/src/testshade/simplerend.cpp @@ -695,8 +695,21 @@ SimpleRenderer::build_interpolated_getter(const ShaderGroup& group, static const OIIO::ustring rs_get_attribute_constant_int( "rs_get_attribute_constant_int"); + static const OIIO::ustring rs_get_attribute_constant_int2( + "rs_get_attribute_constant_int2"); + static const OIIO::ustring rs_get_attribute_constant_int3( + "rs_get_attribute_constant_int3"); + static const OIIO::ustring rs_get_attribute_constant_int4( + "rs_get_attribute_constant_int4"); + static const OIIO::ustring rs_get_attribute_constant_float( "rs_get_attribute_constant_float"); + static const OIIO::ustring rs_get_attribute_constant_float2( + "rs_get_attribute_constant_float2"); + static const OIIO::ustring rs_get_attribute_constant_float3( + "rs_get_attribute_constant_float3"); + static const OIIO::ustring rs_get_attribute_constant_float4( + "rs_get_attribute_constant_float4"); if (param_name == RS::Hashes::s && type == OIIO::TypeDesc::TypeFloat) { spec.set(rs_get_interpolated_s, @@ -727,14 +740,49 @@ SimpleRenderer::build_interpolated_getter(const ShaderGroup& group, spec.set(rs_get_interpolated_test); } else if (const OIIO::ParamValue* p = userdata.find_pv(param_name, type)) { if (p->type().basetype == OIIO::TypeDesc::INT) { - spec.set(rs_get_attribute_constant_int, - ((int*)p->data())[0]); - return; + if (p->type().aggregate == 1) { + spec.set(rs_get_attribute_constant_int, + ((int*)p->data())[0]); + return; + } else if (p->type().aggregate == 2) { + spec.set(rs_get_attribute_constant_int2, + ((int*)p->data())[0], ((int*)p->data())[1]); + return; + } else if (p->type().aggregate == 3) { + spec.set(rs_get_attribute_constant_int3, + ((int*)p->data())[0], ((int*)p->data())[1], + ((int*)p->data())[2]); + return; + } else if (p->type().aggregate == 4) { + spec.set(rs_get_attribute_constant_int4, + ((int*)p->data())[0], ((int*)p->data())[1], + ((int*)p->data())[2], ((int*)p->data())[3]); + return; + } } else if (p->type().basetype == OIIO::TypeDesc::FLOAT) { - spec.set(rs_get_attribute_constant_float, - ((float*)p->data())[0], - InterpolatedSpecBuiltinArg::Derivatives); - return; + if (p->type().aggregate == 1) { + spec.set(rs_get_attribute_constant_float, + ((float*)p->data())[0], + InterpolatedSpecBuiltinArg::Derivatives); + return; + } else if (p->type().aggregate == 2) { + spec.set(rs_get_attribute_constant_float2, + ((float*)p->data())[0], ((float*)p->data())[1], + InterpolatedSpecBuiltinArg::Derivatives); + return; + } else if (p->type().aggregate == 3) { + spec.set(rs_get_attribute_constant_float3, + ((float*)p->data())[0], ((float*)p->data())[1], + ((float*)p->data())[2], + InterpolatedSpecBuiltinArg::Derivatives); + return; + } else if (p->type().aggregate == 4) { + spec.set(rs_get_attribute_constant_float4, + ((float*)p->data())[0], ((float*)p->data())[1], + ((float*)p->data())[2], ((float*)p->data())[3], + InterpolatedSpecBuiltinArg::Derivatives); + return; + } } } }