Passing variables to "out" Vector2/3 parameters doesn't work

These bugs do plan to be resolved, when they can be.

Moderator: GZDoom Developers

Post Reply
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Passing variables to "out" Vector2/3 parameters doesn't work

Post by phantombeta »

As it says in the thread title, you can't pass variables as to Vector2/3 out parameters. Turns out there's some other issue my fix doesn't deal with. Heap-allocated values (e.g., member variables) can be passed just fine, while stack-allocated values (e.g., local variables) just crash GZDoom.
There seems to be two issues - First, it seems like it may still be calculating the wrong amount of parameters in the function call code. Second, there must be some issue where it doesn't correctly calculate or pass the vector's memory address.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Passing variables to "out" Vector2/3 parameters doesn't

Post by phantombeta »

Turns out the reason for this is that, when it's a FxLocalVariable, it still emits shit as if it were a vector instead of a pointer. FxStructMember (used for struct and class members) works, though, so I'm not sure what the hell's up with this.
I have no idea how to deal with this crap.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Passing variables to "out" Vector2/3 parameters doesn't

Post by Major Cooke »

Well, if it works for structs being treated as pointers, would it be possible to export DVector2/3 to ZScript somehow? That would allow for treating it like a pointer then, though that might ax any possibility of adding dynamic array support for it.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Passing variables to "out" Vector2/3 parameters doesn't

Post by Apeirogon »

It still happens in 4.4.2.
Error message btw "Unexpected JIT error : Unknown REGT value passed to EmitPARAM".
Test example
vector_in_out_bug.zip
(801 Bytes) Downloaded 159 times
Load it, start new game and type into console "summon v_bug". As soon as console is start closing vm abort happens.

In some cases Gzdoom just print "Unexpected JIT error : Unknown REGT value passed to EmitPARAM" message into console without vm abort, destroying actor that cause this.
Post Reply

Return to “On Hold Bugs”