KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.02k stars 557 forks source link

error C7011: implicit cast from "vec2" to "ivec2" #1720

Open GregSlazinski opened 3 years ago

GregSlazinski commented 3 years ago

Hello,

when compiling this code in HLSL (microsoft directx shader compiler -> SpirV)

cbuffer name {
float2 TemporalOffsetStart;
}
..
int2 sub_offset=(TemporalOffsetStart<0);

and using:

spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_TRUE);
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 310);

results in following glsl code: ivec2 _497=mix(ivec2(0),ivec2(1),lessThan(TemporalOffsetStart,vec2(0.0)));

which results in error: error C7011: implicit cast from "vec2" to "ivec2" (on GeForce 1050 Ti latest driver, windows, and same with Intel GPU)

It works fine when using spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 300);. However on latest spirv-cross version, using 300 prevents from using texture gather. So I'm stuck with using an older spirv-cross version and 300 glsl es.

HansKristian-Work commented 3 years ago

Driver bug. boolean mix() was added to OpenGL ES 3.10. From spec: integer-mix

HansKristian-Work commented 3 years ago

integer-mix-2