// Load the texture D3DX11_IMAGE_LOAD_INFO loadInfo; loadInfo.MipLevels = 1; loadInfo.Usage = D3D11_USAGE_STAGING; loadInfo.CpuAccessFlags = D3D11_CPU_ACCESS_READ; hr = D3DX11CreateTextureFromFile(g_D3DDevice, L"heightmap8x8.bmp", &loadInfo, NULL, (ID3D11Resource**)(&g_HeightmapTex), NULL); if (FAILED(hr)) return hr; // Try to access it's data D3D11_MAPPED_SUBRESOURCE subres; hr = g_D3DDeviceContext->Map(g_HeightmapTex, 0, D3D11_MAP_READ, NULL, &subres); if (FAILED(hr)) return hr; // do something with the data g_D3DDeviceContext->Unmap(g_HeightmapTex, 0);
I can use the texture in a shader so it shouldn't be an issue of it not loading properly. I played around with the Usage and CpuAccessFlags, but I'm fairly certain that this is the way they should be set up if I want to just read the texture. As I said, I'm not getting any access errors (or any errors period), the application just exits quietly shortly after starting. PIX isn't helping me either.
Hopefully someone can smash me in the head with the Bat of Knowledge. Thanks in advance!