在 Direct3D 11.1 中,ID3D11Device1 接口是 ID3D11Device 接口的扩展版本,提供了一些额外的功能和方法。这个接口定义在 D3d11_1.h 头文件中。

以下是 ID3D11Device1 接口的定义:
DECLARE_INTERFACE_(ID3D11Device1, ID3D11Device)
{
    // ID3D11Device methods
    STDMETHOD(CreateBuffer)(THIS_ const D3D11_BUFFER_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Buffer **ppBuffer) PURE;

    // ID3D11Device1 methods
    STDMETHOD(CreateTexture1D)(THIS_ const D3D11_TEXTURE1D_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture1D **ppTexture1D) PURE;
    STDMETHOD(CreateTexture2D)(THIS_ const D3D11_TEXTURE2D_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture2D **ppTexture2D) PURE;
    STDMETHOD(CreateTexture3D)(THIS_ const D3D11_TEXTURE3D_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture3D **ppTexture3D) PURE;
    STDMETHOD(CreateShaderResourceView1)(THIS_ ID3D11Resource *pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC1 *pDesc, ID3D11ShaderResourceView1 **ppSRView) PURE;
    STDMETHOD(CreateUnorderedAccessView1)(THIS_ ID3D11Resource *pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC1 *pDesc, ID3D11UnorderedAccessView1 **ppUAView) PURE;
    STDMETHOD(CreateRenderTargetView1)(THIS_ ID3D11Resource *pResource, const D3D11_RENDER_TARGET_VIEW_DESC1 *pDesc, ID3D11RenderTargetView1 **ppRTView) PURE;
    STDMETHOD(CreateDeviceContextState)(THIS_ UINT Flags, const D3D_FEATURE_LEVEL *pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, REFIID EmulatedInterface, D3D_FEATURE_LEVEL *pChosenFeatureLevel, ID3DDeviceContextState **ppContextState) PURE;
    STDMETHOD_OpenSharedResource1)(THIS_ HANDLE hResource, REFIID returnedInterface, void **ppResource) PURE;
    STDMETHOD_(BOOL, IsD3D11Device1)(THIS) PURE;
    STDMETHOD_(void, GetImmediateContext1)(THIS_ ID3D11DeviceContext1 **ppImmediateContext) PURE;
    STDMETHOD(CreateDeferredContext1)(THIS_ UINT ContextFlags, ID3D11DeviceContext1 **ppDeferredContext) PURE;
    STDMETHOD(CreateBlendState1)(THIS_ const D3D11_BLEND_DESC1 *pBlendStateDesc, ID3D11BlendState1 **ppBlendState) PURE;
    STDMETHOD(CreateRasterizerState1)(THIS_ const D3D11_RASTERIZER_DESC1 *pRasterizerDesc, ID3D11RasterizerState1 **ppRasterizerState) PURE;
    STDMETHOD(CreateDepthStencilState1)(THIS_ const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, ID3D11DepthStencilState1 **ppDepthStencilState) PURE;
    STDMETHOD(CreateTexture2D1)(THIS_ const D3D11_TEXTURE2D_DESC1 *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture2D1 **ppTexture2D) PURE;
    STDMETHOD(CreateTexture3D1)(THIS_ const D3D11_TEXTURE3D_DESC1 *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture3D1 **ppTexture3D) PURE;
    STDMETHOD_(void, GetFeatureLevel)(THIS_ D3D_FEATURE_LEVEL *pFeatureLevel) PURE;
    STDMETHOD_(UINT, GetCreationFlags)(THIS) PURE;

    // ID3D11Device1 methods (further additions)
    STDMETHOD_(void, GetMultiisampleQualityLevels1)(THIS_ DXGI_FORMAT Format, UINT SampleCount, UINT Flags, UINT *pNumQualityLevels) PURE;
};

这个接口包含了 ID3D11Device 接口的所有方法,并添加了一些额外的方法,用于支持 Direct3D 11.1 中引入的新特性。例如,可以使用 CreateBlendState1 方法创建混合状态,使用 CreateRasterizerState1 方法创建光栅化状态,以及使用 CreateDepthStencilState1 方法创建深度模板状态等。

通过 ID3D11Device1 接口,开发者能够更灵活地使用 Direct3D 11.1 的新特性,并获得更多的渲染控制。


转载请注明出处:http://www.zyzy.cn/article/detail/25834/Win32 API/D3d11_1.h/ID3D11Device1