NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.31k stars 139 forks source link

Required OpenGL 4.4+ #47

Closed cleardusk closed 2 years ago

cleardusk commented 2 years ago

nvdiffrast relies on OpenGL4.4+ (e.g., egl), while many linux distributions cannot install OpenGL4.4+. Will authors support OpenGL3+ without being restricted to configure heavy docker?

s-laine commented 2 years ago

We use a few OpenGL features that are only available from version 4.4 onward, but with additional work it might be possible to support 3.3, possibly at a lower performance. I assumed it is a rare situation where you cannot install the latest OpenGL. Can you please elaborate a bit where you run into such a setup, and how common you think it is?

cleardusk commented 2 years ago

Honestly, I am struggling (trying lots of times) to upgrade OpenGL3.x to OpenGL 4.4+, but failed : (. The default latest version is OpenGL 3.1 (e.g., Ubuntu 18.04), and there are few posts on google about the upgrading. So, users will be greatly appreciated if authors can provide a way to upgrade the default OpenGL to 4.4+. I have gone through the code, and I think the successfull upgrading will work.

s-laine commented 2 years ago

OpenGL 3.1 does not seem feasible because geometry shader support didn't came into core OpenGL until version 3.2, and the nvdiffrast rasterization op relies on it heavily. Another major problem is the indirect draw call. The currently used glMultiDrawElementsIndirect is a 4.3 feature, and the only variant available in 3.x is the old glDrawElements. Thus a different method would be needed for communicating base triangle index etc. into the render call. Finally, I'm somewhat concerned that there might be problems with Cuda/OpenGL interop between modern Cuda and antiquated OpenGL drivers.

Given the difficulties and the fact that OpenGL 4.4 was released already in 2013, I don't think we're going to expend effort to support older versions than that.