simias / rustation

Playstation emulator in the Rust programing language
Other
552 stars 21 forks source link

Use glium ? #6

Closed Yamakaky closed 8 years ago

Yamakaky commented 8 years ago

As you use opengl, you should check https://github.com/tomaka/glium/.

simias commented 8 years ago

I considered it but it's basically the first time I'm using OpenGL so I wanted to understand how the "raw" API worked.

I was also concerned about instabilities in glium: I started working on this emulator before rust itself was stabilized, just fixing breakage with rust-nightly and rust-sdl2 was a daily ordeal, I didn't want to add another experimental dependency. That might be less of an issue now though.

Keep in mind that the current renderer is mostly placeholder code, it doesn't handle textures or transparency. When I revisit the GPU I'll consider switching to glium if it supports everything I need to emulate the PlayStation's GPU accurately (which includes some uses cases not commonly seen in the average 3D application I think).

Yamakaky commented 8 years ago

Some simplifications such a migration would do:

Some pointers:

Yamakaky commented 8 years ago

BTW, glMemoryBarrier calls are automatic https://tomaka.github.io/glium/glium/

simias commented 8 years ago

I've talked with @tomaka a while ago and he told me that some of the things that are needed by rustation's renderer aren't yet supported fully by glium (mainly using a texture while simultaneously rendering into it if memory serves).

That being said it would probably be better to improve glium rather than reinventing the wheel. Once again my main reason for using raw OpenGL was to get a feel for it. Now that I've seen how it looks like I think I would welcome the glium abstraction with my arms wide open...

If you want to try and port the current code to glium I'll definitely attempt to merge it in but keep in mind that the current renderer is basically placeholder code, see issue #10 for my current "specification" for the OpenGL renderer.

If you feel ambitious and want to try to implement a more fully featured renderer (in glium or otherwise) I'd gladly help you but at the moment I can't boot a single game correctly (although I think I'm getting close...) so it might not be great for testing.

Yamakaky commented 8 years ago

A few questions:

simias commented 8 years ago

Definitely, I considered doing it but I thought it would be a pain to match the rust representation with the shader one, if glium does it for us then let's go for it. Eventually we'll probably have to add new attributes for textures, transparency etc...

simias commented 8 years ago

By the way I hang on the freenode IRC network if you want a more immediate communication medium. I could also create a gitter for the project or something like that, whatever's the most convenient.

Yamakaky commented 8 years ago

Ok then. It's easy with glium.