Bug 106394

Summary: Black Mesa cannot compile shaders because of missing GL_EXT_gpu_shader4
Product: Mesa Reporter: ben <ben>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: mirh
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description ben@besd.de 2018-05-03 21:47:44 UTC
There was an update recently (I think 30.4.) that changed the render engine they use, since then:

Various messages like these from the game:
ShaderAPIDX8::CreateD3DTexture: Invalid color format!
Compile of "vertexlit_and_unlit_generic_ps20b" Failed:
Compile of "vertexlit_and_unlit_generic_vs20" Failed:
IDirect3DDevice9::CreatePixelShader: shaderapi's centroid mask (0x00000000) differs from mask derived from shader name (0x0000000C) for shader ps-file teeth_flashlight_ps20b ps-index 0 ps-combo 0

I dumped the shaders and did some runs

shader-db
ERROR: shaders/blackmesa/5073.shader_test failed to compile:
0:2(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

shader-db with MESA_GLSL_VERSION_OVERRIDE=150
ERROR: shaders/blackmesa/5073.shader_test failed to compile:
0:2(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

shader-db with MESA_GL_VERSION_OVERRIDE=4.5
ERROR: shaders/blackmesa/5421.shader_test failed to compile:
0:4(12): error: extension `GL_EXT_gpu_shader4' unsupported in vertex shader

if I try to advertise GL_EXT_gpu_shader4 in mesa/main/version.c (works for gpu_shader5 and others) then the OpenGL core version becomes 2.0 and the problem persists (also because I cant build 32-bit drivers on ubuntu)

   const bool ver_2_1 = (ver_2_0 &&
                         extensions->EXT_pixel_buffer_object &&
                         extensions->ARB_map_buffer_range &&
                         extensions->ARB_draw_instanced &&
                         extensions->ARB_shader_bit_encoding &&
                         extensions->ARB_gpu_shader5 &&
//                         extensions->EXT_gpu_shader4 &&
                         extensions->EXT_texture_sRGB);
Comment 1 Ian Romanick 2018-05-03 22:04:14 UTC
The application should use GLSL 1.30.  Mesa is not going to support GL_EXT_gpu_shader4.  GLSL 1.30 has been around for a decade.
Comment 2 Timothy Arceri 2018-05-03 23:21:32 UTC
It looks like they are now using a compat profile which is unfortunate.
Comment 3 ben@besd.de 2018-05-04 07:30:50 UTC
I think the biggest problem is that they use DirectX emulation even though they use the source engine of halflife 2 (which runs absolutely fine btw)
Comment 4 Gregor Münch 2018-08-08 08:00:55 UTC
Patches appeared this morning to implement this feature. Seems like this isnt really a wontfix anymore. :)
https://patchwork.freedesktop.org/series/47859/
Comment 5 Gregor Münch 2018-08-08 12:57:44 UTC
Just tested the patch series with Black Mesa (non beta) and it started working.
Comment 6 ben@besd.de 2018-08-08 17:12:06 UTC
While the patches allow the non-beta and beta version of Black-Mesa to start, I still get out of memory errors for both.
The beta version does this right after you select to start a new game (in the loading game data stage), the non-beta version only allows to select the lowest graphics options (otherwise crashes) and then runs out of memory sometime after you put on the hazmat suit and go down the elevators.

I had a similar effect when modifying the shaders so they would just compile without caring whether they actually work.

So while this is a significant improvement (thanks Marek!) I think there is still some memory leak, dont know where though system memory looks fine at first glance.

This is the first time I got the 32-bit drivers to compile, but for comparison: Bioshock Infinite runs fine on ultra settings.
Comment 7 ben@besd.de 2018-09-01 13:02:03 UTC
I can capture and successfully compile the shaders with shader-db now.

The game still crashes with out of memory errors, but this seems to be a problem with the game itself, as this always happens when it tries to allocate more than 4 GB of system memory.

I think the original problem is solved and the rest doesnt seem to be mesa related.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.