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

Disable YUV formats on textures #77

Merged
merged 3 commits into from May 4, 2018
Merged

Conversation

elishacloud
Copy link
Contributor

This pull request fixes issue #42.

Overview

This change will return D3DERR_NOTAVAILABLE when an application queries using CheckDeviceFormat on any texture using a YUV format. ATI and Nvidia already return this value for textures, so it should have no affect on these GPUs. However, some Intel chips do not. It appears that these Intel chips attempt to handle the formats but do not handle them correctly.

I believe with Direct3D9 that YUV is supposed to be unsupported on textures. See comment on WineD3D:

    /* Some (all?) Windows drivers do not support YUV 3D textures, only 2D surfaces in
     * StretchRect. Thus use StretchRect to draw the YUV surface onto the screen instead
     * of drawPrimitive. */

Notes

I did think about implementing full support for these formats into d3d8to9, but since most video cards don't support them I did not see the need to do that.

I also thought about blocking the creation of textures that use these formats. I did some tests on Nvidia and it blocks the creation of a texture that use these formats. However this issue was fixed by simply telling the application they are unsupported so I did not add any block on the creation of textures with these formats.

We can always add more fixes here later if there is an issue with other games.

Testing

I tested with the following games:

  • Codemasters Race Driver 2
  • Grand Theft Auto 3
  • Grand Theft Auto Vice City
  • Haegemonia Legions of Iron
  • Haegemonia The Solon Heritage
  • Hitman 2 Silent Assassin
  • Legacy of Kain Blood Omen 2
  • Max Payne
  • Max Payne 2
  • Need for Speed III
  • Need For Speed Hot Pursuit 2
  • Raymond 3
  • Serious Sam The First Encounter
  • Serious Sam The Second Encounter
  • Silent Hill 2
  • Star Wars Republic Commando
  • Star Wars Starfighter
  • True Crime New York City

@crosire
Copy link
Owner

crosire commented May 3, 2018

I don't think the additional check to see if RType is a texture is necessary. A YUV vertex/index buffer doesn't make sense, so might as well always return the error for those formats, regardless of all other arguments. Or is it known to work with offscreen surfaces (that would surprise me)?

@elishacloud
Copy link
Contributor Author

Yes, good point. Somehow I missed that! Updated in e4a0e32.

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

Successfully merging this pull request may close these issues.

None yet

2 participants