PIX Error on experiment startup

Started by
2 comments, last by _Sauce_ 12 years, 10 months ago
So, this is weird. When i run my program normally from visual studio it runs perfectly fine and the CreateDeviceAndSwapChain return S_OK. However, if I start my executable through PIX I get the following error:

PIX Logfile created at: 1:08:48 AM

Frame 000001 ....PRE: Frame(1)
Trigger 'Frame 1' fired
Frame 000001 ........PRE: D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
D3D11: ERROR: ID3D11Device::CreateTexture2D: The Dimensions are invalid. For feature level D3D_FEATURE_LEVEL_10_0, the Width (value = -842150451) must be between 1 and 8192, inclusively. The Height (value = -842150451) must be between 1 and 8192, inclusively. And, the ArraySize (value = 1) must be between 1 and 512, inclusively. [ STATE_CREATION ERROR #101: CREATETEXTURE2D_INVALIDDIMENSIONS ]
D3D11: ERROR: ID3D11Device::CreateTexture2D: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #104: CREATETEXTURE2D_INVALIDARG_RETURN ]
Frame 000001 ........POST: <E_INVALIDARG> D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
Frame 000001 ........PRE: D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_WARP, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
D3D11: ERROR: ID3D11Device::CreateTexture2D: The Dimensions are invalid. For feature level D3D_FEATURE_LEVEL_10_1, the Width (value = -842150451) must be between 1 and 8192, inclusively. The Height (value = -842150451) must be between 1 and 8192, inclusively. And, the ArraySize (value = 1) must be between 1 and 512, inclusively. [ STATE_CREATION ERROR #101: CREATETEXTURE2D_INVALIDDIMENSIONS ]
D3D11: ERROR: ID3D11Device::CreateTexture2D: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #104: CREATETEXTURE2D_INVALIDARG_RETURN ]
Frame 000001 ........POST: <E_INVALIDARG> D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_WARP, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
Frame 000001 ........PRE: D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
D3D11: ERROR: ID3D11Device::CreateTexture2D: The Dimensions are invalid. For feature level D3D_FEATURE_LEVEL_11_0, the Width (value = -842150451) must be between 1 and 16384, inclusively. The Height (value = -842150451) must be between 1 and 16384, inclusively. And, the ArraySize (value = 1) must be between 1 and 2048, inclusively. [ STATE_CREATION ERROR #101: CREATETEXTURE2D_INVALIDDIMENSIONS ]
D3D11: ERROR: ID3D11Device::CreateTexture2D: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #104: CREATETEXTURE2D_INVALIDARG_RETURN ]
Frame 000001 ........POST: <E_INVALIDARG> D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 2, 0x0042F864, 3, 7, 0x0042F814, 0x03B280D8, 0x03B280D4, 0x03B280E0, 0x03B280E8)
An unhandled exception occurred.
Closing Run File

Any ideas?
Advertisement
So this was caused by my screen width and height to be garbage data when running through pix. The reason being was that my width and height I was reading from XML with with a file reference as such:


TiXmlDocument doc("Assets/XML/WindowsTweakables.xml");
if(!doc.LoadFile()) return;

When running through PIX it wasn't getting the proper file directory and returning so my variables from this file weren't being initialized. To fix this I tried the following:
project properties -> c/c++ -> preprocessor -> Preprocesor Definitions: and added this MY_SOLUTIONDIR=$(SolutionDir)

That creates a define with the full c:/ extension. Now I'm stuck on figuring out how to turn the define into a string since it doesn't include the quotes at the beginning and end. If anyone knows a cool way to turn it into a string that would be helpful =D


*UPDATE*:
MY_SOLUTIONDIR expands to something like: C:\Users\***\Desktop\***\TestProject\Debug\\


#define ADD_QUOTES_HELPER(s) #s
#define ADD_QUOTES(s) ADD_QUOTES_HELPER(s)

std::string filename(ADD_QUOTES(MY_SOLUTIONDIR));
**

For some reason the above doesn't work to add the quotes... instead I get:

warning C4129: 'D' : unrecognized character escape sequence
warning C4129: 'T' : unrecognized character escape sequence

Any 1337 macro programmers know how to fix this?
FYI, you can set the folder that PIX runs your executable in if click on the "More Options" button, and then go to the "Target Program" tab.

For some reason the above doesn't work to add the quotes... instead I get:

warning C4129: 'D' : unrecognized character escape sequence
warning C4129: 'T' : unrecognized character escape sequence

Any 1337 macro programmers know how to fix this?

The reason you get these two warnings is because the MY_SOLUTIONDIR expands to a path with backslashes (\) instead of forward slashes (/). Backslashes will be treated as the beginning of an escape sequence and, depending on the character following it, may be interpreted as some other random character (\\, \t, \r, \n are common ones)

Solution:
#define MY_SOLUTIONDIR "C:\\Users\\***\\Desktop\\***\\TestProject\\Debug\\"

or...

#define MY_SOLUTIONDIR "C:/Users/**/Desktop/***/TestProject/Debug/"

or you can do what MJP said :)

Neither of these are great solutions to the problem though. Your application should be capable of finding its resources regardless of the location it is run from. You can set the current working directory (on windows) to the executable directory using GetModuleFileName() and SetCurrentDirectory() so that your relative paths function correctly.

If you're targetting the 360 (XNA) then obviously you don't have to worry about any of this, and you can use one of the previous suggestions.

This topic is closed to new replies.

Advertisement