diff options
Diffstat (limited to 'src/osd/sdl')
| -rw-r--r-- | src/osd/sdl/blit13.h | 4 | ||||
| -rw-r--r-- | src/osd/sdl/draw13.c | 263 | ||||
| -rw-r--r-- | src/osd/sdl/drawogl.c | 156 | ||||
| -rw-r--r-- | src/osd/sdl/input.c | 18 | ||||
| -rw-r--r-- | src/osd/sdl/netdev_pcap.c | 10 | ||||
| -rw-r--r-- | src/osd/sdl/netdev_pcap_osx.c | 10 | ||||
| -rw-r--r-- | src/osd/sdl/osdsdl.h | 10 | ||||
| -rw-r--r-- | src/osd/sdl/sdl.mak | 2 | ||||
| -rw-r--r-- | src/osd/sdl/sdldir.c | 1 | ||||
| -rw-r--r-- | src/osd/sdl/sdlfile.c | 108 | ||||
| -rw-r--r-- | src/osd/sdl/sdlmain.c | 4 | ||||
| -rw-r--r-- | src/osd/sdl/sdlos_macosx.c | 1 | ||||
| -rw-r--r-- | src/osd/sdl/sdlos_unix.c | 3 | ||||
| -rw-r--r-- | src/osd/sdl/sdlos_win32.c | 1 | ||||
| -rw-r--r-- | src/osd/sdl/sdlptty_unix.c | 8 | ||||
| -rw-r--r-- | src/osd/sdl/strconv.c | 14 | ||||
| -rw-r--r-- | src/osd/sdl/video.c | 6 | ||||
| -rw-r--r-- | src/osd/sdl/window.c | 64 | ||||
| -rw-r--r-- | src/osd/sdl/window.h | 4 |
19 files changed, 339 insertions, 348 deletions
diff --git a/src/osd/sdl/blit13.h b/src/osd/sdl/blit13.h index 6b8de983dc2..07177d5e750 100644 --- a/src/osd/sdl/blit13.h +++ b/src/osd/sdl/blit13.h @@ -114,7 +114,7 @@ INLINE UINT32 pixel_ycc_to_rgb_pal(UINT16 *pixel, const rgb_t *palette) #define TEXCOPY_M( _name, _src_type, _dest_type, _op, _len_div) \ INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \ - ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ + ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ int x, y; \ /* loop over Y */ \ for (y = 0; y < texsource->height; y++) { \ @@ -134,7 +134,7 @@ INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo * #define TEXROT( _name, _src_type, _dest_type, _op) \ INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \ - ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ + ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ int x, y; \ const quad_setup_data *setup = &texture->m_setup; \ int dudx = setup->dudx; \ diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c index c6cc098592d..130080ae54b 100644 --- a/src/osd/sdl/draw13.c +++ b/src/osd/sdl/draw13.c @@ -48,12 +48,12 @@ enum static inline bool is_opaque(const float &a) { - return (a >= 1.0f); + return (a >= 1.0f); } static inline bool is_transparent(const float &a) { - return (a < 0.0001f); + return (a < 0.0001f); } //============================================================ @@ -63,11 +63,11 @@ static inline bool is_transparent(const float &a) struct quad_setup_data { - quad_setup_data() - : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0), - rotwidth(0), rotheight(0) - {} - void compute(const render_primitive &prim); + quad_setup_data() + : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0), + rotwidth(0), rotheight(0) + {} + void compute(const render_primitive &prim); INT32 dudx, dvdx, dudy, dvdy; INT32 startu, startv; @@ -105,16 +105,16 @@ struct sdl_info; /* texture_info holds information about a texture */ class texture_info { - friend class simple_list<texture_info>; + friend class simple_list<texture_info>; public: - texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); - ~texture_info(); + texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); + ~texture_info(); - void set_data(const render_texinfo &texsource, const UINT32 flags); - void render_quad(const render_primitive *prim, const int x, const int y); - bool matches(const render_primitive &prim, const quad_setup_data &setup); + void set_data(const render_texinfo &texsource, const UINT32 flags); + void render_quad(const render_primitive *prim, const int x, const int y); + bool matches(const render_primitive &prim, const quad_setup_data &setup); - copy_info_t *compute_size_type(); + copy_info_t *compute_size_type(); void *m_pixels; // pixels for the texture int m_pitch; @@ -125,49 +125,49 @@ public: osd_ticks_t m_last_access; int raw_width() const { return m_texinfo.width; } - int raw_height() const { return m_texinfo.height; } + int raw_height() const { return m_texinfo.height; } - texture_info *next() { return m_next; } - const render_texinfo &texinfo() const { return m_texinfo; } - render_texinfo &texinfo() { return m_texinfo; } + texture_info *next() { return m_next; } + const render_texinfo &texinfo() const { return m_texinfo; } + render_texinfo &texinfo() { return m_texinfo; } - const HashT hash() const { return m_hash; } - const UINT32 flags() const { return m_flags; } - const bool is_pixels_owned() const { // do we own / allocated it ? - return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) - && (m_copyinfo->func != NULL)) ; - } + const HashT hash() const { return m_hash; } + const UINT32 flags() const { return m_flags; } + const bool is_pixels_owned() const { // do we own / allocated it ? + return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) + && (m_copyinfo->func != NULL)) ; + } private: - Uint32 m_sdl_access; - SDL_Renderer * m_renderer; - render_texinfo m_texinfo; // copy of the texture info - HashT m_hash; // hash value for the texture (must be >= pointer size) - UINT32 m_flags; // rendering flags + Uint32 m_sdl_access; + SDL_Renderer * m_renderer; + render_texinfo m_texinfo; // copy of the texture info + HashT m_hash; // hash value for the texture (must be >= pointer size) + UINT32 m_flags; // rendering flags - SDL_Texture * m_texture_id; - int m_is_rotated; + SDL_Texture * m_texture_id; + int m_is_rotated; - int m_format; // texture format - SDL_BlendMode m_sdl_blendmode; + int m_format; // texture format + SDL_BlendMode m_sdl_blendmode; - texture_info * m_next; // next texture in the list + texture_info * m_next; // next texture in the list }; /* sdl_info is the information about SDL for the current screen */ struct sdl_info { - sdl_info() - : m_blittimer(0), m_renderer(NULL), - m_hofs(0), m_vofs(0), - m_resize_pending(0), m_resize_width(0), m_resize_height(0), - m_last_blit_time(0), m_last_blit_pixels(0) - {} + sdl_info() + : m_blittimer(0), m_renderer(NULL), + m_hofs(0), m_vofs(0), + m_resize_pending(0), m_resize_width(0), m_resize_height(0), + m_last_blit_time(0), m_last_blit_pixels(0) + {} - void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); + void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); - texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); - texture_info *texture_update(const render_primitive &prim); + texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); + texture_info *texture_update(const render_primitive &prim); INT32 m_blittimer; @@ -389,46 +389,46 @@ void texture_info::render_quad(const render_primitive *prim, const int x, const target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0); target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0); - SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode); - set_coloralphamode(m_texture_id, &prim->color); - SDL_RenderCopy(m_renderer, m_texture_id, NULL, &target_rect); + SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode); + set_coloralphamode(m_texture_id, &prim->color); + SDL_RenderCopy(m_renderer, m_texture_id, NULL, &target_rect); } void sdl_info::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) { - SDL_Rect target_rect; - - target_rect.x = x; - target_rect.y = y; - target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0); - target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0); - - if (texture) - { - copy_info_t *copyinfo = texture->m_copyinfo; - copyinfo->time -= osd_ticks(); - texture->render_quad(prim, x, y); - copyinfo->time += osd_ticks(); - - copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height())); - if (m_last_blit_pixels) - { - copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels; - } - copyinfo->samples++; - copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time; - } - else - { - UINT32 sr = (UINT32)(255.0f * prim->color.r); - UINT32 sg = (UINT32)(255.0f * prim->color.g); - UINT32 sb = (UINT32)(255.0f * prim->color.b); - UINT32 sa = (UINT32)(255.0f * prim->color.a); - - SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); - SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa); - SDL_RenderFillRect(m_renderer, &target_rect); - } + SDL_Rect target_rect; + + target_rect.x = x; + target_rect.y = y; + target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0); + target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0); + + if (texture) + { + copy_info_t *copyinfo = texture->m_copyinfo; + copyinfo->time -= osd_ticks(); + texture->render_quad(prim, x, y); + copyinfo->time += osd_ticks(); + + copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height())); + if (m_last_blit_pixels) + { + copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels; + } + copyinfo->samples++; + copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time; + } + else + { + UINT32 sr = (UINT32)(255.0f * prim->color.r); + UINT32 sg = (UINT32)(255.0f * prim->color.g); + UINT32 sb = (UINT32)(255.0f * prim->color.b); + UINT32 sa = (UINT32)(255.0f * prim->color.a); + + SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags))); + SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa); + SDL_RenderFillRect(m_renderer, &target_rect); + } } static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat) @@ -518,18 +518,18 @@ int drawsdl2_init(running_machine &machine, sdl_draw_info *callbacks) else osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>"); - /* Enable bilinear filtering in case it is supported. - * This applies to all texture operations. However, artwort is pre-scaled - * and thus shouldn't be affected. - */ - if (video_config.filter) - { - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); - } - else - { - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); - } + /* Enable bilinear filtering in case it is supported. + * This applies to all texture operations. However, artwort is pre-scaled + * and thus shouldn't be affected. + */ + if (video_config.filter) + { + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); + } + else + { + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); + } return 0; } @@ -604,7 +604,7 @@ static int drawsdl2_window_create(sdl_window_info *window, int width, int height { SDL_DisplayMode mode; //SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); - SDL_GetWindowDisplayMode(window->sdl_window, &mode); + SDL_GetWindowDisplayMode(window->sdl_window, &mode); sdl->m_original_mode = mode; mode.w = width; mode.h = height; @@ -630,13 +630,13 @@ static int drawsdl2_window_create(sdl_window_info *window, int width, int height osd_printf_warning("Ignoring depth %d\n", window->depth); } } - SDL_SetWindowDisplayMode(window->sdl_window, &mode); // Try to set mode + SDL_SetWindowDisplayMode(window->sdl_window, &mode); // Try to set mode #ifndef SDLMAME_WIN32 - /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution - * is in place after the mode switch - which will most likely be the case - * This is a hack to work around a deficiency in SDL2 - */ - SDL_WarpMouseInWindow(window->sdl_window, 1, 1); + /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution + * is in place after the mode switch - which will most likely be the case + * This is a hack to work around a deficiency in SDL2 + */ + SDL_WarpMouseInWindow(window->sdl_window, 1, 1); #endif } else @@ -736,7 +736,7 @@ static int drawsdl2_window_draw(sdl_window_info *window, UINT32 dc, int update) SDL_GetWindowSize(window->sdl_window, &window->width, &window->height); sdl->m_resize_pending = 0; SDL_RenderSetViewport(sdl->m_renderer, NULL); - //sdlvideo_monitor_refresh(window->monitor()); + //sdlvideo_monitor_refresh(window->monitor()); } @@ -855,14 +855,14 @@ static void drawsdl2_window_destroy(sdl_window_info *window) drawsdl2_destroy_all_textures(window); - if (window->fullscreen() && video_config.switchres) - { - SDL_SetWindowFullscreen(window->sdl_window, 0); // Try to set mode - SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode); // Try to set mode - SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN); // Try to set mode - } + if (window->fullscreen() && video_config.switchres) + { + SDL_SetWindowFullscreen(window->sdl_window, 0); // Try to set mode + SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode); // Try to set mode + SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN); // Try to set mode + } - SDL_DestroyWindow(window->sdl_window); + SDL_DestroyWindow(window->sdl_window); global_free(sdl); window->dxdata = NULL; @@ -889,7 +889,7 @@ copy_info_t *texture_info::compute_size_type() { if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname)) { - int perf = bi->perf; + int perf = bi->perf; if (perf == 0) return bi; else if (perf > (maxperf * 102) / 100) @@ -920,15 +920,15 @@ copy_info_t *texture_info::compute_size_type() bool texture_info::matches(const render_primitive &prim, const quad_setup_data &setup) { - return texinfo().base == prim.texture.base && - texinfo().width == prim.texture.width && - texinfo().height == prim.texture.height && - texinfo().rowpixels == prim.texture.rowpixels && - m_setup.dudx == setup.dudx && - m_setup.dvdx == setup.dvdx && - m_setup.dudy == setup.dudy && - m_setup.dvdy == setup.dvdy && - ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0; + return texinfo().base == prim.texture.base && + texinfo().width == prim.texture.width && + texinfo().height == prim.texture.height && + texinfo().rowpixels == prim.texture.rowpixels && + m_setup.dudx == setup.dudx && + m_setup.dvdx == setup.dvdx && + m_setup.dudy == setup.dudy && + m_setup.dvdy == setup.dvdy && + ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0; } //============================================================ @@ -937,9 +937,8 @@ bool texture_info::matches(const render_primitive &prim, const quad_setup_data & texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) { - // fill in the core data - m_renderer = renderer; + m_renderer = renderer; m_hash = texture_compute_hash(texsource, flags); m_flags = flags; m_texinfo = texsource; @@ -997,10 +996,10 @@ texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsour if (m_sdl_access == SDL_TEXTUREACCESS_STATIC) { - if (m_copyinfo->func != NULL) - m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp); - else - m_pixels = NULL; + if (m_copyinfo->func != NULL) + m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp); + else + m_pixels = NULL; } m_last_access = osd_ticks(); @@ -1008,9 +1007,9 @@ texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsour texture_info::~texture_info() { - if ( is_pixels_owned() && (m_pixels != NULL) ) - free(m_pixels); - SDL_DestroyTexture(m_texture_id); + if ( is_pixels_owned() && (m_pixels != NULL) ) + free(m_pixels); + SDL_DestroyTexture(m_texture_id); } //============================================================ @@ -1082,9 +1081,9 @@ void quad_setup_data::compute(const render_primitive &prim) #if 0 printf("tl.u %f tl.v %f\n", texcoords->tl.u, texcoords->tl.v); - printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v); - printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v); - printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v); + printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v); + printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v); + printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v); /* compute start and delta U,V coordinates now */ #endif @@ -1162,7 +1161,7 @@ texture_info * sdl_info::texture_update(const render_primitive &prim) if (texture == NULL && prim.texture.base != NULL) { texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags)); - /* add us to the texture list */ + /* add us to the texture list */ m_texlist.prepend(*texture); } @@ -1191,9 +1190,9 @@ static void drawsdl2_destroy_all_textures(sdl_window_info *window) if(window->primlist) { window->primlist->acquire_lock(); - sdl->m_texlist.reset(); - window->primlist->release_lock(); + sdl->m_texlist.reset(); + window->primlist->release_lock(); } else - sdl->m_texlist.reset(); + sdl->m_texlist.reset(); } diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c index 4d9bd21a2e8..7fe795b43ed 100644 --- a/src/osd/sdl/drawogl.c +++ b/src/osd/sdl/drawogl.c @@ -161,24 +161,24 @@ struct texture_info; /* texture_info holds information about a texture */ struct texture_info { - texture_info() - : hash(0), flags(0), rawwidth(0), rawheight(0), - rawwidth_create(0), rawheight_create(0), - type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0), - texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL), - data_own(0), texCoordBufferName(0) - { - for (int i=0; i<2; i++) - { - mpass_textureunit[i] = 0; - mpass_texture_mamebm[i] = 0; - mpass_fbo_mamebm[i] = 0; - mpass_texture_scrn[i] = 0; - mpass_fbo_scrn[i] = 0; - } - for (int i=0; i<8; i++) - texCoord[i] = 0.0f; - } + texture_info() + : hash(0), flags(0), rawwidth(0), rawheight(0), + rawwidth_create(0), rawheight_create(0), + type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0), + texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL), + data_own(0), texCoordBufferName(0) + { + for (int i=0; i<2; i++) + { + mpass_textureunit[i] = 0; + mpass_texture_mamebm[i] = 0; + mpass_fbo_mamebm[i] = 0; + mpass_texture_scrn[i] = 0; + mpass_fbo_scrn[i] = 0; + } + for (int i=0; i<8; i++) + texCoord[i] = 0.0f; + } HashT hash; // hash value for the texture (must be >= pointer size) UINT32 flags; // rendering flags @@ -217,35 +217,35 @@ struct texture_info /* sdl_info is the information about SDL for the current screen */ struct sdl_info { - sdl_info() - : blittimer(0), extra_flags(0), + sdl_info() + : blittimer(0), extra_flags(0), #if (SDLMAME_SDL2) - gl_context_id(0), + gl_context_id(0), #else - sdlsurf(NULL), + sdlsurf(NULL), #endif - initialized(0), - last_blendmode(0), - texture_max_width(0), - texture_max_height(0), - texpoweroftwo(0), - usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL), - glsl_program_num(0), - glsl_program_mb2sc(0), - usetexturerect(0), - init_context(0), - last_hofs(0.0f), - last_vofs(0.0f), - surf_w(0), - surf_h(0) - { - for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++) - texhash[i] = NULL; - for (int i=0; i < 2*GLSL_SHADER_MAX; i++) - glsl_program[i] = 0; - for (int i=0; i < 8; i++) - texVerticex[i] = 0.0f; - } + initialized(0), + last_blendmode(0), + texture_max_width(0), + texture_max_height(0), + texpoweroftwo(0), + usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL), + glsl_program_num(0), + glsl_program_mb2sc(0), + usetexturerect(0), + init_context(0), + last_hofs(0.0f), + last_vofs(0.0f), + surf_w(0), + surf_h(0) + { + for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++) + texhash[i] = NULL; + for (int i=0; i < 2*GLSL_SHADER_MAX; i++) + glsl_program[i] = 0; + for (int i=0; i < 8; i++) + texVerticex[i] = 0.0f; + } INT32 blittimer; UINT32 extra_flags; @@ -3079,40 +3079,40 @@ static void drawogl_destroy_all_textures(sdl_window_info *window) sdl->texhash[i] = NULL; if (texture != NULL) { - if(sdl->usevbo) - { - pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) ); - texture->texCoordBufferName=0; - } - - if(sdl->usepbo && texture->pbo) - { - pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) ); - texture->pbo=0; - } - - if( sdl->glsl_program_num > 1 ) - { - assert(sdl->usefbo); - pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]); - glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]); - } - - if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 ) - { - assert(sdl->usefbo); - pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]); - glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]); - } - - glDeleteTextures(1, (GLuint *)&texture->texture); - if ( texture->data_own ) - { - free(texture->data); - texture->data=NULL; - texture->data_own=FALSE; - } - global_free(texture); + if(sdl->usevbo) + { + pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) ); + texture->texCoordBufferName=0; + } + + if(sdl->usepbo && texture->pbo) + { + pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) ); + texture->pbo=0; + } + + if( sdl->glsl_program_num > 1 ) + { + assert(sdl->usefbo); + pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]); + glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]); + } + + if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 ) + { + assert(sdl->usefbo); + pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]); + glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]); + } + + glDeleteTextures(1, (GLuint *)&texture->texture); + if ( texture->data_own ) + { + free(texture->data); + texture->data=NULL; + texture->data_own=FALSE; + } + global_free(texture); } i++; } diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 4b2f1e57093..87c534a5e5d 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -1986,16 +1986,16 @@ void sdlinput_poll(running_machine &machine) else { #ifndef SDLMAME_WIN32 - /* FIXME: SDL2 sends some spurious resize events on Ubuntu - * while in fullscreen mode. Ignore them for now. - */ - if (!window->fullscreen()) + /* FIXME: SDL2 sends some spurious resize events on Ubuntu + * while in fullscreen mode. Ignore them for now. + */ + if (!window->fullscreen()) #endif - { - //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event)); - if (event.window.data1 != window->width || event.window.data2 != window->height) - window->window_resize(event.window.data1, event.window.data2); - } + { + //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event)); + if (event.window.data1 != window->width || event.window.data2 != window->height) + window->window_resize(event.window.data1, event.window.data2); + } } focus_window = window; break; diff --git a/src/osd/sdl/netdev_pcap.c b/src/osd/sdl/netdev_pcap.c index 54d837cc9fe..ec72fe5ed8a 100644 --- a/src/osd/sdl/netdev_pcap.c +++ b/src/osd/sdl/netdev_pcap.c @@ -98,11 +98,11 @@ void init_pcap() return; } - while(devs) - { - add_netdev(devs->name, devs->description, create_pcap); - devs = devs->next; - } + while(devs) + { + add_netdev(devs->name, devs->description, create_pcap); + devs = devs->next; + } } void deinit_pcap() diff --git a/src/osd/sdl/netdev_pcap_osx.c b/src/osd/sdl/netdev_pcap_osx.c index 9485f65775d..864732ff601 100644 --- a/src/osd/sdl/netdev_pcap_osx.c +++ b/src/osd/sdl/netdev_pcap_osx.c @@ -150,11 +150,11 @@ void init_pcap() } #if 1 - while(devs) - { - add_netdev(devs->name, devs->description, create_pcap); - devs = devs->next; - } + while(devs) + { + add_netdev(devs->name, devs->description, create_pcap); + devs = devs->next; + } #else if (devs) { diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 47bce66a8ee..3bbed8efd16 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -30,7 +30,7 @@ #define SDL13_COMBINE_RESIZE (0) #endif #else - #define SDLMAME_INIT_IN_WORKER_THREAD (0) + #define SDLMAME_INIT_IN_WORKER_THREAD (0) #define SDL13_COMBINE_RESIZE (0) #endif @@ -199,7 +199,7 @@ public: #ifdef USE_NETWORK virtual bool network_init(); #endif - //virtual bool midi_init(); + //virtual bool midi_init(); virtual void video_exit(); virtual void window_exit(); @@ -208,9 +208,9 @@ public: #ifdef USE_NETWORK virtual void network_exit(); #endif - //virtual void midi_exit(); + //virtual void midi_exit(); - sdl_options &options() { return m_options; } + sdl_options &options() { return m_options; } private: virtual void osd_exit(); @@ -220,7 +220,7 @@ private: // FIXME: remove machine usage void extract_video_config(running_machine &machine); - sdl_options &m_options; + sdl_options &m_options; watchdog *m_watchdog; diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak index 2abe695be4e..ca4ae3329dc 100644 --- a/src/osd/sdl/sdl.mak +++ b/src/osd/sdl/sdl.mak @@ -738,7 +738,7 @@ DEBUGOBJS = \ $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o DEFS += -DUSE_QTDEBUG=1 - + else DEFS += -DUSE_QTDEBUG=0 endif diff --git a/src/osd/sdl/sdldir.c b/src/osd/sdl/sdldir.c index 4c3b29dea34..ba1184adc20 100644 --- a/src/osd/sdl/sdldir.c +++ b/src/osd/sdl/sdldir.c @@ -152,7 +152,6 @@ osd_directory *osd_opendir(const char *dirname) if (tmpstr[0] == '$') { - envstr = (char *) osd_malloc_array(strlen(tmpstr)+1); strcpy(envstr, tmpstr); diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c index 6df7615f1ab..5dc2b309cc9 100644 --- a/src/osd/sdl/sdlfile.c +++ b/src/osd/sdl/sdlfile.c @@ -188,7 +188,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 envstr[i] = '\0'; - const char *envval = osd_getenv(&envstr[1]); + const char *envval = osd_getenv(&envstr[1]); if (envval != NULL) { j = strlen(envval) + strlen(tmpstr) + 1; @@ -505,31 +505,31 @@ int osd_is_absolute_path(const char *path) osd_directory_entry *osd_stat(const char *path) { - int err; - osd_directory_entry *result = NULL; - #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) - struct stat st; - #else - struct stat64 st; - #endif - - #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) - err = stat(path, &st); - #else - err = stat64(path, &st); - #endif - - if( err == -1) return NULL; - - // create an osd_directory_entry; be sure to make sure that the caller can - // free all resources by just freeing the resulting osd_directory_entry - result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1); - strcpy(((char *) result) + sizeof(*result), path); - result->name = ((char *) result) + sizeof(*result); - result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE; - result->size = (UINT64)st.st_size; - - return result; + int err; + osd_directory_entry *result = NULL; + #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) + struct stat st; + #else + struct stat64 st; + #endif + + #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) + err = stat(path, &st); + #else + err = stat64(path, &st); + #endif + + if( err == -1) return NULL; + + // create an osd_directory_entry; be sure to make sure that the caller can + // free all resources by just freeing the resulting osd_directory_entry + result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1); + strcpy(((char *) result) + sizeof(*result), path); + result->name = ((char *) result) + sizeof(*result); + result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE; + result->size = (UINT64)st.st_size; + + return result; } //============================================================ @@ -538,32 +538,32 @@ osd_directory_entry *osd_stat(const char *path) file_error osd_get_full_path(char **dst, const char *path) { - file_error err; - char path_buffer[512]; - - err = FILERR_NONE; - - if (getcwd(path_buffer, 511) == NULL) - { - printf("osd_get_full_path: failed!\n"); - err = FILERR_FAILURE; - } - else - { - *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3); - - // if it's already a full path, just pass it through - if (path[0] == '/') - { - strcpy(*dst, path); - } - else - { - sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path); - } - } - - return err; + file_error err; + char path_buffer[512]; + + err = FILERR_NONE; + + if (getcwd(path_buffer, 511) == NULL) + { + printf("osd_get_full_path: failed!\n"); + err = FILERR_FAILURE; + } + else + { + *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3); + + // if it's already a full path, just pass it through + if (path[0] == '/') + { + strcpy(*dst, path); + } + else + { + sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path); + } + } + + return err; } //============================================================ @@ -572,8 +572,8 @@ file_error osd_get_full_path(char **dst, const char *path) const char *osd_get_volume_name(int idx) { - if (idx!=0) return NULL; - return "/"; + if (idx!=0) return NULL; + return "/"; } #endif diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index e6c9e8ed5e1..6337717631b 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) #endif { - sdl_options options; + sdl_options options; sdl_osd_interface osd(options); osd.register_options(); cli_frontend frontend(options, osd); @@ -688,5 +688,3 @@ char *utf8_from_wstring(const WCHAR *wstring) } #endif - - diff --git a/src/osd/sdl/sdlos_macosx.c b/src/osd/sdl/sdlos_macosx.c index 2c0f582c885..3585780f31e 100644 --- a/src/osd/sdl/sdlos_macosx.c +++ b/src/osd/sdl/sdlos_macosx.c @@ -121,4 +121,3 @@ char *osd_get_clipboard_text(void) return result; } - diff --git a/src/osd/sdl/sdlos_unix.c b/src/osd/sdl/sdlos_unix.c index cee3f498724..c5180bc13b7 100644 --- a/src/osd/sdl/sdlos_unix.c +++ b/src/osd/sdl/sdlos_unix.c @@ -147,6 +147,3 @@ char *osd_get_clipboard_text(void) return result; } #endif - - - diff --git a/src/osd/sdl/sdlos_win32.c b/src/osd/sdl/sdlos_win32.c index a5ede43df00..ab488b0d70b 100644 --- a/src/osd/sdl/sdlos_win32.c +++ b/src/osd/sdl/sdlos_win32.c @@ -101,4 +101,3 @@ char *osd_get_clipboard_text(void) return result; } - diff --git a/src/osd/sdl/sdlptty_unix.c b/src/osd/sdl/sdlptty_unix.c index bc9b3a8ff25..60eac1436dd 100644 --- a/src/osd/sdl/sdlptty_unix.c +++ b/src/osd/sdl/sdlptty_unix.c @@ -111,21 +111,21 @@ const char *sdlfile_ptty_identifier = ""; file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize) { - return FILERR_ACCESS_DENIED; + return FILERR_ACCESS_DENIED; } file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) { - return FILERR_ACCESS_DENIED; + return FILERR_ACCESS_DENIED; } file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) { - return FILERR_ACCESS_DENIED; + return FILERR_ACCESS_DENIED; } file_error sdl_close_ptty(osd_file *file) { - return FILERR_ACCESS_DENIED; + return FILERR_ACCESS_DENIED; } #endif diff --git a/src/osd/sdl/strconv.c b/src/osd/sdl/strconv.c index 73d1f576c0a..3eedf040127 100644 --- a/src/osd/sdl/strconv.c +++ b/src/osd/sdl/strconv.c @@ -127,15 +127,15 @@ int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count) int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count) { - wchar_t wch; + wchar_t wch; - count = mbstowcs(&wch, (char *)osdchar, 1); - if (count != -1) - *uchar = wch; - else - *uchar = 0; + count = mbstowcs(&wch, (char *)osdchar, 1); + if (count != -1) + *uchar = wch; + else + *uchar = 0; - return count; + return count; } #endif diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index bef84f9ba86..5a8da9eb031 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -154,9 +154,9 @@ void sdlvideo_monitor_refresh(sdl_monitor_info *monitor) #if defined(SDLMAME_WIN32) SDL_GetDesktopDisplayMode(monitor->handle, &dmode); - #else - SDL_GetCurrentDisplayMode(monitor->handle, &dmode); - #endif + #else + SDL_GetCurrentDisplayMode(monitor->handle, &dmode); + #endif monitor->monitor_width = dmode.w; monitor->monitor_height = dmode.h; monitor->center_width = dmode.w; diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index 3edd6e87c87..88325d682ad 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -270,35 +270,35 @@ bool sdl_osd_interface::window_init() * The code below will document which hints were set. */ const char * hints[] = { SDL_HINT_FRAMEBUFFER_ACCELERATION, - SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_OPENGL_SHADERS, - SDL_HINT_RENDER_SCALE_QUALITY, - SDL_HINT_RENDER_VSYNC, - SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA, - SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD, - SDL_HINT_MOUSE_RELATIVE_MODE_WARP, - SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED, - SDL_HINT_ORIENTATIONS, - SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG, - SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST, - SDL_HINT_TIMER_RESOLUTION, + SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_OPENGL_SHADERS, + SDL_HINT_RENDER_SCALE_QUALITY, + SDL_HINT_RENDER_VSYNC, + SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA, + SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD, + SDL_HINT_MOUSE_RELATIVE_MODE_WARP, + SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED, + SDL_HINT_ORIENTATIONS, + SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG, + SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST, + SDL_HINT_TIMER_RESOLUTION, #if SDL_VERSION_ATLEAST(2, 0, 2) - SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER, - SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, - SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, - SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, + SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER, + SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, + SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, + SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, #endif #if SDL_VERSION_ATLEAST(2, 0, 3) - SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED, - SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL, - SDL_HINT_WINRT_HANDLE_BACK_BUTTON, + SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED, + SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL, + SDL_HINT_WINRT_HANDLE_BACK_BUTTON, #endif - NULL - }; + NULL + }; - osd_printf_verbose("\nHints:\n"); - for (int i = 0; hints[i] != NULL; i++) - osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i])); + osd_printf_verbose("\nHints:\n"); + for (int i = 0; hints[i] != NULL; i++) + osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i])); #endif // set up the window list @@ -1018,17 +1018,17 @@ void sdl_window_info::video_window_update(running_machine &machine) if (osd_event_wait(rendered_event, event_wait_ticks)) { - if ((!fullscreen()) || (video_config.switchres)) - { - blit_surface_size(width, height); - } - else - { - blit_surface_size(monitor()->center_width, monitor()->center_height); - } + if ((!fullscreen()) || (video_config.switchres)) + { + blit_surface_size(width, height); + } + else + { + blit_surface_size(monitor()->center_width, monitor()->center_height); + } // ensure the target bounds are up-to-date, and then get the primitives - set_target_bounds(this); + set_target_bounds(this); render_primitive_list &primlist = target->get_primitives(); diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 3b47433a91d..ca7d8746c04 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -61,8 +61,8 @@ struct sdl_window_info m_fullscreen = !video_config.windowed; prescale = video_config.prescale; - windowed_width = config->width; - windowed_height = config->height; + windowed_width = config->width; + windowed_height = config->height; } void video_window_update(running_machine &machine); |
