Closed elishacloud closed 6 years ago
This is a weird bug. The only way I can explain this to myself is that SetViewport
is affected by whatever view transform is currently set. In that case the cleaner solution would be to set the transform to the identity matrix before applying the viewport and then resetting it to whatever it was before. But I don't know if that's it.
Hold off on this pull request. I think I found the root cause. It looks like the call is failing in Direct3D8 because the parameters in SetViewport
are wrong. The width and height are too large. As far as I can tell, Direct3D9 is also suppose to fail this call as well, but does not. I am working on a better fix for this but need to do more testing.
According to the documentation here it should "return D3DERR_INVALIDCALL ... if pViewport is invalid, or if pViewport describes a region that cannot exist within the render target surface."
It appears that Direct3D9 is still accepting the call even though the region "cannot exist within the render target surface."
Overview:
This pull fixes #76. It will skip unneeded calls to
SetViewport
.The extra call to
SetViewport
causes an issue in Direct3D9, while Direct3D8 can handle it. I believe this is a bug in Hydorah because based on my testing even in Direct3D8 this call is not needed. But since Direct3D9 does not handle it the same as Direct3D8 I believe we should fix it.This update makes the following changes: If
SetViewport
is called twice in the same frame and the only significant function called in between these two calls isSetTransform
usingD3DTS_VIEW
it will skip the second call toSetViewport
.Significant calls are defined as:
Note: Hydorah calls the following three functions in this order:
Testing:
I tested this with the following games: