Hi everyone,
I got stuck with a strange situation, that I couldn’t manage to perfectly pin down yet;
I don’t know if this is the most appropriate category, but every piece of advise or hint on how to continue investigating this would be very useful ![]()
I try and list the situation I’m facing:
- I create two render contexts, let’s call them A and B, on different surfaces (the system I’m working on could create more than two, but let’s keep the sample simple)
- A and B share no elements (i.e. I didn’t use wglShareLists)
- I make A the current context (wglMakeCurrent), and compile shader shaderA in order to create a program, for which the numeric handle is X.
- glUseProgram(X), then glGetUniformLocation(X, “UniformName”) and I get the location of the uniform (namely, location 13). I can set the uniform’s value, I can proceed with draw calls. So far, so good.
- I repeat step 3, but this time I set B as current and compile a different shader shaderB, which program object is referenced by an homonymous value X; since A and B shares nothing, that shouldn’t be an issue.
- I repeat step 4 on the newly set context: glUseProgram(X), then glGetUniformLocation(X, “UniformName”) and I get the location of the uniform (namely, location 67), which allows me to set the uniform value as expected (Note: “UniformName” exists both in shaderA and shaderB, so the fact I used the very same dummy string reflects my situation)
- Now what I cannot understand: I make A the current context again, I perform glUseProgram(X), but glGetUniformLocation(X, “UniformName”) yields 67, as if I were still in context B. I was expecting 13 again, since it were properly compiled/link during step 3.
Some additional data:
- I’m developing on a NVIDIA RTX 2000 Ada Generation GPU
- This behavior began after the driver update to version 573.42; with version 553.62 everything seemed to work as expected
- When available, I try and force OpenGL 3.3 (core profile) by using wglCreateContextAttribsARB
- I tried to describe the test as linear as I could, but the framework I’m working on is quite big: so I double checked that the data retrieved by wglGetCurrentContext and wglGetCurrentDC were the expected ones during steps 3 to 7
- On a laptop with Intel UHD graphics I get no issues
- On a machine with AMD Radeon Pro W5500 I get no issues
- If I omit step 2 by using wglShareLists, everything works: I think that’s due to the fact that shaderA and shaderB cannot both be referenced by the same X handle; however, I would like to avoid this, if possible
- I’m working in C#, with an internal mapping of the API calls (this aspect is quite robust, so I don’t think it’s related, but I’m listing all the data I have)
- I tried and replicate the very same behavior with a GLFW/C++ program: I created two windows with two separate render contexts, but everything seems to work as expected.
Did any of you experience something like that?
Am I missing some evident piece of information?
At the moment, I’ve got no additional ideas, so every hint would be very welcome!
Thx!