shaderc: Fixed GLSL 140. (#3644)

This commit is contained in:
Branimir Karadžić
2026-03-23 22:32:52 -07:00
committed by GitHub
parent fd8d480b28
commit f1ff08a799

View File

@@ -2452,11 +2452,24 @@ namespace bgfx
bx::stringPrintf(code, "#version %d\n", need130 ? 130 : glsl_profile);
if (need130)
if (need130
|| glsl_profile >= 130)
{
bx::stringPrintf(code, "#define attribute in\n");
bx::stringPrintf(code, "#define varying %s\n"
, 'f' == _options.shaderType ? "in" : "out"
);
bx::stringPrintf(code
, "#define bgfxShadow2D(_sampler, _coord) vec4_splat(texture(_sampler, _coord) )\n"
"#define bgfxShadow2DProj(_sampler, _coord) vec4_splat(textureProj(_sampler, _coord) )\n"
);
}
else
{
bx::stringPrintf(code
, "#define bgfxShadow2D shadow2D\n"
"#define bgfxShadow2DProj shader2DProj\n"
);
}
if (usesInstanceID)
@@ -2547,21 +2560,6 @@ namespace bgfx
"#define textureCubeGrad textureCubeGradEXT\n"
);
}
if (need130 || (glsl_profile >= 130) )
{
bx::stringPrintf(code
, "#define bgfxShadow2D(_sampler, _coord) vec4_splat(texture(_sampler, _coord) )\n"
"#define bgfxShadow2DProj(_sampler, _coord) vec4_splat(textureProj(_sampler, _coord) )\n"
);
}
else
{
bx::stringPrintf(code
, "#define bgfxShadow2D shadow2D\n"
"#define bgfxShadow2DProj shader2DProj\n"
);
}
}
else
{