-
Notifications
You must be signed in to change notification settings - Fork 943
Open
Description
I'm using pair of glslang and SPIRV-Cross and compiling simple shader to ES target without optimizer. Input code:
#version 450 core
precision mediump float;
layout(set = 0, binding = 1) uniform mediump sampler2D sTexture;
layout(location = 0) in VertexData {
vec4 Color;
vec2 UV;
} In;
layout(location = 0) out mediump vec4 fColor;
void main() {
fColor = In.Color * texture(sTexture, In.UV.st);
}Without any modifications im getting output:
#version 300 es
precision mediump float;
precision highp int;
uniform highp sampler2D sTexture;
layout(location = 0) out highp vec4 fColor;
in highp vec4 In_Color;
in highp vec2 In_UV;
void main()
{
fColor = In_Color * texture(sTexture, In_UV);
}If I modify GlslangToSpv.cpp with manually forcing precision to RelaxedPrecision
spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type)
{
return spv::Decoration::RelaxedPrecision;
//return TranslatePrecisionDecoration(type.getQualifier().precision);
}Then im getting following output:
#version 300 es
precision mediump float;
precision highp int;
uniform mediump sampler2D sTexture;
layout(location = 0) out vec4 fColor;
in vec4 In_Color;
in vec2 In_UV;
void main()
{
vec4 _19 = In_Color;
highp vec4 hp_copy_19 = _19;
vec4 _29 = texture(sTexture, In_UV);
highp vec4 hp_copy_29 = _29;
fColor = hp_copy_19 * hp_copy_29;
}What's the problem, why does it constantly generate highp without forcing? It's clear that I can't use this modification because it affects other places like uniforms, etc.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels