Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using OpenGL as the renderer leads to TDR(0x0000116) #3332

Open
sqmh666 opened this issue Jul 29, 2024 · 8 comments
Open

Using OpenGL as the renderer leads to TDR(0x0000116) #3332

sqmh666 opened this issue Jul 29, 2024 · 8 comments

Comments

@sqmh666
Copy link

sqmh666 commented Jul 29, 2024

Win11 23H2 thinkpad, CPU:Intel Ultra7 155H,Graphics:Intel Arc(Core graphics)
18-ibl.cpp

bgfx::Init init;
		init.type     = bgfx::RendererType::OpenGL;
		init.vendorId = args.m_pciId;
		init.platformData.nwh  = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
		init.platformData.ndt  = entry::getNativeDisplayHandle();
		init.platformData.type = entry::getNativeWindowHandleType();
		init.resolution.width  = m_width;
		init.resolution.height = m_height;
		init.resolution.reset  = m_reset;
		bgfx::init(init);

line419: init.type = args.m_type;
I change it into init.type = bgfx::RendererType::OpenGL; in Visual Studio and execute single-step debugging about bgfx::init(init);
Call Stack:

example-18-iblDebug.exe!bx::Semaphore::wait(int _msecs) line 276	C++
	example-18-iblDebug.exe!bgfx::Context::renderSemWait() line 5244	C++
	example-18-iblDebug.exe!bgfx::Context::frame(bool _capture) line 2326	C++
	example-18-iblDebug.exe!bgfx::Context::init(const bgfx::Init & _init) line 1997	C++
	example-18-iblDebug.exe!bgfx::init(const bgfx::Init & _userInit) line 3571	C++
>	example-18-iblDebug.exe!`anonymous namespace'::ExampleIbl::init(int _argc, const char * const * _argv, unsigned int _width, unsigned int _height) line 427	C++

return WAIT_OBJECT_0 == WaitForSingleObject(si->m_handle, milliseconds);
I get stuck at this,however,on an older version of thinkpad it's all fine,older version of thinkpad:i7-1260p,Intel iris xe and nvidia mx550
I have update driver for graphic(Arc graphic) tried everything I could do but nothing helped

@bkaradzic
Copy link
Owner

You'll need to debug it, and figure out what is waiting on render thread?

@sqmh666
Copy link
Author

sqmh666 commented Jul 30, 2024

I can't figure out because when I click next step,the screen stuck and tdr makes it black screen,I tried a few times to locate this error.I think it's graphics driver error because it's opengl driver for intel graphics accelerator is quite different from older graphics.I have tried all suitable driver and win10,11before,nothing helps.The output in vs2019 shows bgfx running in multi-threaded mode.Then
I debug from bgfx::init(init); into WAIT_OBJECT_0 == WaitForSingleObject(si->m_handle, millisecond); by step,next step video tdr failure.Windbg shows useless message.

@bkaradzic
Copy link
Owner

I debug from bgfx::init(init); into WAIT_OBJECT_0 == WaitForSingleObject(si->m_handle, millisecond); by step,next step video tdr failure.Windbg shows useless message.

Yes, this is API thread waiting for render thread to finish. You need to switch to render thread, and see where is GL renderer.

I can't figure out because when I click next step,the screen stuck and tdr makes it black screen,I tried a few times to locate this error.I think it's graphics driver error because it's opengl driver for intel graphics accelerator is quite different from older graphics.

I don't have hardware or driver you're using, so it's impossible for me to reproduce this locally and figure out, that's why I'm saying you have to debug and see what's going on. I don't even have guess what it might be other than faulty drivers since I never seen anything like that elsewhere.

@sqmh666
Copy link
Author

sqmh666 commented Jul 30, 2024

I have already been on render thread when I goto return WAIT_OBJECT_0 == WaitForSingleObject(si->m_handle, milliseconds);
call stack on the main thread:
example-18-iblDebug.exe!bgfx::gl::RendererContextGL::RendererContextGL() line 2225 C++

example-18-iblDebug.exe!bgfx::gl::rendererCreate(const bgfx::Init & _init) line 4834 C++
example-18-iblDebug.exe!bgfx::rendererCreate(const bgfx::Init & _init) line 2776 C++
example-18-iblDebug.exe!bgfx::Context::rendererExecCommands(bgfx::CommandBuffer & _cmdbuf) line 2827 C++
example-18-iblDebug.exe!bgfx::Context::renderFrame(int _msecs) line 2457 C++
example-18-iblDebug.exe!bgfx::renderFrame(int _msecs) line 1480 C++
example-18-iblDebug.exe!entry::Context::run(int _argc, const char * const * _argv) line 521 C++
example-18-iblDebug.exe!main(int _argc, const char * const * _argv) line 1191 C++
I try to freeze all thread but the main thread,it's the same problem
It's all message I can get from project

@bkaradzic
Copy link
Owner

That call stack doesn't make sense based on latest version:

: m_numWindows(1)

You're in constructor. You should link code where you are.

@sqmh666
Copy link
Author

sqmh666 commented Jul 31, 2024

I have found the where the problem is.
Call Stack

>	example-18-iblDebug.exe!bgfx::gl::TimerQueryGL::update() line 1636	C++
 	example-18-iblDebug.exe!bgfx::gl::TimerQueryGL::end(unsigned int _idx) line 1619	C++
 	example-18-iblDebug.exe!bgfx::gl::RendererContextGL::submit(bgfx::Frame * _render, bgfx::ClearQuad & _clearQuad, bgfx::TextVideoMemBlitter & _textVideoMemBlitter) line 8602	C++
 	example-18-iblDebug.exe!bgfx::Context::renderFrame(int _msecs) line 2461	C++
 	example-18-iblDebug.exe!bgfx::renderFrame(int _msecs) line 1480	C++
 	example-18-iblDebug.exe!entry::Context::run(int _argc, const char * const * _argv) line 521	C++
 	example-18-iblDebug.exe!main(int _argc, const char * const * _argv) line 1191	C++

In renderer_gl.h

GL_CHECK(glGetQueryObjectiv(query.m_end
   				, GL_QUERY_RESULT_AVAILABLE
   				, &available
   				) );

This line of code calls glGetQueryObjectiv = igxelpgicd32.dll
while on the older thinkpad mentioned above,it calls glGetQueryObjectiv = igxelpicd32.dll
There are only igxelpgicd32.dll and igxelpgicd64.dll on my new thinkpad while the older thinkpad includes both of igxelpicd32.dll and igxelpicd64.dll extra.These dlls are OpenGL driver for Intel graphics accelerator.
So in this function I can't goto next step,it just stuck there.
Is there any solution to this Tough issue?Deeply appreciate your support and guidance!

@bkaradzic
Copy link
Owner

Set m_timerQuerySupport to false.

But this is definitely driver issue.

@r2d2-5
Copy link

r2d2-5 commented Aug 28, 2024

Hello, I was wondering if this is related:
I am trying to run the examples provided (meatballs specifically) in my lap that has an Nvidia RTX 3050.
I forced to use opengl by setting up:
init.type = bgfx::RendererType::OpenGL

When I run the app the following error message pops up:
crashNvidia

I know is not a TDR but it seems to be caused by the same thing, OpenGL rendering.
Could it be something related to the drivers or is more related to the way bfgx is dealing with opengl calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants