Emuforums.com

Go Back   Emuforums.com > Xbox Emulation > Dxbx Official Discussion
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

Reply
 
Thread Tools Display Modes
Old March 5th, 2011, 20:51   #41
patrickvl
Emu author
 
patrickvl's Avatar
 
Join Date: May 2008
Location: Netherlands (GMT+1)
Posts: 414
Previously, emulation worked by patching almost all D3D API's, forwarding them to native D3D8. This worked good enough to get 5 games in the 'playable' state, but that was about the best I could get it.
Since then I've been looking for ways to improve compatibility. First, I stopped patching many API's, so that more Xbox1 code ran unmodified. This actually improved compatibility to a level that made all (but one) SDK samples run correctly! (However, games where worse off than before.)

The lesson I learned, was that less patching means behaving closer to the original, so I took the bull by the horn, removed all D3D patches and started on push-buffer level emulation. I discovered soon enough that implementing push-buffer commands via D3D was going to be problematic at best, hence my switch to OpenGL.

Even though I don't see any graphics on-screen yet, the OpenGL API does turn out to be a much better fit for the NV2A commands - many commands can be forwarded to OpenGL with little or no argument-modifications.

About the constants - the Xbox1 D3D runtime sends these to the GPU, as they are used by the 'passthrough' shader (which is send by the D3D runtime for rendering D3DFVF_XYZRHW vertex data without a user-defined shader).
There are 4 of these constants, one set (0 and 1) contains the SuperSample-Scale & -Offset respectively, the other set (58 and 59) constains the Viewport-Scale & Offset respectively.
The SuperSample constants are accessed by the 'passthrough' shader, the Viewport constants are used by a small piece of code that gets added to all user-defined shaders that have no '#pragma screenspace' directive. (The 'passthrough' shader doesn't have this extra piece).

To be complete - here's the bit that gets added (R12 will be written to oPos afterwards):
Code:
// This part applies the screen-space transform :
MUL R12.xyz, R12, c[134]; // c[-38] in D3D speak - ViewportScale,
RCP R1.x, R12.w; // Originally RCC, but that's not supported in ARBvp1.0
MAD R12.xyz, R12, R1.x, c[133]; // c[-37] in D3D speak - ViewportOffset
Anyway, I'll focus my research on the clip-planes now, I really hope to reach a breakthrough soon!
__________________
Dxbx dev - Delphi FTW ;-)
patrickvl is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old March 8th, 2011, 13:58   #42
vicviper1974
Registered User
 
Join Date: May 2010
Location: usa
Posts: 18
Your da poop patrickvl. Just wanted you to know that.
vicviper1974 is offline   Reply With Quote
Old March 16th, 2011, 20:35   #43
JohnJack
Registered User
 
Join Date: Jul 2010
Location: Caribbean
Posts: 353
VBOs

I saw this thread over at the OpenGL.org forums, and it may interest you if you decide to use VBOs. From the looks of it, STREAM buffers are faster than using gl*Pointer functions.
JohnJack is offline   Reply With Quote
Old March 17th, 2011, 08:39   #44
patrickvl
Emu author
 
patrickvl's Avatar
 
Join Date: May 2008
Location: Netherlands (GMT+1)
Posts: 414
Quote:
Originally Posted by JohnJack View Post
I saw this thread over at the OpenGL.org forums, and it may interest you if you decide to use VBOs. From the looks of it, STREAM buffers are faster than using gl*Pointer functions.
That's an interesting read, but there's a few gotcha's that should be mentioned;
It's faster only for NVidia cards (ATI seems not to be affected by this flag) and the comparison was made using conventional vertex attributes - there's no mention whether this whole story applies to generic attributes too or not.. (Conventional attributes are old-fashioned nowadays, OpenGL has moved on to generic attributes, or at least so the specs say. Don't know what this means for the drivers though.)
__________________
Dxbx dev - Delphi FTW ;-)
patrickvl is offline   Reply With Quote
Old March 17th, 2011, 13:00   #45
JohnJack
Registered User
 
Join Date: Jul 2010
Location: Caribbean
Posts: 353
On the fourth page, the developer states:
Quote:
ATI VA = 56 fps
NVidia VA = 9 fps
ATI VBO STREAM = 200+ fps
NVidia VBO STREAM = 200+ fps
From what we've seen in the past few weeks, conventional attributes can be emulated via generic attributes. Both glVertexAttribPointer and glVertex/Color/NormalPointer work with VBOs as their last parameter is used as an offset. Given that current standards (OGL3+/D3D10+) have focused on buffers in GPU memory rather than system memory, they are future proof. Only CAD-like applications seem to prefer system memory pointers.
JohnJack is offline   Reply With Quote
Old March 17th, 2011, 14:15   #46
patrickvl
Emu author
 
patrickvl's Avatar
 
Join Date: May 2008
Location: Netherlands (GMT+1)
Posts: 414
You got a point there - it seems both major vendors speed up significantly when using VBO + GL_STREAM_DRAW_ARB. Once I fix all transformation & viewport issues, I will try a switch to this rendering method.

However, I do wonder : What happens to performance if the entire VBO is constantly destroyed and re-created? And/or what if the pointers themselves are constantly altered?

This is probably what my most common usage-pattern will be :

The vertex-data is either coming indirectly from a relatively static D3D VertexBuffer, indicated via a pointer, or the data is put in-place in the push-buffer - to which I can still get a pointer (unless the vertex data was split up over multiple header+batch tuples, in which case I have no choice but to collect all these batches into another, contiguous, buffer myself.)

One would expect that GL_DYNAMIC_DRAW_ARB would perform better for the pointer-based rendering, but the thread you mentioned seems to indicate otherwise. Strange.

Also, how's the OpenGL driver going to make a distinction between GL_STREAM_DRAW_ARB and GL_DYNAMIC_DRAW_ARB - does it calculate a CRC in the DYNAMIC case or something, so that it can detect periods of static data and as such prevent an upload to GPU? (STREAM mode would upload the vertex data at every draw - which I would expect *not* to give a performance improvement over the other hint flags. Still strange that the VA approach is so much slower, then.)
__________________
Dxbx dev - Delphi FTW ;-)
patrickvl is offline   Reply With Quote
Old March 23rd, 2011, 20:41   #47
Bill_gates
Linux's worst nightmare..
 
Bill_gates's Avatar
 
Join Date: Feb 2004
Location: USA
Posts: 1,505
any luck getting something to show?
__________________
OS: WinXP Professional Service Pack 3
CPU: Intel pentium 4 3.0GHz
Video: Nvidia Geforce 8400GS
Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card
Memory: 512 MB
HD: [C:] 140.36/449.09 GB
Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller
Bill_gates is offline   Reply With Quote
Old March 23rd, 2011, 20:52   #48
patrickvl
Emu author
 
patrickvl's Avatar
 
Join Date: May 2008
Location: Netherlands (GMT+1)
Posts: 414
Nope, I'm taking a break from Dxbx for a while, as it was starting to cost me my health (staying up way too late for 3 years in a stretch has become a bit too much, or so my head seems to tell me). I still want to continue with it though, but I first have to regain my motivation. In the mean time I'm messing around with some other interesting stuff.
__________________
Dxbx dev - Delphi FTW ;-)
patrickvl is offline   Reply With Quote
Old March 28th, 2011, 00:12   #49
JayFoxRox
Registered User
 
Join Date: Dec 2010
Location: Germany
Posts: 35
Ah sucks to hear that patrick.

Was hoping to get some help with the stuff you send me (Thanks again by the way!) as I spend almost one week labeling it and developing tools to do various things (Mostly network and GPU related).

I also started low-level emulation of the GPU now but used GLSL from the very beginning because it seems to have better support and tends to be faster, especially with the small amount of recompilations needed in xbox games.
JayFoxRox is offline   Reply With Quote
Old March 28th, 2011, 07:24   #50
patrickvl
Emu author
 
patrickvl's Avatar
 
Join Date: May 2008
Location: Netherlands (GMT+1)
Posts: 414
Quote:
Originally Posted by JayFoxRox View Post
Ah sucks to hear that patrick.

Was hoping to get some help with the stuff you send me (Thanks again by the way!) as I spend almost one week labeling it and developing tools to do various things (Mostly network and GPU related).

I also started low-level emulation of the GPU now but used GLSL from the very beginning because it seems to have better support and tends to be faster, especially with the small amount of recompilations needed in xbox games.
Good to hear you found use for it! Anyway, I'm not leaving Xbox emulation; I just have to regain some strength and find a little more balance between this and other basic real life-related stuff, like sleep and stuff.

Just shoot me an email for whatever you'd want further explained/clarified.
__________________
Dxbx dev - Delphi FTW ;-)
patrickvl is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 16:02.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.