//After calling this, the data-directory may be a new one
void ItemRepositoryRegistry::deleteDataDirectory() {
  QMutexLocker lock(&m_mutex);

  //lockForWriting creates a file, that prevents any other KDevelop instance from using the directory as it is.
  //Instead, the other instance will try to delete the directory as well.
  lockForWriting();
  
  // Have to release the lock here, else it will delete the new lock and windows needs all file-handles
  // to be released before deleting a directory that contains these files
  
  m_lock->unlock();
  bool result = removeDirectory(m_path);
  Q_ASSERT(result);
  Q_UNUSED(result);
  Q_ASSERT(m_lock);
  //Just remove the old directory, and allocate a new one. Probably it'll be the same one.
  QPair<QString, KLockFile::Ptr> repo = allocateRepository();
  m_path = repo.first;
  m_lock = repo.second;
}
Beispiel #2
0
void BatchRenderer::Flush()
{
	const UINT numVertices = self->batchedVertices.Num();
	const UINT numIndices = self->batchedIndices.Num();

	if( numVertices == 0 )
	{
		return;
	}

	ID3D11DeviceContext* pD3DContext = D3DContext;

	{
		dxScopedLock	lockForWriting( pD3DContext, self->dynamicVB.mVB, D3D11_MAP_WRITE_DISCARD );
		MemCopy( lockForWriting.ToVoidPtr(), self->batchedVertices.ToPtr(), self->batchedVertices.GetDataSize() );
	}
	{
		dxScopedLock	lockForWriting( pD3DContext, self->dynamicIB.mIB.pD3DBuffer, D3D11_MAP_WRITE_DISCARD );
		MemCopy( lockForWriting.ToVoidPtr(), self->batchedIndices.ToPtr(), self->batchedIndices.GetDataSize() );
	}

	self->batchedVertices.Empty();
	self->batchedIndices.Empty();

	//dxSavePreviouslyBoundMesh	savePrevMesh;
	//dxSaveRenderStates			saveRenderStates;
	//dxSaveShaderResources		saveShaderResources;

	self->currentState->Set( pD3DContext );

	// If we're not currently rendering hit proxies...
	if( !self->pHitTesting )
	{
		// ... then render with our own shader.

		typedef GPU::p_batched_lines ShaderType;

		// Update shader constants.
		ShaderType::Data* pData = ShaderType::cb_Data.Map(pD3DContext);
		{
			pData->transform = self->currentTransform;
		}
		ShaderType::cb_Data.Unmap(pD3DContext);

		ShaderType::textureMap = self->currentTexture;

		// Select correct shader variation.
		rxShaderInstanceId	shaderInstanceId = ShaderType::DefaultInstanceId;

		if( self->currentTexture.IsValid() )
		{
			shaderInstanceId |= ShaderType::bTextureMap;
		}

		ShaderType::Set( pD3DContext, shaderInstanceId );
	}

	// otherwise, render with hit proxy shader.
#if MX_EDITOR
	else
	{
		self->pHitTesting->SetTransform( self->currentTransform );
	}
#endif // MX_EDITOR

	self->dynamicVB.Bind( pD3DContext );
	self->dynamicIB.Bind( pD3DContext );

	pD3DContext->IASetInputLayout( Vertex::layout );
	pD3DContext->IASetPrimitiveTopology( self->currentTopology );

	if( numIndices > 0 )
	{
		pD3DContext->DrawIndexed( numIndices, 0, 0 );
	}
	else
	{
		pD3DContext->Draw( numVertices, 0 );
	}
}