-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conhost UseDx mode #10770
Fix conhost UseDx mode #10770
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,6 @@ using namespace Microsoft::Console::Types; | |
// TODO GH 2683: The default constructor should not throw. | ||
DxEngine::DxEngine() : | ||
RenderEngineBase(), | ||
_invalidateFullRows{ true }, | ||
_pool{ til::pmr::get_default_resource() }, | ||
_invalidMap{ &_pool }, | ||
_invalidScroll{}, | ||
|
@@ -583,6 +582,9 @@ try | |
|
||
_displaySizePixels = _GetClientSize(); | ||
|
||
_invalidMap.resize(_displaySizePixels / _fontRenderData->GlyphCell()); | ||
RETURN_IF_FAILED(InvalidateAll()); | ||
|
||
// Get the other device types so we have deeper access to more functionality | ||
// in our pipeline than by just walking straight from the D3D device. | ||
|
||
|
@@ -963,8 +965,6 @@ CATCH_RETURN() | |
try | ||
{ | ||
_sizeTarget = Pixels; | ||
|
||
_invalidMap.resize(_sizeTarget / _fontRenderData->GlyphCell(), true); | ||
return S_OK; | ||
} | ||
CATCH_RETURN(); | ||
|
@@ -1047,14 +1047,10 @@ HANDLE DxEngine::GetSwapChainHandle() | |
|
||
void DxEngine::_InvalidateRectangle(const til::rectangle& rc) | ||
{ | ||
auto invalidate = rc; | ||
|
||
if (_invalidateFullRows) | ||
{ | ||
invalidate = til::rectangle{ til::point{ static_cast<ptrdiff_t>(0), rc.top() }, til::size{ _invalidMap.size().width(), rc.height() } }; | ||
} | ||
|
||
_invalidMap.set(invalidate); | ||
const auto size = _invalidMap.size(); | ||
const auto topLeft = til::point{ 0, std::min(size.height(), rc.top()) }; | ||
const auto bottomRight = til::point{ size.width(), std::min(size.height(), rc.bottom()) }; | ||
Comment on lines
+1051
to
+1052
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sure @miniksa will agree: i am surprised we do not have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean we do technically have an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only somewhat verbose 😄
okay I admit, it does look rather cumbersome. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally prefer Dustin's, but I'll take either. The structures and operators are tools to make life easier... not a strict requirement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm reading this correctly, there isn't a strong opinion... as I'd like to keep it the way I did it for now, if you don't mind. 😅 |
||
_invalidMap.set({ topLeft, bottomRight }); | ||
Comment on lines
+1050
to
+1053
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to the missing |
||
} | ||
|
||
bool DxEngine::_IsAllInvalid() const noexcept | ||
|
@@ -1273,7 +1269,7 @@ try | |
// so the entire frame is repainted. | ||
if (_FullRepaintNeeded()) | ||
{ | ||
_invalidMap.set_all(); | ||
RETURN_IF_FAILED(InvalidateAll()); | ||
} | ||
|
||
if (TraceLoggingProviderEnabled(g_hDxRenderProvider, WINEVENT_LEVEL_VERBOSE, TIL_KEYWORD_TRACE)) | ||
|
@@ -1322,8 +1318,8 @@ try | |
// And persist the new size. | ||
_displaySizePixels = clientSize; | ||
|
||
// Mark this as the first frame on the new target. We can't use incremental drawing on the first frame. | ||
_firstFrame = true; | ||
_invalidMap.resize(clientSize / _fontRenderData->GlyphCell()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused -- the body of the PR says "responsibility for resizing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woops I mixed things up. I'm fixing my PR body to say that responsibility for full invalidation was moved there. |
||
RETURN_IF_FAILED(InvalidateAll()); | ||
} | ||
|
||
_d2dDeviceContext->BeginDraw(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you pull this? I presume the answer is:
If that's the answer... maybe leave some of that in a comment in
InvalidateRectangle
so we don't forget.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah basically that. I was touching the only function that uses this field and I doubt this field will ever be useful again, as it's slower to figure out what contains ligatures, compared to just redrawing the entire row. The difference between drawing no text and a full row of text is only ~5μs after all. (Also: YAGNI. 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.