Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS hack fixes for Descent 3 #211

Open
wants to merge 2 commits into
base: proton_9.0
Choose a base branch
from

Conversation

Frogging101
Copy link
Contributor

A couple of fixes which allow Descent 3's OpenGL renderer to work with the fullscreen hack.

    fshack: Always allocate a depth buffer
    
    Some applications use depth testing but leave the image format depth
    component set to 0. OpenGL drivers always provide a depth buffer for
    framebuffers regardless of whether the image format specifies one, so the
    FS hack texture should too, otherwise such applications will render
    incorrectly.
    fshack: Use texture name hack for Descent 3
    
    Descent 3's OpenGL renderer will use a texture conflicting with the FS
    hack texture, and only a small rectangle in the bottom left corner will
    be rendered.

@Frogging101
Copy link
Contributor Author

@gofman Gentle ping

@Frogging101 Frogging101 changed the base branch from proton_8.0 to proton_9.0 May 2, 2024 22:14
Descent 3's OpenGL renderer will use a texture conflicting with the FS
hack texture, and only a small rectangle in the bottom left corner will
be rendered.

Signed-off-by: John Brooks <[email protected]>
@Frogging101 Frogging101 force-pushed the descent3-fshack-fixes branch from 17c2f99 to 1373481 Compare May 2, 2024 22:19
Some applications use depth testing but leave the image format depth
component set to 0. OpenGL drivers always provide a depth buffer for
framebuffers regardless of whether the image format specifies one, so the
FS hack texture should too, otherwise such applications will render
incorrectly.

Signed-off-by: John Brooks <[email protected]>
@gofman
Copy link
Contributor

gofman commented May 2, 2024

Some applications use depth testing but leave the image format depth component set to 0. OpenGL drivers always provide a depth buffer for framebuffers regardless of whether the image format specifies one, so the FS hack texture should too, otherwise such applications will render incorrectly.

Are you sure about that? There are certainly GLX visuals without depth buffers. Why do we get 0 GLX_DEPTH_SIZE then? I suspect that maybe something else is wrong, just e. g., the game does something which we do not handle in fshack or maybe wrong GL format is chosen at once. Does it work with Wine without fshack?

Then, skipping pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 ); if we have a stencil looks suspicious, but for now this is secondary, so far I am not yet convinced that the change is correct in general.

Plagman pushed a commit that referenced this pull request May 14, 2024
Descent 3's OpenGL renderer will use a texture conflicting with the FS
hack texture, and only a small rectangle in the bottom left corner will
be rendered.

Signed-off-by: John Brooks <[email protected]>

#211

CW-Bug-Id: #23791
@gofman
Copy link
Contributor

gofman commented May 14, 2024

So I took a look at the second issue with depth buffer. On an AMD machine I could see rendering glitches related to Z testing in the first (Pilot Training) mission when moving left from initial position. That is not related to fshack, the game works with upstream Wine and shows the same. Indeed, the game calls ChoosePixelFormat() without explicitly requesting depth bits in PIXELFORMATDESCRIPTOR. That happens to have depth on one Nvidia machine with Wine / Proton here, but not on AMD. On the same AMD machine the same ChoosePixelFormat ends up with 32 / 8 depth / stencil on Windows 11. Frankly I am not sure that with every possible GPU and driver it will get a depth buffer (and the game warns about "buggy drivers" when selecting OpenGL option which suggests that it doesn't necessarily work very well on arbitrary instance). I suppose it is nothing wrong in matching current Windows / AMD behaviour here instead of depending on unspecified format order. But that should be done in opengl32/wglChoosePixelFormat, not by adding some depth buffers in fshack.

So I pulled the first patch from this PR ("fshack: Use texture name hack for Descent 3 ") and made another patch for depth issue (also sent upstream: https://gitlab.winehq.org/wine/wine/-/merge_requests/5636

Those are in the just updated Proton Experimental ([bleeding-edge] branch): https://github.com/ValveSoftware/wine/commits/experimental-wine-bleeding-edge-9.0-96562-20240514-p230721-we36c29-d6259e8-vf6d390/

Does that fix the issues?

Plagman pushed a commit that referenced this pull request Jun 6, 2024
Descent 3's OpenGL renderer will use a texture conflicting with the FS
hack texture, and only a small rectangle in the bottom left corner will
be rendered.

Signed-off-by: John Brooks <[email protected]>

#211

CW-Bug-Id: #23791
bylaws pushed a commit to bylaws/wine that referenced this pull request Sep 6, 2024
Descent 3's OpenGL renderer will use a texture conflicting with the FS
hack texture, and only a small rectangle in the bottom left corner will
be rendered.

Signed-off-by: John Brooks <[email protected]>

ValveSoftware/wine#211

CW-Bug-Id: #23791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants