Uwp 是否可以在windows composition api中获取给定合成器的渲染设备?

Uwp 是否可以在windows composition api中获取给定合成器的渲染设备?,uwp,com,uwp-xaml,c++-winrt,Uwp,Com,Uwp Xaml,C++ Winrt,我想知道是否有可能为给定xaml控件的合成器调用此API函数: 我的想法大致如下: // Get the graphics device for the compositor auto compositor = Window::Current().Compositor(); com_ptr<ICompositorInterop> comp_interop{ compositor.as<ICompositorInterop> }; com_

我想知道是否有可能为给定xaml控件的合成器调用此API函数:

我的想法大致如下:

    // Get the graphics device for the compositor
    auto compositor = Window::Current().Compositor();
    com_ptr<ICompositorInterop> comp_interop{ compositor.as<ICompositorInterop> };
    com_ptr<ICompositionGraphicsDevice> m_compgd{nullptr};
    comp_interop->GetGraphicsDevice(m_compgd.put()); // This doesn't actually exist.

    // Get the rendering device
    com_ptr<ICompositionGraphicsDeviceInterop> compgd_interop{m_compgd.as<ICompositionGraphicsDeviceInterop>()};
    com_ptr<IUnknown> m_device{ nullptr };
    check_hresult(
        compgd_interop->GetRenderingDevice(m_device.put())
    );
//获取合成器的图形设备
自动合成器=窗口::当前().合成器();
com_ptr comp_interop{compositor.as};
com_ptr m_compgd{nullptr};
comp_interop->GetGraphicsDevice(m_compgd.put());//这实际上并不存在。
//获取渲染设备
com_ptr compgd_interop{m_compgd.as()};
com_ptr m_设备{nullptr};
检查结果(
compgd_interop->GetRenderingDevice(m_device.put())
);

除了因为没有可用的
GetGraphicsDevice
函数,这显然不起作用之外,只有
CreateGraphicsDevice

回答了您的问题:?不幸的是,没有,因为在那个演示中Kenny自己创建了设备,然后使用它。我正在尝试从xaml控件获取现有设备。您可以访问特定xaml元素的底层组合。您可以使用该方法来完成此操作。