void VBlobShadowManager::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
    // hook into an existing renderloop to render the shadows (before rendering particles)
    if (pData->m_pSender==&Vision::Callbacks.OnRenderHook)
    {
        if (m_Instances.Count() && ((VisRenderHookDataObject_cl *)pData)->m_iEntryConst == m_iRenderHookConst)
        {
            INSERT_PERF_MARKER_SCOPE("Blob Shadow Rendering (VBlobShadowManager::OnHandleCallback)");
            RenderAllShadows();
        }
    }

    // UnloadWorld : do some per-scene deinitialisation
    else if (pData->m_pSender==&Vision::Callbacks.OnWorldDeInit)
    {
        ClearResources();
    }

    // Reassign shaders
    else if (pData->m_pSender == &Vision::Callbacks.OnReassignShaders)
    {
        // set shader resources to NULL, shaders will be recreated when
        // GetDefaultTechnique is called next time.
        m_spDefaultFX = NULL;
        m_spDefaultTech[0] = NULL;
        m_spDefaultTech[1] = NULL;
    }
}
Example #2
0
//  public
void MhProtoClient::DownloadMetadataFromServer(int smd,
        const char *remote_file,
        int64_t chunk_size) {
    int16_t response;
    char abs_file[2048];

    DEBUG("MhProtoClient::DownloadMetadataFromServer()\n");
    SndCmd(smd, DOWNLOAD_METADATA);
    write(smd, &chunk_size, sizeof(int64_t));

    int16_t path_size = strlen(remote_file);
    write(smd, &path_size, sizeof(int16_t));
    write(smd, remote_file, path_size);

    so_read(smd, &response, sizeof(int16_t));
    DEBUG("DownloadMetadataFromServer->response : %d\n", response);
    if (response == MH_FILE_NOT_FOUND) {
        printf("Remote file not found.\n");
        ClearResources();
        exit(1);
    }

    CopyString(abs_file, AbsoluteFile(remote_file));
    StrCat(abs_file, ".mdata");

    // Metadata::SaveMetadata only updates, so create "touch" metadata
    // file first.
    int fd = open(abs_file , O_WRONLY | O_CREAT, 0000644);
    close(fd);

    Metadata metadata;
    metadata.ReadMetadataHeader(smd);
    metadata.initControlData();
    metadata.SaveMetadata(abs_file);
}
void VBlobShadowManager::OneTimeDeInit()
{
    Vision::Callbacks.OnRenderHook -= this;
    Vision::Callbacks.OnWorldDeInit -= this;
    Vision::Callbacks.OnReassignShaders -= this;

    ClearResources();
}
void
WebRenderBridgeParent::Destroy()
{
  if (mDestroyed) {
    return;
  }
  mDestroyed = true;
  ClearResources();
}
void
WebRenderBridgeParent::UpdateWebRender(CompositorVsyncScheduler* aScheduler,
                                       wr::WebRenderAPI* aApi,
                                       AsyncImagePipelineManager* aImageMgr,
                                       CompositorAnimationStorage* aAnimStorage)
{
  MOZ_ASSERT(!mWidget);
  MOZ_ASSERT(aScheduler);
  MOZ_ASSERT(aApi);
  MOZ_ASSERT(aImageMgr);
  MOZ_ASSERT(aAnimStorage);

  if (mDestroyed) {
    return;
  }

  // Update id name space to identify obsoleted keys.
  // Since usage of invalid keys could cause crash in webrender.
  mIdNamespace = AllocIdNameSpace();
  // XXX Remove it when webrender supports sharing/moving Keys between different webrender instances.
  // XXX It requests client to update/reallocate webrender related resources,
  // but parent side does not wait end of the update.
  // The code could become simpler if we could serialise old keys deallocation and new keys allocation.
  // But we do not do it, it is because client side deallocate old layers/webrender keys
  // after new layers/webrender keys allocation.
  // Without client side's layout refactoring, we could not finish all old layers/webrender keys removals
  // before new layer/webrender keys allocation. In future, we could address the problem.
  Unused << SendWrUpdated(mIdNamespace);
  CompositorBridgeParentBase* cBridge = mCompositorBridge;
  // XXX Stop to clear resources if webreder supports resources sharing between different webrender instances.
  ClearResources();
  mCompositorBridge = cBridge;
  mCompositorScheduler = aScheduler;
  mApi = aApi;
  mAsyncImageManager = aImageMgr;
  mAnimStorage = aAnimStorage;

  Unused << GetNextWrEpoch(); // Update webrender epoch
  // Register pipeline to updated AsyncImageManager.
  mAsyncImageManager->AddPipeline(mPipelineId);
}