Previous 199869 Revisions Next

r36199 Monday 2nd March, 2015 at 21:04:21 UTC by Couriersud
Fix fullscreen toggle for the accel driver os OSX. [Couriersud]
[src/osd/modules/render]draw13.c drawogl.c drawsdl.c
[src/osd/sdl]video.h

trunk/src/osd/modules/render/draw13.c
r244710r244711
136136//  TEXCOPY FUNCS
137137//============================================================
138138
139enum SDL_TEXFORMAT_E
140{
141   SDL_TEXFORMAT_ARGB32 = 0,
142   SDL_TEXFORMAT_RGB32,
143   SDL_TEXFORMAT_RGB32_PALETTED,
144   SDL_TEXFORMAT_YUY16,
145   SDL_TEXFORMAT_YUY16_PALETTED,
146   SDL_TEXFORMAT_PALETTE16,
147   SDL_TEXFORMAT_RGB15,
148   SDL_TEXFORMAT_RGB15_PALETTED,
149   SDL_TEXFORMAT_PALETTE16A,
150   SDL_TEXFORMAT_PALETTE16_ARGB1555,
151   SDL_TEXFORMAT_RGB15_ARGB1555,
152   SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555,
153   SDL_TEXFORMAT_LAST = SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555
154};
155
139156#include "blit13.h"
140157
141158/* sdl_info is the information about SDL for the current screen */
142159class sdl_info13 : public osd_renderer
143160{
144161public:
145   sdl_info13(osd_window *w)
146   : osd_renderer(w, FLAG_NONE), m_sdl_renderer(NULL), m_blittimer(0),
162   sdl_info13(osd_window *w, int extra_flags)
163   : osd_renderer(w, extra_flags), m_sdl_renderer(NULL), m_blittimer(0),
147164      m_last_hofs(0), m_last_vofs(0),
148165      m_width(0), m_height(0),
149166      m_blit_dim(0,0),
r244710r244711
242259//  STATIC VARIABLES
243260//============================================================
244261
245#define SDL_TEXFORMAT_LAST SDL_TEXFORMAT_PALETTE16A
246262#define BM_ALL (-1)
247263//( SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD)
248264
r244710r244711
329345{ -1 },
330346};
331347
332static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1];
348static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1] = { NULL };
349static bool blit_info_initialized = false;
333350
334351//============================================================
335352//  INLINES
r244710r244711
512529
513530static osd_renderer *drawsdl2_create(osd_window *window)
514531{
515   return global_alloc(sdl_info13(window));
532   if (!blit_info_initialized)
533   {
534      /* On OSX, calling this from drawsdl2_init will
535       * prohibit fullscreen toggling. It is than not possible
536       * to toggle from fullscreen to window mode.
537       */
538      expand_copy_info(blit_info_default);
539      blit_info_initialized = true;
540
541   }
542   return global_alloc(sdl_info13(window, osd_renderer::FLAG_NONE));
516543}
517544
518545// FIXME: machine only used to access options.
519546int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks)
520547{
521   const char *stemp;
522
523548   // fill in the callbacks
524549   callbacks->exit = drawsdl2_exit;
525550   callbacks->create = drawsdl2_create;
526551
527552   osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n");
528553
529   expand_copy_info(blit_info_default);
530
531554#if USE_OPENGL
532555   // Load the GL library now - else MT will fail
533   stemp = downcast<sdl_options &>(machine.options()).gl_lib();
556   const char *stemp = downcast<sdl_options &>(machine.options()).gl_lib();
534557#else
535   stemp = NULL;
558   const char *stemp = NULL;
536559#endif
537560   if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0)
538561      stemp = NULL;
r244710r244711
555578{
556579   int i;
557580   copy_info_t *bi, *freeme;
558   for (i = 0; i <= SDL_TEXFORMAT_LAST; i++)
581   if (blit_info_initialized)
559582   {
560      for (bi = blit_info[i]; bi != NULL; )
583      for (i = 0; i <= SDL_TEXFORMAT_LAST; i++)
561584      {
562         if (bi->pixel_count)
563            osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname,
564                  bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples,
565                  (int) bi->perf);
566         freeme = bi;
567         bi = bi->next;
568         global_free(freeme);
585         for (bi = blit_info[i]; bi != NULL; )
586         {
587            if (bi->pixel_count)
588               osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname,
589                     bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples,
590                     (int) bi->perf);
591            freeme = bi;
592            bi = bi->next;
593            global_free(freeme);
594         }
595         blit_info[i] = NULL;
569596      }
570      blit_info[i] = NULL;
597      blit_info_initialized = false;
571598   }
572599}
573600
r244710r244711
601628// a
602629//============================================================
603630
631static void drawsdl_show_info(struct SDL_RendererInfo *render_info)
632{
633#define RF_ENTRY(x) {x, #x }
634   static struct {
635      int flag;
636      const char *name;
637   } rflist[] =
638      {
639#if 0
640         RF_ENTRY(SDL_RENDERER_SINGLEBUFFER),
641         RF_ENTRY(SDL_RENDERER_PRESENTCOPY),
642         RF_ENTRY(SDL_RENDERER_PRESENTFLIP2),
643         RF_ENTRY(SDL_RENDERER_PRESENTFLIP3),
644         RF_ENTRY(SDL_RENDERER_PRESENTDISCARD),
645#endif
646         RF_ENTRY(SDL_RENDERER_SOFTWARE),
647         RF_ENTRY(SDL_RENDERER_PRESENTVSYNC),
648         RF_ENTRY(SDL_RENDERER_ACCELERATED),
649         RF_ENTRY(SDL_RENDERER_TARGETTEXTURE),
650         {-1, NULL}
651      };
652   int i;
653
654   osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>");
655   for (i = 0; rflist[i].name != NULL; i++)
656      if (render_info->flags & rflist[i].flag)
657         osd_printf_verbose("renderer: flag %s\n", rflist[i].name);
658}
659
660
604661int sdl_info13::create()
605662{
606663#if (SDLMAME_SDL2)
r244710r244711
633690
634691   m_blittimer = 3;
635692
636   SDL_RenderPresent(m_sdl_renderer);
693   //SDL_RenderPresent(m_sdl_renderer);
637694   osd_printf_verbose("Leave sdl_info13::create\n");
638695
696   struct SDL_RendererInfo render_info;
697
698   SDL_GetRendererInfo(m_sdl_renderer, &render_info);
699   drawsdl_show_info(&render_info);
700
639701#else
640702
641703#endif
r244710r244711
651713{
652714   destroy_all_textures();
653715   SDL_DestroyRenderer(m_sdl_renderer);
716   m_sdl_renderer = NULL;
654717}
655718
656719
r244710r244711
11081171      texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags));
11091172      /* add us to the texture list */
11101173      m_texlist.prepend(*texture);
1111
11121174   }
11131175
11141176   if (texture != NULL)
trunk/src/osd/modules/render/drawogl.c
r244710r244711
166166//  MACROS
167167//============================================================
168168
169#ifdef OSD_WINDOWS
170169// texture formats
171170// This used to be an enum, but these are now defines so we can use them as
172171// preprocessor conditionals
r244710r244711
179178#define SDL_TEXFORMAT_RGB15             (6)
180179#define SDL_TEXFORMAT_RGB15_PALETTED    (7)
181180#define SDL_TEXFORMAT_PALETTE16A        (8)
181#if 0
182182// special texture formats for 16bpp texture destination support, do not use
183183// to address the tex properties / tex functions arrays!
184184#define SDL_TEXFORMAT_PALETTE16_ARGB1555    (16)
trunk/src/osd/modules/render/drawsdl.c
r244710r244711
508508      global_free_array(m_yuv_bitmap);
509509      m_yuv_bitmap = NULL;
510510   }
511   SDL_DestroyRenderer(m_sdl_renderer);
511512}
512513
513514//============================================================
trunk/src/osd/sdl/video.h
r244710r244711
2929
3030#define VIDEO_SCALE_MODE_NONE       (0)
3131
32// texture formats
33// This used to be an enum, but these are now defines so we can use them as
34// preprocessor conditionals
35#define SDL_TEXFORMAT_ARGB32            (0) // non-16-bit textures or specials
36#define SDL_TEXFORMAT_RGB32             (1)
37#define SDL_TEXFORMAT_RGB32_PALETTED    (2)
38#define SDL_TEXFORMAT_YUY16             (3)
39#define SDL_TEXFORMAT_YUY16_PALETTED    (4)
40#define SDL_TEXFORMAT_PALETTE16         (5)
41#define SDL_TEXFORMAT_RGB15             (6)
42#define SDL_TEXFORMAT_RGB15_PALETTED    (7)
43#define SDL_TEXFORMAT_PALETTE16A        (8)
44// special texture formats for 16bpp texture destination support, do not use
45// to address the tex properties / tex functions arrays!
46#define SDL_TEXFORMAT_PALETTE16_ARGB1555    (16)
47#define SDL_TEXFORMAT_RGB15_ARGB1555        (17)
48#define SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555   (18)
49
5032#define GLSL_SHADER_MAX 10
5133
5234//============================================================


Previous 199869 Revisions Next


© 1997-2024 The MAME Team