-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote the routine, but hopefully did not change behavior. It's got a lot of complicated features though. This removes all but one of the EnterCriticalSection, and puts that where a map is actually modified, and nothing else. Reorders the subpieces so that we can just modify the shader passed in, and set that shader in the same spot in the routine for all of them. Does an optimization to see if the mShaderOverrideMap is empty or not, and if it's empty, skip doing lookups that take measurable CPU time when profiled. Added several other .empty() checks for other hot spots in the code, so that unless we are using one of the esoteric features of 3Dmigoto, we don't pay any CPU price. Specifically TextureOverrides, ShaderOverrides, or BufferOverrides. After this change, the profile demonstrates we recovered all that CPU time. 1.5% CPU to 0.8% CPU now. I do not believe the remaining items can be trimmed further.
- Loading branch information
Showing
2 changed files
with
67 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1601,6 +1601,20 @@ STDMETHODIMP HackerDevice::CreateTexture2D(THIS_ | |
} | ||
} | ||
|
||
// In the case where there is in fact nothing to be done with a texture hash, | ||
// no texture overrides, let's not calculate it, because it can use measurable | ||
// amounts of CPU time. In GTA5 I measured this as avg frame rates 55 vs. 48. | ||
// | ||
// If we are hunting mode, we need all the hashes for ShaderUsages. | ||
if (G->mTextureOverrideMap.empty() && !G->hunting && (G->gSurfaceSquareCreateMode == -1)) | ||
{ | ||
HRESULT hr = mOrigDevice->CreateTexture2D(pDesc, pInitialData, ppTexture2D); | ||
if (ppTexture2D) LogDebug(" returns result = %x, handle = %p\n", hr, *ppTexture2D); | ||
|
||
return hr; | ||
} | ||
|
||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bo3b
Author
Owner
|
||
// Rectangular depth stencil textures of at least 640x480 may indicate | ||
// the game's resolution, for games that upscale to their swap chains: | ||
if (pDesc && (pDesc->BindFlags & D3D11_BIND_DEPTH_STENCIL) && | ||
|
This should probably go after the depth/stencil resolution check - the result of that check can be used in a ShaderOverride section without needing any TextureOverrides. Currently the only games that use it (Lichdom, Crysis 3) all have TextureOverride sections, so it will still work for them, but it would be better if this did not surprise someone later on.