lots of really great updates in this one. i'll have to try it out.
lots of really great updates in this one. i'll have to try it out.
Linux User #440528
openSUSE 12.1 x86_64/KDE 4.8.4
Ok, then this is because the nVidia driver doesn't provide 32-bit GLX visuals in fullscreen. I'm using an ATI FireGL V5200 (RV530) with the Mesa drivers, and it has the same issue.
Well, either that, or Gens/GS isn't allocating it properly. I'll figure out what's going on later. Eventually, it'll "fall back" to lower color depth so it'll "just work" without crashing. (I already implemented this for backend switching; I need to implement it for fullscreen switching and fullscreen resolutions.)
EDIT: I figured out the problem. Gens/GS was specifying 32-bit color depth for the GLX visual instead of 24-bit. This seemed to work in windowed mode, but failed horribly in fullscreen. Note that the color depth here only applies to the actual color components, and doesn't include the alpha channels. This has been fixed in commit dc1bf7d33073bae3b6be2f98bab6928b1d5edce5, but that commit depends on an earlier commit that cleaned up a part of the SDL+OpenGL backend. Here's a combined patch.
Code:diff --git a/src/gens/video/vdraw_sdl_gl.c b/src/gens/video/vdraw_sdl_gl.c index 76f3b1f..3bb032f 100644 --- a/src/gens/video/vdraw_sdl_gl.c +++ b/src/gens/video/vdraw_sdl_gl.c @@ -186,6 +186,30 @@ int vdraw_sdl_gl_init(void) /** + * vdraw_sdl_gl_set_visual(): Set OpenGL visual attributes. + * @param depth Color depth. + * @param r Red bits. + * @param g Green bits. + * @param b Blue bits. + * @param a Alpha bits. + * @param format Pixel format. + * @param type Data type. + */ +static inline void vdraw_sdl_gl_set_visual(unsigned int depth, + unsigned int r, unsigned int g, unsigned int b, unsigned int a, + GLenum format, GLenum type) +{ + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depth); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, r); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, g); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, b); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, a); + m_pixelFormat = format; + m_pixelType = type; +} + + +/** * vdraw_sdl_gl_init_opengl(): Initialize the OpenGL backend. * @param w Width. * @param h Height. @@ -196,42 +220,27 @@ static int vdraw_sdl_gl_init_opengl(const int w, const int h, const BOOL reinitS { if (reinitSDL) { - // Enable double buffering. + // Set various OpenGL attributes. SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); // Color depth values. if (bppOut == 15) { // 15-bit color. (Mode 555) - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 15); - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); - m_pixelType = GL_UNSIGNED_SHORT_1_5_5_5_REV; - m_pixelFormat = GL_BGRA; + vdraw_sdl_gl_set_visual(15, 5, 5, 5, 0, GL_BGRA, + GL_UNSIGNED_SHORT_1_5_5_5_REV); } else if (bppOut == 16) { // 16-bit color. (Mode 565) - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); - m_pixelType = GL_UNSIGNED_SHORT_5_6_5; - m_pixelFormat = GL_RGB; + vdraw_sdl_gl_set_visual(16, 5, 6, 5, 0, GL_RGB, + GL_UNSIGNED_SHORT_5_6_5); } else //if (bppOut == 32) { // 32-bit color. - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32); - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); - m_pixelType = GL_UNSIGNED_BYTE; - m_pixelFormat = GL_BGRA; + vdraw_sdl_gl_set_visual(24, 8, 8, 8, 0, GL_BGRA, + GL_UNSIGNED_BYTE); } vdraw_sdl_gl_screen = SDL_SetVideoMode(w, h, 0, VDRAW_SDL_GL_FLAGS | (vdraw_get_fullscreen() ? SDL_FULLSCREEN : 0)); @@ -239,9 +248,10 @@ static int vdraw_sdl_gl_init_opengl(const int w, const int h, const BOOL reinitS { // Error setting the SDL video mode. const char *sErr = SDL_GetError(); - SDL_QuitSubSystem(SDL_INIT_VIDEO); LOG_MSG(video, LOG_MSG_LEVEL_ERROR, "SDL_SetVideoMode() failed: %s", sErr); + + SDL_QuitSubSystem(SDL_INIT_VIDEO); return -1; } }
Last edited by GerbilSoft; July 30th, 2009 at 02:16 AM. Reason: Fixed SDL+OpenGL 32-bit in fullscreen.
It took me a while to figure out how to patch this (I have very limited experience with compiling code), but I eventually did manage to get both patches to work ...
Anyway, I built it from source and installed with checkinstall, and the custom resolution bug seems to be fixed now. Also, this version of GensGS doesn't crash anymore if I use my old .gens config folder (from release 6). I'm guessing that the custom resolution listed in the gens.cfg file was making it crash on start up.
However, I also noticed another issue... while running in a custom resolution, Genesis games only seem to run at 30fps. But this only happens if I run in either 15 or 32 bits per pixel mode with "full stretch" turned on. Turning off full stretch will make games run at 60fps again. But, using full stretch in 16bpp mode has little to no effect to the framerate at all. This problem wasn't there for me in milestone 6.
Edit
OK, I should also add something else, that the frame rate issue seems to happen when I have VSync and "Full Stretch" on at the same time while running in either 15bpp or 32bpp with a custom resolution.
Last edited by mister_k81; July 30th, 2009 at 04:09 AM.
15-bit color (aka "555") seems to be horribly slow on all Linux video drivers, probably because no one uses it. I'd recommend using 16-bit color (aka "565") instead.
32-bit color also seems to be slow in some cases (especially when using a renderer that scales to larger than 2x). I'd recommend using 16-bit color in this case. Remember, the Sega Genesis could only output 9-bit color, so even with 16-bit, you aren't losing any precision. (32X could output 15-bit color, but that's automatically converted to 16-bit in the rendering code.)
Random note: 15-bit vs. 16-bit is mostly a Windows legacy issue. Some video drivers that advertised 16-bit color didn't really support 16-bit (565), and only supported 15-bit (555). OpenGL doesn't have this issue, but I left the color depth selection in for debugging purposes.
Last edited by GerbilSoft; July 30th, 2009 at 04:38 AM. Reason: Added a random note.
Ah, OK. I generally just stick with the 16bpp mode anyway, because as you've said, there is no real difference between 16 and 32 visually, and 16bpp does get better performance. It's not really a problem to me though, I only brought it up because it's something that I haven't noticed before in the previous builds. It just seemed like it could've been a potential bug.
I have a couple issues.
The Sega CD crashing issue has not been fixed. (That same crash I reported before still crashes the system.
The emulator is not starting in full screen mode.
For some reason mine ws giving me the error "Cannot find /usr/lib/mvp" The 32-bit plugins were installed in /usr/lib, SHOULD it be in /usr/lib/mvp?
Also save states from older versions are crashing the emulator.
I discussed this with you over IRC, but I'll reply here anyway for reference purposes.
Also save states from older versions are crashing the emulator.These were both buffer overflow errors that glibc only caught in the release build, which I wasn't testing. Fixed in commits dc7837b8a83d938f919de7a4f3ced5148a386603 and badf3aa21d55d06b53e1fad713a6f4d4084acd97, respectively.The Sega CD crashing issue has not been fixed. (That same crash I reported before still crashes the system.
This was the incorrect GLX visuals for 32-bit color bug, fixed in commit dc1bf7d33073bae3b6be2f98bab6928b1d5edce5.The emulator is not starting in full screen mode.
This is an odd bug with the autotools suite. I'll look into it.For some reason mine ws giving me the error "Cannot find /usr/lib/mvp" The 32-bit plugins were installed in /usr/lib, SHOULD it be in /usr/lib/mvp?
Last edited by GerbilSoft; August 1st, 2009 at 01:03 AM.
I don't get any sound. But I didn't get any sound in the last stable release either.
I'm running karmic so that could well be the entire problem but it might be some audio config I've inadvertently brought through in my profile. Any ideas? Anyone on karmic with working sound in gens?
Bookmarks