..:: PCSX2 Forums ::..
Register | Help | Log In |
Register PCSX2 Site Forums Member List Donate View Today's Posts Search

Current time: 05-21-2013, 04:59 PM Hello There, Guest! (Login — Register)

..:: PCSX2 Forums ::.. / PCSX2 Discussion and Support / Developer Discussion v
1 2 3 4 Next »
/ [blog] Path 3 Masking / Geometry Syncing



User(s) browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »
Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
[blog] Path 3 Masking / Geometry Syncing
Author Message
refraction Offline
PCSX2 Coder
********

Posts: 7.406
Joined: Aug 2005
Location: England
Reputation: 108
Post: #1
[blog] Path 3 Masking / Geometry Syncing
I promised myself ages ago I would write a blog about this, more for the PS2 community than anything else as this seems to be almost a dark art in terms of understanding how it works.

Some of you may be familiar with Path 3 masking, some of you may not. In any versions around 0.9.4 or older, have you ever played a game where say some of the floor textures have had writing on them or just looked like absolute crap? Well the likelihood is that was due to Path 3 Masking problems. For those not familiar, here is a picture example of persona 3 displaying Path 3 masking issues.

[Image: attachment.php?aid=29751]

So, what is it exactly?

Path 3 masking is a method of synchronizing the order in which geometry data (polygons etc) and the textures that go on them are sent to the GS (Graphical Synthesizer). It was a pretty efficient method of transferring information, which took completely different path routes to make optimal use of the PS2 Memory BUS and used a stalling method to keep the texture and geometry lists in order instead of interrupts which took extra cpu time. This way, developers could queue up massive amounts of textures and stream them to the GS in time with the geometry data efficiently.

Here is a badly drawn diagram showing what the Mask does:

[Image: attachment.php?aid=29752]

As you can see, the mask stops PATH3 from transferring while the VU is busy, then lets it go and almost immediately puts the mask back on, this ensures that at the end of the texture transfer, PATH3 stops again!

So what was the problem? Why did everything look like crap?

Truthfully? we never had proper control over these packets. The GIF packets can come through the PATH3 DMA channel lumped together, where in actual fact, we should have been stalling half way through it, but in the emulator, we didn't really care what these packets were, so we just threw it all at the GS and ignored any packet ends and this is what caused the Texture/Geometry lists to go out of sync, this is where the crap on the screen came from. As the emulator evolved it became progressively easier to fix this issue, although we had the theory down, developers would handle it in different ways with different timings for the masks, so it took a fair amount of testing and tweaking to get right.

Fortunately these days we have got this pretty much solved and we completely analyze the GIF Packets before sending them on their way, so we know where we can stop the transfers, however we do still get the odd time where this rears its ugly head, due to how we have to time everything perfectly, but due to the nature of emulators, timing is painful to get correct and will probably never be so. Generally however, using gamefixes such as "EE Timing Fix" can get around these issues, without compromising too much on stability.


Attached File(s) Thumbnail(s)
       

[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
(This post was last modified: 10-17-2011 01:40 PM by Bositman.)
09-02-2011 03:10 AM
Visit this user's website Find all posts by this user Quote this message in a reply
abdo123 Offline
plant scientist !!!!

Posts: 3.021
Joined: Jul 2010
Location: FREE SYRIA
Post: #2
RE: [blog] Path 3 Masking / Geometry Syncing
Great blog and pretty short one Tongue

i am hoping that you can put a blog about all GIFs paths 1, 2, 3 ...
09-02-2011 03:24 AM
Find all posts by this user Quote this message in a reply
refraction Offline
PCSX2 Coder
********

Posts: 7.406
Joined: Aug 2005
Location: England
Reputation: 108
Post: #3
RE: [blog] Path 3 Masking / Geometry Syncing
Well there's only so much you can say about Path3 masking ;p Just figured i should make my contribution tho as it's something which isnt discussed much.

Cotton kinda covered the paths in his blog on Threading VU1.

The general idea however is Path 1 does Geometry data while Paths 2 and 3 do Texture data. The only difference between Path2 and Path3 is Path2 can have the textures bundled together with the geometry data, where as Path3 is purely textures, which is good for uploading tile maps and such, textures which can be referenced all over the place.

[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
09-02-2011 03:30 AM
Visit this user's website Find all posts by this user Quote this message in a reply
xstyla Offline
hobby coder
***

Posts: 682
Joined: Aug 2011
Location: just a box
Reputation: 3
Post: #4
RE: [blog] Path 3 Masking / Geometry Syncing
nice one.

but here's a question about path 2 for textures and geometry.

most diagrams if not all refer that path2 going thru vif1. is it possible to use it for untransformed geometry (for example a batch of screenspace quads with framebuffer texture coordinates) and send it to the gif?

I have nothing to check that. would be cool if somebody with knowledge could answer. thx
09-02-2011 04:36 AM
Find all posts by this user Quote this message in a reply
cottonvibes Offline
Pencil Sharpener
******

Posts: 746
Joined: Nov 2008
Location:
Reputation: 19
Post: #5
RE: [blog] Path 3 Masking / Geometry Syncing
(09-02-2011 04:36 AM)xstyla Wrote:  nice one.

but here's a question about path 2 for textures and geometry.

most diagrams if not all refer that path2 going thru vif1. is it possible to use it for untransformed geometry (for example a batch of screenspace quads with framebuffer texture coordinates) and send it to the gif?

I have nothing to check that. would be cool if somebody with knowledge could answer. thx

yes it is.

there actually are no limitations between what the different paths can transfer.
they can all transfer textures/geometry; the reason that games specialize them (having path3 do textures while path1 does geometry) is for efficient use of the ps2.
also since path1 is from VU1 memory, the biggest size a packet can be is 16kb (the size of VU1 memory). path2 and path3 can transfer up to 1mb of gif data.
so it makes sense that games aren't going to be using path1 for transferring big texture data.

path3 also has a special mode that the other 2 paths don't have. it lets it transfer big IMAGE data (textures) and interleaves them with path1/path2 transfers (instead of having to wait for path3 to finish before path1/path2 can start).

the biggest problem with path3 masking is the timing problem which refraction mentioned.
there is a technique games use with path3 where they basically send a huge amount of path3 data at once. and then they time vif1 path3 masking commands (which enable/disable path3) in order to interleave the GIF packets with path1/path2 GIF packets.
to emulate this behavior 100% reliably the emulator needs to emulate its components at much more accurate timing/syncing than it currently does, and its just not very feasible (too many components need to be rewritten with better timing code, and even then random games will still probably have problems).
instead we decided its better to code a fast and relatively good system, and then special gamefix the games that have problems due to bad timing. if games didn't actually rely on the timing of components this wouldn't have been a problem, but sadly they do with path3 masking.

Check out my blog: Trashcan of Code
09-02-2011 07:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
xstyla Offline
hobby coder
***

Posts: 682
Joined: Aug 2011
Location: just a box
Reputation: 3
Post: #6
RE: [blog] Path 3 Masking / Geometry Syncing
ahh ok. and yeah I did see a couple of diagrams already and know a lil of the quirks to sync textures and geometry.
09-02-2011 09:07 AM
Find all posts by this user Quote this message in a reply
refraction Offline
PCSX2 Coder
********

Posts: 7.406
Joined: Aug 2005
Location: England
Reputation: 108
Post: #7
RE: [blog] Path 3 Masking / Geometry Syncing
Tbh its been a pain in my ass for years and we'd put lots of stuff in place to try and keep stuff in time, alas we can only do so much.

[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
09-02-2011 10:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
invisghost Offline
Newbie

Posts: 18
Joined: Nov 2010
Location:
Reputation: 0
Post: #8
RE: [blog] Path 3 Masking / Geometry Syncing
Very nice job Refraction! The diagram was a little funky but I really liked the post. It's great to see another blog post! Do you or cotton have any plans on what your next blog post will be (assuming there is going to be a next one Biggrin)?

I know you guys have recently implemented a system that puts the packet pieces in a queue until it has a complete packet or something along those lines. Does that affect this at all?
09-02-2011 11:25 PM
Find all posts by this user Quote this message in a reply
refraction Offline
PCSX2 Coder
********

Posts: 7.406
Joined: Aug 2005
Location: England
Reputation: 108
Post: #9
RE: [blog] Path 3 Masking / Geometry Syncing
That's related to the gif packets I spoke of yes Smile

[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
09-03-2011 01:29 AM
Visit this user's website Find all posts by this user Quote this message in a reply
DaMan Offline
Senior Member
***

Posts: 333
Joined: Feb 2010
Location:
Reputation: 3
Post: #10
RE: [blog] Path 3 Masking / Geometry Syncing
Programming to the metal, a dying art (thanks MS). Always amazed at what can be done to unlock that last 10% of power. Smile
09-04-2011 05:10 PM
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Pages (3): 1 2 3 Next »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread



Current time: 05-21-2013, 04:59 PM

Contact Us | PCSX2 | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication

Powered By MyBB, © 2002-2013 MyBB Group.
Theme created by IncadudeF and modified by bositman