locked
GetCPUDescriptorHandleForHeapStart - Rigged? RRS feed

  • Question

  • I just spent about three and a half very intensive and frustrating hours trying to track down a crash in a group of function calls between (and including) GetCPUDescriptorHandleForHeapStart and CreateRenderTargetView in DX12.  I am not using Visual Studio; I'm using "manual" assembly language as I always do (clearly making me public enemy #1 to the entire development community on Earth).  I did track down the problem and I have to say that it is quite disturbing that it exists at all.  I'm wondering if anybody else has encountered it - something I seriously doubt because few if any others would take the time to track the problem down.

    The problem occurs in the call to GetCPUDescriptorHandleForHeapStart, although depending on seemingly random conditions, it may not actually manifest a crash until the subsequent call to CreateRenderTargetView.

    Completely undocumented, the RDX register is required to point *somewhere* in the app's data segment on the call to GetCPUDescriptorHandleForHeapStart.  That method is clearly documented as having no parameters, with [THIS] of course being implicit in RCX as is always the case with COM.  The assignment of a valid pointer into RDX immediately before the call is not part of any C++ code whatsoever, at any level.  It's simply generated by the compiler, making it APPEAR to be a manually rigged piece of f***ery to shut down any languages outside VS attempting to use DirectX 12.  

    If you're using DirectX 12 outside of Visual Studio, you might want to make a note of this at the very least, for future reference.  Now I'm proceeding in a state of terror wondering when the next time is going to be that I will encounter such an issue.  I've learned to begin debugging by setting any unused registers of RDX, R8, and R9 to unique and consistent values so that if illegal writes or reads are occurring in the future, they will be immediately identifiable.

    I cannot possibly see how something like this could be inadvertent.  But an explanation could always exist despite appearances so I will leave that door open.


    Those who can, do. Those who can't, teach.

    Saturday, June 13, 2020 7:12 AM

Answers

All replies