Skip to content

[d3d9] DrawIndexedPrimitive with an underflowed primitive count "works" natively, but breaks DXVK #4803

Description

@CookiePLMonster

Software information

The issue is general, but I reproduced it on Colin McRae Rally 3 with an earlier version of my patch. I used to have a bug where I attempted to draw 0 rectangles using the in-game drawing functions, but the problem is that this always "worked" fine on native D3D9, but resulted in issues in DXVK, hence it took me this long to notice my mistake.

In the case of this game, a 0-rectangle draw issues a call to DrawIndexedPrimitive with 2 * (3 * 0 - 2)) = 4294967292 primitive count. This is obviously invalid, but in native D3D9 this doesn't produce visible side effects, while with DXVK it wrecks performance and results in random corruption showing on screen:

Image

Image

System information

  • GPU: NVIDIA GTX 1070
  • Driver: 560.94
  • Wine version: Native, on Windows 10 22H2
  • DXVK version: 2.6

Apitrace file(s)

Something to note - this issue crashes both PIX and apitrace. I managed to capture a trace but it crashes the moment you try to preview the last frame of the capture. Nonetheless, I'm attaching the file in case it is useful in this broken state. .7z compresses it much better than .zip but it cannot be attached on GitHub, hence the double packing:

Rally_3PC.7z.zip

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions