END_TEST;
}
+int UtcDaliFramebufferContextLoss(void)
+{
+ tet_infoline("UtcDaliFramebufferContextLoss\n");
+ TestApplication application; // Default config: DALI_DISCARDS_ALL_DATA
+
+ //Create the texture
+ unsigned int width(64);
+ unsigned int height(64);
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ DALI_TEST_CHECK( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ DALI_TEST_CHECK( frameBuffer );
+ frameBuffer.AttachColorTexture( texture, 0u, 1u );
+
+ application.SendNotification();
+ application.Render(16);
+
+ // Lose & regain context (in render 'thread')
+ application.ResetContext();
+ DALI_TEST_CHECK( frameBuffer );
+
+ END_TEST;
+}
END_TEST;
}
+int UtcDaliTextureContextLoss(void)
+{
+ tet_infoline("UtcDaliTextureContextLoss\n");
+ TestApplication application; // Default config: DALI_DISCARDS_ALL_DATA
+
+ //Create the texture
+ unsigned int width(64);
+ unsigned int height(64);
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ DALI_TEST_CHECK( texture );
+
+ application.SendNotification();
+ application.Render(16);
+
+ // Lose & regain context (in render 'thread')
+ application.ResetContext();
+ DALI_TEST_CHECK( texture );
+
+ END_TEST;
+}
RenderManager::~RenderManager()
{
- for ( TextureOwnerIter iter = mImpl->textureContainer.Begin(); iter != mImpl->textureContainer.End(); ++iter )
- {
- (*iter)->Destroy( mImpl->context );
- }
-
- for ( FrameBufferOwnerIter iter = mImpl->frameBufferContainer.Begin(); iter != mImpl->frameBufferContainer.End(); ++iter )
- {
- (*iter)->Destroy( mImpl->context );
- }
-
delete mImpl;
}
// inform texture cache
mImpl->textureCache.GlContextDestroyed(); // Clears gl texture ids
+ //Inform textures
+ for( TextureOwnerIter iter = mImpl->textureContainer.Begin(); iter != mImpl->textureContainer.End(); ++iter )
+ {
+ (*iter)->GlContextDestroyed();
+ }
+
+ //Inform framebuffers
+ for( FrameBufferOwnerIter iter = mImpl->frameBufferContainer.Begin(); iter != mImpl->frameBufferContainer.End(); ++iter )
+ {
+ (*iter)->GlContextDestroyed();
+ }
+
// inform renderers
RendererOwnerContainer::Iterator end = mImpl->rendererContainer.End();
RendererOwnerContainer::Iterator iter = mImpl->rendererContainer.Begin();
}
}
+void FrameBuffer::GlContextDestroyed()
+{
+ mId = 0u;
+}
+
void FrameBuffer::Initialize(Context& context)
{
context.GenFramebuffers( 1, &mId );
void Destroy( Context& context );
/**
+ * Called by RenderManager to inform the framebuffer that the context has been destroyed
+ */
+ void GlContextDestroyed();
+
+ /**
* @brief Attach a texture for color rendering. Valid only for Framebuffers with COLOR attachments.
* param[in] context The GL context
* @param[in] texture The texture that will be used as output when rendering
}
}
+void NewTexture::GlContextDestroyed()
+{
+ mId = 0u;
+}
+
void NewTexture::Initialize(Context& context)
{
if( mNativeImage )
void Destroy( Context& context );
/**
+ * Called by RenderManager to inform the texture that the context has been destroyed
+ */
+ void GlContextDestroyed();
+
+ /**
* Uploads data to the texture.
* @param[in] context The GL context
* @param[in] pixelData A pixel data object