shaderc: Fixed metal interpolation qualifiers.

This commit is contained in:
Бранимир Караџић 2019-01-15 19:01:18 -08:00
parent 1cdc78b451
commit 9d1590670e
2 changed files with 11 additions and 6 deletions

View File

@ -61,6 +61,7 @@ initialize_mesa_context(struct gl_context *ctx, glslopt_target api)
ctx->Extensions.EXT_shader_framebuffer_fetch = true;
break;
case kGlslTargetMetal:
ctx->Const.GLSLVersion = 150;
ctx->Extensions.ARB_ES3_compatibility = true;
ctx->Extensions.EXT_shader_framebuffer_fetch = true;
break;

View File

@ -1131,9 +1131,13 @@ namespace bgfx
|| 0 == bx::strCmp(typen, "noperspective", 13)
|| 0 == bx::strCmp(typen, "centroid", 8) )
{
interpolation = typen;
if ('f' == _options.shaderType)
{
interpolation = typen;
usesInterpolationQualifiers = true;
}
typen = nextWord(parse);
usesInterpolationQualifiers = true;
}
bx::StringView name = nextWord(parse);
@ -1956,15 +1960,15 @@ namespace bgfx
if (0 == essl)
{
const bool need130 = 120 == glsl && (false
const bool need130 = 0 != metal || (120 == glsl && (false
|| !bx::findIdentifierMatch(input, s_130).isEmpty()
|| usesInterpolationQualifiers
|| usesTexelFetch
);
) );
if (0 != metal)
{
bx::stringPrintf(code, "#version 120\n");
bx::stringPrintf(code, "#version 130\n");
}
else
{
@ -2081,7 +2085,7 @@ namespace bgfx
{
bx::stringPrintf(code
, "#define bgfxShadow2D shadow2D\n"
"#define bgfxShadow2DProj shadow2DProj\n"
"#define bgfxShadow2DProj shadow2DProj\n"
);
}
}