Esempio n. 1
0
bool CDirect3D::UnlockTexture(const Bit16u *changed)
{
	changedLines = changed;
#if D3D_THREAD
	Wait(false);
	thread_command = D3D_UNLOCK;
	LeaveCriticalSection(&cs);

	SDL_SemPost(thread_sem);
	return true;
#else
	return UnlockTexture();
#endif
}
Esempio n. 2
0
int CDirect3D::Start(void)
{
#if LOG_D3D
    LOG_MSG("D3D:Worker thread %u starting", SDL_ThreadID());
#endif

    SDL_SemPost(thread_ack);

    EnterCriticalSection(&cs);
    while(thread_run) {

	HRESULT hr;
	D3D_state tmp = thread_command;
	LeaveCriticalSection(&cs);

	if(tmp == D3D_IDLE) {
	    SDL_SemWait(thread_sem);
	    EnterCriticalSection(&cs);
	    continue;
	}

	switch(tmp) {
	    case D3D_LOADPS: hr = LoadPixelShader(); break;
	    case D3D_LOCK: hr = LockTexture(); break;
	    case D3D_UNLOCK: (UnlockTexture() ? hr = S_OK : hr = E_FAIL); break;
	    default: hr = S_OK; break;
	}

	EnterCriticalSection(&cs);
	thread_hr = hr;
	thread_command = D3D_IDLE;
	if(wait) {
		LeaveCriticalSection(&cs);
		SDL_SemPost(thread_ack);
		EnterCriticalSection(&cs);
	}
    }

#if LOG_D3D
    LOG_MSG("D3D:Thread %u is finishing...", SDL_ThreadID());
#endif
    LeaveCriticalSection(&cs);

    return 0;
}
Esempio n. 3
0
void BrowserSource::UpdateBrowser()
{
	if (browserIdentifier != 0) {
		LockTexture();
		BrowserManager::Instance()->DestroyBrowser(browserIdentifier);
		InvalidateActiveTexture();
		browserIdentifier = 0;
		UnlockTexture();
	}

	std::shared_ptr<BrowserListener> browserListener(CreateListener());

	BrowserSettings browserSettings;

	browserSettings.url = isLocalFile? "http://absolute/"+ url : url,
	browserSettings.width = width;
	browserSettings.height = height;
	browserSettings.fps = fps;
	browserSettings.css = css;

	browserIdentifier = BrowserManager::Instance()->CreateBrowser(
			browserSettings, browserListener);
}