IGCIT / Intel-GPU-Community-Issue-Tracker-IGCIT

IGCIT is a Community-driven issue tracker for Intel GPUs.
GNU General Public License v3.0
118 stars 4 forks source link

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

Closed Adamillo closed 1 year ago

Adamillo commented 2 years ago

Checklist [README]

Application [Required]

Xenia

Processor / Processor Number [Required]

Intel Core i5-7360U

GPU Driver Version [Required]

Rendering API [Required]

Windows Build Number [Required]

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

IGCIT commented 2 years ago

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?

IntelSupport-Rozilah commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Here's graphical glitches with RTV: image image

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

IGCIT commented 2 years ago

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 commented 2 years ago

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

Adamillo commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

Adamillo commented 1 year ago

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

Triang3l commented 1 year ago

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 commented 1 year ago

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.

Triang3l commented 1 year ago

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 commented 1 year ago

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 🙈