mellinoe / ShaderGen

Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
MIT License
497 stars 56 forks source link

[Bug] Comparison between UInt and Int fails on GlslEs300 #75

Open thargy opened 6 years ago

thargy commented 6 years ago

When compiling code such as

    uint index = 3;
    if (index >= 2)
        return ;

Against the GlslEs300 backend, the following error occurs (from glslangvalidator:

'>=' : wrong operand types: no operation '>=' exists that takes a left-hand operand of type ' temp mediump uint' and a right operand of type ' const int' (or there is no acceptable conversion)

This implies we need add am explicit cast in this scenario for this specific backend (compilation succeeds on other backends, can't test Metal).

mellinoe commented 6 years ago

GLSL ES has been a major pain with how it handles signed-unsigned and other cross-type comparisons. It's far more strict than all of the other language targets, for whatever reason.