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

graphics: Strange rendering with Radeon RX 580 #993

Closed
hajimehoshi opened this issue Nov 19, 2019 · 13 comments
Closed

graphics: Strange rendering with Radeon RX 580 #993

hajimehoshi opened this issue Nov 19, 2019 · 13 comments

Comments

@hajimehoshi
Copy link
Owner

hajimehoshi commented Nov 19, 2019

Version: OpenDiablo2/OpenDiablo2@dba17fc
This is not reproduced with Ebiten 1.10.

GPU: RX 580 sapphire

@hajimehoshi hajimehoshi added this to the v1.11.0 milestone Nov 19, 2019
hajimehoshi added a commit that referenced this issue Nov 19, 2019
Before this change, the pixel object buffer is unbound just after
getting a pointer by glMapBuffer. This seemed suspicious.

This change fixes to do all pixel manipulations once between
glMapBuffer and glUnmapBuffer without changing a bound buffer.

This might fix a wrong rendering on some machines, but I am not
sure.

Updates #993
@hajimehoshi hajimehoshi changed the title graphics: Strange rendering on OpenDiablo 2 graphics: Strange rendering on OpenDiablo 2 with Radeon RX 580 Nov 22, 2019
@hajimehoshi hajimehoshi changed the title graphics: Strange rendering on OpenDiablo 2 with Radeon RX 580 graphics: Strange rendering with Radeon RX 580 Nov 22, 2019
@hajimehoshi
Copy link
Owner Author

Confirmed that this happens with examples/flappy

@hajimehoshi
Copy link
Owner Author

flappy

by Troispoils

@hajimehoshi
Copy link
Owner Author

Note that this worked before introducing glMapBuffer.

@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Nov 22, 2019

We might need to avoid glMapBuffer due to portability, maybe? On the other hand, glTexSubImage2d should be called once for multiple rectangle regions, or the performance would be poor.

My current idea is:

  • If the number of the region is 1, call glTexSubImage2d or glTexSubImage2d.
  • If not:
    • Create one big byte slice that includes the rectangle regions
    • Create a temporary texture (if needed)
    • Call glTexSubImage2d on the temporary texture with the big byte slice
    • Render the temporary texture to the target in the regular glDrawElement way.

Instead of glTexSubImage2d, glBuffer(Sub)Data might be better. In this case, we still use PBO.

@hajimehoshi
Copy link
Owner Author

Radeon R4 Graphics (Bungbungame Photon2) didn't cause this issue.

@hajimehoshi
Copy link
Owner Author

@auyer
Copy link

auyer commented Nov 25, 2019

Does not occur with Go1.12.5 / Go1.13.4 windows/amd64 on an AMD Vega 64.

@hajimehoshi
Copy link
Owner Author

Thanks! I think this means that not all external AMD GPUs caused this issue.

@hajimehoshi
Copy link
Owner Author

@auyer What is the SHA1 hash of Ebiten?

@hajimehoshi
Copy link
Owner Author

Meh, I could not reproduce this with MacBook Pro 2018 and an eGPU (Radeon RX 580)

@auyer
Copy link

auyer commented Dec 2, 2019

Thanks! I think this means that not all external AMD GPUs caused this issue.

The GPU I used is dedicated, but not external.

@auyer What is the SHA1 hash of Ebiten?

f6390ab

I can re-test with a different commit if you want.

@hajimehoshi
Copy link
Owner Author

Thanks!

I can re-test with a different commit if you want.

That commit is fine (this should include the reported problem). Thanks.

@hajimehoshi
Copy link
Owner Author

Now I replaced glMapBuffer / glUnmapBuffer with glBufferSubData, then this should not be problematic more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants