• Advertisement


  • Content count

  • Joined

  • Last visited

Everything posted by BClarenbach

  1. AngelScript 2.26.0 is out

    * CScriptBuilder::AddSectionFromMemory() now requires a name and an optional length for the buffer in case it is not null terminated (Thanks Paril101)   was a dangerous change because it swaps the order of parameters but because of the new default parameter, its not obvious when you update. :)
  2. Type-Casting single reference types

    Hi, I have a couple of objects that I currently introduce as single reference types into the scripting environment. This is because they are in-place allocated in a special memory manager. They obviously do not have any ref counting behaviours, either. Now the management class only handles base pointers to the class hierarchy. I would like to create casting behaviours in AS now so that I can safely cast the types up and down the hierarchy. I am not able to register the type casting like it is documented in the Class Hierarchies chapter of the manual. Returning by value is obviously wrong, returning by @ is equally wrong since there is no ref counting. Returning by & returns an error when I try to register the type cast. Any ideas or hints on what I could also do? Thanks!
  3. Type-Casting single reference types

    Thanks, NOCOUNT did what I wanted. I know the lifetime of both objects and scripts, so there is no danger of dangling references
  4. 16 Byte Alignment on Value Types

    Hi, I need a 16 byte alignment on certain value types to accurately mirror value classes we pass into our interface. I've tried overloading the memory allocator but that does not seem to work, I still get unaligned addresses for value types created by AngelScript. I noticed there is an 8 byte alignment flag, but that does not seem to do anything at all. Could you point me to where I can modify this and turn the 8byte into a functional 16 byte alignment flag? Thanks!
  5. 16 Byte Alignment on Value Types

    Never mind, forgot to switch the type registration from value back to scoped. .. .
  6. 16 Byte Alignment on Value Types

    Hi, I tried to implement your wrapper idea but it seems that the type registration does not allow @ modifiers when using scoped types. [source lang="bash"]Object handle is not supported for this type Failed in call to function 'RegisterObjectMethod' with 'vector' and 'vector @opAdd(const vector &in) const' (Code: -10)[/source] Any ideas? The signature of the wrapper is like you mentioned in your post. Thanks for the help!
  7. 16 Byte Alignment on Value Types

    With modern SIMD architectures, we're looking mostly at 4 and 16 byte alignments. If AS would provide those two, my guesstimate is that almost everyone is happy. If your class needs 8 bytes alignment, you are probably happy with 16 byte alignments, too. If your class needs alignments over 16 bytes, you are most likely ok to allocate the memory in a different location and wrap the access. (e.g. 4k pages etc.) If an align16 object flag is reasonably easy to implement, that would be fabulous. Right now, I had to switch to unaligned reads for my simd types which makes the bridge between native and scripted code somewhat cumbersome. No, I am not going to do performance relevant math operations in scripts but passing values in and out of registered functions that use an equivalent math class like we have in the native code makes it easier to read and maintain.
  8. 16 Byte Alignment on Value Types

    The problem appears to be amazingly similar to http://www.gamedev.net/topic/507813-operator-addsubmultiplydivide-with-scoped-types/
  9. 16 Byte Alignment on Value Types

    I've run into a problem with the scoped reference type. I have the following registration call: [source lang="cpp"] r = _engine->RegisterObjectMethod("vector", "vector &opAdd(const vector &in) const", asMETHODPR(Vector, operator+, (const Vector &) const, Vector), asCALL_THISCALL); [/source] and this binds to a class method of class Vector that is declared like this: [source lang="cpp"] Vector operator+( const Vector& _rhs ) const; [/source] There seems to be no way to declare the method in a working fashion. If I leave the reference out in the angelscript type, I cannot register the method. If I remove the reference on the c++ side, I hit a road block because it is 16 bytes aligned and value parameters do not work with alignment restrictions. If I use both the way they are, I get a 0-pointer on the _rhs parameter. Any ideas on how to work around this? Thanks! ps.: I dug up the old post so you knew the troubles I had with declaring vector a scoped reference and why I did it.
  10. 16 Byte Alignment on Value Types

    I turned it into a scoped reference type for now. Seems to work ok so far.
  11. Section names and reloading

    Hi, I have a usage scenario for AngelScript and would like to ask if that is possible at all and what the best way to do it is: I believe I have the easy steps figured out (but am open to suggestions): - I register a set of interfaces with the scripting engine so the scripts can interact with my systems - The scripts are going to be script classes that implement a set of event methods set by a specific interface (like onUpdate or onSetup) - Although many different instances of those script classes exist, only one of the event methods run at a time. - The system loads presets that reference script code. I would ideally have this script code in binary form when I load it. The hard part would be: - During developement of the presets, I would ideally be able to unload the script class definition for one preset and reload it with the updated code. The main problem is that there will most likely be 300-400 of those presets active at one time, and only a hand full share the same script class so only those would need reloading. I traced AddScriptSection for a bit and found that although it uses a string table and index for the naming, the index itself is not really used and sections with the same name would be added more than once. I also found no way to unload a section, either. Thanks for helping!
  • Advertisement