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

Make efb to texture less broken for paletted textures that are efb copies #1916

Merged
merged 1 commit into from
Jan 21, 2015
Merged

Conversation

mimimi085181
Copy link
Contributor

When using efb to texture, don't change the texID depending on the tlut_hash for paletted textures that are efb copies and don't have an entry in the cache for texID ^ tlut_hash. This makes those textures less broken.

This is not really fixing those textures, but it's a step forward. The mini map in Twilight Princess for example is in grayscales with this and is more or less usable.

@JMC47
Copy link
Contributor

JMC47 commented Jan 18, 2015

@dolphin-emu-bot rebuild

@degasus
Copy link
Member

degasus commented Jan 18, 2015

"textures.find(temp_texID) != textures.end() && textures[temp_texID]->IsEfbCopy()" will lookup twice in the map. It's faster to use:

auto iter = textures.find(temp_texID);
if (iter != textures.end() && iter->second->IsEfbCopy())

…pies

Don't change the texID depending on the tlut_hash for paletted textures that are efb copies and don't have an entry in the cache for texID ^ tlut_hash. This makes those textures less broken when using efb to texture.

This is not really fixing those textures, but it's a step forward. The mini map in Twilight Princess for example is in grayscales with this and is more or less usable.
@mimimi085181
Copy link
Contributor Author

I changed this PR to do its thing for efb2ram as well. This fixes issues when switching between efb2ram and efb2tex.

Since it now affects efb2ram, it needs to be tested for regressions in the affected games using efb2ram as well.

@phire
Copy link
Member

phire commented Jan 19, 2015

@dolphin-emu-bot rebuild

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

This is really nice. Twilight Princess and Star Wars Rogue Squadron 2 no longer need safe texture cache.

Twilight Princess, Faron Woods: Master: 24 fps (safe), PR, 36 fps (fast)
Star Wars Rogue Squadron 2: Master: 56 fps (safe), PR: 86 fps (fast)

So, this is really awesome.

@magumagu
Copy link
Contributor

This isn't very clean code, but it's not really any worse than messing with the texID for paletted textures in the first place. LGTM.

@dolphin-emu-bot
Copy link
Contributor

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

  • fortune-street on ogl-lin-mesa: diff
  • fortune-street-white-box on ogl-lin-mesa: diff
  • simpsons-tev on ogl-lin-mesa: diff
  • ztp-grass on ogl-lin-mesa: diff
  • nfsu-purplerect on ogl-lin-nv: failed to render
  • rs2-zfreeze on ogl-lin-nv: failed to render

automated-fifoci-reporter

@shellashock
Copy link

Not sure if this matters, but behavior has not changed for Pokemon XD needing safe texture to properly display text. Tested on both texture and ram (with and without cache). Nice work all the same!

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

Definitely matters; if you find other behavior changes, please let us know. It's good to know for INI changes down the line.

@Linktothepast
Copy link
Contributor

So jmc you are saying that this pr affects games that needed both efb to ram and the safest texture cache setting, and that they now need only efb to ram?

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

@Linktothepast: Not all games. It appears certain games, like Twilight Princess, Rogue Squadron 2, no longer need safe cache even on EFB2RAM, and can work somewhat when on EFB2Texture.

@Linktothepast
Copy link
Contributor

Yep, sims kingdom for example seems unaffected. I will search some more, but why exactly Twilight Princess needs stc, i thought the middle setting was sufficient for the minimap updates?

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

It has to do with Palleted textures and stuff.

@Linktothepast
Copy link
Contributor

Oh, i found something interesting, The Last Story doesn't seem to need efb to ram for the clothes! This speeds up the game considerably, it will no longer be so demanding. Just need to make an extensive test to be certain.

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

Wait what???

@Linktothepast
Copy link
Contributor

With this pr efb to ram doesn't seem to be needed for last story, character textures don't get messed up when changing scene.
Edit: Wait, scratch that, i am an idiot, started a new game and character textures were messed up from the beginning, when i changed the setting ingame seemed to work when changing scene....Sorry false alarm.

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

OpenGL seems broken in Last Story for me completely.

@mimimi085181
Copy link
Contributor Author

This will only affect games that fit the following pattern:

  • some texture is broken or invisible when using efb2tex
  • the texture works with efb2ram
  • but it is scaled at 1xIR
  • and the texture is a paletted texture

I'm going to poke around the code trying to create something similar for similar textures, which are not paletted textures, like the spinning coins in new super mario bros.

@Linktothepast: It is known that switching to efb2tex, after the clothes are drawn, works well in the Last Story. I also made a small hack for last story that might work more or less properly:
forums.dolphin-emu.org/Thread-wii-the-last-story?pid=353191#pid353191

@JMC47
Copy link
Contributor

JMC47 commented Jan 19, 2015

I'm sorry about reporting a regression in this PR; I'm incorrect. Something was going on with my system and tinkering with my computer fixed it. I have no idea what happened or why; but it just disappeared.

Sonicadvance1 added a commit that referenced this pull request Jan 21, 2015
Make efb to texture less broken for paletted textures that are efb copies
@Sonicadvance1 Sonicadvance1 merged commit 50d495b into dolphin-emu:master Jan 21, 2015
@Linktothepast
Copy link
Contributor

Found that a lot of the games that needed efb to ram for shadows are fine after this pr with efb to texture. Tony Hawk's Pro Skater 4, Tony Hawk's Pro Skater 3, Mario Superstar Baseball are few that i found up to now.

@mimimi085181
Copy link
Contributor Author

Cool. Were the shadows low res before on efb2ram, and now with efb2tex, they are high res? Also, are you sure the shadows are correct now? I mean, are they in the correct color and everything?

@Linktothepast
Copy link
Contributor

They were either missing or broken (basically a mess). And they seem fine. Btw you can add Prince of Persia Forgotten Sands to the above list.

// Don't change the texID depending on the tlut_hash for paletted textures that are efb copies and don't have
// an entry in the cache for texID ^ tlut_hash. This makes those textures less broken when using efb to texture.
// Examples are the mini map in Twilight Princess and objects on the targetting computer in Rogue Squadron 2(RS2).
// TODO: Convert those textures using the right palette, so they display correctly

This comment was marked as off-topic.

This comment was marked as off-topic.

mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 3, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 3, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 3, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 3, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 6, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 6, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 6, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 8, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 10, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 17, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 18, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 18, 2015
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 dolphin-emu#1916)
mimimi085181 added a commit to mimimi085181/dolphin that referenced this pull request Feb 18, 2015
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 dolphin-emu#1916)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants