Use packed enums on shader types in ANGLE renderer
This patch uses a packed internal enum ShaderType everywhere we
need a shader type instead of the GLenum value of the shader type.
This patch also uses program::getAttachedShader(type) everywhere
we need to get gl::Shader from a program in ANGLE.
BUG=angleproject:2169
Change-Id: I28a7fa1cfe35622c57a486932911110688eaadec
Reviewed-on: https://chromium-review.googlesource.com/972844
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/Compiler.cpp b/src/libANGLE/Compiler.cpp
index 2523279..d2319b3 100644
--- a/src/libANGLE/Compiler.cpp
+++ b/src/libANGLE/Compiler.cpp
@@ -200,22 +200,22 @@
ANGLE_SWALLOW_ERR(mImplementation->release());
}
-ShHandle Compiler::getCompilerHandle(GLenum type)
+ShHandle Compiler::getCompilerHandle(ShaderType type)
{
ShHandle *compiler = nullptr;
switch (type)
{
- case GL_VERTEX_SHADER:
+ case ShaderType::Vertex:
compiler = &mVertexCompiler;
break;
- case GL_FRAGMENT_SHADER:
+ case ShaderType::Fragment:
compiler = &mFragmentCompiler;
break;
- case GL_COMPUTE_SHADER:
+ case ShaderType::Compute:
compiler = &mComputeCompiler;
break;
- case GL_GEOMETRY_SHADER_EXT:
+ case ShaderType::Geometry:
compiler = &mGeometryCompiler;
break;
default:
@@ -230,7 +230,7 @@
sh::Initialize();
}
- *compiler = sh::ConstructCompiler(type, mSpec, mOutputType, &mResources);
+ *compiler = sh::ConstructCompiler(ToGLenum(type), mSpec, mOutputType, &mResources);
ASSERT(*compiler);
activeCompilerHandles++;
}
@@ -238,7 +238,7 @@
return *compiler;
}
-const std::string &Compiler::getBuiltinResourcesString(GLenum type)
+const std::string &Compiler::getBuiltinResourcesString(ShaderType type)
{
return sh::GetBuiltInResourcesString(getCompilerHandle(type));
}