Dolphin, the GameCube and Wii emulator - Forums

Full Version: Copy EFB to Ram
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Quote:Actually his question is completely on topic. He's asking how our proposed changes to the efb copy system would affect gpu temperature/video memory consumption. How is that off-topic in any way?

No. His post reads like many others before: "is my system strong enough to run dolphin well".

And I'm sure, he's not understanding, whats going on in this topic.

But back to topic now:

What exactly is the difference between EFP to texture and EFB to FBO?

Is to texture using an api or what is the reason for "hardware closer coding"? Ok. My coding time is long time ago, but in my time DMA coding was a basic, that had to be learned. It is true, that you crash the system very fast, when you don't have control over the loops. But for me, it was much easier to handle this, than the class stuff, that came up later, as I tried, to change from 68k ASM to C++.
Quote:What exactly is the difference between EFB to texture and EFB to FBO?

EFB to texture stores the efb in vdram as a clear texture. Because of this the cpu cannot modify the content, only the gpu (therefore effects that need this to be emulated properly will not work).

EFB to RAM stores the efb as a static object (FBO) in system ram.

The cpu cannot directly interact with EFB textures. But the cpu can directly read/write EFB FBO objects.

So we propose that dolphin should store the efb as an fbo inside the vdram. This would massively speed up efb copy/read/write while offering proper emulation (instead of a hack which is basically what efb to texture is). Problem is this would require direct hardware access.

If you need more info. read this thread: http://www.xtemu.com/forum/topic/3033-project-management-in-projects/

Or join our community and ask squall yourself (DO IT! You know you want to Tongue).


Quote:No. His post reads like many others before: "is my system strong enough to run dolphin well".

I respectfully disagree. All he did was ask if this would increase his temps and/or video memory consumption. That has nothing to do with "is my system strong enough to run dolphin well".

Quote:And I'm sure, he's not understanding, whats going on in this topic.

Probably not but his post was still on topic none the less. I don't think you should have been so mean/insulting to him. Part of using this forum is learning how to post alongside people who aren't quite as computer literate as us in a peaceful manner.
Alright, fine. Yesterday I thought a bit about EFB copies, how our two (or three with that hybrid stuff) approaches to this differ and why EFB to texture fails. I think I've understood the most stuff about this now and I'm kind of proud of it, even though it's somewhat nerdy oO
Anyway, with respect: As far as I can see, Squall is just throwing some random expressions around without actually having a clue what he's talking about. Maybe he knows his way around the Wii internals, but I guess he doesn't really know the Dolphin source as much as me. (FWIW, you're free to correct me on this statement)

So here's a little lesson for you guys, haven't read any explanation like this from anyone else on the forums, yet: (fwiw, I only know the D3D side, but most stuff should apply to OGL as well, apart from the API-specific terminology maybe)
1. What is the Embedded Frame Buffer (EFB)? - it's a memory area of 2 MB inside the Flipper (GPU) which kind of acts as a (color and depth) render target with variable size. It's the only area where the GPU can render (draw stuff) to. There's two other important things which can be done with the EFB: It can be accessed by the CPU (pixel wise, as far as I could see; color and depth values are seperate), only reads are supported, right now. Also, the EFB can be copied to the Wii's RAM and can be reused as a texture lateron (the Wii's textures are stored in RAM).

2. So, what are we doing when we copy the EFB to RAM? - This is the "proper" way of doing it (talking about the "old" EFB to RAM btw). It's implementation is pretty complex, but it boils down to reading the EFB (which is emulated with a D3D texture), converting it to a native texture format and storing it in the Wii's memory area. This also explains why it's so ****** slow Tongue The actual D3D texture is created once that RAM data is being reused as a texture then (using our funky Safe Texture Cache).

3. And.. what are we doing when we copy the EFB to a texture? - Since most times the EFB data is just being used as a texture anyway, we just directly copy it to a D3D texture which will get reused lateron (again, using funky texture cache algorithms Tongue). Advantage: It's much faster, since we only need to draw a textured quad. The downside of it is that we can't track if the game changed the texture meanwhile.

4. Where exactly is the problem with EFB to texture? - Alright, if a Wii game requests an EFB copy to texture, it expects the EFB data to be stored in RAM afterwards. The game can read some bytes, write some bytes, etc... but we don't actually copy the EFB to the RAM, so the game just reads and writes whatever texture was stored in that RAM area before. This will cause bugs, since the resulting texture won't be the same.

5. In the case that the Wii does try to write something to that RAM area, will we use the resulting (wrong) texture or the old (unmodified) EFB data? - nice question, I think (!) it's the old EFB data without STC and the wrong texture when STC is enabled.

6. Could you explain why in NSMBW the coins aren't spinning with EFB copy to texture? - fwiw, I didn't debug this issue and can only guess. I think the game is rendering the coins to the EFB, copies the rendered coins to RAM and does some funky postprocessing then.
Preparation: NSMBW stores the coin texture somewhere in the RAM.
First frame: NSBMW renders a coin with the coin texture to the EFB. It then tries to copy the rendered data back to the coin texture, which will create a D3D texture with the rendered coin, but won't update the Wii's RAM contents.
Second frame:NSMBW renders a coin to the EFB (again). Then it tries to copy the EFB data back to the texture again (still the RAM won't get updated). When the coin is displayed then, STC will completely ignore the stuff drawn to the EFB and just use the old RAM data which will never get updated. And so it goes on, which would be why you only see one frame of the coin.

7. About FrameBuffer Objects (FBOs): They won't fix anything. IIRC we are (or at least were) using FBOs in OpenGL anyway, and there's not equivalent of FBOs in Direct3D. The only advantage of them is that AccessEFB is much faster, but that won't help us either regarding EFB copies. ANY texture which is not stored in the (emulated) Wii's RAM will cause problems, simple as that.

8. The only thing you can do is copy the EFB both to a texture and to RAM, that's the way that this hybrid approach is working IIRC.

So much for that, did I miss anything?

EDIT, tl;dr: direct VRAM access for the CPU wouldn't help us at all since the actual problem is a) that we have no way to tell whether a texture changed until it gets set (because textures are stored in RAM and could be modified any time) b) that the only way to let the Wii game read/write textures copied from the EFB is to actually enable EFB copies to RAM.

tl;dr the tl;dr: Just forget about it, there's no way to improve the situation.

EDIT2: Fine, apparently there's some fancy technique(s) which I don't know of, but which could improve the situation. I'll talk to mudlord about this.
Alright, I'm right now reading through that xtemu thread and here are some quotes, which I want to comment on:
Sqall Wrote:copy EFB to ram is the lamer way, the best way is to copy EFB to vram which is awesomely fast on PCI-E, which may be more difficult to implement, but is the smarter choice in the long run.
It's not only difficult to implement, it's IMPOSSIBLE, since there's no way to tell wether the game tries to change a texture without checking EACH and EVERY executed CPU instruction. (Althought I don't know what that HWFBE or even only FBE stuff is supposed to be, couldn't find any info after quick googling)

Sqall Wrote:lol... they use peek z.... slow ass....
What's that got to do with anything? Peek Z is related to EFB access, but not at all to EFB copying... (Unless I'm missing something here..)
sorry i miss read my evga percision lol thts memory clock Tongue sorry but seriously about the heat...will it make it work harder or no?
I have been following aalong with this too...ive been reading every post i just posted thsi to make sure cuz i really dont need to have my graphics card go out and yes my system is plenty strong for dolphin.

it runs most games 80-100%
I would suggest talking to mudlord, although I'd wait for him to respond again.

In regards to your explanation, I think you are unnecessarily over-complicating things a bit.

Quote:It's not only difficult to implement, it's IMPOSSIBLE, since there's no way to tell wether the game tries to change a texture without checking EACH and EVERY executed CPU instruction. (Althought I don't know what that HWFBE or even only FBE stuff is supposed to be, couldn't find any info after quick googling)

I don't think that is necessary and it shouldn't be that complicated, I don't even think that is what they were suggesting or had in mind much less this being required to copy framebuffer objects to Vram.

Quote:his explanation fails to take into account the use of SYSTEM RAM prior to passing it to the vram.

this is where the main hit occurs, the method me and mudlord propose (and mudlord knows his way around) skips the system ram and handles all modifications in video memory, as a HWFBE

There are a number of ways to do this, either as an FBO and allowing the CPU or even shaders to handle change detection (write back and reload) emulation.
(10-07-2010, 04:28 AM)Xtreme2damax Wrote: [ -> ]I would suggest talking to mudlord, although I'd wait for him to respond again.
I'll do that for sure, if he know some way to improve the EFB copy situation I'd like to learn about that.

About the other stuff you posted, either I'll comment that in the other thread or my answer would boil down to "I explained stuff based upon the assumption that there's no fast way to detect texture modifications, if that's not the case (which might be possible if mudlord indeed can teach some new things to me) my whole last post would be pretty much invalid."
If it can be done, that would be nice, if not then no big deal. I'm done discussing it, I'm not a developer nor can I code so I would be way off on any suggestions or explanations. Tongue
One point I see, when using FBO for EFB, that it could be possible to use more GPU coding, for example to copy between EFB and texture cache, EFB scaling (for that would be somethin like double buffering needed to get away from the "to texture" hack. One buffer for native data and a second [larger] buffer where the scaled stuff for target resolution gets stored)....
(10-07-2010, 05:26 PM)KarstenS Wrote: [ -> ]One point I see, when using FBO for EFB, that it could be possible to use more GPU coding, for example to copy between EFB and texture cache, EFB scaling (for that would be somethin like double buffering needed to get away from the "to texture" hack. One buffer for native data and a second [larger] buffer where the scaled stuff for target resolution gets stored)....

Wouldnt this require multiple codings like, for example one for ATI, one for NVIDIA and etc?

My real question here is: Can this kind of feature be done in a general way, to work for everything without milions of checkboxes?
Pages: 1 2 3 4 5