mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 01:25:31 +00:00
Fixed issue [#1240]: "Generic ref and out wrappers do not copy results to the reference parameter", by assigning the GCHandle.Target back to the reference parameter.
This commit is contained in:
parent
b2bc058ac9
commit
353ef37dd4
|
@ -422,7 +422,9 @@ namespace Bind.Structures
|
||||||
|
|
||||||
handle_release_statements.Add(String.Format("{0}_ptr.Free();", p.Name));
|
handle_release_statements.Add(String.Format("{0}_ptr.Free();", p.Name));
|
||||||
|
|
||||||
if (p.Flow == FlowDirection.Out)
|
// Due to the GCHandle-style pinning (which boxes value types), we need to assign the modified
|
||||||
|
// value back to the reference parameter (but only if it has an out or in/out flow direction).
|
||||||
|
if ((p.Flow == FlowDirection.Out || p.Flow == FlowDirection.Undefined) && p.Reference)
|
||||||
{
|
{
|
||||||
assign_statements.Add(String.Format(
|
assign_statements.Add(String.Format(
|
||||||
"{0} = ({1}){0}_ptr.Target;",
|
"{0} = ({1}){0}_ptr.Target;",
|
||||||
|
@ -444,7 +446,12 @@ namespace Bind.Structures
|
||||||
p.Array > 0 ? p.Name : "&" + p.Name,
|
p.Array > 0 ? p.Name : "&" + p.Name,
|
||||||
indirection_levels[p.IndirectionLevel]));
|
indirection_levels[p.IndirectionLevel]));
|
||||||
|
|
||||||
if (p.Flow == FlowDirection.Out && p.Array == 0) // Fixed Arrays of blittable types don't need explicit assignment.
|
if (p.Name == "pixels_ptr")
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
|
||||||
|
// Arrays are not value types, so we don't need to do anything for them.
|
||||||
|
// Pointers are passed directly by value, so we don't need to assign them back either (they don't change).
|
||||||
|
if ((p.Flow == FlowDirection.Out || p.Flow == FlowDirection.Undefined) && p.Reference)
|
||||||
{
|
{
|
||||||
assign_statements.Add(String.Format("{0} = *{0}_ptr;", p.Name));
|
assign_statements.Add(String.Format("{0} = *{0}_ptr;", p.Name));
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue