void
MesaSoftwareRenderer::LockGL()
{
	CALLED();
	BGLRenderer::LockGL();

	_mesa_make_current(fContext, &fFrameBuffer->base, &fFrameBuffer->base);

	color_space colorSpace = BScreen(GLView()->Window()).ColorSpace();

	BAutolock lock(fInfoLocker);
	if (fDirectModeEnabled && fInfo != NULL) {
		fNewWidth = fInfo->window_bounds.right
			- fInfo->window_bounds.left + 1;
		fNewHeight = fInfo->window_bounds.bottom
			- fInfo->window_bounds.top + 1;
	}

	if (fColorSpace != colorSpace) {
		fColorSpace = colorSpace;
		_SetupRenderBuffer(fFrontRenderBuffer, fColorSpace);
		if (fVisual->doubleBufferMode)
			_SetupRenderBuffer(fBackRenderBuffer, fColorSpace);
	}

	if (fBitmap && fNewWidth == fWidth
		&& fNewHeight == fHeight)
		return;

	fWidth = fNewWidth;
	fHeight = fNewHeight;

	_AllocateBitmap();
}
Beispiel #2
0
void
IntelRenderer::LockGL()
{
//	CALLED();
	BGLRenderer::LockGL();

	color_space cs = BScreen(GLView()->Window()).ColorSpace();

	BAutolock lock(fInfoLocker);
	if (fDirectModeEnabled && fInfo != NULL) {
		fNewWidth = fInfo->window_bounds.right - fInfo->window_bounds.left;
		fNewHeight = fInfo->window_bounds.bottom - fInfo->window_bounds.top;
	}

	if (fBitmap && cs == fColorSpace && fNewWidth == fWidth
		&& fNewHeight == fHeight) {
		fContextObj->SetCurrentContext(fBitmap, fContextID);
		return;
	}

	fColorSpace = cs;
	fWidth = fNewWidth;
	fHeight = fNewHeight;

	_AllocateBitmap();
	fContextObj->SetCurrentContext(fBitmap, fContextID);
}
Beispiel #3
0
void
MesaSoftwareRenderer::LockGL()
{
	CALLED();
	BGLRenderer::LockGL();

	_mesa_make_current(fContext, &fFrameBuffer->Base, &fFrameBuffer->Base);

	color_space cs = B_RGBA32;

	BAutolock lock(fInfoLocker);
	if (fDirectModeEnabled && fInfo != NULL) {
		cs = BScreen(GLView()->Window()).ColorSpace();
		fNewWidth = fInfo->window_bounds.right
			- fInfo->window_bounds.left + 1;
		fNewHeight = fInfo->window_bounds.bottom
			- fInfo->window_bounds.top + 1;
	}

	if (fBitmap && cs == fColorSpace && fNewWidth == fWidth
		&& fNewHeight == fHeight)
		return;

	if (cs != fColorSpace) {
		fColorSpace = cs;
		_SetSpanFuncs(fFrontRenderBuffer, fColorSpace);
		_SetSpanFuncs(fBackRenderBuffer, fColorSpace);
	}

	fWidth = fNewWidth;
	fHeight = fNewHeight;

	_AllocateBitmap();
}
Beispiel #4
0
IntelRenderer::IntelRenderer(BGLView *view, ulong options,
	BGLDispatcher* dispatcher)
	:
	BGLRenderer(view, options, dispatcher),
	fBitmap(NULL),
	fDirectModeEnabled(false),
	fInfo(NULL),
	fInfoLocker("info locker"),
	fOptions(options),
	fColorSpace(B_NO_COLOR_SPACE)
{
	CALLED();

	// Disable double buffer for the moment.
	options &= ~BGL_DOUBLE;

	// Initialize the "Haiku Software GL Pipe"
	time_t beg;
	time_t end;
	beg = time(NULL);
	fContextObj = new GalliumContext(options);
	end = time(NULL);
	TRACE("Haiku Intel GL Pipe initialization time: %f.\n",
		difftime(end, beg));

	// Allocate a bitmap
	BRect b = view->Bounds();
	fColorSpace = BScreen(view->Window()).ColorSpace();
	TRACE("%s: Colorspace:\t%s\n", __func__, color_space_name(fColorSpace));

	fWidth = (GLint)b.IntegerWidth();
	fHeight = (GLint)b.IntegerHeight();
	fNewWidth = fWidth;
	fNewHeight = fHeight;

	_AllocateBitmap();

	// Initialize the first "Haiku Intel GL Pipe" context
	beg = time(NULL);
	fContextID = fContextObj->CreateContext(fBitmap);
	end = time(NULL);

	if (fContextID < 0)
		ERROR("%s: There was an error creating the context!\n", __func__);
	else {
		TRACE("%s: Haiku Intel GL Pipe context creation time: %f.\n",
			__func__, difftime(end, beg));
	}

	if (!fContextObj->GetCurrentContext())
		LockGL();
}