Skip to content

C# binding fails to automatically update ByteCodeSize when setting ShaderCreateInfo::ByteCode directly #766

@ODtian

Description

@ODtian

When ShaderCreateInfo like this:

ShaderCreateInfo shaderCI = new ShaderCreateInfo();
shaderCI.ByteCode = data;·
Device.CreateShader(shaderCI, out compilerOutput)

The following exception throwed

UnhandledException
   at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String)
   at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String)
   at System.Environment.FailFast(System.String)
   at System.Runtime.EH.FallbackFailFast(System.Runtime.RhFailFastReason, System.Object)
   at System.Runtime.EH.UnhandledExceptionFailFastViaClasslib(System.Runtime.RhFailFastReason, System.Object, IntPtr, ExInfo ByRef)
   at System.Runtime.EH.DispatchEx(System.Runtime.StackFrameIterator ByRef, ExInfo ByRef)
   at SharpGen.Runtime.CppObject.get_Item(Int32)
   at Diligent.IRenderDevice.CreateShader(Diligent.ShaderCreateInfo ByRef, Diligent.IDataBlob ByRef)

The problem was solved when I manually set the underlying ByteCodeSize through some hack methods. At the same time, looking at the code automatically generated by SharpGen, I did not find that ByteCodeSize was explicitly set. Therefore, I suspect that this is due to improper mapping settings of SharpGen.

<map field="ShaderCreateInfo::ByteCode" type="unsigned char" override-native-type="true" />
<map field="ShaderCreateInfo::ByteCodeSize" relation="length(ByteCode)" />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions