summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-03-02 22:04:21 +0100
committer couriersud <couriersud@arcor.de>2015-03-02 22:04:21 +0100
commit081cae691979eeb90d52a82e6f76f70fb41b17ce (patch)
tree518da538084d122584ab0af40e435ab1ed8a8d60
parentde6b0909171d576d9ed69a9e57d6fbb134a02a9b (diff)
Fix fullscreen toggle for the accel driver os OSX. [Couriersud]
-rw-r--r--src/osd/modules/render/draw13.c108
-rw-r--r--src/osd/modules/render/drawogl.c2
-rw-r--r--src/osd/modules/render/drawsdl.c1
-rw-r--r--src/osd/sdl/video.h18
4 files changed, 87 insertions, 42 deletions
diff --git a/src/osd/modules/render/draw13.c b/src/osd/modules/render/draw13.c
index bc55c2be14f..acc64a1f982 100644
--- a/src/osd/modules/render/draw13.c
+++ b/src/osd/modules/render/draw13.c
@@ -136,14 +136,31 @@ private:
// TEXCOPY FUNCS
//============================================================
+enum SDL_TEXFORMAT_E
+{
+ SDL_TEXFORMAT_ARGB32 = 0,
+ SDL_TEXFORMAT_RGB32,
+ SDL_TEXFORMAT_RGB32_PALETTED,
+ SDL_TEXFORMAT_YUY16,
+ SDL_TEXFORMAT_YUY16_PALETTED,
+ SDL_TEXFORMAT_PALETTE16,
+ SDL_TEXFORMAT_RGB15,
+ SDL_TEXFORMAT_RGB15_PALETTED,
+ SDL_TEXFORMAT_PALETTE16A,
+ SDL_TEXFORMAT_PALETTE16_ARGB1555,
+ SDL_TEXFORMAT_RGB15_ARGB1555,
+ SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555,
+ SDL_TEXFORMAT_LAST = SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555
+};
+
#include "blit13.h"
/* sdl_info is the information about SDL for the current screen */
class sdl_info13 : public osd_renderer
{
public:
- sdl_info13(osd_window *w)
- : osd_renderer(w, FLAG_NONE), m_sdl_renderer(NULL), m_blittimer(0),
+ sdl_info13(osd_window *w, int extra_flags)
+ : osd_renderer(w, extra_flags), m_sdl_renderer(NULL), m_blittimer(0),
m_last_hofs(0), m_last_vofs(0),
m_width(0), m_height(0),
m_blit_dim(0,0),
@@ -242,7 +259,6 @@ static void drawsdl2_exit(void);
// STATIC VARIABLES
//============================================================
-#define SDL_TEXFORMAT_LAST SDL_TEXFORMAT_PALETTE16A
#define BM_ALL (-1)
//( SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD)
@@ -329,7 +345,8 @@ static copy_info_t blit_info_default[] =
{ -1 },
};
-static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1];
+static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1] = { NULL };
+static bool blit_info_initialized = false;
//============================================================
// INLINES
@@ -512,27 +529,33 @@ static void expand_copy_info(copy_info_t *list)
static osd_renderer *drawsdl2_create(osd_window *window)
{
- return global_alloc(sdl_info13(window));
+ if (!blit_info_initialized)
+ {
+ /* On OSX, calling this from drawsdl2_init will
+ * prohibit fullscreen toggling. It is than not possible
+ * to toggle from fullscreen to window mode.
+ */
+ expand_copy_info(blit_info_default);
+ blit_info_initialized = true;
+
+ }
+ return global_alloc(sdl_info13(window, osd_renderer::FLAG_NONE));
}
// FIXME: machine only used to access options.
int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks)
{
- const char *stemp;
-
// fill in the callbacks
callbacks->exit = drawsdl2_exit;
callbacks->create = drawsdl2_create;
osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n");
- expand_copy_info(blit_info_default);
-
#if USE_OPENGL
// Load the GL library now - else MT will fail
- stemp = downcast<sdl_options &>(machine.options()).gl_lib();
+ const char *stemp = downcast<sdl_options &>(machine.options()).gl_lib();
#else
- stemp = NULL;
+ const char *stemp = NULL;
#endif
if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0)
stemp = NULL;
@@ -555,19 +578,23 @@ static void drawsdl2_exit(void)
{
int i;
copy_info_t *bi, *freeme;
- for (i = 0; i <= SDL_TEXFORMAT_LAST; i++)
+ if (blit_info_initialized)
{
- for (bi = blit_info[i]; bi != NULL; )
+ for (i = 0; i <= SDL_TEXFORMAT_LAST; i++)
{
- if (bi->pixel_count)
- osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname,
- bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples,
- (int) bi->perf);
- freeme = bi;
- bi = bi->next;
- global_free(freeme);
+ for (bi = blit_info[i]; bi != NULL; )
+ {
+ if (bi->pixel_count)
+ osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname,
+ bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples,
+ (int) bi->perf);
+ freeme = bi;
+ bi = bi->next;
+ global_free(freeme);
+ }
+ blit_info[i] = NULL;
}
- blit_info[i] = NULL;
+ blit_info_initialized = false;
}
}
@@ -601,6 +628,36 @@ static void drawsdl2_exit(void)
// a
//============================================================
+static void drawsdl_show_info(struct SDL_RendererInfo *render_info)
+{
+#define RF_ENTRY(x) {x, #x }
+ static struct {
+ int flag;
+ const char *name;
+ } rflist[] =
+ {
+#if 0
+ RF_ENTRY(SDL_RENDERER_SINGLEBUFFER),
+ RF_ENTRY(SDL_RENDERER_PRESENTCOPY),
+ RF_ENTRY(SDL_RENDERER_PRESENTFLIP2),
+ RF_ENTRY(SDL_RENDERER_PRESENTFLIP3),
+ RF_ENTRY(SDL_RENDERER_PRESENTDISCARD),
+#endif
+ RF_ENTRY(SDL_RENDERER_SOFTWARE),
+ RF_ENTRY(SDL_RENDERER_PRESENTVSYNC),
+ RF_ENTRY(SDL_RENDERER_ACCELERATED),
+ RF_ENTRY(SDL_RENDERER_TARGETTEXTURE),
+ {-1, NULL}
+ };
+ int i;
+
+ osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>");
+ for (i = 0; rflist[i].name != NULL; i++)
+ if (render_info->flags & rflist[i].flag)
+ osd_printf_verbose("renderer: flag %s\n", rflist[i].name);
+}
+
+
int sdl_info13::create()
{
#if (SDLMAME_SDL2)
@@ -633,9 +690,14 @@ int sdl_info13::create()
m_blittimer = 3;
- SDL_RenderPresent(m_sdl_renderer);
+ //SDL_RenderPresent(m_sdl_renderer);
osd_printf_verbose("Leave sdl_info13::create\n");
+ struct SDL_RendererInfo render_info;
+
+ SDL_GetRendererInfo(m_sdl_renderer, &render_info);
+ drawsdl_show_info(&render_info);
+
#else
#endif
@@ -651,6 +713,7 @@ void sdl_info13::destroy()
{
destroy_all_textures();
SDL_DestroyRenderer(m_sdl_renderer);
+ m_sdl_renderer = NULL;
}
@@ -1108,7 +1171,6 @@ texture_info * sdl_info13::texture_update(const render_primitive &prim)
texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags));
/* add us to the texture list */
m_texlist.prepend(*texture);
-
}
if (texture != NULL)
diff --git a/src/osd/modules/render/drawogl.c b/src/osd/modules/render/drawogl.c
index 63abc7a7a74..8186cd44af6 100644
--- a/src/osd/modules/render/drawogl.c
+++ b/src/osd/modules/render/drawogl.c
@@ -166,7 +166,6 @@ enum
// MACROS
//============================================================
-#ifdef OSD_WINDOWS
// texture formats
// This used to be an enum, but these are now defines so we can use them as
// preprocessor conditionals
@@ -179,6 +178,7 @@ enum
#define SDL_TEXFORMAT_RGB15 (6)
#define SDL_TEXFORMAT_RGB15_PALETTED (7)
#define SDL_TEXFORMAT_PALETTE16A (8)
+#if 0
// special texture formats for 16bpp texture destination support, do not use
// to address the tex properties / tex functions arrays!
#define SDL_TEXFORMAT_PALETTE16_ARGB1555 (16)
diff --git a/src/osd/modules/render/drawsdl.c b/src/osd/modules/render/drawsdl.c
index dbaef4066ce..bffd435ff13 100644
--- a/src/osd/modules/render/drawsdl.c
+++ b/src/osd/modules/render/drawsdl.c
@@ -508,6 +508,7 @@ void sdl_info::destroy()
global_free_array(m_yuv_bitmap);
m_yuv_bitmap = NULL;
}
+ SDL_DestroyRenderer(m_sdl_renderer);
}
//============================================================
diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h
index 7b8e3f09762..4a3d8b69f9d 100644
--- a/src/osd/sdl/video.h
+++ b/src/osd/sdl/video.h
@@ -29,24 +29,6 @@ enum {
#define VIDEO_SCALE_MODE_NONE (0)
-// texture formats
-// This used to be an enum, but these are now defines so we can use them as
-// preprocessor conditionals
-#define SDL_TEXFORMAT_ARGB32 (0) // non-16-bit textures or specials
-#define SDL_TEXFORMAT_RGB32 (1)
-#define SDL_TEXFORMAT_RGB32_PALETTED (2)
-#define SDL_TEXFORMAT_YUY16 (3)
-#define SDL_TEXFORMAT_YUY16_PALETTED (4)
-#define SDL_TEXFORMAT_PALETTE16 (5)
-#define SDL_TEXFORMAT_RGB15 (6)
-#define SDL_TEXFORMAT_RGB15_PALETTED (7)
-#define SDL_TEXFORMAT_PALETTE16A (8)
-// special texture formats for 16bpp texture destination support, do not use
-// to address the tex properties / tex functions arrays!
-#define SDL_TEXFORMAT_PALETTE16_ARGB1555 (16)
-#define SDL_TEXFORMAT_RGB15_ARGB1555 (17)
-#define SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555 (18)
-
#define GLSL_SHADER_MAX 10
//============================================================