DOOM Rage idtech on mesa/radeonsi help? progress!

Hi guys,

I've been wanting to test out DOOM and play Rage for ages on Linux, but as I use the open source drivers, they do not support the compatibility profiles necessary to run these titles. www.gearsongallium.com (currently offline) had a guide on how to patch wine and fix the shaders to get these id tech based games working. Luckily I managed to grab a google cache copy of the guide, but the wine patch seems to be incomplete. When I run it, it does the first chunk and fails on the second chunk. I'm not a coder or knowledgeable enough to figure out whats wrong with it and I can't get in contact with the author as his site is dead right now :(. Any help would be appreciated. This is the guide:

Newest id Software games like Rage or Wolfenstein: The New Order does not work on mesa ( FATAL ERROR: wglCreateContextAttribsARB failed, missed compatibility profile context GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB).
So for run this games we need
Disable WGL_CONTEXT_PROFILE_MASK_ARB attribute(patch for wine).

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 932b217..0b218bc 100644                                                                                                                                
--- a/dlls/opengl32/wgl.c                                                                                                                                    
+++ b/dlls/opengl32/wgl.c                                                                                                                                    
@@ -261,6 +261,31 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)                                                                                        
     return ret;                                                                                                                                             
 }                                                                                                                                                           
+static
+const int* remove_profile_mask(const int *attribs)
+{
+    int* ret = NULL;
+    int i = 0;
+    int j = 0;
+    int attr_num = 0;
+    int profile_mask = 0;
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] == WGL_CONTEXT_PROFILE_MASK_ARB)
+            profile_mask = 1;
+        ++attr_num;
+    }
+    if (profile_mask == 0) return attribs;
+    ret = calloc(attr_num*2 - 1, sizeof(int));
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] != WGL_CONTEXT_PROFILE_MASK_ARB) {
+            ret[j] = attribs[i];
+            ret[j+1] = attribs[i+1];
+            j += 2;
+        }
+    }
+    return ret;
+}
+
 /***********************************************************************
  *             wglCreateContextAttribsARB
  *
@@ -274,6 +299,8 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
     struct opengl_context *context;
     struct opengl_funcs *funcs = get_dc_funcs( hdc );
+    attribs = remove_profile_mask(attribs);
+
     if (!funcs || !funcs->ext.p_wglCreateContextAttribsARB) return 0;
     if (share && !(share_ptr = get_handle_ptr( share, HANDLE_CONTEXT ))) return 0;
     if ((drv_ctx = funcs->ext.p_wglCreateContextAttribsARB( hdc,

2) Run game and dump shader

MESA_SHADER_READ_PATH=/shader/read/ MESA_SHADER_DUMP_PATH=/shader/dump/ MESA_GL_VERSION_OVERRIDE=4.3COMPAT wine ./Rage.exe
3) Fix the vertex shader and copy shaders to /shader/read

cd /shader/dump/
sed -i 's/out vec4 gl_Position;//g' VS* && cp /shader/dump/* /shader/read/
4) Repeat step 2 and 3 until game does not start

5) Or just use my shaders dump (download and unpack)

MESA_SHADER_READ_PATH=/path/to/read/dir/ MESA_GL_VERSION_OVERRIDE=4.3COMPAT wine ./Rage.exe
Use 64 bit wine and mesa

Shot in the dark here.

I had a look at the original wgl.c and what the patch successfully added, from that I can see the layout isn't as the patch is expecting, some new lines of code have been added by wine devs I'm guessing. I think I have a very basic understanding of how the patch works now, so I've manually added

attribs = remove_profile_mask(attribs);

(the only thing the patch couldn't successfully add itself) and I will attempt to compile wine.

Times like this I wish I had actually learned how to code, rather than pretend I know what I'm doing. :smile:

1 Like

I think I was on the right track and I've updated the patch to work with wine 2.5 (not much needed changing), unfortunately I haven't managed to get Doom to dump any of it's shaders. But the process does appear to work for Rage. Very tedious though!! I will update the thread if I manage to get Rage to launch, but I'm drawing a blank with Doom right now.

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 932b217..0b218bc 100644                                                                                                                                
--- a/dlls/opengl32/wgl.c                                                                                                                                    
+++ b/dlls/opengl32/wgl.c                                                                                                                                    
@@ -261,6 +261,31 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)                                                                                        
     return ret;                                                                                                                                             
 }                                                                                                                                                           
+static
+const int* remove_profile_mask(const int *attribs)
+{
+    int* ret = NULL;
+    int i = 0;
+    int j = 0;
+    int attr_num = 0;
+    int profile_mask = 0;
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] == WGL_CONTEXT_PROFILE_MASK_ARB)
+            profile_mask = 1;
+        ++attr_num;
+    }
+    if (profile_mask == 0) return attribs;
+    ret = calloc(attr_num*2 - 1, sizeof(int));
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] != WGL_CONTEXT_PROFILE_MASK_ARB) {
+            ret[j] = attribs[i];
+            ret[j+1] = attribs[i+1];
+            j += 2;
+        }
+    }
+    return ret;
+}
+
 /***********************************************************************
  *             wglCreateContextAttribsARB
  *
@@ -274,6 +299,8 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
     struct opengl_context *context;
     struct opengl_funcs *funcs = get_dc_funcs( hdc );
+    attribs = remove_profile_mask(attribs);
+
     if (!funcs)
    {
        SetLastError( ERROR_DC_NOT_FOUND );

heya, just wondering if you managed to get this working?

i got it working follow this guide

and i tested a lot of the newer wine staging (rc) versions and it works pretty well.

i dont need doom with vulkan, thats fine, i’ve already got that running. I’m trying to get opengl working for wolfenstein, which has the same problem as rage and the opengl version of doom for mesa/amd open source users.

new order right?
https://appdb.winehq.org/objectManager.php?sClass=version&iId=31803

yeah, It’s a known issue with mesa and wine, neither side wants to fix it.

https://bugs.winehq.org/show_bug.cgi?id=38969#c11

I’m on arch with a vega 64, mesa 17.2.2, amd-staging kernel. everything is installed/up to date. just looking for a way to patch wine to get past this error.

~googles and reads~
forcing opengl 3.1 on that game should solve the issue. take something like this https://steamcommunity.com/app/262410/discussions/0/458605613414324092/) and mod it for your use case

the problem seems to be the game engine expecting opengl 3.1 and mesa using a newer version which the game doesnt know what to do with. if you force the old version it should work in theory

i tried the override trick already with new order, no luck. It did work with the old blood, but then the game just loads a green screen with audio :expressionless:

try messing around with all the settings in wine and playonlinux. i was able to get skyrim se working but only on 500x800 resolution for some reason… and if the game is loading at all it’s a good sign it can be made to work.

So, I managed to kinda get Rage running earlier in the year. But it wasn’t rendering perfectly. I’m unable to look at it right this minute as my old machine is on its last legs and I’m in the process of putting a fresh copy of Arch on my new Ryzen+Vega system. I’ll try and look into it later this week if I have time.

1 Like

nice, I also run arch + ryzen + vega, should hopefully be able to help out!

Hah! Actually, you’ve already been helping me without knowing it. :smiley:

I’ve been running Arch first on Manjaro and Antergos for years, but wanted to do it myself from scratch. Tried a couple of times before but always ran into a roadblock. I remembered your name from when I was trying to get Warframe running, so after you replied to this thread I was looking at your youtube channel again and followed your latest Arch EFI guide and I made it! Feels good man :sunglasses:

Now I can finally finish building my PC now i know it all works. Got a custom watercooling loop to put together (another first for me).

Getting back to the topic, i’ll see if I can dig up the old files and give it a test on my new machine.
I was following a guide from gearsongallium / Yaroslav Andrusyak - But his site went down and he hasn’t posted a video or replied to my question.

I got Rage running to the same state as he shows in this video and tried running some tweaks/fixes for the artifacts, but had no luck at that point.

WOOHOO small world! gonna check that out in a bit and see what I can do with it! Glad to hear you’re on vanilla arch!

Be sure to let everyone know you’re on vanilla arch. :joy:

compiling wine with the patch now. going to try out the shader dump thing. he has a 64 bit mode video with no artifacts. suppose ill try it with a 64 bit prefix and see if that does anything

At OP… Why are you using rsi when amdgpu is really good?

think you might be confused. we’re using amdgpu, he was saying amdgpu doesnt contain the gl profile needed for the game to run, which is the main problem

Uhhhh? Mesa and RadeonSI is a completely different stack… Unless I just missed a post in which lol ok then.

@OP I’m not too good with c#, but in the patch, where it says

    for (i = 0; attribs[i] != NULL; i += 2) {
        if (attribs[i] == WGL_CONTEXT_PROFILE_MASK_ARB)
            profile_mask = 1;
        ++attr_num;
    }

is there a way right after the for line to print to console or to a file all of the attribs[i] lines? would something like Console.WriteLine(attribs[i])
work? so we could see the values of all the attribs