Hi,
I’m looking a mesh rendering performance issue in HdStorm, seems one bottleneck is on geometry shader, is there any way to skip the linking of geometry shader for mesh?
Keli
Hi,
I’m looking a mesh rendering performance issue in HdStorm, seems one bottleneck is on geometry shader, is there any way to skip the linking of geometry shader for mesh?
Keli
Hi Keli,
Geometry shaders, when active, do have a big performance impact. We turn it off when possible, and we’re working on finding ways to express the features we need without the geometry shader.
A key consideration here is that if your GPU supports builtin barycentric coordinate access from the fragment shader (which is standard on RTX-class hardware), we can avoid the geometry shader for common features like edge styling and face-varying interpolation. We currently require it for displacement shading, and adaptive subdivision, although in the future we may be able to improve those with compute shaders or mesh shaders.
If you’re able to instrument the conditional I linked above, that should tell you why your object is drawing with a geometry shader; if you feel like it shouldn’t be drawing with a geometry shader, please let us know, as we’re happy to improve that conditional to cover more cases.
Hope that helps!
Tom
Hi Tom,
Thanks for your reply, in our case, we’re using HdMeshGeomStyleSurf, it’s the condition below which triggered the GS:
// Selected edges can be highlighted even if not otherwise displayed
const bool renderSelectedEdges = geomStyle == HdMeshGeomStyleSurf ||
geomStyle == HdMeshGeomStyleHull;
Could this be optimized out as we’re just rendering faces? Could the renderSelectedEdges flag be turned on only when highlighting/selecting is enabled?
From what we saw, we could be at least 2x faster on large scene if GS is OFF.
Keli
Hi Keli,
Unfortunately the knowledge of whether selection highlighting is enabled is passed to Hydra at a fairly late stage. However, it definitely seems like we should be doing something better in the shader config here. If you know you won’t be using our edge highlighting code, you could try skipping this condition and see if that speeds things up.
Feel free to file a github issue about this, and we can look at either adding a setting to disable this condition, or finding a way to generate the edge coords without the GS, or something along those lines.
Just to confirm, are you expecting to run on hardware without builtin barycentric coordinate access? If your hardware has access to GLSL/extensions/ext/GLSL_EXT_fragment_shader_barycentric.txt at master · KhronosGroup/GLSL · GitHub, that removes the need for a geometry shader in most cases. If you have that extension, and hydra isn’t picking it up, let me know.
Thanks,
Tom
Hi Tom,
As a first step, it would be great to have an option to not use GS to handle edge highlighting, then next step could be find another way to handle edge highlighting.
With that option, we can skip the GS for most of our rendering cases (no quads, no displacement, no per-face interpolation), do you want me to create an issue for this request?
Yes, we’re expecting to run on hardware without builtin barycentric coordinate access.
Keli