DirectX11 has problems with loading?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
vilgeits
Goblin
Posts: 298
Joined: Tue Aug 02, 2005 10:41 pm

DirectX11 has problems with loading?

Post by vilgeits »

First problem is really straightfoward to be detected

Code: Select all

Ogre::TextureManager::getSingleton().load(lightfile1,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,Ogre::TEX_TYPE_2D,0);
Ogre::TextureManager::getSingleton().load(lightfile2,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,Ogre::TEX_TYPE_2D,0);

Code: Select all

17:20:08: Texture: Plane_box: Loading 1 faces(PF_FLOAT32_RGB,1500x500x1) with 11 generated mipmaps from Image. Internal format is PF_FLOAT32_RGBA,1500x500x1.
17:20:08: Texture: Plane_light.exr: Loading 1 faces(PF_FLOAT32_RGB,1500x500x1) with 11 generated mipmaps from Image. Internal format is PF_A8B8G8R8,1500x500x1.
What the hell? 11 mipmap levels? I put 0!
Internal format 8 bits in the second one? why???

I have a code that works fine in Dx9 , since I manage to transform all my materials to shading I don't need RTMaterial system neither but I had lots of problems... and after a lot of tries I really think that they are related to threading.

Of course I tried disabling boost and with OGRE_CONFIG_THREADS = 0 but it looks that you can't disable threads on Dx11.

Ie.

Code: Select all

//also tried disabled background loading before the load call
mTptr = Ogre::TextureManager::getSingleton().load(filename2,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,Ogre::TEX_TYPE_2D,0,1,false,Ogre::PF_FLOAT16_RGBA);
//wait until it is loaded, it looks that it doesn't work on dx11
while (!mTptr->isLoaded()){}
mTptr->convertToImage(shaderImages[i]);	 
In this case I tested by writting some messages to the log and it looks that it works as they want and mTptr is not loaded fine so I get:

Code: Select all

17:35:52: OGRE EXCEPTION(9:UnimplementedException): pack to PF_UNKNOWN not implemented in PixelUtil::packColour at ..\..\OgreMain\src\OgrePixelFormat.cpp (line 1119)
All this problems doesn't affect Dx9.



Thanks in advance.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: DirectX11 has problems with loading?

Post by robert_sasu »

I get your message from the Development forums. There are lot of differences between DX 9 and DX 11 pixel mappings. Look at this link: http://msdn.microsoft.com/en-us/library ... re_formats. As for mip maps, they are generated automatically and are used to provide different levels of detail when rendering.

Don't forget that DirectX 11 Render System there are no more fixed pipeline functions, so you need to have at least Vertex and Pixel shader at every pass of your program.

Can you post more about your problem, like a screenshot while rendering using DirectX 9 Render System, and one when using DirectX 11 Render screenshot ?
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
vilgeits
Goblin
Posts: 298
Joined: Tue Aug 02, 2005 10:41 pm

Re: DirectX11 has problems with loading?

Post by vilgeits »

robert_sasu wrote:As for mip maps, they are generated automatically and are used to provide different levels of detail when rendering.
I didn't noticed it! That's weird since I'm working on a imagen postproduction tool and I need no mip maps, so they are just a waste of memory for me.
robert_sasu wrote:Don't forget that DirectX 11 Render System there are no more fixed pipeline functions, so you need to have at least Vertex and Pixel shader at every pass of your program.
Sure! I have them! Vertex shader are just a quad and pixel shader seems that have no problem at all.
robert_sasu wrote:Can you post more about your problem, like a screenshot while rendering using DirectX 9 Render System, and one when using DirectX 11 Render screenshot ?
The loading screen is just a regular image over a quad and it works fine (and equal) on both.
The problem comes when I load files and I try to store them on 'images' load call doesn't work properly and convertToImage crash the app so I have no way to get the screenshot. Anyway as I said the problem comes no from the rendering but loading.


Thank you for your interest and response robert_sasu.
User avatar
robert_sasu
Google Summer of Code Student
Google Summer of Code Student
Posts: 237
Joined: Mon Apr 02, 2012 11:07 am
x 42

Re: DirectX11 has problems with loading?

Post by robert_sasu »

Try to use pixel formats which are the same at each part (DX9 and DX11), you can look at OgreD3D11Mappings.cpp if you want to know how are pixel formats transfered from the one ogre use, and the one the render system does (from PF_* to DXGI_FORMAT_*). Probably because of uncompatible pixel formats convertToImage try to access more memory then needed and crashes because of this - example 32bits format changed to 16bits. If you get PF_UNKNOWN, there is no way to load or convert it correctly.

Code: Select all

	DXGI_FORMAT D3D11Mappings::_getPF(PixelFormat ogrePF)
	{
		switch(ogrePF)
		{
		case PF_L8:				return DXGI_FORMAT_R8_UNORM;
		case PF_L16:			return DXGI_FORMAT_R16_UNORM;
		case PF_A8:				return DXGI_FORMAT_A8_UNORM;
		case PF_A4L4:			return DXGI_FORMAT_UNKNOWN;
		case PF_BYTE_LA:		return DXGI_FORMAT_UNKNOWN; 
		case PF_R3G3B2:			return DXGI_FORMAT_UNKNOWN;
		case PF_A1R5G5B5:		return DXGI_FORMAT_UNKNOWN;
		case PF_R5G6B5:			return DXGI_FORMAT_UNKNOWN;
		case PF_A4R4G4B4:		return DXGI_FORMAT_UNKNOWN;
		case PF_R8G8B8:			return DXGI_FORMAT_UNKNOWN;
		case PF_A8R8G8B8:		return DXGI_FORMAT_B8G8R8A8_UNORM;
		case PF_A8B8G8R8:		return DXGI_FORMAT_R8G8B8A8_UNORM;
		case PF_X8R8G8B8:		return DXGI_FORMAT_UNKNOWN;
		case PF_X8B8G8R8:		return DXGI_FORMAT_UNKNOWN;
		case PF_A2B10G10R10:	return DXGI_FORMAT_R10G10B10A2_TYPELESS;
		case PF_A2R10G10B10:	return DXGI_FORMAT_UNKNOWN;
		case PF_FLOAT16_R:		return DXGI_FORMAT_R16_FLOAT;
		case PF_FLOAT16_RGBA:	return DXGI_FORMAT_R16G16B16A16_FLOAT;
		case PF_FLOAT32_R:		return DXGI_FORMAT_R32_FLOAT;
		case PF_FLOAT32_RGBA:	return DXGI_FORMAT_R32G32B32A32_FLOAT;
		case PF_SHORT_RGBA:		return DXGI_FORMAT_R16G16B16A16_UNORM;
		case PF_DXT1:			return DXGI_FORMAT_BC1_UNORM;
		case PF_DXT2:			return DXGI_FORMAT_BC2_UNORM;
		case PF_DXT3:			return DXGI_FORMAT_BC3_UNORM;
		case PF_DXT4:			return DXGI_FORMAT_BC4_UNORM;
		case PF_DXT5:			return DXGI_FORMAT_BC5_UNORM;

		case PF_UNKNOWN:
		default:				return DXGI_FORMAT_UNKNOWN;
		}
	}
Here is how the formats are changed to DXGI_FORMAT, notice that some of the formats are not more compatible for DX 11. If you want more about the formats read the last link I past here: http://msdn.microsoft.com/en-us/library ... re_formats
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
User avatar
vilgeits
Goblin
Posts: 298
Joined: Tue Aug 02, 2005 10:41 pm

Re: DirectX11 has problems with loading?

Post by vilgeits »

Weird experiments:

Code: Select all

Ogre::LogManager::getSingletonPtr()->logMessage("Previous message");
MRenderedTexture = Ogre::TextureManager::getSingleton().createManual( "mRenderedTextureOrig", 
															Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TextureType::TEX_TYPE_2D, 
															300 ,400, 0, Ogre::PF_FLOAT32_RGBA,Ogre::TextureUsage::TU_RENDERTARGET );
Ogre::LogManager::getSingletonPtr()->logMessage(QString::number(MRenderedTexture ->getWidth()).toStdString());
Ogre::LogManager::getSingletonPtr()->logMessage("Post message");
... //RENDER TO TEXTURE AND SO
MRenderedTexture ->convertToImage(mImage);
Image of the .log since some chars are not allowed:
Image

also tried with Ogre::PF_FLOAT16_RGBA


This is really frustating since it works like a charm in Dx9