NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.37k stars 146 forks source link

error C7528: OpenGL reserves names starting with 'gl_': gl_PrimitiveID #77

Closed geek0075 closed 2 years ago

geek0075 commented 2 years ago

Hi,

I got the following exception trying to run:

$ python test.py --name=model1 --epoch=20 --img_folder=./datasets/mydata

on this repository: https://github.com/sicxu/Deep3DFaceRecon_pytorch

This returns an error:

Error C7528: OpenGL reserves names starting with 'gl_': gl_PrimitiveID Error C2003: Incompatible options for Link

Has anyone else experienced this? I am running on Windows with NVIDIA GeForce 3090.

My Nvidia Driver Version:

Driver Provider: NVIDIA Driver Version: 30.0.15.1179 Driver Date: 2/10/2022 Digital Signer: Microsoft Windows Hardware Compatibility Publisher

The error in more detail:

Model [FaceReconModel] was created loading the model from ./checkpoints\model1\epoch_20.pth 0 ./datasets/biden512\0000001.jpg [I D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\common\glutil.cpp:119] Creating GL context for Cuda device 0 [I D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\common\glutil.cpp:127] Selecting device with PCI bus id 000:01:00.0 - success [I D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\common\glutil.cpp:164] WGL OpenGL context (hdc: 0x81010f36, hglrc: 0x00010000) [I D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\common\rasterize.cpp:91] OpenGL version reported as 4.6

Traceback (most recent call last): File "test.py", line 74, in main(0, opt, opt.img_folder) File "test.py", line 64, in main model.test() # run inference File "D:\kay_taiwo\deep3d\Deep3DFaceRecon_pytorch\models\base_model.py", line 162, in test self.forward() File "D:\kay_taiwo\deep3d\Deep3DFaceRecon_pytorch\models\facerecon_model.py", line 139, in forward self.pred_vertex, self.facemodel.face_buf, feat=self.pred_color) File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "D:\kay_taiwo\deep3d\Deep3DFaceRecon_pytorch\util\nvdiffrast.py", line 58, in forward self.glctx = dr.RasterizeGLContext(device=device) File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\torch\ops.py", line 151, in init self.cpp_wrapper = _get_plugin().RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx) RuntimeError: glLinkProgram() failed: Fragment info

0(2) : error C7528: OpenGL reserves names starting with 'gl_': gl_PrimitiveID (0) : error C2003: Incompatible options for link

Kind Regards.

geek0075 commented 2 years ago

Hello. @s-laine . I see that you helped a different issue no opened around this same issue here:

https://github.com/NVlabs/nvdiffrast/issues/50

I have tried your suggestions in that post to no avail. Do kindly have a look and respond with possible solutions.

Thanks.

s-laine commented 2 years ago

This could be the same issue as in #50, although the error message doesn't make sense (the shaders never try to declare a variable named gl_PrimitiveID). Can you try removing all four blocks like this (8 lines in total):

  in vec4 gl_FragCoord;
  out float gl_FragDepth;

and see if it gets the GLSL to compile.

geek0075 commented 2 years ago

Hi @s-laine.

Thanks lots for your prompt response. I must apologize for troubling you though ;-). It was a very simple issue that has resolved and the fault is not nvdiffrast's at all!

Apparently the repository here (https://github.com/sicxu/Deep3DFaceRecon_pytorch) that requires the use of nvdiffrast recommends cloning it by doing a git clone --recursive which automatically clones and installs an old (likely abandoned) branch of nvdiffrast. I had always just left it at that - thinking that the Deep3DFaceRecon repo may have a specific dependency on that branch of nvdiffrast.

But this morning after receiving your response, I searched for the lines of code you said to comment out:

in vec4 gl_FragCoord; out float gl_FragDepth;

And it was no where to be found! Then it occurred to me that perhaps I was working with the wrong version or branch of nvdiffrast! So I deleted my nvdiffrast folder. Cloned the nvdiffrast afresh and just ran the app!

Lo and behold - she is chugging along for dear life doing exactly what is needed!

Thanks for your time and God bless. Keep up the good work. It is much appreciated.

Venika-19 commented 2 years ago

Hi! I have tried the solution that you have suggested but it is not getting fixed. Screenshot from 2022-07-04 15-54-57 I am using NVDIA RTX 3070 Ti and the version of the drivers is 510.73.05. Please help me fix the error.

s-laine commented 2 years ago

Looks like you're also using an outdated version of nvdiffrast bundled with Deep3DFaceRecon_pytorch. See the comment preceding yours.