MCPcopy Create free account
hub / github.com/comaps/comaps / UpdateDynamicTextures

Method UpdateDynamicTextures

libs/drape/texture_manager.cpp:190–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190bool TextureManager::UpdateDynamicTextures(ref_ptr<dp::GraphicsContext> context)
191{
192 if (m_nothingToUpload.test_and_set())
193 {
194 auto const apiVersion = context->GetApiVersion();
195 if (apiVersion == dp::ApiVersion::OpenGLES3)
196 {
197 // For some reasons OpenGL can not update textures immediately.
198 // Here we use some timeout to prevent rendering frozening.
199 double constexpr kUploadTimeoutInSeconds = 2.0;
200 return m_uploadTimer.ElapsedSeconds() < kUploadTimeoutInSeconds;
201 }
202
203 if (apiVersion == dp::ApiVersion::Metal || apiVersion == dp::ApiVersion::Vulkan)
204 return false;
205
206 CHECK(false, ("Unsupported API version."));
207 }
208
209 CHECK(m_isInitialized, ());
210
211 m_uploadTimer.Reset();
212
213 CHECK(m_colorTexture != nullptr, ());
214 m_colorTexture->UpdateState(context);
215
216 CHECK(m_stipplePenTexture != nullptr, ());
217 m_stipplePenTexture->UpdateState(context);
218
219 UpdateGlyphTextures(context);
220
221 CHECK(m_textureAllocator != nullptr, ());
222 m_textureAllocator->Flush();
223
224 return true;
225}
226
227void TextureManager::UpdateGlyphTextures(ref_ptr<dp::GraphicsContext> context)
228{

Callers 1

RenderFrameMethod · 0.80

Calls 5

ElapsedSecondsMethod · 0.80
GetApiVersionMethod · 0.45
ResetMethod · 0.45
UpdateStateMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected