• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
mrheisenberg

Strange DirectX error(debugger is unreliable in this case)

4 posts in this topic

I'm calling

 

IDXGIOutput* output;
adapter->EnumOutputs(0, &output);
DXGIOutput outputInterface = DXGIOutput(output);
 

 

 

 

adapter is a DXGIAdapter* that I create with EnumAdapters1 from the factory object, it gives me no problems, I get the description and it properly gives me the GPU name when I take its DXGI_ADAPTER_DESC1.
DXGIOutput is just a thin wrapper that contains an IDXGIOutput* and has a SafeRelease(obj) macro used in it's destructor to release the contained IDXGIOutput*.This is the macro:
#define SafeRelease(obj) {if(obj){(obj)->Release();(obj)=nullptr;}}It's just the standart SafeRelease used across most tutorials, but It kept telling me this when SafeRelease was called:

Unhandled exception at 0x00150138 in Rendering.exe: 0xC0000005: Access violation executing location 0x00150138. 

 

since I was only using DXGIOutput outputInterface temporarily, once it got killed at the end of the function and it's destructor got called.

So I change it to:
#define SafeRelease(obj) {if(obj){(obj)->Release();}}
And now it stopped giving me the error.However, on the call stack it says:

  <Unknown function> Unknown

  [Frames below may be incorrect and/or missing]
 
I linked to Microsoft symbol server just in case, but that didn't fix it the [Frames below may be incorrect and/or missing] issue.
So after I fixed the problem with the destructor, the line above it(adapter->EnumOutputs(0, &output);) started to give me an

Unhandled exception at 0x7728A4DE (ntdll.dll) in Rendering.exe: 0xC0000005: Access violation reading location 0xFEEEFEF6.


And on the top of the call stack there's:
 

ntdll.dll!<Unknown function> Unknown
  [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
  dxgi.dll!<Unknown function> Unknown
  dxgi.dll!<Unknown function> Unknown
  dxgi.dll!<Unknown function> Unknown
  dxgi.dll!<Unknown function> Unknown
 
All if this is really confusing, changing the destructor of an object can't interfere with something that happens before it's called o_O unless the frames really are not in that order, but in that case I have no idea what can be done.Has anyone ever had this problem?It says in MSDN, that the symbol files are included in Windows 7 by default, and even so I tried with the Microsoft symbol server.

 

 

0

Share this post


Link to post
Share on other sites

If you are using the XXX1 functions, then you should be sure to use the equivalent interfaces.  For example, here is my code to do something similar to what you posted:

// Create a factory to enumerate all of the hardware in the system.

	IDXGIFactory1* pFactory = 0;
	hr = CreateDXGIFactory1( __uuidof(IDXGIFactory), (void**)(&pFactory) );


	// Enumerate all of the adapters in the current system.  This includes all
	// adapters, even the ones that don't support the ID3D11Device interface.

	IDXGIAdapter1* pCurrentAdapter;
	std::vector<DXGIAdapter*> vAdapters;
	std::vector<DXGIOutput*> vOutputs;

	while( pFactory->EnumAdapters1( vAdapters.size(), &pCurrentAdapter ) != DXGI_ERROR_NOT_FOUND )
	{
		vAdapters.push_back( new DXGIAdapter( pCurrentAdapter ) );

		DXGI_ADAPTER_DESC1 desc;
		pCurrentAdapter->GetDesc1( &desc );

		Log::Get().Write( desc.Description );
	}

Notice that the interfaces are all the updated versions - please try this and see if the issue is resolved.

0

Share this post


Link to post
Share on other sites

Yes, I use the updated ones everywhere, however I don't understand this:
 

/ Create a factory to enumerate all of the hardware in the system.

    IDXGIFactory1* pFactory = 0;
    hr = CreateDXGIFactory1( __uuidof(IDXGIFactory), (void**)(&pFactory) );

Shouldn't it be IDXGIFactory1? I'm using IDXGIFactory1, maybe that's the issue?
It also worries me that the SafeRelease macro causes a crash, even if I use 0 instead of nullptr, could be a hint at the problem.

 


on a side note - I just now notice GameDev has colors for DirectX in the code tags lol

Edited by mrheisenberg
1

Share this post


Link to post
Share on other sites

Good catch!  Maybe I should follow my own advice then, eh? :)

 

I updated it and recompiled, and there was not issue in either case (before and after the change).  But you are right about the safe release - it should be fool proof.  Do you use that macro in other parts of your program?  Perhaps there is some minor miscue in the macro itself.  Here is the version that is used in Hieroglyph:

 

#define SAFE_RELEASE( x ) {if(x){(x)->Release();(x)=NULL;}}

 

This looks the same to me as your solution.  Perhaps you could try to manually expand the macro and step through it to find out if there is a value there or not?

0

Share this post


Link to post
Share on other sites

ok I expanded it and same thing happens, it crashes on Release(), but when I remove the line afterwards that sets it to 0/NULL the other error appears.There's

<Unknown function>

Unknown
at the top of the call stack, so I guess there's something wrong in the COM?I don't think I initialized it wrong tho, just used 
EnumOutputs, I check the HRESULT and it's ok

edit: I tried to use IDXGIOutput1 too instead of IDXGIOutput, but I EnumOutputs() doesn't take IDXGIOutput1 as an argument, it wants an IDXGIOutput, or is IDXGIOutput1 a special case and used in a different way?

I check breakpoint by breakpoint the pointer addresses, all of the IDXGI objects seem to be getting created with valid addresses(they're not 
0x00000000 or anything similar)

Ok I fixed it, DXGIOutput outputInterface = DXGIOutput(output); should have been DXGIOutput* outputInterface = new DXGIOutput(output); otherwise it gets destroyed in the end of the frame and then I do adapterOutputs.Add(&outputInterface); I was adding a pointer to an already destroyed object (facepalm).

Edited by mrheisenberg
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0