Jump to content


Photo

Xfx Framework


  • Please log in to reply
22 replies to this topic

#1 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 26 April 2010 - 01:09 AM

I'm currently working on an XNA clone for the XBOX, designed on top of OpenXDK.

I've finished most of the Mathematical classes (Vector2 et al), the Input namespace works (only GamePad has been tested as of now, but Mouse and Keyboard should work as well.)
The highest priority is to get the Graphics System working, but I'm still not sure whether I should use SDLx, or pbKit to implement it.

Want to try it out for yourself?
Download the compiled libraries here.

Also, I suggest downloading the demo app.
It's not very sophisticated, but it contains a rudimentary game loop, and it shows how to use the XFX Input system.

Any suggestions for improvements are welcome, and I will try my best to implement them as soon as possible.

#2 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 26 April 2010 - 08:43 AM

Nice !

Since pbkit is just the shortest direct way of feeding gpu with prepared push buffers (it can be considered the port of the lowest layer under directx named nvidia miniport driver, often seen on pc as something_mini.sys, kind of abstraction layer allowing directx to manipulate standard shaders, registers, push buffers, etc... -but let's not forget the tricky direct8 shaders => native shaders encoding-) the real question is :
- sdl + pbkit
or
- opengl + pbkit
or
- directx + pbkit
Because it wouldn't pay much to not use pbkit for graphics acceleration (and it's not so complicated to use). Redoing directx may lead to copyright problems, and maybe sdl is the easiest to do... Anyway you can always limit available api to a minimal subset to avoid too much work at first.
If everything was to be redone, it's all the management of textures that is tricky (I think).
You can start with just the accelerated 2D bitblt, that way you avoid the shader stuff, which I agree is a bit sophisticated (SM 1.1) if you never handled shaders code before.

If it goes all the way, that would allow, even with a limited subset of directx or similar, maybe, some interesting dev community targetting xb1/360/pc/zune free dev (no subscription)

I'm still lacking free time to participate efficiently though... Good luck anyway!

Edited by openxdkman, 26 April 2010 - 09:53 AM.


#3 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 16 May 2010 - 08:10 AM

After playing a bit with open gl es 2.0 on iPhone and Zune HD, I really believe there might be a way to simulate a few compatible calls on xbox1. If I have time I will try to create these calls above pbkit (the hardest part being some shaders translations. also I can't exclude shader model 1.1 being too weak for such an attempt... so it can fail. but if it works there will be plenty of homebrew sources using open gl es 2.0 that could be ported easily then. at least it should be possible to create xb1 compatible shader doing what does the open gl es 1.1 fixed-function pipeline).

Edited by openxdkman, 16 May 2010 - 08:13 AM.


#4 Hyper_Eye

Hyper_Eye

    X-S Expert

  • Members
  • PipPipPip
  • 594 posts
  • Location:Huntsvegas, AL.
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 17 May 2010 - 06:17 AM

If you get any sort of opengl layer going there are a few things I am interested in doing myself. I have only written a few sample applications for openxdk but I am interested in using it for some more serious development. Keep up the good work.

#5 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 17 May 2010 - 01:39 PM

QUOTE(openxdkman @ May 16 2010, 08:10 AM) View Post

After playing a bit with open gl es 2.0 on iPhone and Zune HD, I really believe there might be a way to simulate a few compatible calls on xbox1. If I have time I will try to create these calls above pbkit (the hardest part being some shaders translations. also I can't exclude shader model 1.1 being too weak for such an attempt... so it can fail. but if it works there will be plenty of homebrew sources using open gl es 2.0 that could be ported easily then. at least it should be possible to create xb1 compatible shader doing what does the open gl es 1.1 fixed-function pipeline).
Building the XFX Graphics on top of OpenGL sounds appealing, especially since Linux supports OpenGL...
See where I'm going?

On a side note, what library should I get to implement OpenGL? MESA3D seems the most likely candidate, but I want your opinion just to be sure.

#6 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 17 May 2010 - 05:19 PM

I want open gl es 2.0 because I dream about homebrew using nice shaders being immediately ported without a change between xb1, iphone 3gs/ipod 3g/ipad, ZuneHD and pandora...

But since it's anyway a strong coding nightmare ahead, feel free to choose what you know the most and/or what looks the easiest... I've become an old lazzy man, so my opinion counts for peanuts... All you need to know is that xbox1 gpu is nv2A, clone of nv20 compliant with shader model 1.1. A few odd things changed compared to nv20 at shader level, but comments in pbkit source will teach you all you need to know about these little changes.

Edited by openxdkman, 17 May 2010 - 05:25 PM.


#7 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 17 May 2010 - 11:14 PM

I took a look at OpenGL ES 2.0, but I'm missing glBegin() and glEnd() in the funtion list.
Now, from what I've seen in code samples, those are being handled by EGL, or a similar library, which also helps managing the game window.
For the XBOX, however, that's not necessary.
So I was wondering what I should do 'cause glBegin and glEnd would be the perfect places to insert pb_begin and pb_end respectively.

Should I go ahead and add glBegin and glEnd, or should I try to mimick the EGL functions that do those calls?

#8 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 18 May 2010 - 09:00 AM

I don't know.
Maybe browse through open gl es 2.0 samples and select one that you would like to see run on xb1 and try to minimize the changes needed in the sample source.

Guys at www.opengles-book.com ported their samples to iphone and had to change a lot these initialize and terminate calls because apple already call them in a specific iphone framework you have to use.
So at the end, all devs will finally obtain specific initialize and terminate calls for each platform, I guess...
See what they say on their site. They also give hints in order to code and test on windows or mac (through open gl es emulators for pc or mac).

Edited by openxdkman, 18 May 2010 - 09:01 AM.


#9 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 18 May 2010 - 11:59 AM

I want as little code changes as possible between, say, the IPhone, Pandora, and the XBOX when porting,
so I guess I'll take a look at some IPhone and Pandora code samples to see if there are similarities.

The hardest thing to do will be shaders and texture management.
Main problem with the shader functions will be the compilation of GLSL to microcode.
Texture management? I dunno. I come from XNA, so the entire thing is handled for you instead of doing it yourself. This will take some time.

Once GLES works on the XBOX, I'm going to try to build a SpriteBatch class on top of it, and work from there.

#10 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 18 May 2010 - 08:02 PM

iPhone homebrew may come in two versions :
with fixed-function pipeline in order to comply with open gl es 1.1 and to be able to run on
iphone 2G/3G, ipod 2G
or
with regular open gl es 2.0 shaders able to run on
iphone 3Gs, ipod 3G, ipad

from the same site they say they created a shader for 2.0 that does the entire fixed-function pipeline

so starting withi this one maybe a good way to be sure all can be done, and postpone a bit the hard work on automatic translation of any shader source in correct opcode...
pbkit does the translation from standard direct8 pseudo opcode (produced by cgc+vsa for example) into nv2a specific native opcode. it's sure the 'fixed-function pipeline' shader can be translated into .cg source for xb1... (well I haven't tried yet, but it's on my lazzy todo list...)

Obviously some hyper-sophisticated 2.0 shaders won't probably be translatable into sm 1.1 shaders... So boundaries and limits will appear afterward.

Edited by openxdkman, 18 May 2010 - 08:05 PM.


#11 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 25 May 2010 - 01:29 AM

The Nouveau project is an incredible source for push buffer coding hints.
Most of their code fits right in, and because of that, I already have around one third of the GL ES 2.0 functions coded.

I still need to test them, though, and I still don't know whether I should also create a custom subset of EGL, but I'm getting there.

libGLESv2 is coming to the XBOX.

#12 halofreak1990

halofreak1990

    X-S Young Member

  • Members
  • Pip
  • 57 posts
  • Location:The Netherlands
  • Xbox Version:v1.6
  • 360 version:v1 (xenon)

Posted 14 November 2010 - 11:10 PM

Alright, after roughly six months of silence, here's an update.
No change to the files at SourceForge yet, but al lot has changed.
Of what little code that I had completed, most has been rewritten.
I now manage the code with Visual Studio 2005 (still compiling with Cygwin, though), which makes everything so much easier.
The directory structure has been completely revamped, together with a lot of other, smaller changes.
The only thing left to do before I can (finally) post the SOURCE code of XFX, is to clean up the directories and remove all unneeded bloat.
After that, I think I'll open up a couple of developer spots on my 1 man team, so XFX can really evolve into something useful.

One of the most important changes is 'type-safe' enums.
Previously, you wrote XFX code like:
CODE
GamePadState gamePadState = GamePad::GetState(One);
    
//Allow the game to exit
if(gamePadState.Buttons.Back == Pressed)
    done=1;

While it works, there's a downside, since enums violate the scope principle of C++: the namespaces become polluted with constant definitions that easily lead to naming conflicts.
So what I did was wrap all enums in structs like the PlayerIndex enum, for example:
CODE
struct PlayerIndex
{
    enum type
    {
        One,
        Two,
        Three,
        Four
    };
};

typedef PlayerIndex::type PlayerIndex_t;

Not very elegant, but it works. Now, let's take the above XFX example and modify it to reflect the changes:
CODE
GamePadState gamePadState = GamePad::GetState(PlayerIndex::One);
    
//Allow the game to exit
if(gamePadState.Buttons.Back == ButtonState::Pressed)
    done=1;

Not only does it look more like XNA, it also prevents namespace pollution.

Well, that's it for now. I'll update again when I've uploaded the source code and updated precompiled libs to SourceForge.net

#13 Kronus980

Kronus980

    X-S Enthusiast

  • Members
  • 6 posts

Posted 18 November 2010 - 06:43 AM

Yeah, I'm all up for OpenGL support ^.^ How close is it for that?

#14 Hyper_Eye

Hyper_Eye

    X-S Expert

  • Members
  • PipPipPip
  • 594 posts
  • Location:Huntsvegas, AL.
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 November 2010 - 03:36 AM

I'm glad to hear there is progress!

#15 Clockface

Clockface

    X-S Expert

  • Members
  • PipPipPip
  • 574 posts

Posted 03 December 2010 - 12:06 AM

There has to be one clueless newbie in every topic to ask the obvious, so it might as well be me sad.gif

What exactly is this? What can it do, and what might we expect to see from it?

Will it let other games be ported to the XBox?

Thanks for any answers.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users