This modified sample is from the Custom WebGL layer (https://developers.arcgis.com/javascript/latest/sample-code/custom-gl-visuals/index.html#).
To make this work for a feature layer, I did the following....
- Created a feature layer class