translator: Put ShaderLang APIs in "sh" namespace.
Working with glslang in Vulkan means we are static linking libANGLE
with functions that have the same name as our translator APIs. We
can fix this by scoping our APIs. We don't need to scope the types
of the file, since they don't conflict.
This will require a follow-up patch to remove the unscoped APIs
once we switch over Chromium.
We also scope TCompiler and some related classes to avoid multiply
defined link errors with glslang.
BUG=angleproject:1576
Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16
Reviewed-on: https://chromium-review.googlesource.com/408337
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
index e008772..e65eb8e 100644
--- a/src/libANGLE/Shader.cpp
+++ b/src/libANGLE/Shader.cpp
@@ -266,17 +266,17 @@
sourceCStrings.push_back(sourceString.c_str());
bool result =
- ShCompile(compilerHandle, &sourceCStrings[0], sourceCStrings.size(), compileOptions);
+ sh::Compile(compilerHandle, &sourceCStrings[0], sourceCStrings.size(), compileOptions);
if (!result)
{
- mInfoLog = ShGetInfoLog(compilerHandle);
+ mInfoLog = sh::GetInfoLog(compilerHandle);
TRACE("\n%s", mInfoLog.c_str());
mCompiled = false;
return;
}
- mState.mTranslatedSource = ShGetObjectCode(compilerHandle);
+ mState.mTranslatedSource = sh::GetObjectCode(compilerHandle);
#ifndef NDEBUG
// Prefix translated shader with commented out un-translated shader.
@@ -301,22 +301,22 @@
#endif
// Gather the shader information
- mState.mShaderVersion = ShGetShaderVersion(compilerHandle);
+ mState.mShaderVersion = sh::GetShaderVersion(compilerHandle);
- mState.mVaryings = GetShaderVariables(ShGetVaryings(compilerHandle));
- mState.mUniforms = GetShaderVariables(ShGetUniforms(compilerHandle));
- mState.mInterfaceBlocks = GetShaderVariables(ShGetInterfaceBlocks(compilerHandle));
+ mState.mVaryings = GetShaderVariables(sh::GetVaryings(compilerHandle));
+ mState.mUniforms = GetShaderVariables(sh::GetUniforms(compilerHandle));
+ mState.mInterfaceBlocks = GetShaderVariables(sh::GetInterfaceBlocks(compilerHandle));
switch (mState.mShaderType)
{
case GL_COMPUTE_SHADER:
{
- mState.mLocalSize = ShGetComputeShaderLocalGroupSize(compilerHandle);
+ mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle);
break;
}
case GL_VERTEX_SHADER:
{
- mState.mActiveAttributes = GetActiveShaderVariables(ShGetAttributes(compilerHandle));
+ mState.mActiveAttributes = GetActiveShaderVariables(sh::GetAttributes(compilerHandle));
break;
}
case GL_FRAGMENT_SHADER:
@@ -324,7 +324,7 @@
// TODO(jmadill): Figure out why we only sort in the FS, and if we need to.
std::sort(mState.mVaryings.begin(), mState.mVaryings.end(), CompareShaderVar);
mState.mActiveOutputVariables =
- GetActiveShaderVariables(ShGetOutputVariables(compilerHandle));
+ GetActiveShaderVariables(sh::GetOutputVariables(compilerHandle));
break;
}
default: