Commit Graph

15649 Commits

Author SHA1 Message Date
Magnus Norddahl 48fd91227c - fix compile error 2018-11-21 10:46:13 +01:00
Magnus Norddahl dd42557e69 - implement a shader cache 2018-11-20 23:12:20 +01:00
Magnus Norddahl 96df21e3dc - fix typo 2018-11-20 13:54:18 +01:00
Magnus Norddahl 216191c86d - interpolate the normal for models 2018-11-20 13:41:27 +01:00
Christoph Oelckers a5ee673c91 - exported ADecal to ZScript as a non-native class.
Its one function is still native but this was by far the easiest of the remaining actor classes to export.
2018-11-19 17:54:38 +01:00
Christoph Oelckers e90ed0a01c removed the quite redundant GetStateForButtonName function
Since it forwards directly to FindState and has no script bindings there is no need to keep it, it'd only complicate the full scriptification of the weapon class if it stuck around.
2018-11-19 18:26:23 +01:00
Christoph Oelckers ad04001135 - fixed some issues with the bodyque and moved this variable into FLevelLocals
* it was never saved in savegames, leaving the state of dead bodies undefined
* it shouldn't be subjected to pointer substitution because all it contains is old dead bodies, not live ones.
2018-11-19 18:13:23 +01:00
Christoph Oelckers 02de10f657 - cleaned up the PointerSubstitution code
Since the only thing it gets used for is swapping out PlayerPawns it can safely skip all global variables that never point to a live player, which allowed to remove quite a bit of code here that stood in the way of scriptifying more content
2018-11-19 17:05:00 +01:00
Christoph Oelckers 108874f379 - fixed the reginfo checks for the Draw... functions.
They need to be offset by the same amount as the arguments so that the values are properly matched.
2018-11-18 21:18:15 +01:00
Christoph Oelckers 8bc2d50ad2 Merge branch 'master' into asmjit
# Conflicts:
#	src/p_actionfunctions.cpp
2018-11-18 21:08:16 +01:00
Christoph Oelckers 426ee2b78e - fixed: Ceiling render hack segments were inserted into the floor list and incorrectly rendered. 2018-11-18 20:03:06 +01:00
Christoph Oelckers 3aef8418d9 - fixed the type checks for object arrays.
Null pointers must be allowed and non-object pointers which are not null must be explicitly checked for because the code could crash on them when performing a static_cast on an incorrect type.
2018-11-18 19:48:09 +01:00
Christoph Oelckers a9ec819557 - moved the type infomation entirely out of VMValue.
For the varargs functions that used the Type field to validate their parameters, now a hidden additional argument is passed which contains a byte array with the type info for the current call's arguments. Since this is static per call location it can be better prepared once when the code is being compiled instead of being put in a runtime created array for each invocation. Everything else uses the per-function instance of the same data.

The only thing that still needed the type field with a VMValue is the defaults array, so this uses a different struct type now to store its data.
2018-11-18 19:31:13 +01:00
Christoph Oelckers a981737855 - generate register type info for the parameter lists of all functions.
Currently used for loading parameters into registers.
For checking parameters of native functions some more work is needed to get the info to the function. Currently it doesn't receive the function descriptor.
2018-11-18 17:10:55 +01:00
Major Cooke a8d4d45e89 P_Thing_Raise fixes & cleanup
- Transfer flags directly into the function and process inside instead of the action functions
- Pass in raiser for all function calls
2018-11-18 15:28:05 +01:00
Magnus Norddahl 1ef772d017 - add missing CheckVMFrame call 2018-11-18 14:02:39 +01:00
Magnus Norddahl a8a9ec98f3 - only allocate stack space for vmframe and call returns when we need them 2018-11-18 13:49:19 +01:00
Magnus Norddahl 748dbec77a - improve dumpjit output slightly 2018-11-18 13:14:41 +01:00
Magnus Norddahl e778f05b12 - don't emit VMValue.Type information when we know the receiver isn't going to read it anyway 2018-11-18 12:59:53 +01:00
Magnus Norddahl 486b7e0f3c - delay emitting PARAM and VTBL instructions until CALL/CALL_K 2018-11-18 12:38:55 +01:00
alexey.lysiuk 4624c6e6a3 - use custom offsetof() macro
src/scripting/vm/jit_call.cpp:164:38: warning: offset of on non-standard-layout type 'VMScriptFunction' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:87:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:96:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:257:53: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
2018-11-18 12:48:50 +02:00
alexey.lysiuk e4c238b6c7 - fixed compilation of POSIX targets
src/scripting/backend/vmbuilder.h:169:19: error: no member named 'function' in namespace 'std'
2018-11-18 12:37:07 +02:00
Christoph Oelckers 28db04b501 - missed one OP_RESULT. 2018-11-18 10:09:29 +01:00
Christoph Oelckers fe0a341e0c - moved all code related to function calls into the helper class so that all future work on the calling convention is in one place only. 2018-11-18 10:02:31 +01:00
Christoph Oelckers cbedcff559 - moved all handling for the simple calls into EmitterArray to have it in one place only.
The main case of FxVmFunctionCall is not done yet, though.
2018-11-18 08:29:41 +01:00
Christoph Oelckers 629d329f22 - removed OP_TAIL.
The amount of support code for this minor optimization was quite large and this stood in the way of streamlining the VM's calling convention, so it was preferable to remove it before moving on.
2018-11-18 07:43:03 +01:00
Magnus Norddahl 4e0c5cf16c - fix compile errors 2018-11-18 03:28:57 +01:00
Christoph Oelckers 292cf93fa7 - fixed TArray's Append methods.
I mistakenly assumed that Grow would incease the array's reserved space.
2018-11-18 01:23:14 +01:00
Christoph Oelckers 983c0c56b1 - changed OP_PARAM handling so that all registers remain allocated until the call instruction and reordered instruction emission so that the param instructions all directly precede the call instruction. 2018-11-18 01:06:04 +01:00
Christoph Oelckers b2c07e731f - completed the Dehacked fix.
I missed some arguments that were specified but set to 'not given'.
2018-11-17 21:33:21 +01:00
Christoph Oelckers 16c85b532b - restored the old A_Jump prototype because DECORATE needs this to parse the arguments. 2018-11-17 21:22:18 +01:00
Christoph Oelckers 5180265ab1 - fixed: The Dehacked function wrappers now need full parameter lists. 2018-11-17 21:21:23 +01:00
Christoph Oelckers 533f66396d Merge branch 'master' into asmjit 2018-11-17 20:16:03 +01:00
Christoph Oelckers 45ef7bca4f - fixed: FTexture::SmoothEdges must forward its result to the base texture in case a redirection is in effect.
Both need the bMasked flag, or some code will think that the texture is not fully opaque if no holes were found.
2018-11-17 18:55:44 +01:00
Christoph Oelckers 08fe9c375b - use the same formula for calculating 3DMidTex offsets as the renderer when per-sidedef scaling is used.
This reuses the FTexCoordInfo class the hardware renderer had been using to calculate wall texture offsetting.
The software renderers still need this sorted out to bring them in line with the rest of the code, though, but they do not have this code sufficiently well organized to make this a straightforward task.
2018-11-17 18:24:14 +01:00
Magnus Norddahl 7e0dacdb1d - disabled code that shows how a thunk function and native setup would look like 2018-11-17 16:26:54 +01:00
Christoph Oelckers 701b793f24 - fixed parameter mixup with P_CanResurrect. 2018-11-17 16:21:08 +01:00
Christoph Oelckers 160f17a907 - fixed stencil cap generation for old hardware and changed it so that it only gets done once for each stencil setup, not for each stencil pass. 2018-11-17 15:34:23 +01:00
Christoph Oelckers bb4007f16a - fixed: CVar.ResetToDefault was missing a check for use outside of menus. 2018-11-17 15:23:57 +01:00
Christoph Oelckers 89cec539fa - fixed IJMP code generation for the JIT compiler.
With a proper count value available this can be done properly. The only relevant targets are the jumps immediately succeeding the IJMP instructions, nothing else.
2018-11-17 13:39:14 +01:00
Christoph Oelckers fcb5684607 - do not use instructions from too recent instruction set extensions.
andn is part of BMI1 which was introduced in 2012, which is far too recent to be used unchecked.
2018-11-17 13:10:18 +01:00
Christoph Oelckers adde0510fe - deconstruct A_Jump with multiple labels into A_Jump(chance, RandomPick(label1, label2, label3,...)) to remove this ugly special case from the VM calling convention.
This also adds the number of available choices to OP_IJMP.
2018-11-17 12:35:03 +01:00
Magnus Norddahl 68afc419af - inline ReadBarrier, GetClass and GetClassMeta 2018-11-17 10:54:16 +01:00
Christoph Oelckers 6398c27646 - fixed RNG setup in FxRandom. 2018-11-17 10:06:01 +01:00
Christoph Oelckers 94ed30e782 - removed the default parameter handling from all native script functions because it is no longer needed. 2018-11-17 10:03:40 +01:00
Christoph Oelckers e643582957 - fixed FxFRandom setup which used a path in FxRandom that is no longer supported. 2018-11-17 08:06:23 +01:00
Magnus Norddahl f99bba48dc - stop using lambda functions for CreateCall because MSVC lambas use a different calling convention and "converts" them to the right one by generating a thunk function 2018-11-17 05:12:47 +01:00
Magnus Norddahl f082a8af98 - removed the SetupSimpleFrameMissingArgs logic as the number of args are now guaranteed 2018-11-17 00:49:22 +01:00
Magnus Norddahl 8ec85cb0ee - add warning text when falling back to the VM 2018-11-17 00:36:40 +01:00
Christoph Oelckers 6423902c63 - removed the unused 'no arguments' cases from the BuiltinRandom functions and split off BuiltinRandom2 into its own function.
This removes the last non-vararg cases where a native VM function checks 'numparam'. As of this commit all function calls will pass the complete list of arguments.
2018-11-17 00:14:39 +01:00