使用DXGI_FORMAT_YUY2作为格式时,CreateTexture2D()失败

时间:2017-03-29 14:14:02

标签: directx-10

D3D10_TEXTURE2D_DESC包含以下内容时:

textureDesc.Width               = 1920 * 2;
textureDesc.Height              = 1080 * 2;
textureDesc.MipLevels           = 1;
textureDesc.ArraySize           = 1;
textureDesc.Format              = DXGI_FORMAT_YUY2;
textureDesc.SampleDesc.Count    = 1;
textureDesc.SampleDesc.Quality  = 0;
textureDesc.Usage               = D3D10_USAGE_DYNAMIC;
textureDesc.BindFlags           = D3D10_BIND_SHADER_RESOURCE;
textureDesc.CPUAccessFlags      = D3D10_CPU_ACCESS_WRITE;
textureDesc.MiscFlags           = 0;

ID3D10Device :: CreateTexture2D()失败 但是,如果我将Format更改为DXGI_FORMAT_R8G8B8A8_UNORM,则ID3D10Device :: CreateTexture2D()会成功。有人能解释一下原因吗?

1 个答案:

答案 0 :(得分:0)

我知道,如果设置D3D10_CREATE_DEVICE_DEBUG标志,DirectX可以将有关错误的注释输出到stderr或stdout。看起来它可以帮助您找到失败的原因。