以下是该结构的定义:
struct CD3D11_TEXTURE2D_DESC1 : public D3D11_TEXTURE2D_DESC1
{
CD3D11_TEXTURE2D_DESC1();
explicit CD3D11_TEXTURE2D_DESC1(const D3D11_TEXTURE2D_DESC1& o);
explicit CD3D11_TEXTURE2D_DESC1(const D3D11_TEXTURE2D_DESC& o);
explicit CD3D11_TEXTURE2D_DESC1(const DXGI_SWAP_CHAIN_DESC1& desc);
explicit CD3D11_TEXTURE2D_DESC1(
DXGI_FORMAT format,
UINT width,
UINT height,
UINT arraySize = 1,
UINT mipLevels = 0,
UINT bindFlags = D3D11_BIND_SHADER_RESOURCE,
D3D11_USAGE usage = D3D11_USAGE_DEFAULT,
UINT cpuaccessFlags = 0,
UINT sampleCount = 1,
UINT sampleQuality = 0,
D3D11_TEXTURE_LAYOUT textureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED);
CD3D11_TEXTURE2D_DESC1& Width(UINT w) { Width = w; return *this; }
CD3D11_TEXTURE2D_DESC1& Height(UINT h) { Height = h; return *this; }
CD3D11_TEXTURE2D_DESC1& MipLevels(UINT mipLevels) { MipLevels = mipLevels; return *this; }
CD3D11_TEXTURE2D_DESC1& ArraySize(UINT arraySize) { ArraySize = arraySize; return *this; }
CD3D11_TEXTURE2D_DESC1& Format(DXGI_FORMAT fmt) { Format = fmt; return *this; }
CD3D11_TEXTURE2D_DESC1& SampleDesc(DXGI_SAMPLE_DESC sd) { SampleDesc = sd; return *this; }
CD3D11_TEXTURE2D_DESC1& Usage(D3D11_USAGE u) { Usage = u; return *this; }
CD3D11_TEXTURE2D_DESC1& BindFlags(UINT bindFlags) { BindFlags = bindFlags; return *this; }
CD3D11_TEXTURE2D_DESC1& CPUAccessFlags(UINT cpuFlags) { CPUAccessFlags = cpuFlags; return *this; }
CD3D11_TEXTURE2D_DESC1& MiscFlags(UINT miscFlags) { MiscFlags = miscFlags; return *this; }
CD3D11_TEXTURE2D_DESC1& TextureLayout(D3D11_TEXTURE_LAYOUT layout) { TextureLayout = layout; return *this; }
};
这个结构提供了一些方便的方法来设置各个成员变量的值,使得代码更加简洁易读。你可以使用这个结构来初始化和配置 Direct3D 11.3 中的 2D 纹理。
转载请注明出处:http://www.zyzy.cn/article/detail/25846/Win32 API/D3d11_3.h/CD3D11_TEXTURE2D_DESC1