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

Massive graphical issues with GPU render target cache called "RTV" in Xenia #176

Closed
6 of 31 tasks
Adamillo opened this issue Nov 7, 2022 · 14 comments
Closed
6 of 31 tasks
Labels
Info: Needs Replication Issue needs replication. Type: Graphical Glitches Issue causes graphical glitches.

Comments

@Adamillo
Copy link

Adamillo commented Nov 7, 2022

Checklist [README]

  • Device is not undervolted nor overclocked
  • Device is using the latest drivers
  • Application is not cracked, modded and use the latest patch

Application [Required]

Xenia

Processor / Processor Number [Required]

Intel Core i5-7360U

GPU Driver Version [Required]

  • 31.0.101.3790 / 31.0.101.2114 (latest)
  • 31.0.101.3729 / 31.0.101.2114
  • 31.0.101.3430 / 31.0.101.2111
  • 31.0.101.3616 / 31.0.101.2111
  • 31.0.101.3413 / 31.0.101.2111
  • 31.0.101.3222 / 31.0.101.2111
  • 30.0.101.3113
  • 30.0.101.3109
  • 30.0.101.1994
  • 30.0.101.1960
  • 30.0.101.1934
  • 30.0.101.1660
  • 30.0.101.1631
  • 30.0.101.1404

Rendering API [Required]

  • Vulkan
  • OpenGL
  • DirectX12
  • DirectX11
  • DirectX10
  • DirectX9
  • Not applicable

Windows Build Number [Required]

  • Windows 11 22H2
  • Windows 11 21H1 (October 2021 Update)
  • Windows 10 21H2 (November 2021 Update)
  • Windows 10 21H1 (May 2021 Update)
  • Windows 10 20H2 (October 2020 Update)
  • Windows 10 20H1 (May 2020 Update)
  • Other (Please specify)

Other Windows build number

No response

Intel System Support Utility report

ssu-info.txt

Description and steps to reproduce [Required]

The Xenia Xbox 360 emulator has major graphical issues with the RTV render target path. The Intel drivers have a bug in the stencil buffer logic. The "always pass test" always fails, resulting in the Xbox 360 games not being able to clear framebuffers. This bug happens in many Xbox 360 games, including Banjo-Kazooie, Banjo-Tooie and Sonic Unleashed. It has been reproduced by other developers that don't have a Mac, so it's not an issue related to Bootcamp.

Device / Platform

iMac 2017 21.5 inch

Crash dumps [Required, if applicable]

No response

Application / Windows logs

No response

@Adamillo Adamillo added the Info: Needs Replication Issue needs replication. label Nov 7, 2022
@IGCIT
Copy link
Owner

IGCIT commented Nov 8, 2022

i can confirm this issue is present on all intel gpus, including Arc. (tested on pc)

can you please provide a homebrew or some code so that intel can reproduce and debug the issue?

@IGCIT IGCIT added the Type: Graphical Glitches Issue causes graphical glitches. label Nov 8, 2022
@IntelSupport-Rozilah
Copy link

hi @Adamillo,
could you please answer @IGCIT request, so that easy for us to verify the issue?
can you please attach any video or screenshot of the issue?

@Adamillo
Copy link
Author

Adamillo commented Nov 11, 2022

I can share a screenshot, but I'd need access to my PC. I'll show some screenshots when I'm back home. As for the homebrew program, I don't know which one can be tested for RTV debugging. I've seen a homebrew program of a Dolphin swimming, but I could not find it for download. Maybe that program could help in debugging the issues with RTV

@Adamillo
Copy link
Author

Adamillo commented Nov 11, 2022

Here's graphical glitches with RTV:
image
image

Here's how it's supposed to look like as shown with ROV:
image
image

@IGCIT
Copy link
Owner

IGCIT commented Nov 13, 2022

are you a xenia dev?

if not, please understand that it is not possible for intel to test commercial games, so in this case you should contact xenia devs and ask them to provide more details and an application/homebrew (pc or xenia) to debug this, or this will probably be closed.

@Adamillo
Copy link
Author

Sure thing! I'll try asking the Xenia devs for a homebrew program and send it to you guys

@Adamillo
Copy link
Author

Adamillo commented Nov 14, 2022

One of the graphics programmers of Xenia called TriΔng3l is taking longer to respong than I thought. This might take a while for me to be able to share the homebrew program. Sorry about that

@IntelSupport-Rozilah
Copy link

hi @Adamillo,
thanks for the info, it would be good if you can close the issue now, then you can reopen it again once homebrew is ready.

@Adamillo
Copy link
Author

Sure thing! I'll report back once the homebrew program is avaiable!

@Adamillo
Copy link
Author

Adamillo commented Dec 4, 2022

Reopening the issue since TriΔng3l responded with a program that can debug the issue. It's going to be posted very soon

@Adamillo Adamillo reopened this Dec 4, 2022
@Triang3l
Copy link

Triang3l commented Dec 4, 2022

When stencil test is enabled in the pipeline state, the right and the bottom edges of the viewport are clamped to the right and the bottom edges of the render target.

Xenia uses a 8192x8192 viewport (the maximum size of a render target on the Xbox 360) to emulate drawing directly in screen coordinates without a viewport, that is possible on the Xbox 360, without vertex position precision loss caused by the division (it's simple exponent biasing for power of two), but render targets are generally much smaller than that size — so the clear rectangle drawn by the game becomes very small.

The viewport, though, doesn't seem to be clamped to the left and the top edges — negative TopLeftX and TopLeftY are handled as normal.

Here is a screenshot comparing a rectangle drawn with stencil testing disabled ("culled", in red — with all culling disabled by PIX) and one with stencil enabled ("visible", that passed all tests — in green). The render target is 1280x512, and the viewport is at -16, -96, with the size 1536x768 (the right edge at 1520, 672).

Rectangles without and with stencil test

The vertex shader generates a rectangle covering the upper-left quadrant of the viewport — that is, from -16, -96, to 752, 288). This is correct for the red rectangle, and matches the behavior on Nvidia and WARP.

However, the green rectangle, that has stencil test enabled, has its bottom-right corner at 632, 208. This corresponds to the center of a viewport between -16, -96 and 1280, 512 (the right and the bottom boundaries of the render target):

-16 + (1280 - (-16)) / 2 == 632

-96 + (512 - (-96)) / 2 == 208

I've tried changing various other state parameters: whether there is a color render target, depth test enabled/disabled, depth/stencil target format, back face culling, front face winding order, DepthClipEnable, MSAA sample count — they all seem to have no effect. However, DepthStencilState.StencilEnable = TRUE appears to be enough to trigger this bug, regardless of the masks, comparison functions, and operations.

Here is the source code for a reproduction C++ console application, which runs the test on every adapter, and writes the red component of the color value for the bottom-right pixel (which should be 255 if the rectangle is large enough, 0 — the clear color — otherwise) of the intended rectangle to stderr. If launched from PIX, GPU captures will automatically be created for every adapter the test was executed on. You can experiment with the viewport values there.

@IntelSupport-Rozilah
Copy link

hi @Adamillo and @Triang3l ,
I have informed this issue internally and this is out of our scope but they advise for you to submit a ticket to Developing Games on Intel Graphics community for better help. So we will close this issue as for now.

@IGCIT IGCIT closed this as completed Dec 7, 2022
@Triang3l
Copy link

Triang3l commented Dec 7, 2022

hi @Adamillo and @Triang3l , I have informed this issue internally and this is out of our scope but they advise for you to submit a ticket to Developing Games on Intel Graphics community for better help. So we will close this issue as for now.

At least this link works for me, unlike most of the Intel website ;) :/ Alright, I'll report it later today there!

@Triang3l
Copy link

Triang3l commented May 5, 2023

Sorry, I was… kinda busy back then 🙃 But I've moved this report to https://community.intel.com/t5/Developing-Games-on-Intel/D3D12-bug-enabling-stencil-causes-viewport-to-be-clamped-to-the/m-p/1483586#M2019

The issue doesn't happen on the HD Graphics 4400, however, but on the UHD Graphics 630, it's still broken on the latest driver.

edit: that forum post was marked as spam 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Info: Needs Replication Issue needs replication. Type: Graphical Glitches Issue causes graphical glitches.
Projects
None yet
Development

No branches or pull requests

5 participants