Selaa lähdekoodia

Some Linux fixes

Panagiotis Christopoulos Charitos 3 vuotta sitten
vanhempi
sitoutus
156db10822
4 muutettua tiedostoa jossa 11 lisäystä ja 24 poistoa
  1. 2 1
      AnKi/Core/App.cpp
  2. 1 1
      AnKi/Core/ConfigVars.defs.h
  3. 2 7
      AnKi/Core/NativeWindow.h
  4. 6 15
      AnKi/Core/NativeWindowSdl.cpp

+ 2 - 1
AnKi/Core/App.cpp

@@ -240,7 +240,8 @@ Error App::initInternal(AllocAlignedCallback allocCb, void* allocCbUserData)
 	nwinit.m_height = m_config->getHeight();
 	nwinit.m_depthBits = 0;
 	nwinit.m_stencilBits = 0;
-	nwinit.m_fullscreenDesktopRez = NativeWindowInitInfo::WindowMode(m_config->getWindowFullscreen());
+	nwinit.m_fullscreenDesktopRez = m_config->getWindowFullscreen() > 0;
+	nwinit.m_exclusiveFullscreen = m_config->getWindowFullscreen() == 2;
 	ANKI_CHECK(NativeWindow::newInstance(nwinit, m_window));
 
 	//

+ 1 - 1
AnKi/Core/ConfigVars.defs.h

@@ -15,7 +15,7 @@ ANKI_CONFIG_VAR_BOOL(CoreMaliHwCounters, false, "Enable Mali counters")
 
 ANKI_CONFIG_VAR_U32(Width, 1920, 16, 16 * 1024, "Width")
 ANKI_CONFIG_VAR_U32(Height, 1080, 16, 16 * 1024, "Height")
-ANKI_CONFIG_VAR_U32(WindowFullscreen, 1, 0, 2, "Start at fullscreen")
+ANKI_CONFIG_VAR_U32(WindowFullscreen, 1, 0, 2, "0: windowed, 1: borderless fullscreen, 2: exclusive fullscreen")
 
 ANKI_CONFIG_VAR_U32(CoreTargetFps, 60u, 30u, MAX_U32, "Target FPS")
 ANKI_CONFIG_VAR_U32(CoreJobThreadCount, max(2u, getCpuCoresCount() / 2u), 2u, 1024u, "Number of job thread")

+ 2 - 7
AnKi/Core/NativeWindow.h

@@ -17,12 +17,6 @@ namespace anki {
 class NativeWindowInitInfo
 {
 public:
-	enum class WindowMode : U8
-	{
-		Windowed = 0,
-		Fullscreen = 1,
-		FullscreenExclusive = 2
-	};
 	AllocAlignedCallback m_allocCallback = nullptr;
 	void* m_allocCallbackUserData = nullptr;
 
@@ -34,7 +28,8 @@ public:
 	U32 m_samplesCount = 0;
 	static const Bool m_doubleBuffer = true;
 	/// Create a fullscreen window with the desktop's resolution
-	WindowMode m_fullscreenDesktopRez = WindowMode::Windowed;
+	Bool m_fullscreenDesktopRez = false;
+	Bool m_exclusiveFullscreen = false;
 
 	CString m_title = "AnKi";
 };

+ 6 - 15
AnKi/Core/NativeWindowSdl.cpp

@@ -80,19 +80,6 @@ Error NativeWindowSdl::init(const NativeWindowInitInfo& init)
 	//
 	ANKI_CORE_LOGI("Creating SDL window. SDL version %u.%u", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
 
-#if ANKI_GR_BACKEND_GL
-	if(SDL_GL_SetAttribute(SDL_GL_RED_SIZE, init.m_rgbaBits[0])
-	   || SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, init.m_rgbaBits[1])
-	   || SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, init.m_rgbaBits[2])
-	   || SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, init.m_rgbaBits[3])
-	   || SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, init.m_depthBits)
-	   || SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, init.m_doubleBuffer))
-	{
-		ANKI_CORE_LOGE("SDL_GL_SetAttribute() failed");
-		return Error::FUNCTION_FAILED;
-	}
-#endif
-
 	//
 	// Create window
 	//
@@ -105,9 +92,13 @@ Error NativeWindowSdl::init(const NativeWindowInitInfo& init)
 #endif
 
 	SDL_SetHint(SDL_HINT_ALLOW_TOPMOST, "0");
-	if(init.m_fullscreenDesktopRez != NativeWindowInitInfo::WindowMode::Windowed)
+	if(init.m_fullscreenDesktopRez)
 	{
-		if(init.m_fullscreenDesktopRez == NativeWindowInitInfo::WindowMode::FullscreenExclusive)
+#if ANKI_OS_WINDOWS
+		flags |= SDL_WINDOW_FULLSCREEN;
+#endif
+
+		if(init.m_exclusiveFullscreen)
 		{
 			flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
 		}