IDCompositionDevice2::CreateSurfaceFactory method (dcomp.h)

Creates a Microsoft DirectComposition surface factory object, which can be used to create other DirectComposition surface or virtual surface objects

Syntax

HRESULT CreateSurfaceFactory(
  [in]  IUnknown                    *renderingDevice,
  [out] IDCompositionSurfaceFactory **surfaceFactory
);

Parameters

[in] renderingDevice

A pointer to a DirectX device to be used to create DirectComposition surface objects. Must be a pointer to an object implementing the IDXGIDevice or ID2D1Device interfaces. This parameter must not be NULL.

[out] surfaceFactory

The newly created surface factory object. This parameter must not be NULL.

Return value

If the function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. See DirectComposition Error Codes for a list of error codes.

Remarks

A surface factory allows an application to simultaneously use more than one single DXGI or Direct2D device with DirectComposition. Each surface factory has a permanent association with one DXGI or Direct2D device, but a DirectComposition device may have any number of surface factories.

Each surface factory manages resources independently from the others. In particular, DirectComposition pools surface allocations to mitigate surface allocation and deallocation costs. This pool is done on a per-surface factory basis.

If the DCompositionCreateDevice2 function is called with a non-NULL renderingDevice parameter, the returned DirectComposition device object has an implicit surface factory under the covers associated with the given rendering device. This implicit surface factory is used to service the IDCompositionDevice::CreateSurface, IDCompositionDevice::CreateVirtualSurface, IDCompositionDevice2::CreateSurface and IDCompositionDevice2::CreateVirtualSurface methods.

A surface object remains alive as long as any of the surfaces or virtual surfaces that it created remain alive, either directly because the application holds a direct reference, or indirectly because one or more such surfaces are associated with one or more visual objects.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header dcomp.h
Library Dcomp.lib
DLL Dcomp.dll

See also

IDCompositionDevice2

IDCompositionDevice2::CreateSurface

IDCompositionDevice2::CreateVirtualSurface