Added dynamic textures sample app.#380
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. |
| 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.
consider initializing these members here with {}
| std::vector<RECT> renderedRectsCurrFrame; | ||
|
|
||
| // Render thread. | ||
| HANDLE m_hRenderThread = nullptr; |
There was a problem hiding this comment.
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.
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.
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.