I miss AnsiString on Mobile...not only for Internet but for Shaders also.

I miss AnsiString on Mobile...not only for Internet but for Shaders also.

// FMX.Context.GLES.pas

const
GLESHeaderHigh: array [0..24] of byte =
(Byte('p'), Byte('r'), Byte('e'), Byte('c'), Byte('i'), Byte('s'), Byte('i'), Byte('o'), Byte('n'), Byte(' '),
Byte('h'), Byte('i'), Byte('g'), Byte('h'), Byte('p'), Byte(' '), Byte(' '), Byte(' '), Byte('f'), Byte('l'),
Byte('o'), Byte('a'), Byte('t'), Byte(';'), Byte(#13));

Comments

  1. And Shaders are actually stored as array of byte but they are (for OpenGL) just plain ASCII text.

    The DirectX version (provided regardless of the platform) are a binary dump of the fxc compiler output...but they could also be compiled in realtime from an ASCII version with D3DCompiler.

    ReplyDelete
  2. Const
    GLESHeaderHigh : MarshaledAString = 'precision highp float;'#13;

    ReplyDelete
  3. If you stick with ASCII only, doesn't Utf8String do the job?

    ReplyDelete
  4. Uwe Raabe Utf8String on mobile platforms arrived only with Berlin

    ReplyDelete
  5. I wrote a small tool to convert the shader to a byte array. I know it is not the best way, but how often you change the code on runtime.

    ReplyDelete
  6. Jeroen Wiert Pluimers I know this, and I know that Embt don't want to reintroduce AnsiString...just pointing another situation where they are welcome ;)

    ReplyDelete
  7. Paul TOTH I exactly know what you mean. It took weeks for me to get ARAT Synapse running under the new compiler. You might check this out: andy.jgknet.de - System.ByteStrings for 10.1 Berlin | Andy's Blog and Tools

    ReplyDelete
  8. in fact, I used to put binary data in Delphi 6 stings, and Embt told me how bad this is. strings are for textual data, use Stream or TBytes for binary data...but now I have true plain ASCII textual data and I have to put them in UTF8 or TBytes...curious isn't it ? :D

    ReplyDelete
  9. Paul TOTH 'now I have true plain ASCII textual data and I have to put them in UTF8' - if you're sticking to ASCII, there's zero difference between using the AnsiString and UTF8String types... or am I missing something...?

    ReplyDelete
  10. Chris Rolliston probably the same difference between RawByteString and TBytes :) plus extra code to handle UTF8 that is not necessary. And as a french developper I could add some ANSI characters that do not fit in the ASCII table, Voilà :D

    ReplyDelete
  11. Paul TOTH A UTF8String is an AnsiString though. It surely takes more effort to support Windows codepages on non-Windows platforms than UTF-8...

    ReplyDelete
  12. Chris Rolliston yes and a RawByteString is an array of Byte. It's not the problem, it's not consistent to prohibit binary string for semantic reasons and using UTF8String to store non-UTF8 data.

    ReplyDelete
  13. Paul TOTH 'yes and a RawByteString is an array of Byte' - well no, a RawByteString is an AnsiString too (i.e. an array of bytes + code page setting, managed by the long string support routines in System.pas). 'Using UTF8String to store non-UTF8 data' - I thought we were talking about 'plain ASCII text', as you put it in your first post...?

    ReplyDelete
  14. Chris Rolliston ok, you don't agree with me, but I don't want to play with words (and you). Thanks ;)

    ReplyDelete

Post a Comment