From 31116738adbd12fec9ebb3adc28540e62dd903b4 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Tue, 9 Oct 2018 18:30:01 -0400 Subject: [PATCH] Inline many more hotspots for the Texture draw test. Bug: angleproject:2763 Change-Id: Ib8193e7ff5ee7763b92f4775fb7e9adaa51c9305 Reviewed-on: https://chromium-review.googlesource.com/c/1262738 Commit-Queue: Jamie Madill Reviewed-by: Yuly Novikov --- src/libANGLE/Context.cpp | 5 ---- src/libANGLE/Context.h | 11 ++++++-- src/libANGLE/Framebuffer.cpp | 10 ------- src/libANGLE/Framebuffer.h | 16 ++++++++--- src/libANGLE/FramebufferAttachment.cpp | 5 ---- src/libANGLE/FramebufferAttachment.h | 4 ++- src/libANGLE/ResourceManager.h | 8 +++--- src/libANGLE/ResourceMap.h | 2 +- src/libANGLE/State.cpp | 2 +- src/libANGLE/TransformFeedback.cpp | 5 ---- src/libANGLE/TransformFeedback.h | 3 ++- src/libANGLE/params.cpp | 37 -------------------------- src/libANGLE/params.h | 26 ++++++++++++++++-- src/libANGLE/validationES2.cpp | 5 ---- src/libANGLE/validationES2.h | 4 +++ 15 files changed, 62 insertions(+), 81 deletions(-) diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index bfd5815fd..fad487167 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -7823,11 +7823,6 @@ Shader *Context::getShader(GLuint handle) const return mState.mShaderPrograms->getShader(handle); } -bool Context::isTextureGenerated(GLuint texture) const -{ - return mState.mTextures->isHandleGenerated(texture); -} - bool Context::isRenderbufferGenerated(GLuint renderbuffer) const { return mState.mRenderbuffers->isHandleGenerated(renderbuffer); diff --git a/src/libANGLE/Context.h b/src/libANGLE/Context.h index 6faca5789..24523774d 100644 --- a/src/libANGLE/Context.h +++ b/src/libANGLE/Context.h @@ -480,7 +480,10 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl Buffer *getBuffer(GLuint handle) const; FenceNV *getFenceNV(GLuint handle); Sync *getSync(GLsync handle) const; - Texture *getTexture(GLuint handle) const { return mState.mTextures->getTexture(handle); } + ANGLE_INLINE Texture *getTexture(GLuint handle) const + { + return mState.mTextures->getTexture(handle); + } Framebuffer *getFramebuffer(GLuint handle) const; Renderbuffer *getRenderbuffer(GLuint handle) const; @@ -1636,7 +1639,11 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl Program *getProgramNoResolveLink(GLuint handle) const; Shader *getShader(GLuint handle) const; - bool isTextureGenerated(GLuint texture) const; + ANGLE_INLINE bool isTextureGenerated(GLuint texture) const + { + return mState.mTextures->isHandleGenerated(texture); + } + bool isBufferGenerated(GLuint buffer) const { return mState.mBuffers->isHandleGenerated(buffer); diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp index b577d2269..7c6c609ea 100644 --- a/src/libANGLE/Framebuffer.cpp +++ b/src/libANGLE/Framebuffer.cpp @@ -587,16 +587,6 @@ bool FramebufferState::hasStencil() const return (mStencilAttachment.isAttached() && mStencilAttachment.getStencilSize() > 0); } -GLsizei FramebufferState::getNumViews() const -{ - const FramebufferAttachment *attachment = getFirstNonNullAttachment(); - if (attachment == nullptr) - { - return FramebufferAttachment::kDefaultNumViews; - } - return attachment->getNumViews(); -} - const std::vector *FramebufferState::getViewportOffsets() const { const FramebufferAttachment *attachment = getFirstNonNullAttachment(); diff --git a/src/libANGLE/Framebuffer.h b/src/libANGLE/Framebuffer.h index 7777548b8..6f3891725 100644 --- a/src/libANGLE/Framebuffer.h +++ b/src/libANGLE/Framebuffer.h @@ -97,7 +97,17 @@ class FramebufferState final : angle::NonCopyable bool hasStencil() const; GLenum getMultiviewLayout() const; - GLsizei getNumViews() const; + + ANGLE_INLINE GLsizei getNumViews() const + { + const FramebufferAttachment *attachment = getFirstNonNullAttachment(); + if (attachment == nullptr) + { + return FramebufferAttachment::kDefaultNumViews; + } + return attachment->getNumViews(); + } + const std::vector *getViewportOffsets() const; GLint getBaseViewIndex() const; @@ -240,7 +250,7 @@ class Framebuffer final : public angle::ObserverInterface, void invalidateCompletenessCache(const Context *context); - GLenum checkStatus(const Context *context) + ANGLE_INLINE GLenum checkStatus(const Context *context) { // The default framebuffer is always complete except when it is surfaceless in which // case it is always unsupported. @@ -257,7 +267,7 @@ class Framebuffer final : public angle::ObserverInterface, int getCachedSamples(const Context *context); // Helper for checkStatus == GL_FRAMEBUFFER_COMPLETE. - bool isComplete(const Context *context) + ANGLE_INLINE bool isComplete(const Context *context) { return (checkStatus(context) == GL_FRAMEBUFFER_COMPLETE); } diff --git a/src/libANGLE/FramebufferAttachment.cpp b/src/libANGLE/FramebufferAttachment.cpp index d2311149c..dc5b6bcec 100644 --- a/src/libANGLE/FramebufferAttachment.cpp +++ b/src/libANGLE/FramebufferAttachment.cpp @@ -256,11 +256,6 @@ bool FramebufferAttachment::isLayered() const return mTarget.textureIndex().isLayered(); } -GLsizei FramebufferAttachment::getNumViews() const -{ - return mNumViews; -} - GLenum FramebufferAttachment::getMultiviewLayout() const { return mMultiviewLayout; diff --git a/src/libANGLE/FramebufferAttachment.h b/src/libANGLE/FramebufferAttachment.h index 44f56c8fa..72a3b9c72 100644 --- a/src/libANGLE/FramebufferAttachment.h +++ b/src/libANGLE/FramebufferAttachment.h @@ -114,7 +114,9 @@ class FramebufferAttachment final GLint mipLevel() const; GLint layer() const; bool isLayered() const; - GLsizei getNumViews() const; + + GLsizei getNumViews() const { return mNumViews; } + GLenum getMultiviewLayout() const; GLint getBaseViewIndex() const; const std::vector &getMultiviewViewportOffsets() const; diff --git a/src/libANGLE/ResourceManager.h b/src/libANGLE/ResourceManager.h index 14f940f70..3ca900ef1 100644 --- a/src/libANGLE/ResourceManager.h +++ b/src/libANGLE/ResourceManager.h @@ -64,7 +64,7 @@ class TypedResourceManager : public ResourceManagerBase TypedResourceManager() {} void deleteObject(const Context *context, GLuint handle); - bool isHandleGenerated(GLuint handle) const + ANGLE_INLINE bool isHandleGenerated(GLuint handle) const { // Zero is always assumed to have been generated implicitly. return handle == 0 || mObjectMap.contains(handle); @@ -166,7 +166,7 @@ class TextureManager : public TypedResourceManager::~ResourceMap() } template -bool ResourceMap::contains(GLuint handle) const +ANGLE_INLINE bool ResourceMap::contains(GLuint handle) const { if (handle < mFlatResourcesSize) { diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp index 434d7476c..a6f8beafe 100644 --- a/src/libANGLE/State.cpp +++ b/src/libANGLE/State.cpp @@ -381,7 +381,7 @@ ANGLE_INLINE angle::Result State::updateActiveTexture(const Context *context, return angle::Result::Continue(); } - mCompleteTextureBindings[textureIndex].bind(texture->getSubject()); + mCompleteTextureBindings[textureIndex].bind(texture->getImplementation()); if (!texture->isSamplerComplete(context, sampler)) { diff --git a/src/libANGLE/TransformFeedback.cpp b/src/libANGLE/TransformFeedback.cpp index 8ae932d20..4958736c7 100644 --- a/src/libANGLE/TransformFeedback.cpp +++ b/src/libANGLE/TransformFeedback.cpp @@ -169,11 +169,6 @@ void TransformFeedback::resume() mImplementation->resume(); } -bool TransformFeedback::isActive() const -{ - return mState.mActive; -} - bool TransformFeedback::isPaused() const { return mState.mPaused; diff --git a/src/libANGLE/TransformFeedback.h b/src/libANGLE/TransformFeedback.h index 800ce8713..119331895 100644 --- a/src/libANGLE/TransformFeedback.h +++ b/src/libANGLE/TransformFeedback.h @@ -68,7 +68,8 @@ class TransformFeedback final : public RefCountObject, public LabeledObject void pause(); void resume(); - bool isActive() const; + bool isActive() const { return mState.mActive; } + bool isPaused() const; PrimitiveMode getPrimitiveMode() const; // Validates that the vertices produced by a draw call will fit in the bound transform feedback diff --git a/src/libANGLE/params.cpp b/src/libANGLE/params.cpp index 14785d79a..5ddc6b318 100644 --- a/src/libANGLE/params.cpp +++ b/src/libANGLE/params.cpp @@ -20,43 +20,6 @@ namespace gl constexpr ParamTypeInfo ParamsBase::TypeInfo; constexpr ParamTypeInfo DrawCallParams::TypeInfo; -// DrawCallParams implementation. -// Called by DrawArrays. -DrawCallParams::DrawCallParams(PrimitiveMode mode, - GLint firstVertex, - GLsizei vertexCount, - GLsizei instances) - : mMode(mode), - mFirstVertex(firstVertex), - mVertexCount(vertexCount), - mIndexCount(0), - mBaseVertex(0), - mType(GL_NONE), - mIndices(nullptr), - mInstances(instances), - mIndirect(nullptr) -{ -} - -// Called by DrawElements. -DrawCallParams::DrawCallParams(PrimitiveMode mode, - GLint indexCount, - GLenum type, - const void *indices, - GLint baseVertex, - GLsizei instances) - : mMode(mode), - mFirstVertex(0), - mVertexCount(0), - mIndexCount(indexCount), - mBaseVertex(baseVertex), - mType(type), - mIndices(indices), - mInstances(instances), - mIndirect(nullptr) -{ -} - // Called by DrawArraysIndirect. DrawCallParams::DrawCallParams(PrimitiveMode mode, const void *indirect) : mMode(mode), diff --git a/src/libANGLE/params.h b/src/libANGLE/params.h index 26e99ff90..08fe5544d 100644 --- a/src/libANGLE/params.h +++ b/src/libANGLE/params.h @@ -78,7 +78,18 @@ class DrawCallParams final : angle::NonCopyable { public: // Called by DrawArrays. - DrawCallParams(PrimitiveMode mode, GLint firstVertex, GLsizei vertexCount, GLsizei instances); + DrawCallParams(PrimitiveMode mode, GLint firstVertex, GLsizei vertexCount, GLsizei instances) + : mMode(mode), + mFirstVertex(firstVertex), + mVertexCount(vertexCount), + mIndexCount(0), + mBaseVertex(0), + mType(GL_NONE), + mIndices(nullptr), + mInstances(instances), + mIndirect(nullptr) + { + } // Called by DrawElements. DrawCallParams(PrimitiveMode mode, @@ -86,7 +97,18 @@ class DrawCallParams final : angle::NonCopyable GLenum type, const void *indices, GLint baseVertex, - GLsizei instances); + GLsizei instances) + : mMode(mode), + mFirstVertex(0), + mVertexCount(0), + mIndexCount(indexCount), + mBaseVertex(baseVertex), + mType(type), + mIndices(indices), + mInstances(instances), + mIndirect(nullptr) + { + } // Called by DrawArraysIndirect. DrawCallParams(PrimitiveMode mode, const void *indirect); diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp index 7eb99bb1a..5433c43e5 100644 --- a/src/libANGLE/validationES2.cpp +++ b/src/libANGLE/validationES2.cpp @@ -5681,11 +5681,6 @@ bool ValidateUniform1i(Context *context, GLint location, GLint x) return ValidateUniform1iv(context, location, 1, &x); } -bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y) -{ - return ValidateUniform(context, GL_FLOAT_VEC2, location, 1); -} - bool ValidateUniform2fv(Context *context, GLint location, GLsizei count, const GLfloat *v) { return ValidateUniform(context, GL_FLOAT_VEC2, location, count); diff --git a/src/libANGLE/validationES2.h b/src/libANGLE/validationES2.h index 2ebf15ff4..a0ea78631 100644 --- a/src/libANGLE/validationES2.h +++ b/src/libANGLE/validationES2.h @@ -723,6 +723,10 @@ bool ValidateTexStorage3DEXT(Context *context, GLsizei depth); bool ValidateMaxShaderCompilerThreadsKHR(Context *context, GLuint count); +ANGLE_INLINE bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y) +{ + return ValidateUniform(context, GL_FLOAT_VEC2, location, 1); +} } // namespace gl #endif // LIBANGLE_VALIDATION_ES2_H_