Commit Graph

109 Commits

Author SHA1 Message Date
Lioncash f295182833 VideoBackends: Simplify initialization and deinitialization of resources
Approximately three or four times now, the issue of pointers being
in an inconsistent state been an issue in the video backend renderers
with regards to tripping up other developers.

Global (ugh) resources are put into a unique_ptr and will always have a
well-defined state of being - null or not null
2015-12-20 22:40:37 -05:00
Scott Mansell 03461915a7 Fix lens flares in Mario Kart Wii. 2015-12-01 05:25:38 +13:00
degasus c9dc5fb376 TextureCache: Allow the backends to return nullptr for textures. 2015-11-24 22:48:55 +01:00
degasus ee2223c4a0 TextureCache: Fix crash for invalid textures. 2015-11-17 23:29:54 +01:00
degasus 087ba5268a TextureCache: Rewrite EFB Copy control flow 2015-11-15 12:02:41 +01:00
degasus dcdf8fd3ce TextureCache: Split efb2ram from efb2tex 2015-11-15 11:59:52 +01:00
Tillmann Karras 2ad901b2da VideoCommon: drop unused variable/setter 2015-11-06 15:43:58 +01:00
Tillmann Karras 81d9cce70c VideoCommon: rename TextureCache to TextureCacheBase 2015-11-06 15:43:58 +01:00
Lioncash c28e3affc5 TextureCacheBase: Change CacheLinesPerRow to BytesPerRow 2015-10-22 08:14:43 -04:00
mimimi085181 ff709247e2 Check the hashes of efb copies before applying them as partial texture updates 2015-10-18 16:36:38 +02:00
mimimi085181 af28934703 Do not delete strided efb copies on load
This hopefully allows to use partial texture updates with strided efb copies that start at the same offset as the loaded texture
2015-10-15 00:45:55 +02:00
mimimi085181 e24b8c4ab7 Respect the stride for efb copies when hashing them 2015-09-26 20:19:02 +02:00
Scott Mansell a355d9868e FifoRecorder: Use Video Common to record efb2ram correctly.
Texture updates have been moved into TextureCache, while
TMEM updates where moved into bpmem. Code for handling
efb2ram updates was added to TextureCache.

There was a bug for preloaded RGBA8 textures, it only copied
half the texture. The TODO was wrong too.
2015-09-22 23:59:16 +12:00
mimimi085181 dd458b554d Fix performance regression in Sonic the Fighters, introduced by PR#2001 2015-09-12 09:12:14 +02:00
Scott Mansell 68b415ba87 Merge pull request #3019 from mimimi085181/store-base-hash
Store the base hash for paletted textures in the texture cache entries
2015-09-12 16:24:29 +12:00
flacs c5685ba53a Merge pull request #2972 from lioncash/align
General: Replace GC_ALIGN macros with alignas
2015-09-11 17:00:13 +00:00
mimimi085181 e408e0ab17 Store the base hash for paletted textures in the texture cache entries 2015-09-10 22:28:59 +02:00
mimimi085181 38f6cf2089 Perform garbage collection for efb copies
This checks every TEXTURE_KILL_THRESHOLD frames, to see if the hash for the memory area of the efb copy has hanged. If it has changed, the efb copy can be removed, it wouldn't be used anymore. Before this pr, some efb copies would never be deleted.

Fixes issue https://bugs.dolphin-emu.org/issues/6101 and possibly some other VRAM leaks.
2015-09-10 11:58:58 +02:00
Scott Mansell ac467d9fb9 FifoPlayer: Don't check efb copy hashes when plaing back a broken dff 2015-09-07 05:20:25 +12:00
Lioncash 8ce04f9a65 General: Replace GC_ALIGN macros with alignas
Standard supported alignment -> out with compiler-specific.
2015-09-06 12:53:51 -04:00
Scott Mansell bda964e0b9 Workaround to allow partial texture updates to keep working in NSMBWii 2015-09-07 02:32:01 +12:00
Scott Mansell ee649c6d9f Make efb2tex behave more like efb2ram.
Instead of having special case code for efb2tex that ignores hashes,
the only diffence between efb2tex and efb2ram now is that efb2tex
writes zeros to the memory instead of actual texture data.

Though keep in mind, all efb2tex copies will have hashes of zero as
their hash.
2015-09-07 02:32:01 +12:00
Scott Mansell d797b5d0b5 Use ROUND_UP instead of custom bittwiddling. 2015-09-06 23:00:17 +12:00
Scott Mansell b9be3245e1 Move common EFB copy code into VideoCommon
Addded a few duplicated depth copy texture formats to the enum
in TextureDecoder.h. These texture formats were already implemented
in TextureCacheBase and the ogl/dx11 texture cache implementations.
2015-09-06 21:16:51 +12:00
Scott Mansell 52948bb3ef Cleanup and unify handling of efb copy stride. 2015-09-05 23:37:24 +12:00
Rodolfo Bogado d8cd2c3252 Implement scaled partial texture updates 2015-07-02 08:53:40 -03:00
Lioncash daa205990f Use emplace() instead of insert() where applicable for maps. 2015-06-28 19:52:40 -04:00
Jules Blok 2a5dd69c72 Merge branch 'stable' 2015-06-24 19:34:16 +02:00
mimimi085181 829fc3dc2d Quick fix for an invalid iterator 2015-06-24 19:12:46 +02:00
mimimi085181 0ed6b5623f Support partial texture updates via efb copies 2015-06-21 14:02:44 +02:00
degasus c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00
mimimi085181 4d5fdb74be Code cleanup for FreeTexture after merging PR #2097 2015-06-09 21:45:09 +02:00
mimimi085181 3b9020dc9b Search the texture cache for small textures by address and hash
This fixes issue 6563:
https://code.google.com/p/dolphin-emu/issues/detail?id=6563

This PR adds a 2nd map to texture cache, which uses the hash as key. Cache entries from this new map are used only if the address matches or if the texture was fully hashed. This restriction avoids false positive cache hits. This results in a possible situation where safe texture cache accuracy could be faster than the fast one.

Small textures means up to 1KB for fast texture cache accuracy, 4KB for medium, and all textures for safe accuracy.

Since this adds a small overhead to all texture cache handling, some regression testing would be nice. Games, which use a lot of textures the same time, should be affected the most.
2015-06-05 21:30:39 +02:00
Markus Wick a6412fb41e Merge pull request #2162 from degasus/prefetch_tex
CustomTexture: prefetch all available textures
2015-05-26 13:30:26 +02:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
degasus 242f7d964d CustomTexture: prefetch all available textures 2015-05-16 15:12:07 +02:00
Jules Blok 54f4443971 VideoCommon: Implement EFB dumping for both backends. 2015-05-02 13:23:33 +02:00
degasus 35373c5185 TextureCache: load all mipmap levels from custom textures
This drops the "feature" to load level 0 from the custom texture
and all other levels from the native one if the size matches.
But in my opinion, when a custom texture only provide one level,
no more should be used at all.
2015-03-02 00:09:09 +01:00
degasus 7ca24f90d1 TexCache: increase TEXTURE_KILL_THRESHOLD
Xenoblade uses more than 40 textures alternately per frame for eg water effects.
So don't try to drop them as aggressive.
2015-03-01 13:41:14 +01:00
Lioncash 7408de7e79 Merge pull request #2058 from Stevoisiak/Codemaid-Cleanup-Take2
Basic Formatting/Whitespace Cleanup
2015-02-25 18:07:56 -05:00
Stevoisiak 93b16a4a2d Formatting/Whitespace Cleanup
Various fixes to formatting and whitespace
2015-02-25 10:48:21 -05:00
degasus 967eaad8df VideoCommon: rename efb2tex and efb2ram 2015-02-24 23:10:13 +01:00
Tillmann Karras e2fec13ab6 Fix some -Wsign-compare warnings 2015-02-24 10:29:59 +01:00
magumagu 074397c12d Explicitly set up AllocateTexture configuration for palette conversion.
No functional change.
2015-02-19 15:57:05 -08:00
magumagu ddc815dd7a Remove TextureAddress struct. 2015-02-19 15:36:32 -08:00
magumagu c0a4760f0e Decode EFB copies used as paletted textures.
A number of games make an EFB copy in I4/I8 format, then use it as a
texture in C4/C8 format.  Detect when this happens, and decode the copy on
the GPU using the specified palette.

This has a few advantages: it allows using EFB2Tex for a few more games,
it, it preserves the resolution of scaled EFB copies, and it's probably a
bit faster.

D3D only at the moment, but porting to OpenGL should be straightforward..
2015-02-19 15:09:27 -08:00
mimimi085181 2f8e0c9bb9 Allow multiple texture cache entries for textures at the same address
This is the same trick which is used for Metroid's fonts/texts, but for all textures. If 2 different textures at the same address are loaded during the same frame, create a 2nd entry instead of overwriting the existing one. If the entry was overwritten in this case, there wouldn't be any caching, which results in a big performance drop.

The restriction to textures, which are loaded during the same frame, prevents creating lots of textures when textures are used in the regular way. This restriction is new. Overwriting textures, instead of creating new ones is faster, if the old ones are unlikely to be used again.

Since this would break efb copies, don't do it for efb copies.

Castlevania 3 goes from 80 fps to 115 fps for me.

There might be games that need a higher texture cache accuracy with this, but those games should also see a performance boost from this PR.

Some games, which use paletted textures, which are not efb copies, might be faster now. And also not require a higher texture cache accuracy anymore. (similar sitation as PR https://github.com/dolphin-emu/dolphin/pull/1916)
2015-02-18 23:54:40 +01:00
Markus Wick 43605f8716 Merge pull request #1948 from magumagu/remove-efb-cache
Remove EFB to RAM cache, and simplify code.
2015-01-27 09:42:15 +01:00
degasus 51990fcdfa TexCache: Rewrite the texID generation for paletted textures
This changes the behavior if both texture are available. The old code did
try to load the modfied texID, the new code tries the unmodified texID first.
2015-01-24 13:58:20 +01:00