Skip to content

Commit

Permalink
Abstract Session.hpp
Browse files Browse the repository at this point in the history
Summary:
Abstract Session.hpp for representation samples.
Subsequent diff will attempt to use this abstraction for kit/canvas/core/imagetests separately

Reviewed By: EricGriffith

Differential Revision: D47821260

fbshipit-source-id: ebe7cf617f66ba0b5f3ba722a58d2f83c471b03d
  • Loading branch information
MichaelTay authored and facebook-github-bot committed Jul 28, 2023
1 parent b25400d commit c4e240d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shell/mac/ViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ - (void)render {
: igl::SurfaceTextures{[self createTextureFromNativeDrawable],
[self createTextureFromNativeDepth]};
IGL_ASSERT(surfaceTextures.color != nullptr && surfaceTextures.depth != nullptr);
const auto& dims = surfaceTextures.color->getDimensions();
shellParams_.nativeSurfaceDimensions = glm::ivec2{dims.width, dims.height};
session_->update(std::move(surfaceTextures));
if (session_->appParams().exitRequested)
[[NSApplication sharedApplication] terminate:nil];
Expand Down Expand Up @@ -316,6 +318,8 @@ - (void)loadView {

session_ = igl::shell::createDefaultRenderSession(shellPlatform_);
IGL_ASSERT_MSG(session_, "createDefaultRenderSession() must return a valid session");
// Get initial native surface dimensions
shellParams_.nativeSurfaceDimensions = glm::ivec2(2048, 1536);
session_->initialize();
}

Expand Down
1 change: 1 addition & 0 deletions shell/shared/renderSession/ShellParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct ShellParams {
RenderMode renderMode = RenderMode::Mono;
bool shellControlsViewParams = false;
glm::vec2 viewportSize = glm::vec2(1024.0f, 768.0f);
glm::ivec2 nativeSurfaceDimensions = glm::ivec2(2048, 1536);
igl::TextureFormat defaultColorFramebufferFormat = igl::TextureFormat::BGRA_SRGB;
float viewportScale = 1.f;
};
Expand Down

0 comments on commit c4e240d

Please sign in to comment.