gsdx: remove completely the SDL backend. Let's hope I didn't break too much VS

cmake: take the opportunity to drop the support of 3rdparty compilation. Distributions have got a more recent version of zlib/soundtouch anyway.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5376 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2012-08-15 10:22:19 +00:00
parent b70c5eb8b7
commit 226b2d63b8
17 changed files with 86 additions and 694 deletions

View File

@ -5,18 +5,4 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
# build project zlib
if(projectZLIB)
add_subdirectory(zlib)
endif(projectZLIB)
# build project SoundTouch
if(projectSoundTouch)
add_subdirectory(SoundTouch)
endif(projectSoundTouch)
# build project sdl
if(projectSDL)
add_subdirectory(SDL-1.3.0-5387)
endif(projectSDL)
### 3rd party was dropped

View File

@ -1,15 +1,12 @@
### TODO
# Hardcode GLSL_SHADER_DIR and GAMEINDEX_DIR. To check that default is fine for everybody
### Select the build type
# Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug
# Enable/disable the stripping : -DCMAKE_BUILD_STRIP=TRUE|FALSE
# generation .po based on src : -DCMAKE_BUILD_PO=TRUE|FALSE
# Rebuild the ps2hw.dat file : -DREBUILD_SHADER=TRUE
# Build the Replay Loaders : -DBUILD_REPLAY_LOADERS=TRUE|FALSE
### Force the choice of 3rd party library in pcsx2 over system libraries
# Use all internal lib: -DFORCE_INTERNAL_ALL=TRUE
# Use soundtouch internal lib: -DFORCE_INTERNAL_SOUNDTOUCH=TRUE
# Use zlib internal lib: -DFORCE_INTERNAL_ZLIB=TRUE
# Use sdl1.3 internal lib: -DFORCE_INTERNAL_SDL=TRUE # Not supported yet
# Use GLSL API(else NVIDIA_CG): -DGLSL_API=TRUE
### GCC optimization options
@ -55,35 +52,6 @@ if(NOT DEFINED CMAKE_BUILD_PO)
endif(CMAKE_BUILD_TYPE STREQUAL "Release")
endif(NOT DEFINED CMAKE_BUILD_PO)
#-------------------------------------------------------------------------------
# Select library system vs 3rdparty
#-------------------------------------------------------------------------------
if(FORCE_INTERNAL_ALL)
set(FORCE_INTERNAL_SOUNDTOUCH TRUE)
set(FORCE_INTERNAL_ZLIB TRUE)
set(FORCE_INTERNAL_SDL TRUE)
endif(FORCE_INTERNAL_ALL)
if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
set(FORCE_INTERNAL_SOUNDTOUCH FALSE)
endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
if(NOT DEFINED FORCE_INTERNAL_ZLIB)
set(FORCE_INTERNAL_ZLIB FALSE)
endif(NOT DEFINED FORCE_INTERNAL_ZLIB)
if(NOT DEFINED FORCE_INTERNAL_SDL)
set(FORCE_INTERNAL_SDL FALSE)
endif(NOT DEFINED FORCE_INTERNAL_SDL)
if (FORCE_INTERNAL_SDL)
message(STATUS "Internal SDL is a development snapshot of libsdl 1.3
Crashes can be expected and no support will be provided")
endif (FORCE_INTERNAL_SDL)
if (NOT DEFINED XDG_STD)
set(XDG_STD FALSE)
endif (NOT DEFINED XDG_STD)
#-------------------------------------------------------------------------------
# Control GCC flags
#-------------------------------------------------------------------------------
@ -181,11 +149,11 @@ if(PACKAGE_MODE)
endif(NOT DEFINED PLUGIN_DIR)
if(NOT DEFINED GAMEINDEX_DIR)
set(GAMEINDEX_DIR "/var/games/pcsx2")
set(GAMEINDEX_DIR "${CMAKE_INSTALL_PREFIX}/share/games/pcsx2")
endif(NOT DEFINED GAMEINDEX_DIR)
if(NOT DEFINED GLSL_SHADER_DIR)
set(GLSL_SHADER_DIR "/usr/share/games/pcsx2")
set(GLSL_SHADER_DIR "${CMAKE_INSTALL_PREFIX}/share/games/pcsx2")
endif(NOT DEFINED GLSL_SHADER_DIR)
# Compile all source codes with these 3 defines
@ -213,3 +181,11 @@ endif(NOT DEFINED REBUILD_SHADER)
if(NOT DEFINED BUILD_REPLAY_LOADERS)
set(BUILD_REPLAY_LOADERS TRUE)
endif(NOT DEFINED BUILD_REPLAY_LOADERS)
#-------------------------------------------------------------------------------
# Use PCSX2 default path (not XDG)
#-------------------------------------------------------------------------------
if (NOT DEFINED XDG_STD)
set(XDG_STD FALSE)
endif (NOT DEFINED XDG_STD)

View File

@ -31,10 +31,8 @@ find_package(Gettext) # translation tool
find_package(JPEG)
find_package(OpenGL)
# Tell cmake that we use SDL as a library and not as an application
if(NOT FORCE_INTERNAL_SDL)
set(SDL_BUILDING_LIBRARY TRUE)
find_package(SDL)
endif(NOT FORCE_INTERNAL_SDL)
set(SDL_BUILDING_LIBRARY TRUE)
find_package(SDL)
find_package(Subversion)
# The requirement of wxWidgets is checked in SelectPcsx2Plugins module
# Does not require the module (allow to compile non-wx plugins)
@ -43,9 +41,7 @@ find_package(Subversion)
# set(wxWidgets_CONFIG_OPTIONS --unicode=yes --debug=yes) # In case someone want to debug inside wx
set(wxWidgets_CONFIG_OPTIONS --unicode=yes)
find_package(wxWidgets COMPONENTS base core adv)
if(NOT FORCE_INTERNAL_ZLIB)
find_package(ZLIB)
endif(NOT FORCE_INTERNAL_ZLIB)
find_package(ZLIB)
## Use pcsx2 package to find module
## Include cg because of zzogl-cg and zerogs
@ -55,9 +51,7 @@ endif(NOT FORCE_INTERNAL_ZLIB)
include(FindGlew)
include(FindLibc)
include(FindPortAudio)
if(NOT FORCE_INTERNAL_SOUNDTOUCH)
include(FindSoundTouch)
endif(NOT FORCE_INTERNAL_SOUNDTOUCH)
include(FindSoundTouch)
include(FindSparseHash)
include(FindSparseHash_NEW)
@ -70,36 +64,7 @@ include(FindSparseHash_NEW)
#----------------------------------------
# Fallback on 3rdparty libraries
#----------------------------------------
# Note to avoid some conflict with system include, we must include 3rdparty first
if(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
# use project one
set(projectZLIB TRUE)
set(ZLIB_FOUND TRUE)
# Set path
set(ZLIB_LIBRARIES pcsx2_zlib)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/zlib)
message(STATUS "Use internal pcsx2 zlib library")
endif(NOT ZLIB_FOUND OR FORCE_INTERNAL_ZLIB)
if(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
# use project one
set(projectSoundTouch TRUE)
set(SOUNDTOUCH_FOUND TRUE)
# Set path
set(SOUNDTOUCH_LIBRARIES pcsx2_SoundTouch)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/soundtouch_linux_include)
message(STATUS "Use internal pcsx2 SoundTouch library")
endif(NOT SOUNDTOUCH_FOUND OR FORCE_INTERNAL_SOUNDTOUCH)
if(NOT SDL_FOUND OR FORCE_INTERNAL_SDL)
# use project one
set(projectSDL TRUE)
set(SDL_FOUND TRUE)
# Set path
set(SDL_LIBRARY pcsx2_SDL)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/SDL-1.3.0-5387/include)
message(STATUS "Use internal pcsx2 SDL library")
endif(NOT SDL_FOUND OR FORCE_INTERNAL_SDL)
# Empty
#----------------------------------------
# Use system include (if not 3rdparty one)
@ -152,14 +117,14 @@ if(PORTAUDIO_FOUND)
endif(PORTAUDIO_FOUND)
# SDL
if(SDL_FOUND AND NOT projectSDL)
if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})
endif(SDL_FOUND AND NOT projectSDL)
endif(SDL_FOUND)
# SoundTouch
if(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
if(SOUNDTOUCH_FOUND)
include_directories(${SOUNDTOUCH_INCLUDE_DIR})
endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
endif(SOUNDTOUCH_FOUND)
# SPARSEHASH
if(SPARSEHASH_FOUND)
@ -198,6 +163,6 @@ if(wxWidgets_FOUND)
endif(wxWidgets_FOUND)
# Zlib
if(ZLIB_FOUND AND NOT projectZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
endif(ZLIB_FOUND AND NOT projectZLIB)
endif(ZLIB_FOUND)

View File

@ -4,16 +4,15 @@
set(msg_dep_common_libs "check these libraries -> wxWidgets (>=2.8.10), sparsehash (>=1.5)")
set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=2.8.10), gtk2 (>=2.16), zlib (>=1.2.4), pcsx2 common libs")
set(msg_dep_cdvdiso "check these libraries -> bzip2 (>=1.0.5), gtk2 (>=2.16)")
set(msg_dep_zerogs "check these libraries -> glew (>=1.5), opengl, X11, nvidia-cg-toolkit (>=2.1)")
set(msg_dep_zerogs "check these libraries -> glew (>=1.6), opengl, X11, nvidia-cg-toolkit (>=2.1)")
set(msg_dep_gsdx "check these libraries -> opengl, X11")
set(msg_dep_onepad "check these libraries -> sdl (>=1.2)")
set(msg_dep_zeropad "check these libraries -> sdl (>=1.2)")
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), pcsx2 common libs")
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
if(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
else(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
endif(GLSL_API)
#-------------------------------------------------------------------------------
@ -129,7 +128,6 @@ endif(GTK2_FOUND)
#---------------------------------------
# requires: -OpenGL
# -X11
# -PCSX2 SDL
#---------------------------------------
if(OPENGL_FOUND AND X11_FOUND)
set(GSdx TRUE)

View File

@ -29,25 +29,19 @@ set(OptimizationFlags
-DNDEBUG
)
if(projectSDL)
set(SDLFlags -DENABLE_SDL_DEV)
else(projectSDL)
set(SDLFlags "")
endif(projectSDL)
# Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(${CommonFlags} ${SDLFlags} -DOGL_DEBUG -g -Wall)
add_definitions(${CommonFlags} -DOGL_DEBUG -g -Wall)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -g -W)
add_definitions(${CommonFlags} ${OptimizationFlags} -g -W)
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build
if(CMAKE_BUILD_TYPE STREQUAL Release)
add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -W)
add_definitions(${CommonFlags} ${OptimizationFlags} -W)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
if(XDG_STD)
@ -72,7 +66,6 @@ set(GSdxSources
GSCrc.cpp
GSDevice.cpp
GSDeviceOGL.cpp
GSDeviceSDL.cpp
GSDeviceSW.cpp
GSDeviceNull.cpp
GSDirtyRect.cpp
@ -190,9 +183,6 @@ add_library(${Output} SHARED ${GSdxSources} ${GSdxHeaders})
target_link_libraries(${Output} ${X11_LIBRARIES})
target_link_libraries(${Output} ${GLEW_LIBRARY})
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
if(projectSDL)
target_link_libraries(${Output} ${SDL_LIBRARY})
endif(projectSDL)
if(Linux)
target_link_libraries(${Output} ${GTK2_LIBRARIES})
@ -223,7 +213,7 @@ if(BUILD_REPLAY_LOADERS)
# We can have separate option for gsdx inside the player. It will only
# cost a 2nd rebuild of gsdx...
#add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -W)
#add_definitions(${CommonFlags} ${OptimizationFlags} -W)
add_library(${Static} STATIC ${GSdxSources} ${GSdxHeaders})
@ -233,9 +223,6 @@ if(BUILD_REPLAY_LOADERS)
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Static} ${SDL_LIBRARY})
endif(projectSDL)
target_link_libraries(${Replay} ${Static})
# Warning others lib must be linked after GSdx...
@ -243,10 +230,6 @@ if(BUILD_REPLAY_LOADERS)
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Replay} ${SDL_LIBRARY})
endif(projectSDL)
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")

View File

@ -23,7 +23,6 @@
#include "GSdx.h"
#include "GSUtil.h"
#include "GPURendererSW.h"
#include "GSDeviceSDL.h"
#include "GSDeviceNull.h"
#ifdef _WINDOWS
@ -118,9 +117,6 @@ EXPORT_C_(int32) GPUopen(void* hWnd)
case 0: s_gpu = new GPURendererSW(new GSDevice9(), threads); break;
case 1: s_gpu = new GPURendererSW(new GSDevice11(), threads); break;
#endif
#ifdef ENABLE_SDL_DEV
case 2: s_gpu = new GPURendererSW(new GSDeviceSDL(), threads); break;
#endif
case 3: s_gpu = new GPURendererSW(new GSDeviceNull(), threads); break;
//case 4: s_gpu = new GPURendererNull(new GSDeviceNull()); break;
}

View File

@ -24,7 +24,6 @@
#include "GSUtil.h"
#include "GSRendererSW.h"
#include "GSRendererNull.h"
#include "GSDeviceSDL.h"
#include "GSDeviceNull.h"
#ifdef _WINDOWS
@ -141,16 +140,6 @@ EXPORT_C_(int) GSinit()
#endif
#ifdef ENABLE_SDL_DEV
if(!SDL_WasInit(SDL_INIT_VIDEO))
{
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
return -1;
}
}
#endif
return 0;
}
@ -162,10 +151,6 @@ EXPORT_C GSshutdown()
s_renderer = -1;
#ifdef ENABLE_SDL_DEV
SDL_Quit();
#endif
#ifdef _WINDOWS
if(SUCCEEDED(s_hr))
@ -246,9 +231,6 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
case 0: dev = new GSDevice9(); break;
case 1: dev = new GSDevice11(); break;
#endif
#ifdef ENABLE_SDL_DEV
case 2: dev = new GSDeviceSDL(); break;
#endif
#ifdef _LINUX
case 4: dev = new GSDeviceOGL(); break;
#endif

View File

@ -1,234 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "stdafx.h"
#include "GSDeviceSDL.h"
#ifdef ENABLE_SDL_DEV
GSDeviceSDL::GSDeviceSDL()
: m_free_window(false)
, m_window(NULL)
, m_renderer(NULL)
, m_texture(NULL)
{
}
GSDeviceSDL::~GSDeviceSDL()
{
if(m_texture != NULL)
{
SDL_DestroyTexture(m_texture);
}
if(m_renderer != NULL)
{
SDL_DestroyRenderer(m_renderer);
}
if(m_window != NULL && m_free_window)
{
SDL_DestroyWindow(m_window);
}
}
bool GSDeviceSDL::Create(GSWnd* wnd)
{
if (m_window == NULL) {
m_window = SDL_CreateWindowFrom(wnd->GetHandle());
m_free_window = true;
}
#ifdef __LINUX__
// In GSopen2, sdl failed to received any resize event. GSWnd::GetClientRect need to manually
// set the window size... So we send the m_window to the wnd object to allow some manipulation on it.
wnd->SetWindow(m_window);
#endif
return GSDeviceSW::Create(wnd);
}
bool GSDeviceSDL::Reset(int w, int h)
{
if(!GSDeviceSW::Reset(w, h))
{
return false;
}
delete m_backbuffer;
m_backbuffer = new GSDummyTexture(w, h);
if(m_texture != NULL)
{
SDL_DestroyTexture(m_texture);
m_texture = NULL;
}
if(m_renderer != NULL)
{
SDL_DestroyRenderer(m_renderer);
m_renderer = NULL;
}
m_renderer = SDL_CreateRenderer(m_window, -1, SDL_RENDERER_ACCELERATED); // SDL_RENDERER_PRESENTVSYNC
if(m_renderer == NULL)
{
return false;
}
SDL_RenderClear(m_renderer);
SDL_RenderPresent(m_renderer);
m_format = SDL_PIXELFORMAT_ARGB8888;
SDL_RendererInfo info;
memset(&info, 0, sizeof(info));
SDL_GetRendererInfo(m_renderer, &info);
for(uint32 i = 0; i < info.num_texture_formats; i++)
{
if(info.texture_formats[i] == SDL_PIXELFORMAT_ABGR8888)
{
m_format = SDL_PIXELFORMAT_ABGR8888;
}
}
return true;
}
void GSDeviceSDL::Present(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader)
{
ASSERT(dt == m_backbuffer); // ignore m_backbuffer
GSVector2i size = st->GetSize();
if(m_texture != NULL)
{
Uint32 format;
int access;
int w, h;
if(SDL_QueryTexture(m_texture, &format, &access, &w, &h) < 0)
{
return;
}
if(w != size.x || h != size.y)
{
SDL_DestroyTexture(m_texture);
m_texture = NULL;
}
}
if(m_texture == NULL)
{
m_texture = SDL_CreateTexture(m_renderer, m_format, SDL_TEXTUREACCESS_STREAMING, size.x, size.y);
}
if(m_texture == NULL)
{
return;
}
GSTexture::GSMap sm, dm;
if(SDL_LockTexture(m_texture, NULL, (void**)&dm.bits, &dm.pitch) == 0)
{
if(st->Map(sm, NULL))
{
GSVector2i s = st->GetSize();
if(m_format == SDL_PIXELFORMAT_ARGB8888)
{
if(((int)dm.bits & 15) == 0 && (dm.pitch & 15) == 0)
{
for(int j = s.y; j > 0; j--, sm.bits += sm.pitch, dm.bits += dm.pitch)
{
GSVector4i* RESTRICT src = (GSVector4i*)sm.bits;
GSVector4i* RESTRICT dst = (GSVector4i*)dm.bits;
for(int i = s.x >> 2; i > 0; i--, dst++, src++)
{
*dst = ((*src & 0x00ff0000) >> 16) | ((*src & 0x000000ff) << 16) | (*src & 0x0000ff00);
}
uint32* RESTRICT src2 = (uint32*)src;
uint32* RESTRICT dst2 = (uint32*)dst;
for(int i = s.x & 3; i > 0; i--, dst2++, src2++)
{
*dst2 = ((*src2 & 0x00ff0000) >> 16) | ((*src2 & 0x000000ff) << 16) | (*src2 & 0x0000ff00);
}
}
}
else
{
// VirtualBox/Ubuntu does not return an aligned pointer
for(int j = s.y; j > 0; j--, sm.bits += sm.pitch, dm.bits += dm.pitch)
{
uint32* RESTRICT src = (uint32*)sm.bits;
uint32* RESTRICT dst = (uint32*)dm.bits;
for(int i = s.x; i > 0; i--, dst++, src++)
{
*dst = ((*src & 0x00ff0000) >> 16) | ((*src & 0x000000ff) << 16) | (*src & 0x0000ff00);
}
}
}
}
else
{
for(int j = s.y; j > 0; j--, sm.bits += sm.pitch, dm.bits += dm.pitch)
{
memcpy(dm.bits, sm.bits, s.x * 4);
}
}
st->Unmap();
}
SDL_UnlockTexture(m_texture);
}
GSVector4i dri(dr);
SDL_Rect r;
r.x = dri.left;
r.y = dri.top;
r.w = dri.width();
r.h = dri.height();
SDL_RenderClear(m_renderer);
SDL_RenderCopy(m_renderer, m_texture, NULL, &r);
}
void GSDeviceSDL::Flip()
{
SDL_RenderPresent(m_renderer);
}
#endif

View File

@ -1,58 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#ifdef ENABLE_SDL_DEV
#include "GSDeviceSW.h"
#include "../../3rdparty/SDL-1.3.0-5387/include/SDL.h"
class GSDeviceSDL : public GSDeviceSW
{
bool m_free_window;
SDL_Window* m_window;
SDL_Renderer* m_renderer;
SDL_Texture* m_texture;
int m_format;
class GSDummyTexture : public GSTexture
{
public:
GSDummyTexture(int w, int h) {m_size.x = w; m_size.y = h; }
virtual ~GSDummyTexture() {}
virtual bool Update(const GSVector4i& r, const void* data, int pitch) {return false;}
virtual bool Map(GSMap& m, const GSVector4i* r = NULL) {return false;}
virtual void Unmap() {}
virtual bool Save(const string& fn, bool dds = false) {return false;}
};
public:
GSDeviceSDL();
virtual ~GSDeviceSDL();
bool Create(GSWnd* wnd);
bool Reset(int w, int h);
void Present(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0);
void Flip();
};
#endif

View File

@ -68,11 +68,7 @@ GtkWidget* CreateRenderComboBox()
// better use opengl instead of SDL
case 6:
case 7:
#ifdef ENABLE_SDL_DEV
label += " (deprecated)";
#else
label += " (removed)";
#endif
break;
// (dev only) for any NULL stuff
@ -94,10 +90,6 @@ GtkWidget* CreateRenderComboBox()
switch (theApp.GetConfig("renderer", 0)) {
// Note the value are based on m_gs_renderers vector on GSdx.cpp
#ifdef ENABLE_SDL_DEV
case 7 : renderer_box_position = 0; break;
case 8 : renderer_box_position = 1; break;
#endif
case 10: renderer_box_position = 2; break;
case 11: renderer_box_position = 3; break;
case 12: renderer_box_position = 4; break;
@ -163,7 +155,7 @@ GtkWidget* CreateFilterComboBox()
void toggle_widget_states( GtkWidget *widget, gpointer callback_data )
{
int render_type;
bool hardware_render = false, software_render = false, sdl_render = false, null_render = false;
bool hardware_render = false, software_render = false, null_render = false;
render_type = gtk_combo_box_get_active(GTK_COMBO_BOX(render_combo_box));
hardware_render = ((render_type % 3) == 1);
@ -443,10 +435,6 @@ bool RunLinuxDialog()
if (gtk_combo_box_get_active(GTK_COMBO_BOX(render_combo_box)) != -1) {
// Note the value are based on m_gs_renderers vector on GSdx.cpp
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(render_combo_box))) {
#ifdef ENABLE_SDL_DEV
case 0: theApp.SetConfig("renderer", 7); break;
case 1: theApp.SetConfig("renderer", 8); break;
#endif
case 2: theApp.SetConfig("renderer", 10); break;
case 3: theApp.SetConfig("renderer", 11); break;
case 4: theApp.SetConfig("renderer", 12); break;

View File

@ -219,13 +219,6 @@ GSWnd::GSWnd()
GSWnd::~GSWnd()
{
#ifdef ENABLE_SDL_DEV
if(m_window != NULL && m_managed)
{
SDL_DestroyWindow(m_window);
m_window = NULL;
}
#endif
if (m_XDisplay) {
XCloseDisplay(m_XDisplay);
m_XDisplay = NULL;
@ -315,16 +308,16 @@ bool GSWnd::Attach(void* handle, bool managed)
m_managed = managed;
m_renderer = theApp.GetConfig("renderer", 0) / 3;
if (m_renderer != 2) {
m_XDisplay = XOpenDisplay(NULL);
assert(m_renderer != 2);
// Note: 4.2 crash on latest nvidia drivers!
if (!CreateContext(3, 3)) return false;
m_XDisplay = XOpenDisplay(NULL);
AttachContext();
// Note: 4.2 crash on latest nvidia drivers!
if (!CreateContext(3, 3)) return false;
CheckContext();
}
AttachContext();
CheckContext();
return true;
}
@ -333,18 +326,9 @@ void GSWnd::Detach()
{
// Actually the destructor is not called when there is only a GSclose/GSshutdown
// The window still need to be closed
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
if(m_window != NULL && m_managed)
{
SDL_DestroyWindow(m_window);
m_window = NULL;
}
#endif
} else {
DetachContext();
if (m_context) glXDestroyContext(m_XDisplay, m_context);
}
DetachContext();
if (m_context) glXDestroyContext(m_XDisplay, m_context);
if (m_XDisplay) {
XCloseDisplay(m_XDisplay);
m_XDisplay = NULL;
@ -362,95 +346,46 @@ bool GSWnd::Create(const string& title, int w, int h)
m_managed = true;
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
// note this part must be only executed when replaying .gs debug file
m_XDisplay = XOpenDisplay(NULL);
#ifdef _LINUX
// When you reconfigure the plugins during the play, SDL is shutdown so SDL_GetNumVideoDisplays return 0
// and the plugins is badly closed. NOTE: SDL is initialized in SDL_CreateWindow.
//
// I'm not sure this sanity check is still useful, normally (I hope) SDL_CreateWindow will return a null
// hence a false for this current function.
// For the moment do an init -- Gregory
if(!SDL_WasInit(SDL_INIT_VIDEO))
if(SDL_Init(SDL_INIT_VIDEO) < 0) return false;
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
None
};
XVisualInfo* vi = glXChooseVisual(m_XDisplay, DefaultScreen(m_XDisplay), attrListDbl);
// Sanity check; if there aren't any video displays available, we can't create a window.
if (SDL_GetNumVideoDisplays() <= 0) return false;
#endif
/* create a color map */
XSetWindowAttributes attr;
attr.colormap = XCreateColormap(m_XDisplay, RootWindow(m_XDisplay, vi->screen),
vi->visual, AllocNone);
attr.border_pixel = 0;
attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask |
EnterWindowMask | LeaveWindowMask | FocusChangeMask ;
m_window = SDL_CreateWindow(title.c_str(), 100, 100, w, h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
// Create a window at the last position/size
m_Xwindow = XCreateWindow(m_XDisplay, RootWindow(m_XDisplay, vi->screen),
0 , 0 , w, h, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);
// Get the X window from the newly created window
// It would be needed to get the current size
SDL_SysWMinfo wminfo;
memset(&wminfo, 0, sizeof(wminfo));
XMapWindow (m_XDisplay, m_Xwindow);
XFree(vi);
wminfo.version.major = SDL_MAJOR_VERSION;
wminfo.version.minor = SDL_MINOR_VERSION;
if (!CreateContext(3, 3)) return false;
SDL_GetWindowWMInfo(m_window, &wminfo);
m_Xwindow = wminfo.info.x11.window;
AttachContext();
#endif
return (m_window != NULL);
} else {
// note this part must be only executed when replaying .gs debug file
m_XDisplay = XOpenDisplay(NULL);
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
None
};
XVisualInfo* vi = glXChooseVisual(m_XDisplay, DefaultScreen(m_XDisplay), attrListDbl);
/* create a color map */
XSetWindowAttributes attr;
attr.colormap = XCreateColormap(m_XDisplay, RootWindow(m_XDisplay, vi->screen),
vi->visual, AllocNone);
attr.border_pixel = 0;
attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask |
EnterWindowMask | LeaveWindowMask | FocusChangeMask ;
// Create a window at the last position/size
m_Xwindow = XCreateWindow(m_XDisplay, RootWindow(m_XDisplay, vi->screen),
0 , 0 , w, h, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);
XMapWindow (m_XDisplay, m_Xwindow);
XFree(vi);
if (!CreateContext(3, 3)) return false;
AttachContext();
return (m_Xwindow != 0);
}
return (m_Xwindow != 0);
}
Display* GSWnd::GetDisplay()
{
#ifdef ENABLE_SDL_DEV
SDL_SysWMinfo wminfo;
memset(&wminfo, 0, sizeof(wminfo));
wminfo.version.major = SDL_MAJOR_VERSION;
wminfo.version.minor = SDL_MINOR_VERSION;
SDL_GetWindowWMInfo(m_window, &wminfo);
return wminfo.subsystem == SDL_SYSWM_X11 ? wminfo.info.x11.display : NULL;
#else
// note this part must be only executed when replaying .gs debug file
return m_XDisplay;
#endif
}
GSVector4i GSWnd::GetClientRect()
@ -464,17 +399,8 @@ GSVector4i GSWnd::GetClientRect()
int xDummy;
int yDummy;
// In gsopen2, pcsx2 stoles all event (including resize event). SDL is not able to update its structure
// so you must do it yourself
// In perfect world:
// if (m_window) SDL_GetWindowSize(m_window, &w, &h);
// In real world...:
if (!m_XDisplay) m_XDisplay = XOpenDisplay(NULL);
XGetGeometry(m_XDisplay, m_Xwindow, &winDummy, &xDummy, &yDummy, &w, &h, &borderDummy, &depthDummy);
#ifdef ENABLE_SDL_DEV
if (m_renderer == 2)
SDL_SetWindowSize(m_window, w, h);
#endif
return GSVector4i(0, 0, (int)w, (int)h);
}
@ -486,78 +412,36 @@ bool GSWnd::SetWindowText(const char* title)
{
if (!m_managed) return true;
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
XTextProperty prop;
// Do not find anyway to check the current fullscreen status
// Better than nothing heuristic, check the window position. Fullscreen = (0,0)
// if(!(m_window->flags & SDL_WINDOW_FULLSCREEN) ) // Do not compile
//
// We call SDL_PumpEvents to refresh x and y value.
// but we not use this function anyway.
// FIXME: it does not feel a good solution -- Gregory
// NOte: it might be more thread safe to use a call to XGetGeometry
int x,y = 0;
SDL_PumpEvents();
SDL_GetWindowPosition(m_window, &x, &y);
if ( x && y )
SDL_SetWindowTitle(m_window, title);
memset(&prop, 0, sizeof(prop));
#endif
} else {
XTextProperty prop;
memset(&prop, 0, sizeof(prop));
char* ptitle = (char*)title;
if (XStringListToTextProperty(&ptitle, 1, &prop)) {
XSetWMName(m_XDisplay, m_Xwindow, &prop);
}
XFree(prop.value);
XFlush(m_XDisplay);
char* ptitle = (char*)title;
if (XStringListToTextProperty(&ptitle, 1, &prop)) {
XSetWMName(m_XDisplay, m_Xwindow, &prop);
}
XFree(prop.value);
XFlush(m_XDisplay);
return true;
}
void GSWnd::Flip()
{
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_GL_SwapWindow(m_window);
#else
SDL_GL_SwapBuffers();
#endif
#endif
} else {
glXSwapBuffers(m_XDisplay, m_Xwindow);
}
glXSwapBuffers(m_XDisplay, m_Xwindow);
}
void GSWnd::Show()
{
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
SDL_ShowWindow(m_window);
#endif
} else {
XMapRaised(m_XDisplay, m_Xwindow);
XFlush(m_XDisplay);
}
XMapRaised(m_XDisplay, m_Xwindow);
XFlush(m_XDisplay);
}
void GSWnd::Hide()
{
if (m_renderer == 2) {
#ifdef ENABLE_SDL_DEV
SDL_HideWindow(m_window);
#endif
} else {
XUnmapWindow(m_XDisplay, m_Xwindow);
XFlush(m_XDisplay);
}
XUnmapWindow(m_XDisplay, m_Xwindow);
XFlush(m_XDisplay);
}
void GSWnd::HideFrame()

View File

@ -55,51 +55,12 @@ public:
};
#else
/*
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
class GSWnd
{
Display* m_display;
Window m_window;
bool m_managed; // set true when we're attached to a 3rdparty window that's amanged by the emulator
bool m_frame;
public:
GSWnd();
virtual ~GSWnd();
bool Create(const string& title, int w, int h);
bool Attach(void* handle, bool managed = true) {return false;}
void Detach() {}
bool IsManaged() const {return m_managed;}
Display* GetDisplay() {return m_display;}
void* GetHandle() {return (void*)m_window;}
GSVector4i GetClientRect();
bool SetWindowText(const char* title);
void Show();
void Hide();
void HideFrame();
};
*/
#include <X11/Xlib.h>
#ifdef ENABLE_SDL_DEV
#include "../../3rdparty/SDL-1.3.0-5387/include/SDL.h"
#include "../../3rdparty/SDL-1.3.0-5387/include/SDL_syswm.h"
#endif
class GSWnd
{
#ifdef ENABLE_SDL_DEV
SDL_Window* m_window;
#else
void* m_window;
#endif
Window m_Xwindow;
Display* m_XDisplay;
@ -122,9 +83,6 @@ public:
void* GetHandle() {return (void*)m_Xwindow;}
GSVector4i GetClientRect();
bool SetWindowText(const char* title);
#ifdef ENABLE_SDL_DEV
void SetWindow(SDL_Window* current_window) { if (current_window) m_window = current_window; }
#endif
bool CreateContext(int major, int minor);
void AttachContext();

View File

@ -89,8 +89,6 @@
<Unit filename="GSDevice.h" />
<Unit filename="GSDeviceNull.cpp" />
<Unit filename="GSDeviceNull.h" />
<Unit filename="GSDeviceSDL.cpp" />
<Unit filename="GSDeviceSDL.h" />
<Unit filename="GSDeviceSW.cpp" />
<Unit filename="GSDeviceSW.h" />
<Unit filename="GSDirtyRect.cpp" />

View File

@ -83,8 +83,6 @@
<Unit filename="GSDevice.h" />
<Unit filename="GSDeviceNull.cpp" />
<Unit filename="GSDeviceNull.h" />
<Unit filename="GSDeviceSDL.cpp" />
<Unit filename="GSDeviceSDL.h" />
<Unit filename="GSDeviceSW.cpp" />
<Unit filename="GSDeviceSW.h" />
<Unit filename="GSDirtyRect.cpp" />

View File

@ -460,7 +460,6 @@
<ClCompile Include="GSDevice9.cpp" />
<ClCompile Include="GSDeviceDX.cpp" />
<ClCompile Include="GSDeviceNull.cpp" />
<ClCompile Include="GSDeviceSDL.cpp" />
<ClCompile Include="GSDeviceSW.cpp" />
<ClCompile Include="GSDialog.cpp" />
<ClCompile Include="GSDirtyRect.cpp" />
@ -1588,7 +1587,6 @@
<ClInclude Include="GSDevice9.h" />
<ClInclude Include="GSDeviceDX.h" />
<ClInclude Include="GSDeviceNull.h" />
<ClInclude Include="GSDeviceSDL.h" />
<ClInclude Include="GSDeviceSW.h" />
<ClInclude Include="GSDialog.h" />
<ClInclude Include="GSDirtyRect.h" />
@ -1688,11 +1686,6 @@
<ItemGroup>
<ResourceCompile Include="GSdx.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\3rdparty\SDL-1.3.0-5387\VisualC\SDL\SDL_VS2010.vcxproj">
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
@ -1701,4 +1694,4 @@
<UserProperties RESOURCE_FILE="GSdx.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
</Project>

View File

@ -285,9 +285,6 @@
<ClCompile Include="GSDeviceSW.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GSDeviceSDL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GSSetupPrimCodeGenerator.x64.avx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -632,9 +629,6 @@
<ClInclude Include="GSDeviceSW.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GSDeviceSDL.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -683,4 +677,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -767,13 +767,6 @@
/>
</Configuration>
</Configurations>
<References>
<ProjectReference
ReferencedProjectIdentifier="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
CopyLocal="false"
RelativePathToProject=".\3rdparty\SDL-1.3.0-5387\VisualC\SDL\SDL_VS2008.vcproj"
/>
</References>
<Files>
<Filter
Name="Source Files"
@ -868,10 +861,6 @@
RelativePath=".\GSDeviceNull.cpp"
>
</File>
<File
RelativePath=".\GSDeviceSDL.cpp"
>
</File>
<File
RelativePath=".\GSDeviceSW.cpp"
>
@ -1470,10 +1459,6 @@
RelativePath=".\GSDeviceNull.h"
>
</File>
<File
RelativePath=".\GSDeviceSDL.h"
>
</File>
<File
RelativePath=".\GSDeviceSW.h"
>