LordOfDragons / dragengine

Drag[en]gine Game Engine
MIT License
69 stars 6 forks source link

Engine fails to start up with SSBO enabled #10

Closed LordOfDragons closed 3 years ago

LordOfDragons commented 3 years ago

Observed on this configuration: OS: Windows 10 GPU: AMD RX 580 OpenGL Support: Core 4.6 GPU Driver: Radeon Pro Software for Enterprise 20.Q3.1 Logs: testRun.log

SSBO support is correctly detected. The GPU driver though fails to link a simple vertex/geometry/fragment shader combination using an error message making no sense:

EE [OpenGL-RT] Shader linking failed ():
EE [OpenGL-RT]   geometry unit source code file = v130/geometry/defren/skin/depth.glsl
EE [OpenGL-RT]   vertex unit source code file = v130/vertex/defren/skin/depth.glsl
EE [OpenGL-RT]   fragment unit source code file = v130/fragment/defren/skin/depth.glsl
EE [OpenGL-RT]   error log: Fragment shader(s) failed to link.
Fragment link error: HW_UNSUPPORTED.
ERROR: Internal compile error, error code: E_SC_NOTSUPPORTED
Shader not supported by HWWARNING: warning(#276) Symbol "vGSPosition" usage doesn't match between two stages

Searching the Internet yields results all linked to SSBO causing troubles.

The problem vanishes if SSBO is forcefully disabled by creating a text file at "C:\Program Files\Dragengine\Config\modules\graphic\opengl\opengl.xml" (create directories starting with "Config") with this content:

<?xml version='1.0' encoding='ISO-8859-1'?>
<config>
    <disableExtension>GL_ARB_shader_storage_buffer_object</disableExtension>
</config>

This issue does not seem to be a game engine bug but it warrants adding a GPU Driver Bug Test to the OpenGL module to disable SSBO if linking fails albeit it should be working.

Linuxydable commented 3 years ago

This problem is here because the GL_ARB_shader_storage_buffer_object extension is only available from OpenGL Core 4.5 if I look on the Khronos OpenGL Hardware Database : https://opengl.gpuinfo.org/listreports.php?extension=GL_ARB_shader_storage_buffer_object

Here is the first report of the Radeon RX 580 on the database : https://opengl.gpuinfo.org/displayreport.php?id=2096

If the Engine is not running on OpenGL Core 4.5 or above you need to disable this extension sadly.

If you need more information you can talk with me on the Discord Server. I'm also sorry for my bad english. ^^"

LordOfDragons commented 3 years ago

The logs show that the driver reports the "GL_ARB_shader_storage_buffer_object" as being supported and querying the extension function glShaderStorageBlockBinding returns a valid function pointer. If not the OpenGL module would consider the extension disabled. Also gpuinfo shows the extension as being supported.

It is possible this problem comes from the driver not delivering the appropriate context. According to OpenGL specs one should request the lowest context version supported (which is 3.3 here) but the implementation should return the context with the most features at or higher than the requested one. Chances are the driver is doing something wrong there.

Whatever the case if a driver lists an extension supported for a context it returns and delivers a valid function pointer then this means the driver has to properly support the feature.

Linuxydable commented 3 years ago

It's maybe a driver bug. But if this bug is here. It's here from a long time.

I'm not a profesionnal C++ developper for confirm that or help on OpenGL.

LordOfDragons commented 3 years ago

A similar case has been found on Intel GPU. According to a foreign bug tracker of a different project they could fix it by using "#version 450 core" in the shader instead of anything below. Most probably these drivers require the extension to be explicitly enabled in the shader. I'll give this a test when I find out more.

LordOfDragons commented 3 years ago

@Linuxydable Can you please verify if the problem still exists with the latest 1.5 release?

LordOfDragons commented 3 years ago

Closed with no activity. If the issue shows up again please reopen the issue.