I'm trying to create a texture with mips, but it keeps failing. I've been searching the internet for an answer, but I'm not having any luck. Here is what I have:
D3D11_TEXTURE2D_DESC desc; ZeroMemory(&desc,sizeof(desc)); desc.Width = sx; desc.Height = sy; desc.MipLevels = 1; desc.ArraySize = 1; desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.SampleDesc.Count = 1; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; desc.MiscFlags = 0; ID3D11Texture2D *pTexture = NULL; HRESULT result=GE->dev->CreateTexture2D( &desc, NULL, &pTexture );//this works. doesn't fail if(FAILED(result)) tp1=12345; result=GE->dev->CreateShaderResourceView(pTexture,NULL,&m_texture); if(FAILED(result)) tp1=2;
sx and sy are defined already as 256. This works fine as long as I don't try to change the "desc.MipLevels" to anything but 1. I can't find an example of creating the texture with anything but 1 mip level......
Does anyone know how to do it?