Skip to content

Commit

Permalink
igl | shell | Introduce different screen modes
Browse files Browse the repository at this point in the history
Summary: Introduced different screen modes for shell apps.

Reviewed By: mmaurer

Differential Revision: D62977516

fbshipit-source-id: 863b3f89be45854cc0bdaef23bbf573c791b747d
  • Loading branch information
corporateshark authored and facebook-github-bot committed Sep 19, 2024
1 parent 8d9de28 commit 8f305c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion shell/shared/renderSession/RenderSessionConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@

namespace igl::shell {

enum class ScreenMode {
Windowed,
FullscreenNoTaskbar,
Fullscreen,
};

struct RenderSessionConfig {
std::string displayName;
BackendVersion backendVersion;
igl::TextureFormat colorFramebufferFormat = igl::TextureFormat::BGRA_UNorm8;
uint32_t width = 1024;
uint32_t height = 768;
bool fullscreen = false;
ScreenMode screenMode = ScreenMode::Windowed;
};

} // namespace igl::shell
4 changes: 2 additions & 2 deletions shell/windows/opengl/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ GLFWwindow* initGLWindow(const shell::RenderSessionConfig& config) {
glfwWindowHint(GLFW_DOUBLEBUFFER, true);
glfwWindowHint(GLFW_RESIZABLE, true);
glfwWindowHint(GLFW_SRGB_CAPABLE, true);
glfwWindowHint(GLFW_MAXIMIZED, config.fullscreen);
glfwWindowHint(GLFW_MAXIMIZED, config.screenMode != shell::ScreenMode::Windowed);

GLFWwindow* windowHandle =
glfwCreateWindow(config.width, config.height, config.displayName.c_str(), NULL, NULL);
Expand Down Expand Up @@ -285,7 +285,7 @@ int main(int argc, char* argv[]) {
.colorFramebufferFormat = TextureFormat::RGBA_SRGB,
.width = 1024,
.height = 768,
.fullscreen = false,
.screenMode = shell::ScreenMode::Windowed,
},
};

Expand Down
4 changes: 2 additions & 2 deletions shell/windows/opengles/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ GLFWwindow* initGLESWindow(const shell::RenderSessionConfig& config) {
glfwWindowHint(GLFW_DOUBLEBUFFER, true);
glfwWindowHint(GLFW_RESIZABLE, true);
glfwWindowHint(GLFW_SRGB_CAPABLE, true);
glfwWindowHint(GLFW_MAXIMIZED, config.fullscreen);
glfwWindowHint(GLFW_MAXIMIZED, config.screenMode != shell::ScreenMode::Windowed);

GLFWwindow* windowHandle =
glfwCreateWindow(config.width, config.height, config.displayName.c_str(), NULL, NULL);
Expand Down Expand Up @@ -192,7 +192,7 @@ int main(int argc, char* argv[]) {
.colorFramebufferFormat = TextureFormat::RGBA_UNorm8,
.width = 1024,
.height = 768,
.fullscreen = false,
.screenMode = shell::ScreenMode::Windowed,
},
};

Expand Down
4 changes: 2 additions & 2 deletions shell/windows/vulkan/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GLFWwindow* initWindow(const shell::RenderSessionConfig& config) {
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
glfwWindowHint(GLFW_MAXIMIZED, config.fullscreen);
glfwWindowHint(GLFW_MAXIMIZED, config.screenMode != shell::ScreenMode::Windowed);

GLFWwindow* windowHandle =
glfwCreateWindow(config.width, config.height, config.displayName.c_str(), nullptr, nullptr);
Expand Down Expand Up @@ -207,7 +207,7 @@ int main(int argc, char* argv[]) {
.colorFramebufferFormat = TextureFormat::BGRA_UNorm8,
.width = 1024,
.height = 768,
.fullscreen = false,
.screenMode = shell::ScreenMode::Windowed,
},
};

Expand Down

0 comments on commit 8f305c6

Please sign in to comment.