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

Author Topic: SegFault in Texture.cpp (Intel Graphics)  (Read 1347 times)

0 Members and 1 Guest are viewing this topic.

Overlay

  • Newbie
  • *
  • Posts: 5
    • View Profile
SegFault in Texture.cpp (Intel Graphics)
« on: May 30, 2022, 10:57:28 pm »
Hi, all! I just started to learn SFML and I got a SegFault when trying to run this little mandelbrot sample program.
It runs well on my friend's PC (nVidia graphics) but not on my laptop (Intel graphics).

My specs:
  • Windows 7 x64 SP1
  • Intel (GMA) 4500MHD adapter with the latest available driver (8.15.10.2869), OpenGL 2.1 and GL_EXT_framebuffer_object support (reported by OpenGL Extensions Viewer)
  • Code::Blocks 20.03 with MinGW-64-GCC-8.10
  • SFML (Dev snapshot, windows-gcc-810-mingw-64.zip, 2022-Jan-07)

Stack trace:

main.cpp:
// Line 43
mandelTexture = mandelbrot(width, height, oxmin, oxmax, oymin, oymax, 100);

mandelbrot func works ok and returns its value and we go to the operator= of the Texture class:
Texture.cpp:
// Line 816
Texture& Texture::operator =(const Texture& right)
// Line 818
    Texture temp(right);

then to the copy constructor:
Texture.cpp:
// Line 83
Texture::Texture(const Texture& copy) :
// Line 99
            update(copy);

then to the update func:
Texture.cpp:
// Line 439
void Texture::update(const Texture& texture)
// Line 441
    // Update the whole texture
// Line 442
    update(texture, {0, 0});

and another update:
Texture.cpp:
// Line 447
void Texture::update(const Texture& texture, const Vector2u& dest)
// Line 455
#ifndef SFML_OPENGL_ES
// Line 487
        // Link the destination texture to the destination frame buffer
// Line 488
        glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_DRAW_FRAMEBUFFER, destFrameBuffer));
// Line 489
        glCheck(GLEXT_glFramebufferTexture2D(GLEXT_GL_DRAW_FRAMEBUFFER, GLEXT_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0));

and I got a SegFault at line 489  :'(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10849
    • View Profile
    • development blog
    • Email
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #1 on: May 31, 2022, 10:01:57 am »
Can you provide the segfault as reported directly in Code::Blocks?
Does it originate in the Intel driver?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Overlay

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #2 on: May 31, 2022, 10:10:28 am »
Does it originate in the Intel driver?

Yes,

Program received signal SIGSEGV, Segmentation fault.
In ?? () (C:\Windows\system32\ig4icd64.dll)
#4  0x000000006d1ff570 in sf::Texture::update (this=0x22f230, texture=..., x=0, y=0) at C:\Dev\buildbot\windows-gcc-810-mingw-64\build\src\SFML\Graphics\Texture.cpp:489
C:\Dev\buildbot\windows-gcc-810-mingw-64\build\src\SFML\Graphics\Texture.cpp:489:15857:beg:0x6d1ff570
At C:\Dev\buildbot\windows-gcc-810-mingw-64\build\src\SFML\Graphics\Texture.cpp:489
#4  0x000000006d1ff570 in sf::Texture::update (this=0x22f230, texture=..., x=0, y=0) at C:\Dev\buildbot\windows-gcc-810-mingw-64\build\src\SFML\Graphics\Texture.cpp:489
C:\Dev\buildbot\windows-gcc-810-mingw-64\build\src\SFML\Graphics\Texture.cpp:489:15857:beg:0x6d1ff570




eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10849
    • View Profile
    • development blog
    • Email
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #3 on: May 31, 2022, 04:30:59 pm »
Can you try the driver from Intel itself instead of the one from DELL (assuming): https://www.intel.com/content/www/us/en/download/19534/intel-graphics-media-accelerator-driver-for-windows-7-64-exe.html

If you get the ContextSettings after creating the window, what OpenGL was exactly requested?
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#ae5b8065e92bbd0408e1fd8328e80d7d1
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Overlay

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #4 on: May 31, 2022, 05:20:33 pm »
Can you try the driver from Intel itself instead of the one from DELL (assuming): https://www.intel.com/content/www/us/en/download/19534/intel-graphics-media-accelerator-driver-for-windows-7-64-exe.html

I can't install it. I get the message "Error: This computer does not meet the minimum requirements for installing the software. Setup will exit.". And it is older (2009) than my current driver (2012). My previous driver was from the Acer site, but I downloaded the newer (current) driver from the Intel site in 2013.

If you get the ContextSettings after creating the window, what OpenGL was exactly requested?
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#ae5b8065e92bbd0408e1fd8328e80d7d1


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10849
    • View Profile
    • development blog
    • Email
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #5 on: May 31, 2022, 06:23:25 pm »
Not sure there's much that SFML can do if there's a unfixed driver bug in a very old driver :\

You could try and avoid certain things, by changing the code and see if it works around the issue.
For example instead of copying the texture by returning it as value, you could pass in a reference instead.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Overlay

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #6 on: May 31, 2022, 06:33:15 pm »
Not sure there's much that SFML can do if there's a unfixed driver bug in a very old driver :\

It's very strange, but I have no issues with other OpenGL software. I play Quake 3, SDL2 games, run Blender and Photoshop. But all SFML games with textures always crash on start (the only exception is Vagante 1.10 - it works ok, but crashes on exit). SFML games without textures work fine.

Overlay

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #7 on: May 31, 2022, 11:22:55 pm »
I'm not an OpenGL guru, but it looks like glFramebufferTexture2D is not supported by OpenGL 2.1:

Khronos docs:


SFML\Graphics\GLExtensions.hpp:
// Line 262
    // Core since 3.0 - EXT_framebuffer_object
// Line 272
    #define GLEXT_glFramebufferTexture2D              glFramebufferTexture2DEXT
 

So, does SFML require OpenGL 3.0? If no and if we have 2.1 in the ContextSettings, why does Texture::update() call the unsupported function?
« Last Edit: May 31, 2022, 11:25:26 pm by Overlay »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10849
    • View Profile
    • development blog
    • Email
Re: SegFault in Texture.cpp (Intel Graphics)
« Reply #8 on: June 07, 2022, 11:47:41 am »
The driver advertises what extensions are supported, which is checked in the Texture, which seems to obviously pass. So the driver is telling SFML that it supports something, but then crashes when you actually try to use it.

Also if glGenFramebuffers and glBindFramebuffer cause no issue, then glFramebufferTexture2D should also work, because what else is one going to do with those framebuffers?

You could try patching SFML for your needs, but we usually don't want to implement bug fixes for broken and very old drivers.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/