PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6k stars 1.19k forks source link

Bad comment producing a syntax error in a glslfx file #3144

Open lanierd-adsk opened 2 months ago

lanierd-adsk commented 2 months ago

Description of Issue

In https://github.com/PixarAnimationStudios/OpenUSD/blob/2864f3d04f396432f22ec5d6928fc37d34bb4c90/pxr/usdImaging/plugin/usdShaders/shaders/primvarReader.glslfx#L35 There is -- This file is intentionally empty. It should be : // This file is intentionally empty.

Steps to Reproduce

  1. For some reason, Hydra tries to compile that empty shader which fails nbecause of this syntax error. I am using a custom GLSLFX under Storm and building in C++ the following network :

    VtValue _CreateHydraCustomColorMaterial(const SdfPath& matPath, const GfVec3f& color)
    {
    HdMaterialNetworkMap networkMap;
    HdMaterialNetwork    network;
    
    //Create our custom GLSLFX shader node
    HdMaterialNode       node;
    node.identifier = _tokens->FVP_CustomColor_Shader;//Identifier of our custom GLSLFX shader
    node.path = matPath;
    // Add the parameters
    node.parameters[_tokens->FVP_CustomColor] = VtValue(GfVec3f(color[0], color[1], color[2]));
    network.nodes.emplace_back(std::move(node));
    
    // Create the UV primvar reader node
    const SdfPath uvPrimvarNodePath = SdfPath(_tokens->uvPrimVarReaderNode);
    HdMaterialNode uvPrimvarNode;
    uvPrimvarNode.path = uvPrimvarNodePath;
    uvPrimvarNode.identifier = UsdImagingTokens->UsdPrimvarReader_float2;
    uvPrimvarNode.parameters[_tokens->varname] = _tokens->st;
    network.nodes.emplace_back(std::move(uvPrimvarNode));
    
    // Insert connection between UV primvar reader node
    // and the material input
    HdMaterialRelationship uvPrimvarRel;
    uvPrimvarRel.inputId = uvPrimvarNodePath;
    uvPrimvarRel.inputName = _tokens->result;
    uvPrimvarRel.outputId = matPath;
    uvPrimvarRel.outputName = _tokens->st;
    network.relationships.emplace_back(std::move(uvPrimvarRel));
    
    networkMap.map.insert({ HdMaterialTerminalTokens->surface, std::move(network) });
    networkMap.terminals.push_back(matPath);
    return VtValue(networkMap);
    }

    Which triggers the compilation of this shader.

System Information (OS, Hardware)

Windows.

Package Versions

Build Flags

jesschimein commented 2 months ago

Filed as internal issue #USD-9810