Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use functions available in OpenGL 3.3 #9

Closed
wants to merge 1 commit into from
Closed

Use functions available in OpenGL 3.3 #9

wants to merge 1 commit into from

Conversation

tikhomirov
Copy link
Contributor

Using functions which are available in OpenGL 3.3 will allow to build project on OS X

@simias
Copy link
Owner

simias commented Oct 8, 2015

That does severely gimp the debug/error reporting, doesn't it?

The reasons I didn't really mind using extensions from OpenGL 4.x were that 1/ I'm a clueless OpenGL noob and 2/ I think down the line in order to accurately emulate certain features of the PlayStation GPU I might end up needing some extensions like GL_ARB_texture_barrier to implement custom blending in the fragment shader.

I didn't think it would be an issue since this extension and GL_KHR_debug seemed well supported even on 3.x cards.

Since you seem much more knowledgeable than me on this subjects, what do you think would be the right course of action here?

For the record here are the blending modes used by the PlayStation (taken from the No$ specs):

  B=Back  (the old pixel read from the image in the frame buffer)
  F=Front (the new halftransparent pixel)
  * 0.5 x B + 0.5 x F    ;aka B/2+F/2
  * 1.0 x B + 1.0 x F    ;aka B+F
  * 1.0 x B - 1.0 x F    ;aka B-F
  * 1.0 x B +0.25 x F    ;aka B+F/4

As far as I know some of those are incompatible with the fixed function OpenGL blending.

There's also the problem of the "mask" bit: the GPU draws using 1555 RGB but and the MSB is used as a kind of stencil/read only bit: in certain modes the GPU won't write to any framebuffer pixels whose MSB is set. And of course any triangle being drawn can potentially set it depending on the configuration, so it's not like a static stencil buffer.

For simplicity I thought if I performed the blending in the fragment shader I could handle this mask bit there as well.

@tikhomirov
Copy link
Contributor Author

...GL_KHR_debug seemed well supported even on 3.x cards...

but it isn't supported on OS X (what a shame)

...I might end up needing some extensions like GL_ARB_texture_barrier...

OS X doesn't support this extension but it supports GL_NV_texture_barrier, but I believe it can be fixed with conditional compilation. Also using conditional compilation we can have functionality which uses KHR_debug for all systems except OS X

To be honest I didn't expect this patch to be merged at the first attempt :) I just wanted to get feedback ASAP

@tikhomirov
Copy link
Contributor Author

Here is OpenGL capabilities table of OS X: https://developer.apple.com/opengl/capabilities/

@simias
Copy link
Owner

simias commented Oct 8, 2015

Your work is definitely appreciated!

I think I'm going to create a new issue where I outline my current understanding of the PlayStation GPU and how I think it can be emulated in OpenGL while also allowing improvements like increased internal resolution, filtering, texture replacements etc... I think it would help to start with the big picture to figure out how to deal with hardware that doesn't support some extensions. Also I would be interested to have some feedback on that given my lack of experience with OpenGL, maybe some of the things I have in mind are silly or would perform extremely badly.

@simias
Copy link
Owner

simias commented Oct 8, 2015

Okay I made a mega-issue in #10, I hope it's not too difficult to follow. I think it represents well what I currently understand of the PlayStation GPU and how it could be implemented in OpenGL.

@ADormant
Copy link

ADormant commented Oct 8, 2015

I think there is no point in limiting accuracy and features just to support systems with very bad OpenGL support like OSX and accurate PSX emulation may require OpenGL higher than 3.3 anyway however it should be doable with some hacks or a separate codepath.
Dolphin OpenGL extension 4.0-4.5. Looks like Apple itself uses some hacks on OSX.
dolphin-emu/dolphin#1185

@Yamakaky
Copy link
Contributor

Can you try master with the glium migration? @tikhomirov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants