NVIDIA/cuda-samples

simpleCUDA2GL sample: GL_INVALID_OPERATION

Forceflow opened this issue · 1 comments

When compiling and running the simpleCUDA2GL sample on windows 10 (20H2), using Visual Studio 16.8.4, this is the output:

(Interactive OpenGL Demo)
GPU Device 0: "Turing" with compute capability 7.5
Shader compilation error: Fragment info
0(4) : warning C7533: global variable gl_Color is deprecated after version 120
Shader compilation error: Fragment info
0(5) : warning C7533: global variable gl_TexCoord is deprecated after version 120
0(6) : warning C7533: global variable gl_FragColor is deprecated after version 120
Controls
(right click mouse button for Menu)
[esc] - Quit
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.2\3_Imaging\simpleCUDA2GL\main.cpp(297) : GL Error : GL_INVALID_OPERATION
GL Error in file 'C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.2\3_Imaging\simpleCUDA2GL\main.cpp' in line 297 :  GL_INVALID_OPERATION
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.2\bin\win64\Release\simpleCUDA2GL.exe (process 24616) exited with code 1.

The correct checkerboard image appears for one frame, then the program crashes.

The problematic lines around line 297:

#ifndef USE_TEXSUBIMAGE2D
    glUseProgram(shDrawTex);
    GLint id = glGetUniformLocation(shDrawTex, "texImage");
    glUniform1i(id, 0); // texture unit 0 to "texImage"
    SDK_CHECK_ERROR_GL();
#endif

I guess the uniform lookup/assignment is the problem or it treats the shader compilation warnings as errors, forcing the program to quit.

Not solved in CUDA 11.2 update 1