Jump to content
  • Advertisement
Sign in to follow this  
pnt1614

DX11 Check each mipmap of a texture2D?

This topic is 1018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I follow the book "Introduction to 3D Game Programming with DIRECTX 11" to load several textures and its mipmaps, then copy into a texture array. But there is a problem with mipmaps. I am not sure the reason so now I want to check each mipmap of each loaded texture 2D by saving each mipmap to a file, but I do not know how to do that.

 

The following source code is used to load 2D textures and its mipmap (automatically generated by GPU):

        D3DX11_IMAGE_LOAD_INFO loadInfo;
	loadInfo.Width = 1024;
	loadInfo.Height = 1024;
	loadInfo.Depth = 0;
	loadInfo.FirstMipLevel = 0;
	loadInfo.MipLevels = 0;
	loadInfo.Usage = D3D11_USAGE_STAGING;
	loadInfo.BindFlags = 0;
	loadInfo.CpuAccessFlags = D3D10_CPU_ACCESS_WRITE | D3D10_CPU_ACCESS_READ;
	loadInfo.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
	loadInfo.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
	loadInfo.Filter = D3DX11_FILTER_NONE;
	loadInfo.MipFilter = D3DX11_FILTER_NONE;
	loadInfo.pSrcInfo = 0;

	vector<string> m_sTextureNames;

	m_sTextureNames.push_back("MovingBox/metalcrate-L.jpg");

	UINT iNumOfMaterials = (UINT)m_sTextureNames.size();
	g_pTexture2Ds.resize(iNumOfMaterials);

	for (UINT i = 0; i<iNumOfMaterials; i++)
	{
		if (m_sTextureNames[i].compare("") != 0)
		{
			V(D3DX11CreateTextureFromFileA(pd3dDevice, m_sTextureNames[i].c_str(),
				&loadInfo, 0, (ID3D11Resource**)&g_pTexture2Ds[i], 0));
		}
	}

Is there anyone know to save a mipmap of a 2D texture to a file?

Share this post


Link to post
Share on other sites
Advertisement
Trying to save them to a file is only creating more potential for errors that could distract you.
Draw each mipmap to the screen. Take a screenshot if you want to put them into Photoshop or etc.


L. Spiro

Share this post


Link to post
Share on other sites

Or use a GPU debugger that can show you details of the texture from a runtime capture (e.g. Renderdoc, or the one built in to the new visual studio, etc...).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!