Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ RefPtr<BitmapTexture> BitmapTexturePool::acquireTexture(const IntSize& size, Opt
m_textures.append(Entry(BitmapTexture::create(size, flags)));
selectedEntry = &m_textures.last();
m_poolSize += size.unclampedArea();

if (flags.contains(BitmapTexture::Flags::DepthBuffer))
m_poolSize += size.unclampedArea();
} else
selectedEntry->m_texture->reset(size, flags);

Expand Down Expand Up @@ -100,6 +103,10 @@ void BitmapTexturePool::releaseUnusedTexturesTimerFired()
m_textures.removeAllMatching([this, &minUsedTime](const Entry& entry) {
if (entry.canBeReleased(minUsedTime)) {
m_poolSize -= entry.m_texture->size().unclampedArea();

if (entry.m_texture->flags().contains(BitmapTexture::Flags::DepthBuffer))
m_poolSize -= entry.m_texture->size().unclampedArea();

return true;
}
return false;
Expand Down
6 changes: 6 additions & 0 deletions Source/WebCore/platform/graphics/texmap/TextureMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ class TextureMapperGLData {
SharedGLData()
{
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);

#ifdef GL_TEXTURE_MAX_SIZE
// Limit the max texture size to allow textures reuse and reduce GPU mem spikes
if (m_maxTextureSize > GL_TEXTURE_MAX_SIZE)
m_maxTextureSize = GL_TEXTURE_MAX_SIZE;
#endif
}

HashMap<unsigned, RefPtr<TextureMapperShaderProgram>> m_programs;
Expand Down
4 changes: 4 additions & 0 deletions Source/cmake/OptionsWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ if (USER_AGENT_BRANDING)
add_definitions(-DUSER_AGENT_BRANDING=${USER_AGENT_BRANDING})
endif ()

if (GL_TEXTURE_MAX_SIZE)
add_definitions(-DGL_TEXTURE_MAX_SIZE=${GL_TEXTURE_MAX_SIZE})
endif ()

if (NOT EXISTS "${TOOLS_DIR}/glib/apply-build-revision-to-files.py")
set(BUILD_REVISION "tarball")
endif ()
Expand Down