-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Added dynamic textures sample app. #380
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
base: main
Are you sure you want to change the base?
Conversation
|
@oldnewthing is it ok to commit directly to this repo or should this go through the staging branch? |
|
We generally prefer that samples go through staging. Internal documentation here: https://www.osgwiki.com/wiki/Classic_Samples |
This goes against samples guidance. Samples should show best practices. |
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.
Raymond is suggesting using the samples process. but if there is a reason to not do that... this looks good to me. if your API review reps want a comment in dcomp-preview.h please add it.
| D2D_POINT_2F positions[N]; | ||
| D2D_POINT_2F velocities[N]; | ||
| D2D1_COLOR_F colors[N] = { {0.9f, 0.2f, 0.1f, 1.0f} , {0.1f, 0.9f, 0.2f, 1.0f}, {0.1f, 0.2f, 0.9f, 1.0f}, {0.8f, 0.2f, 0.9f, 1.0f} }; | ||
| LARGE_INTEGER frequency; |
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.
consider initializing these members here with {}
| std::vector<RECT> renderedRectsCurrFrame; | ||
|
|
||
| // Render thread. | ||
| HANDLE m_hRenderThread = nullptr; |
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.
wil::unique_handle to manage the thread lifetime. consider using std::thread instead.
| // Render thread. | ||
| HANDLE m_hRenderThread = nullptr; | ||
| DWORD m_dwRenderThreadId = 0; | ||
| volatile bool m_running = false; |
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.
volatile is suspicious, should this be std::atomic<bool>?
| @@ -0,0 +1,29 @@ | |||
| #ifndef __COMPOSITION_DCOMP_PREVIEW_H__ | |||
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.
add a comment here that explains how this will be replaced with the real SDK when that is ready. and the fact that this is a preview interface that may change in a breaking way.
This sample app shows how to use composition textures and dynamic composition textures. Composition textures allow developers to use d3d textures as content inside dcomp visual, and dynamic textures allow to efficiently provide information about portions of the texture that have been changed in between frames. This allows windows to redraw only necessary parts of the composition texture.
Note: API that is shown in this sample has no validity checks and require developer to strictly follow its documentation. If provided rects are not correct the window may have visible rendering artifacts.