Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL bug? Nvidia driver bug? SFML bug? My fault?  (Read 48401 times)

0 Members and 1 Guest are viewing this topic.

Lokk

  • Full Member
  • ***
  • Posts: 228
    • View Profile
    • http://betadineproject.wordpress.com/
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #105 on: October 13, 2009, 01:32:32 pm »
test1.cpp

Code: [Select]
Context c1;
Context c2(&c1);

int main()
{
  Context c3(&c1);
  return 0;
}

With glXMakeCurrent(...) shared condition, the test below confirm the error on a second context :
Code: [Select]
Succeeded to create context!
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  144 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Serial number of failed request:  26
  Current serial number in output stream:  29


Without the condition :
Code: [Select]
Succeeded to create context!
Succeeded to create context!
Creating a shared context...
Succeeded to create context!


test2.cpp
Code: [Select]
// Globals
Context c1;
Context c2(false, &c1);

int main()
{
  std::cout << "Creating a shared context..." << std::endl;
  Context c3(false, &c1);

  return 0;
}

And for that test too, the condition failed the context sharing creation
 :?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #106 on: October 13, 2009, 09:10:23 pm »
I've commited the fix (removing the if (shared) condition), you can test whether it's working or not.

I've also activated again the OpenGL 3 contexts (K-Bal will be able to test that on his PC ;)).
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #107 on: October 13, 2009, 11:53:41 pm »
The window opens, Clear() and Display() work, but I get a segmentation fault with this minimal example:
Code: [Select]
#include <SFML/Graphics.hpp>

int main() {
sf::RenderWindow  wnd( sf::VideoMode( 800, 600, 32 ), "Test" );
sf::Event         event;
sf::String        str( "Foo" );

while( wnd.IsOpened() ) {
while( wnd.GetEvent( event ) ) {
if( event.Type == sf::Event::Closed ) {
wnd.Close();
}
}

wnd.Clear();
wnd.Display();
}

return 0;
}


Backtrace:
Code: [Select]
#0  0xb7ea955a in std::less<unsigned int>::operator() (this=0xb7fa023c, __x=@0x10, __y=@0xbfffe034) at /usr/include/c++/4.3/bits/stl_function.h:230
#1  0xb7eabcdf in std::_Rb_tree<unsigned int, std::pair<unsigned int const, sf::Glyph>, std::_Select1st<std::pair<unsigned int const, sf::Glyph> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, sf::Glyph> > >::_M_insert_unique_ (this=0xb7fa023c, __position=..., __v=...)
    at /usr/include/c++/4.3/bits/stl_tree.h:1183
#2  0xb7eac09d in std::map<unsigned int, sf::Glyph, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, sf::Glyph> > >::insert (
    this=0xb7fa023c, __position=..., __x=...) at /usr/include/c++/4.3/bits/stl_map.h:496
#3  0xb7eac198 in std::map<unsigned int, sf::Glyph, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, sf::Glyph> > >::operator[] (
    this=0xb7fa023c, __k=@0x871f67c) at /usr/include/c++/4.3/bits/stl_map.h:419
#4  0xb7ea844d in sf::priv::FontLoader::CreateBitmapFont (this=0xb7fa02c8, face=0x8a5a4a8, charSize=30, charset=..., font=...) at FontLoader.cpp:228
#5  0xb7ea8bf4 in sf::priv::FontLoader::LoadFontFromMemory (this=0xb7fa02c8, data=0xb7f29100 "", sizeInBytes=367112, charSize=30, charset=..., font=...)
    at FontLoader.cpp:150
#6  0xb7ea52b3 in sf::Font::LoadFromMemory(char const*, unsigned int, unsigned int, sf::Unicode::Text const&) () from /usr/local/lib/libsfml-graphics.so.2.0
#7  0xb7ea54d3 in sf::Font::GetDefaultFont() () from /usr/local/lib/libsfml-graphics.so.2.0
#8  0x0804a7ce in main ()


Reported error:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0xb7ea955a in std::less<unsigned int>::operator() (this=0xb7fa023c, __x=@0x10, __y=@0xbfffd4e4) at /usr/include/c++/4.3/bits/stl_function.h:230
230           { return __x < __y; }


When I comment out the line with sf::String, everything works. I wonder if this really belongs to the context stuff. "__x=@0x10" looks weird, like an invalid pointer.

Edit: Stop! A clean rebuild fixed that issue. ;) Doing some more tests now..

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #108 on: October 14, 2009, 12:15:51 am »
Okay, so the fix is partially working. ;)

The following code works:
Code: [Select]
#include <SFML/Graphics.hpp>

int main() {
sf::RenderWindow  wnd( sf::VideoMode( 800, 600, 32 ), "Test" );
sf::Event         event;

wnd.SetActive( true );
sf::String        str( "Foo" );

while( wnd.IsOpened() ) {
while( wnd.GetEvent( event ) ) {
if( event.Type == sf::Event::Closed ) {
wnd.Close();
}
}

wnd.Clear();
wnd.Draw( str );
wnd.Display();
}

return 0;
}


If I don't add "wnd.SetActive( true )", the string is not visible.

When exiting the application, I get a segmentation fault with the following backtrace:
Code: [Select]
#0  0x00000000 in ?? ()
#1  0xb76c33d7 in intel_region_release () from /usr/lib/dri/i915_dri.so
#2  0xb76c6bb5 in intel_miptree_release () from /usr/lib/dri/i915_dri.so
#3  0xb76ca2be in ?? () from /usr/lib/dri/i915_dri.so
#4  0xb77881ea in _mesa_delete_texture_image () from /usr/lib/dri/i915_dri.so
#5  0xb778efbd in _mesa_delete_texture_object () from /usr/lib/dri/i915_dri.so
#6  0xb76ca348 in ?? () from /usr/lib/dri/i915_dri.so
#7  0xb778e421 in _mesa_reference_texobj () from /usr/lib/dri/i915_dri.so
#8  0xb778fb07 in _mesa_DeleteTextures () from /usr/lib/dri/i915_dri.so
#9  0xb7e8ccf0 in sf::Image::DestroyTexture (this=0xb7f9a458) at Image.cpp:802
#10 0xb7e8fc43 in ~Image (this=0xb7f9a458, __in_chrg=<value optimized out>) at Image.cpp:127
#11 0xb7e82ce2 in ~Font (this=0xb7f9a440, __in_chrg=<value optimized out>) at ../../../include/SFML/Graphics/Font.hpp:55
#12 0xb7bc6589 in exit () from /lib/i686/cmov/libc.so.6
#13 0xb7bac7ad in __libc_start_main () from /lib/i686/cmov/libc.so.6
#14 0x0804a631 in _start () at ../sysdeps/i386/elf/start.S:119


Seems like some context switching issue or similar.

Lokk

  • Full Member
  • ***
  • Posts: 228
    • View Profile
    • http://betadineproject.wordpress.com/
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #109 on: October 14, 2009, 02:26:05 pm »
The svn update resolved the bug for me :)
I used Tank sample code for testing it and the string is visible (with or without SetActive(...))

And without segfault xD

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #110 on: October 14, 2009, 03:44:07 pm »
Then it still seems to fail for Intel graphics cards. I'll do some more tests later.

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #111 on: October 14, 2009, 08:08:26 pm »
The current revision fails on my PC with my nvidia card again  :?  Don't know about my Laptop with the ATI chip.

Quote
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  128 (GLX)
  Minor opcode of failed request:  34 ()
  Serial number of failed request:  26
  Current serial number in output stream:  29
Listen to my band: pencilcase.bandcamp.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #112 on: October 14, 2009, 08:20:54 pm »
Quote
The current revision fails on my PC with my nvidia card again

Ok. So the OpenGL 3 issue was not related to this one. I'll disable the code again.
Laurent Gomila - SFML developer

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #113 on: October 17, 2009, 06:12:12 pm »
The newest revision works on my Laptop (ATI) :D
Listen to my band: pencilcase.bandcamp.com

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #114 on: October 17, 2009, 10:45:34 pm »
Still issues with Intel GPUs. Direct OpenGL is working flawlessly, but SFML stuff isn't.

OpenGL sample:


Pong sample:


When exiting the samples, I also get a memory access violation. Backtrace in pong sample:
Code: [Select]
#0  0x00000000 in ?? ()
#1  0xb74233d7 in intel_region_release () from /usr/lib/dri/i915_dri.so
#2  0xb7426bb5 in intel_miptree_release () from /usr/lib/dri/i915_dri.so
#3  0xb742a2be in ?? () from /usr/lib/dri/i915_dri.so
#4  0xb74e81ea in _mesa_delete_texture_image () from /usr/lib/dri/i915_dri.so
#5  0xb74eefbd in _mesa_delete_texture_object () from /usr/lib/dri/i915_dri.so
#6  0xb742a348 in ?? () from /usr/lib/dri/i915_dri.so
#7  0xb74ee421 in _mesa_reference_texobj () from /usr/lib/dri/i915_dri.so
#8  0xb74efb07 in _mesa_DeleteTextures () from /usr/lib/dri/i915_dri.so
#9  0xb7edf677 in sf::Image::DestroyTexture() () from /usr/local/lib/libsfml-graphics.so.2.0
#10 0xb7edf9e5 in sf::Image::~Image() () from /usr/local/lib/libsfml-graphics.so.2.0
#11 0x0804a835 in main ()

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #115 on: October 17, 2009, 11:13:23 pm »
By the way, did you notice that the default install directory has changed? It is now /usr/local instead of /usr. It can cause weird stuff it you still have an old version of SFML in /usr :)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #116 on: October 17, 2009, 11:34:02 pm »
Sure. I was one who appreciated that change. :)

And by the way, you can see that in the backtrace.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #117 on: October 18, 2009, 12:59:54 am »
Ok. The same question applies for all others who still have problems ;)
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #118 on: October 27, 2009, 10:29:22 am »
I made some changes to the OpenGL contexts code. Does it change anything for those who still had problems?
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
OpenGL bug? Nvidia driver bug? SFML bug? My fault?
« Reply #119 on: October 27, 2009, 11:01:31 pm »
I'll try to test that as soon as possible. Hopefully this eliminates that disturbing bug. :)