Bug#1014937: stormbaancoureur: Slow/wrong rendering on Intel 945GM x86/MMX/SSE2

2022-07-15 Thread Nils Dagsson Moskopp
Package: stormbaancoureur
Version: 2.1.6-3
Followup-For: Bug #1014937
X-Debbugs-Cc: nils+debian-report...@dieweltistgarnichtso.net

I haveinvestigated the source package of stormbaancoureur.

The file src-common/ogl.cxx contains the shadow rendering functionality.

It also contains a check for when exactly shadow rendering is enabled:

--- 8< --- snip --- 8< ---
/*
 * This helper function checks wether we have all req'd extensions for shadow 
mapping
 */
bool OglCanDoShadowing(void)
{
  if (getenv("PLODE_NO_SHADOWS")) return false;
  const char *vers = (const char*) glGetString(GL_VERSION);
  const char *rend = (const char*) glGetString(GL_RENDERER);
  fprintf(stderr, "OpenGL is version %s\n", vers);
  fprintf(stderr, "OpenGL renderer %s\n", rend);
  const char *exts = (const char*) glGetString(GL_EXTENSIONS);
  //fprintf(stderr, "OpenGL has extensions %s\n", exts);
  if (!strstr(exts, "GL_ARB_multitexture")) return false;
  if (!strstr(exts, "GL_ARB_depth_texture")) return false;
  if (!strstr(exts, "GL_ARB_shadow")) return false;
  if (!strstr(exts, "GL_EXT_framebuffer_object")) return false;
  if (!strstr(exts, "GL_ARB_vertex_shader")) return false;
  if (!strstr(exts, "GL_ARB_fragment_shader")) return false;
  if (!strstr(exts, "GL_ARB_shader_objects")) return false;
  return true;
}
--- >8 --- snap --- >8 ---

The Irrlicht engine manages to do bug-free realtime shadows on the same GPU.
Therefore, I assume that this issue can be worked around relatively easily.

-- System Information:
Debian Release: 11.3
  APT prefers stable
  APT policy: (900, 'stable'), (500, 'oldoldstable')
Architecture: i386 (i686)

Kernel: Linux 5.10.0-10-686 (SMP w/2 CPU threads)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages stormbaancoureur depends on:
ii  freeglut3   2.8.1-6
ii  libasound2  1.2.4-1.1
ii  libc6   2.31-13+deb11u3
ii  libgcc-s1   10.2.1-6
ii  libgl1  1.3.2-1
ii  libglu1-mesa [libglu1]  9.0.1-1
ii  libode8 2:0.16.2-1
ii  libplib11.8.5-8+deb11u1
ii  libstdc++6  10.2.1-6
ii  stormbaancoureur-data   2.1.6-3

stormbaancoureur recommends no packages.

stormbaancoureur suggests no packages.

-- no debconf information



Bug#1014937: stormbaancoureur: Slow/wrong rendering on Intel 945GM x86/MMX/SSE2

2022-07-14 Thread Nils Dagsson Moskopp
Package: stormbaancoureur
Version: 2.1.6-3
Severity: important
Tags: patch
X-Debbugs-Cc: nils+debian-report...@dieweltistgarnichtso.net

Dear Maintainer,

when I started stormbaancoureur, it had very low FPS (about 3) in racing mode.
Additionally, the level textures looked broken – a bit like a moiré effect.

I expected the game to look non-broken and run well on my Thinkpad T60.

Using software rendering with LIBGL_ALWAYS_SOFTWARE=1 I got about 14 FPS.
In the main menu I got over 30 FPS, always, which seemed highly unusual …

I remembered the game running fine on worse hardware than I am using now.
Henwe, I tried to disable Mesa extensions by year. I found the following:

The game ran fine using: MESA_EXTENSION_MAX_YEAR=2001 stormbaancoureur 
The game was broken using: MESA_EXTENSION_MAX_YEAR=2002 stormbaancoureur

To figure out which extensions this could be i looked at glxinfo output.
It reported different extensions based on the MESA_EXTENSION_MAX_YEAR.

Here is a word-diff of the extensions between 2001 and 2002:

--- 8< --- snip --- 8< ---
@@ -61,28 +61,32 @@ OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) 945GM x86/MMX/SSE2
OpenGL version string: 1.4 Mesa 20.3.5
OpenGL extensions:
GL_3DFX_texture_compression_FXT1, {+GL_APPLE_packed_pixels,+} 
GL_ARB_depth_texture, {+GL_ARB_draw_buffers, GL_ARB_fragment_program, +}
{+GL_ARB_fragment_shader,+} GL_ARB_multisample, GL_ARB_multitexture, 
GL_ARB_point_parameters, {+GL_ARB_shader_objects,+} GL_ARB_shadow, 
GL_ARB_texture_border_clamp, GL_ARB_texture_compression, 
GL_ARB_texture_cube_map, GL_ARB_texture_env_add, 
GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar, 
GL_ARB_texture_env_dot3, GL_ARB_texture_mirrored_repeat, 
GL_ARB_transpose_matrix, {+GL_ARB_vertex_program, GL_ARB_vertex_shader,+} 
GL_ARB_window_pos, {+GL_ATI_draw_buffers, GL_ATI_texture_env_combine3,+} 
GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color, GL_EXT_blend_func_separate, 
GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array, 
GL_EXT_copy_texture, GL_EXT_draw_range_elements, GL_EXT_fog_coord, 
GL_EXT_framebuffer_object, GL_EXT_multi_draw_arrays, GL_EXT_packed_pixels, 
GL_EXT_point_parameters, GL_EXT_rescale_normal, GL_EXT_secondary_color, 
GL_EXT_separate_specular_color, {+GL_EXT_shadow_funcs,+} 
GL_EXT_stencil_two_side, {+GL_EXT_stencil_wrap,+} GL_EXT_subtexture, 
GL_EXT_texture, GL_EXT_texture3D, GL_EXT_texture_compression_s3tc, 
GL_EXT_texture_cube_map, GL_EXT_texture_edge_clamp, 
GL_EXT_texture_env_add, GL_EXT_texture_env_combine, 
GL_EXT_texture_env_dot3, GL_EXT_texture_filter_anisotropic, 
GL_EXT_texture_lod_bias, GL_EXT_texture_object, GL_EXT_vertex_array, 
GL_IBM_multimode_draw_arrays, GL_IBM_rasterpos_clip, 
GL_IBM_texture_mirrored_repeat, GL_INGR_blend_func_separate, 
{+GL_MESA_pack_invert,+} GL_MESA_window_pos, {+GL_MESA_ycbcr_texture,+} 
GL_NV_blend_square, GL_NV_light_max_exponent, GL_NV_packed_depth_stencil, 
GL_NV_texgen_reflection, GL_NV_texture_env_combine4, 
GL_NV_texture_rectangle, GL_S3_s3tc, GL_SGIS_generate_mipmap, 
GL_SGIS_texture_border_clamp, GL_SGIS_texture_edge_clamp, 
--- >8 --- snap --- >8 ---

Disabling any of th the following extensions makes the game run well:

GL_ARB_fragment_shader
GL_ARB_vertex_shader
GL_EXT_shadow_funcs

A line in the output of stormbaancoureur changed in all cases from

“This platform supports all required GL extensions to do hardware accelerated 
shadowing.”

to

“This platform does not support all required GL extensions to do hardware 
accelerated shadowing.
”

therefore it seems to me that shadow rendering is (at least partially) broken.

To make the game run well, I suggest to make it start using:

MESA_EXTENSION_OVERRIDE='-GL_EXT_shadow_funcs' stormbaancoureur

If you do not want to always disable shadows, please add a hint to the man page.

-- System Information:
Debian Release: 11.3
  APT prefers stable
  APT policy: (900, 'stable'), (500, 'oldoldstable')
Architecture: i386 (i686)

Kernel: Linux 5.10.0-10-686 (SMP w/2 CPU threads)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages stormbaancoureur depends on:
ii  freeglut3   2.8.1-6
ii  libasound2  1.2.4-1.1
ii  libc6   2.31-13+deb11u3
ii  libgcc-s1   10.2.1-6
ii  libgl1  1.3.2-1
ii  libglu1-mesa [libglu1]  9.0.1-1
ii  libode8 2:0.16.2-1
ii  libplib11.8.5-8+deb11u1
ii  libstdc++6  10.2.1-6
ii  stormbaancoureur-data   2.1.6-3

stormbaancoureur recommends no packages.

stormbaancoureur suggests no packages.

-- no debconf information