Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lhecker committed Jul 8, 2022
1 parent 4ba1f8d commit 4c7738a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/renderer/atlas/AtlasEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ namespace Microsoft::Console::Render

// We need to backup _pos/_size in case our resize below exceeds _maxArea.
// In that case we have to restore _pos/_size so that if _maxArea is increased
// (window resize for instance), we can pick up were we previously left off.
// (window resize for instance), we can pick up where we previously left off.
const auto pos = _pos;

_pos.x += _tileSize.x;
Expand Down
14 changes: 9 additions & 5 deletions src/renderer/atlas/AtlasEngine.r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ void AtlasEngine::_updateConstantBuffer() const noexcept

void AtlasEngine::_adjustAtlasSize()
{
const auto atlasSize = _r.tileAllocator.size();
if (atlasSize.y <= _r.atlasSizeInPixel.y && atlasSize.x <= _r.atlasSizeInPixel.x)
// Only grow the atlas texture if our tileAllocator needs it to be larger.
// We have no way of shrinking our tileAllocator at the moment,
// so technically a `requiredSize != _r.atlasSizeInPixel`
// comparison would be sufficient, but better safe than sorry.
const auto requiredSize = _r.tileAllocator.size();
if (requiredSize.y <= _r.atlasSizeInPixel.y && requiredSize.x <= _r.atlasSizeInPixel.x)
{
return;
}
Expand All @@ -149,8 +153,8 @@ void AtlasEngine::_adjustAtlasSize()
wil::com_ptr<ID3D11ShaderResourceView> atlasView;
{
D3D11_TEXTURE2D_DESC desc{};
desc.Width = atlasSize.x;
desc.Height = atlasSize.y;
desc.Width = requiredSize.x;
desc.Height = requiredSize.y;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
Expand All @@ -175,7 +179,7 @@ void AtlasEngine::_adjustAtlasSize()
_r.deviceContext->CopySubresourceRegion1(atlasBuffer.get(), 0, 0, 0, 0, _r.atlasBuffer.get(), 0, &box, D3D11_COPY_NO_OVERWRITE);
}

_r.atlasSizeInPixel = atlasSize;
_r.atlasSizeInPixel = requiredSize;
_r.atlasBuffer = std::move(atlasBuffer);
_r.atlasView = std::move(atlasView);
_setShaderResources();
Expand Down

0 comments on commit 4c7738a

Please sign in to comment.