Commit 87498164 by jchen10 Committed by Commit Bot

Make some Program methods inlined

These methods are very hot in the DrawCall/gl_null bechmark. With this CL applied, the score can improve about 10% on Linux. This also removes a few unnecessary resolveLink calls. Bug: chromium:873724 Change-Id: I6034f29eeeebe8341dae3988c38196123687a44f Reviewed-on: https://chromium-review.googlesource.com/1183522 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6d32cefd
...@@ -1668,23 +1668,12 @@ const std::vector<sh::Attribute> &Program::getAttributes() const ...@@ -1668,23 +1668,12 @@ const std::vector<sh::Attribute> &Program::getAttributes() const
return mState.mAttributes; return mState.mAttributes;
} }
const AttributesMask &Program::getActiveAttribLocationsMask() const
{
resolveLink();
return mState.mActiveAttribLocationsMask;
}
const std::vector<SamplerBinding> &Program::getSamplerBindings() const const std::vector<SamplerBinding> &Program::getSamplerBindings() const
{ {
resolveLink(); resolveLink();
return mState.mSamplerBindings; return mState.mSamplerBindings;
} }
const std::vector<ImageBinding> &Program::getImageBindings() const
{
resolveLink();
return mState.mImageBindings;
}
const sh::WorkGroupSize &Program::getComputeShaderLocalSize() const const sh::WorkGroupSize &Program::getComputeShaderLocalSize() const
{ {
resolveLink(); resolveLink();
...@@ -1712,12 +1701,6 @@ GLint Program::getGeometryShaderMaxVertices() const ...@@ -1712,12 +1701,6 @@ GLint Program::getGeometryShaderMaxVertices() const
return mState.mGeometryShaderMaxVertices; return mState.mGeometryShaderMaxVertices;
} }
const ProgramState &Program::getState() const
{
resolveLink();
return mState;
}
GLuint Program::getInputResourceIndex(const GLchar *name) const GLuint Program::getInputResourceIndex(const GLchar *name) const
{ {
resolveLink(); resolveLink();
...@@ -1847,11 +1830,6 @@ int Program::getNumViews() const ...@@ -1847,11 +1830,6 @@ int Program::getNumViews() const
resolveLink(); resolveLink();
return mState.getNumViews(); return mState.getNumViews();
} }
bool Program::usesMultiview() const
{
resolveLink();
return mState.usesMultiview();
}
ComponentTypeMask Program::getDrawBufferTypeMask() const ComponentTypeMask Program::getDrawBufferTypeMask() const
{ {
......
...@@ -691,16 +691,29 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -691,16 +691,29 @@ class Program final : angle::NonCopyable, public LabeledObject
bool isValidated() const; bool isValidated() const;
bool samplesFromTexture(const State &state, GLuint textureID) const; bool samplesFromTexture(const State &state, GLuint textureID) const;
const AttributesMask &getActiveAttribLocationsMask() const; const AttributesMask &getActiveAttribLocationsMask() const
{
resolveLink();
return mState.mActiveAttribLocationsMask;
}
const std::vector<SamplerBinding> &getSamplerBindings() const; const std::vector<SamplerBinding> &getSamplerBindings() const;
const std::vector<ImageBinding> &getImageBindings() const; const std::vector<ImageBinding> &getImageBindings() const
{
resolveLink();
return mState.mImageBindings;
}
const sh::WorkGroupSize &getComputeShaderLocalSize() const; const sh::WorkGroupSize &getComputeShaderLocalSize() const;
PrimitiveMode getGeometryShaderInputPrimitiveType() const; PrimitiveMode getGeometryShaderInputPrimitiveType() const;
PrimitiveMode getGeometryShaderOutputPrimitiveType() const; PrimitiveMode getGeometryShaderOutputPrimitiveType() const;
GLint getGeometryShaderInvocations() const; GLint getGeometryShaderInvocations() const;
GLint getGeometryShaderMaxVertices() const; GLint getGeometryShaderMaxVertices() const;
const ProgramState &getState() const; const ProgramState &getState() const
{
resolveLink();
return mState;
}
static LinkMismatchError LinkValidateVariablesBase( static LinkMismatchError LinkValidateVariablesBase(
const sh::ShaderVariable &variable1, const sh::ShaderVariable &variable1,
...@@ -726,7 +739,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -726,7 +739,7 @@ class Program final : angle::NonCopyable, public LabeledObject
const ProgramBindings &getFragmentInputBindings() const; const ProgramBindings &getFragmentInputBindings() const;
int getNumViews() const; int getNumViews() const;
bool usesMultiview() const; bool usesMultiview() const { return mState.usesMultiview(); }
ComponentTypeMask getDrawBufferTypeMask() const; ComponentTypeMask getDrawBufferTypeMask() const;
ComponentTypeMask getAttributesTypeMask() const; ComponentTypeMask getAttributesTypeMask() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment