Results 1 to 10 of 48

Thread: Cheb's project will be here.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2



    Yet another !surprise! from this newfangled string encoding auto-management.

    I launched my engine compiled in fpc 3.0.4 on the mammoth coprolite I call my file server:
    Code:
    Chentrah version 0.21.3847 for Win32-i386, 
      compiled at 12:21:52 on 2018/01/28 using Free Pascal 3.0.4.
      (developer mode on)
    Operating System: Wine 1.3.28 / Ubuntu 11.10
    User name: cheb
    CPU Phenom II X2 550
      x2 logical cores
      level 2 cache: 512 Kbytes, line size 64 bytes
      TSC invariancy: yes
      TSC frequency: 3.11 GHz)
    Lo and behold it crashed with "Failed to load "GL_ARB_framebuffer_object"".
    Scratching the bone between my ears, I checked the extension string. Nope, the extension was there. So why?

    Unearthed an old function naively assuming that String = AnsiString:
    Code:
    function glext_ExtensionSupported(const extension: String; const searchIn: String): Boolean;
    var
      extensions: PAnsiChar;
      start: PAnsiChar;
      where, terminator: PAnsiChar;
    begin
    
      if (Pos(' ', extension) <> 0) or (extension = '') then
      begin
        Result := FALSE;
        Exit;
      end;
    
      if searchIn = '' then extensions := PAnsiChar(glGetString(GL_EXTENSIONS))
      else extensions := PAnsiChar(searchIn);
      start := extensions;
      while TRUE do
      begin
        where := StrPos(start, PAnsiChar(extension));
        if where = nil then Break;
        terminator := Pointer(PtrUInt(where) + Length(extension));
        if (where = start) or (PAnsiChar(PtrUInt(where) - 1)^ = ' ') then
        begin
          if (terminator^ = ' ') or (terminator^ = #0) then
          begin
            Result := TRUE;
            Exit;
          end;
        end;
        start := terminator;
      end;
      Result := FALSE;
    
    end;
    Corrected it to AnsiString and my engine started up, proving there is life on GeForce 7025.

    But!
    The wrong version was working fine in real Windows.
    I can only assume that that fossilized wine did not have some mechanism the auto-recoding of the FPC RTL relies on.
    That's another thing to watch out for, I suppose.
    Last edited by Chebmaster; 20-11-2019 at 08:58 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •