Announcement

Collapse
No announcement yet.

c0000005 ACCESS_VIOLATION during CanvasInit() in 64bit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • c0000005 ACCESS_VIOLATION during CanvasInit() in 64bit

    Hi,

    Afterwarp is a fantastic piece of software and i was able to solve a lot of thing mire efficient than in asphyre.
    Converting software from asphyre to afterwork goes well, but one error appear while compiling the application in 64bit.
    The init of the device succeeded, but in the next step an exception is throw while init the canvas.

    Anyone has an idea how this could solved? I tried to compile the examples under delphi sydney 10.4 but same issue.

    Best regards

    MC

  • #2
    A similar problem was reported by one of our clients few years ago. I don't remember exactly what was the culprit, but it could be either due to floating-point exceptions being enabled (they are getting disabled when you call DeviceInit) or something similar. Does this happen both in Direct3D and OpenGL backends?

    Since several months ago we're offering our clients to try Afterwarp v2, which was ready since December 2019, but due to pandemic we didn't have opportunity to publish it officially yet. It is scheduled to replace Afterwarp v1. In case of canvas, it has some additional optimizations and internal changes, plus Delphi/Pascal headers have been updated, so it is possible that this issue will no longer occur there. If you want to try the new version before it is released, please send me an e-mail.

    Comment


    • #3
      After further investigation, this appears to be a Delphi compiler bug, which usually happens during creation of 3D modeling scene, reproduced in Delphi 10.4.1.

      Inside "PXT.Graphics.pas" at line 1946, the declaration looks as following:
      Code:
      function ModelSceneInit(const ADevice: TDevice; const AShadowTechnique: TShadowTechnique;
        const AAttributes: TSceneAttributes; const AVertexElements: array of TVertexElement): TModelScene; overload;
      In simple examples such as Triangle or Cube, this would be the first entry point that triggers AV exception. It can also be seen that internal value of "ADevice" changes from correct one to some garbage once the function is entered (it is a Delphi function that inside does minor processing and then calls C API). The problem can be avoided, if the above declaration is modified, by changing first "const" into "var":
      Code:
      function ModelSceneInit(var ADevice: TDevice; const AShadowTechnique: TShadowTechnique;
        const AAttributes: TSceneAttributes; const AVertexElements: array of TVertexElement): TModelScene; overload;
      There are a couple of other functions inside "PXT.Graphics.pas", where this issue occurs. This will be fixed by using classes as API wrappers instead of objects/records at a cost of minor additional calling overhead in incoming release of Afterwarp v2.

      Comment

      Working...
      X