apitrace / apitrace

Tools for tracing OpenGL, Direct3D, and other graphics APIs
https://apitrace.github.io/
MIT License
2.62k stars 489 forks source link

Valid trace which crashes both glretrace and qapitrace #426

Closed turol closed 8 years ago

turol commented 8 years ago

Using this trace:

https://www.dropbox.com/s/oj0qjzsdi7m0wl2/Overgrowth.bin.x86_64.trace.xz?dl=0

this command:

glretrace -D 8349 --dump-format ubjson Overgrowth.bin.x86_64.trace > /dev/null

crashes with

retrace/glstate_images.cpp:310: bool glstate::getActiveTextureLevelDesc(glstate::Context&, GLenum, GLint, glstate::ImageDesc&): Assertion '0' failed.

This in turn causes qapitrace to crash with:

gui/qubjson.cpp:138: int readSize(QDataStream&, ubjson::Marker): Unimplemented code.
ASSERT: "0" in file gui/qubjson.cpp, line 284

I think this has something to do with texture buffer objects.

schulmar commented 8 years ago

The problem seems to be that the type for GL_RED_INTEGER's InternalFormatDesc is GL_NONE, which leads to the assert.

schulmar commented 8 years ago

More precisely it seems that commit 8374a0d66ca9228269e860089c1535fcda9f9c5f changed the semantics of the if because before it would trigger if the format was not found and now it triggers on type == GL_NONE.

jrfonseca commented 8 years ago

This is a bug in NVIDIA driver.

2575 glBindTexture(target = GL_TEXTURE_BUFFER, texture = 17)
2576 glTexBuffer(target = GL_TEXTURE_BUFFER, internalformat = GL_R32UI, buffer = 7)

but querying GL_TEXTURE_BUFFER_FORMAT_ARB or GL_TEXTURE_INTERNAL_FORMAT returns GL_RED_INTEGER, and not GL_R32UI as it should.

Mesa OpenGL drivers works fine.

I'm afraid there's not much I can do. GL_RED_INTEGER is untyped and does not explain how to interpret the texture buffer (it could be integer, float, 32 bits, 16 bits, etc.)

I'll replace the assertion with a warning, but you won't be able to see the contents of those buffers.

jrfonseca commented 8 years ago

@ahuillet

turol commented 8 years ago

@jrfonseca Not seeing the buffer contents is no big deal, I can always go look at the glBufferData command if I need to. The crashing however IS a big deal since I can't see any states in certain draw calls. Can you fix qapitrace so that it deals gracefully with crashing glretrace?

Thanks for fixing this.

jrfonseca commented 8 years ago

Can you fix qapitrace so that it deals gracefully with crashing glretrace?

Fixing this particular crash is easy.

Fixing generic crashes is harder, but I agree worthwhile. I'll try but I can't guarantee ETA.

BTW, if you apitrace build in release (ie pass -DCMAKE_BUILD_TYPE=Release) it won't assert and neither glretrace or qapitrace should crash.

ahuillet commented 8 years ago

I have filed NVIDIA bug 1733820 to track this issue. If you can provide a repro application, or an update to Piglit's tests/texturing/texture-rg.c to test integer formats, this would be helpful. Thanks

ahuillet commented 8 years ago

The problem in the NVIDIA driver was identified and fixed a while ago.

jrfonseca commented 8 years ago

@ahuillet Thanks!