0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

General information and assistance with DOSBox.

0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby sy2002 » 2019-5-05 @ 00:24

EDIT: I added "and Linux" to the headline, as jmarsh reports a similar problem on Linux

Hi all,

I observed the following problem with 0.74-2 and with the latest SVN build on macOS Mojave (10.14.3) on a 2018 MacBook Pro. The problem is not observed on 0.74-1 (the special Mac version):

=> A thin red line is at the very bottom of the screen. And a thin red line is on the very right of the screen.

I use

fullresolution=2880x1800 (which is the native resolution of my display)
windowresolution=1024x768
output=opengl

If I switched to fullresolution=original, the problem is gone in fullscreen, but then, e.g. Wolfenstein3D looks very small. (I have scaler=none, because I want the opengl hardware scalers.)

Strange thing... ...any ideas?
Last edited by sy2002 on 2019-5-05 @ 00:46, edited 1 time in total.
sy2002
Newbie
 
Posts: 2
Joined: 2019-5-05 @ 00:08

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS

Postby jmarsh » 2019-5-05 @ 00:28

Seeing the same thing in Linux. I assumed it was an artifact of opengl's bilinear filtering sampling pixels beyond the expected output area.
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS

Postby sy2002 » 2019-5-05 @ 00:44

Thank you for your feedback! As it is not happening (on my machine) on version 0.74-1, but only since version 0.74-2 and SVN, I guess it might be a bug in DOSBox, rather than in OpenGL.
sy2002
Newbie
 
Posts: 2
Joined: 2019-5-05 @ 00:08

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby Qbix » 2019-5-06 @ 13:36

attached are the changes between 74-1 and 2 for the rendering.


Maybe cleaning the opengl buffer on each frame would fix it. (which is needed for opengl systems with 3 buffers and when interacting with the steam overlay).
(patch seems to be present in a lot of the steam released dosbox powered games)
Attachments
opengl-clear.diff
clearing
(459 Bytes) Downloaded 17 times
2-main-render.diff
changes between 0.74-1 and 0.74-2 with regards to rendering
(28.9 KiB) Downloaded 15 times
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10859
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby jmarsh » 2019-5-06 @ 22:43

For me, if I disable the use of the pixel_buffer_object extension (or use openglnb instead of opengl) the problem goes away. So definitely seems like the filtering is sampling garbage pixels... but both the pbo and texture are the same width&height so I can't identify where they're coming from.

EDIT: I see now the texture is initialized with dimensions that are a power of 2. That's likely the problem then, the texture pixels outside the viewable area are never cleared and the bilinear sampling reads them when the right/bottom edges are rendered.
The easiest way to fix this would be to initialize the texture with the real width/height instead of padding to a power of two, pretty much all hardware supports it now since it was a core requirement for OpenGL 2.0. For extra safety you could check for the "GL_ARB_texture_non_power_of_two" extension, but I think there might be some implementations that don't bother to report it since it's been a core requirement for so long.
Alternatively one row and column of pixels just beyond width/height could be cleared to black when the texture is created (if linear filtering is active) for a cheap fix.
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby kode54 » 2019-5-07 @ 06:06

Or use 0.5 pixel less as the bottom/right texture coordinates.
User avatar
kode54
Member
 
Posts: 271
Joined: 2003-6-15 @ 05:32

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby jmarsh » 2019-5-07 @ 06:38

Technically that should be done for the left/top co-ordinates too for the scaling to be correct.
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby Qbix » 2019-5-07 @ 07:08

Would opengl-clear work as "quick" fix ? non-2 textures are regardless of that not a bad idea.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10859
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby jmarsh » 2019-5-07 @ 07:28

glClear only clears the framebuffer, not textures.
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby kode54 » 2019-5-08 @ 04:01

jmarsh wrote:Technically that should be done for the left/top co-ordinates too for the scaling to be correct.

Ah, yeah, you’re right.

This is because texture coordinates are relative to the top left of each texel cell, so 0.5 px would be centered.
User avatar
kode54
Member
 
Posts: 271
Joined: 2003-6-15 @ 05:32

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby Qbix » 2019-5-23 @ 11:08

I can't really reproduce it on linux or windows, so that makes trying to fix it difficult.

Is a fullresolution of 2880x1800 really needed as I don't have a screen of that resolution.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10859
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby jmarsh » 2019-5-23 @ 11:29

Any non-power-of-two resolution should be enough.
I haven't seen it on windows, and it doesn't happen on linux for me unless the PBO extension is used (using nvidia's driver).
Might be possible to force it by setting the entire texture to a bright color when it's first initialized, then looking for that colour on the right/bottom edges (instead of the random stuff that we're seeing).
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby Qbix » 2019-5-23 @ 12:22

Got to check if that extension is used on linux for me.
edit: it is used, but I am using intel

I was thinking would changing GL_CLAMP to GL_CLAMP_TO_BORDER help it? as that deals with textures.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10859
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby jmarsh » 2019-5-23 @ 15:22

Qbix wrote:I was thinking would changing GL_CLAMP to GL_CLAMP_TO_BORDER help it? as that deals with textures.


That only affects pixels returned for texture co-ordinates that point outside of the texture.
jmarsh
Member
 
Posts: 180
Joined: 2014-1-04 @ 09:17

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby Qbix » 2019-5-26 @ 09:25

should hopefully be fixed in r4228
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10859
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: 0.74-2 (and SVN) introduces gfx glitch on macOS and Linux

Postby hermit » 2019-7-09 @ 10:33

I have a similar problem with the game "indiana jones last crusade action game"
at the third level, the image of the character is distorted
solutions? use dosbox-svn with Retropie
https://i.ibb.co/HtSX29C/indy-002.png
thanks
hermit
Newbie
 
Posts: 1
Joined: 2019-7-09 @ 10:26


Return to DOSBox General

Who is online

Users browsing this forum: pedrotski and 1 guest