sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.68k stars 642 forks source link

SharpDX 3.2.0 InfoQueue object #1102

Closed PhillipHamlyn closed 5 years ago

PhillipHamlyn commented 5 years ago

Upgrade from 4.1.0 to 4.2.0 - InfoQueue object now unstable.

InfoQueue infoQueue = this.debugDevice.QueryInterface<InfoQueue>();
 infoQueue.GetStorageFilter();

Crashes with NullReferenceException.


// We want to supress some specific warnng messages for foliage rendering.
            InfoQueue infoQueue = this.debugDevice.QueryInterface<InfoQueue>();
            infoQueue.SetBreakOnSeverity(MessageSeverity.Corruption, new SharpDX.Mathematics.Interop.RawBool(true));
            infoQueue.SetBreakOnSeverity(MessageSeverity.Error, new SharpDX.Mathematics.Interop.RawBool(true));

            // https://blogs.msdn.microsoft.com/chuckw/2015/07/27/dxgi-debug-device/
            MessageId[] messagesToHide = new MessageId[] 
            {
                MessageId.MessageIdDeviceDrawVertexBufferTooSmall,
                MessageId.MessageIdSetPrivateDataChangingparams
            };
            InfoQueueFilter filter = new InfoQueueFilter();
            filter.DenyList = new InfoQueueFilterDescription() { Ids = messagesToHide };
            infoQueue.AddStorageFilterEntries(filter);

Crashes with NullReferenceException

amerkoleci commented 5 years ago

Make sure you have VS2017 graphics tool installed:

https://docs.microsoft.com/en-us/visualstudio/debugger/graphics/getting-started-with-visual-studio-graphics-diagnostics?view=vs-2017

PhillipHamlyn commented 5 years ago

@amerkoleci - yes, I have it installed. To be clear my 4.1.0 works fine, but when I install 4.2.0 is breaks.

amerkoleci commented 5 years ago

This seams bug to SharpGenTools, @jkoritzinsky can you check please? In 4.1.0 it was checking for null during InfoQueueFilter.__MarshalTo:

// 4.1.0
internal void __MarshalTo(ref __Native @ref)
    {
        @ref.AllowList = default(InfoQueueFilterDescription.__Native);
        if (AllowList != null)
        {
            AllowList.__MarshalTo(ref @ref.AllowList);
        }
        @ref.DenyList = default(InfoQueueFilterDescription.__Native);
        if (DenyList != null)
        {
            DenyList.__MarshalTo(ref @ref.DenyList);
        }
    }

 4.2.0
internal void __MarshalTo(ref __Native @ref)
{
    AllowList.__MarshalTo(ref @ref.AllowList);
    DenyList.__MarshalTo(ref @ref.DenyList);
}

MarshalFree and MarshalFrom are wrong as well

jkoritzinsky commented 5 years ago

I think I've already fixed this in SharpGenTools master IIRC. I'll check the next time I have time for SharpGenTools.