Page 2 of 2

Re: Oolite 1.77 Intel Graphics problem

Posted: Sun Jul 28, 2013 5:18 am
by drumz
Commenting out

Code: Select all

if (scannerUpdated) return;		// there's never the need to draw the scanner twice per frame!
in - (void) drawScanner:(NSDictionary *)info (line 894) does not fix the bug. It also does not fix the bug when I combine it with cim's suggestion.

Found a fix!
Replacing

Code: Select all

for (i = [dialArray count] - 1; i >= 0; i--)
with

Code: Select all

for (int i = 0; i < [dialArray count]; i++)
in function drawDials fixes the problem. It also fixes the bug on master.

I can see why that change is made. I'm going to create a temporary variable to store the result [dialArray count] and try that, so we can still benefit from the optimization without introducing the bug.

Re: Oolite 1.77 Intel Graphics problem

Posted: Sun Jul 28, 2013 5:27 am
by drumz
Ok, on branch master I modified drawDials like so:

Code: Select all

- (void) drawDials
{	
	z1 = [[UNIVERSE gameView] display_z];
	// reset drawScanner flag.
	_scannerUpdated = NO;
	_compassUpdated = NO;
	
	// tight loop, we assume dialArray doesn't change in mid-draw.
	NSInteger i;
	const NSInteger dialArray_count = [dialArray count];
	//for (i = [dialArray count] - 1; i >= 0; i--)
	for (i = 0; i < dialArray_count; i++)
	{
As you can see, I changed the loop to count from 0 up to [dialArray count], like it was before the commit that introduced the bug. I also introduced a new variable, dialArray_count, to store the result of [dialArray count] to keep the optimization that the offending commit was trying to introduce. Apparently, for some reason drawing in reverse order introduces the bug.

Re: Oolite 1.77 Intel Graphics problem

Posted: Sun Jul 28, 2013 5:33 am
by drumz
Offtopic: This was the first time I've ever used git bisect, and I've got to say, that was exciting. It's pretty neat how easily you can find a commit that introduces a bug, which allows you to then just brute-force your way through the changes made to find the specific line that caused the bug.

Re: Oolite 1.77 Intel Graphics problem

Posted: Sun Jul 28, 2013 8:15 am
by cim
drumz wrote:
Ok, on branch master I modified drawDials like so:
Good catch. Could you send us a pull request with that change, please.

This does suggest that there may be another much older bug somewhere, then. Presumably, having made that fix, if you then edit hud.plist so that the "drawScanner" entry is at the end of the dials section rather than the beginning, the bug reappears? (If it does, could you try to find out which of the other dials is interfering with it?)

Re: Oolite 1.77 Intel Graphics problem

Posted: Sun Jul 28, 2013 10:54 pm
by drumz
In hud.plist, if I move the scanner entry:
Before the speed bar: looks good, no bug
After speed bar, but before ship's clock: crazy colors
https://dl.dropboxusercontent.com/u/150 ... olors1.png
https://dl.dropboxusercontent.com/u/150 ... olors2.png
After ship's clock: flashing/invisible

Re: Oolite 1.77 Intel Graphics problem

Posted: Mon Jul 29, 2013 4:12 am
by drumz
If I move ship's clock to last, I can set the scanner to second-to-last, and it is still visible, but it is in the "crazy color" mode.

The following items can appear before the scanner without causing the crazy color effect:
Targeting enhancement
scanner zoom indicator
stick sensitivity indicator
compass
station aegis
fuel scoop status
energy gauge
"drawYellowSurround:"
missile display

Any one of the following listed before the scanner caused the crazy color effect:
speed bar
roll bar
pitch bar
yaw bar
forward shield bar
aft shield bar
fuel bar
cabin temperature bar
weapon temperature bar
altitude bar
status indicator light
weapons system offline text (must trigger weapons offline to cause crazy colors)

Not tested:
primed equipment (didn't have equipment to prime)
fps counter (forgot how to activate FPS display)

Note to others who suffer from this bug:
You should be able to simply reverse the order of the "dials" elements in hud.plist in 1.77 to "fix" the bug. I didn't test this yet.

Edit: You also have to hold the "Shift" key when starting Oolite to cause it to reread the hud.plist file.

Re: Oolite 1.77 Intel Graphics problem

Posted: Mon Jul 29, 2013 9:57 am
by JazHaz
drumz wrote:
You should be able to simply reverse the order of the "dials" elements in hud.plist in 1.77 to "fix" the bug. I didn't test this yet.
If the "fix" does work, I suggest putting up the hud.plist on box.com (or similar) for others to download.

Re: Oolite 1.77 Intel Graphics problem

Posted: Mon Jul 29, 2013 5:48 pm
by cim
Thanks. The fix has been merged into master and maintenance/1.77.

I have no idea what could be causing the underlying bug, though. There's so far as I can see no graphics-related difference between - for instance - the energy gauge (which doesn't break things) and the altitude bar (which does).

Re: Oolite 1.77 Intel Graphics problem

Posted: Tue Jul 30, 2013 5:00 am
by drumz
JazHaz wrote:
drumz wrote:
You should be able to simply reverse the order of the "dials" elements in hud.plist in 1.77 to "fix" the bug. I didn't test this yet.
If the "fix" does work, I suggest putting up the hud.plist on box.com (or similar) for others to download.
The simplest solution, for those on 1.77, is to create your own OXP. Go to your AddOns directory, and create a new directoy, let's say ScannerFix.oxp. Inside that directory create a directory names Config. Inside that directory create a file named hud.plist, with the following contents:

Code: Select all

{
	dials			= //these are drawn, in order, after the legends
	(
		{	// fps counter, x and y give the location, the size defines the character size
			height		= 18;
			selector	= "drawFPSInfoCounter:";
			width		= 18;
			x		= -300;
			y		= -20;
			y_origin	= 1;
		},
		{	// weapons systems offline text, x and y give the location, the size defines the character size
			height		= 8;
			selector	= "drawWeaponsOfflineText:";
			width		= 8;
			x		= -175;
			y		= 2;
			y_origin	= -1;
		},
		{	// ship's clock, x and y give the location, the size defines the character size
			height		= 12;
			selector	= "drawClock:";
			width		= 12;
			x		= -48;
			y		= 6;
			y_origin	= -1;
		},
		{	// status indicator light, x and y give the location, the size defines the icon size
			height		= 8;
			selector	= "drawStatusLight:";
			width		= 8;
			x		= -108;
			y		= 24;
			y_origin	= -1;
		},
		{	// missile display, x and y give the location, the x-spacing is given by spacing, the size defines the icon size
			height		= 12;
			selector	= "drawMissileDisplay:";
			spacing		= 16;
			width		= 12;
			x		= -228;
			y		= 16;
			y_origin	= -1;
		},
		{	// altitude bar
			height		= 8;
			selector	= "drawAltitudeBar:";
			width		= 80;
			x		= -200;
			y		= 31;
			y_origin	= -1;
		},
		{	// weapon temperature bar
			height		= 8;
			selector	= "drawWeaponTempBar:";
			width		= 80;
			x		= -200;
			y		= 41;
			y_origin	= -1;
		},
		{	// cabin temperature bar
			height		= 8;
			selector	= "drawCabinTempBar:";
			width		= 80;
			x		= -200;
			y		= 51;
			y_origin	= -1;
		},
		{	// fuel bar
			height		= 8;
			selector	= "drawFuelBar:";
			width		= 80;
			x		= -200;
			y		= 61;
			y_origin	= -1;
		},
		{	// just draws a surround 2 units around the selected size, you could also use drawGreenSurround:
			height		= 40;
			selector	= "drawYellowSurround:";
			width		= 80;
			x		= -200;
			y		= 46;
			y_origin	= -1;
		},
		{	// aft shield bar, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 8;
			selector	= "drawAftShieldBar:";
			width		= 80;
			x		= -200;
			y		= 78;
			y_origin	= -1;
		},
		{	// forward shield bar, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 8;
			selector	= "drawForwardShieldBar:";
			width		= 80;
			x		= -200;
			y		= 94;
			y_origin	= -1;
		},
		{	// energy gauge, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 48;
			selector	= "drawEnergyGauge:";
			width		= 80;
			x		= 200;
			y		= 35;
			y_origin	= -1;
			labelled	= yes;
		},
		//{	// yaw bar, can draw a surround 2 units out from the dial size specified
		//	// this is disabled by default, uncomment as required to enable
		//	draw_surround	= yes;
		//	height		= 8;
		//	selector	= "drawYawBar:";
		//	width		= 80;
		//	x		= 200;
		//	y		= -130;
		//},
		{	// pitch bar, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 6;
			selector	= "drawPitchBar:";
			width		= 80;
			x		= 200;
			y		= 70;
			y_origin	= -1;
		},
		{	// roll bar, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 6;
			selector	= "drawRollBar:";
			width		= 80;
			x		= 200;
			y		= 80;
			y_origin	= -1;
		},
		{	// speed bar, can draw a surround 2 units out from the dial size specified
			draw_surround	= yes;
			height		= 8;
			selector	= "drawSpeedBar:";
			width		= 80;
			x		= 200;
			y		= 95;
			y_origin	= -1;
		},
		{	// fuel scoop status
			alpha		= 0.75;
			selector	= "drawScoopStatus:";
			x		= -132;
			y		= 88;
			y_origin	= -1;
		},
		{	// station aegis
			alpha		= 1.0;
			selector	= "drawAegis:";
			x		= -132;
			y		= 24;
			y_origin	= -1;
		},
		//{	// stick sensitivity indicator
		//	alpha		= 1.0;
		//	selector	= "drawStickSensitivityIndicator:";
		//	x		= 151;
		//	y		= -165;
		//	height		= 12;
		//	width		= 12;
		//},
		{	// scanner zoom indicator
			alpha		= 1.0;
			selector	= "drawScannerZoomIndicator:";
			x		= 108;
			y		= 24;
			y_origin	= -1;
		},
		{	// scanner
			alpha		= 1.0;
			selector	= "drawScanner:";
			x		= 0;
			y		= 60;
			y_origin	= -1;
			height		= 72.0;
			width		= 288.0;
			rgb_color	= (1.0, 0.0, 0.0);
		},
		{	// compass
			alpha		= 1.0;
			selector	= "drawCompass:";
			x		= 132;
			y		= 24;
			y_origin	= -1;
			rgb_color	= (0.0, 0.0, 1.0);
		},
		{	// Targeting enhancement
			equipment_required 	= "EQ_SCANNER_SHOW_MISSILE_TARGET";
			selector		= "drawTargetReticle:";
		}
	);
}
I reversed the order and also had to move the compass farther down because it started acting up.

Re: Oolite 1.77 Intel Graphics problem

Posted: Tue Jul 30, 2013 2:52 pm
by Diziet Sma
drumz wrote:
JazHaz wrote:
If the "fix" does work, I suggest putting up the hud.plist on box.com (or similar) for others to download.
The simplest solution, for those on 1.77, is to create your own OXP. Go to your AddOns directory, and create a new directoy, let's say ScannerFix.oxp. Inside that directory create a directory names Config. Inside that directory create a file named hud.plist, with the following contents:
I've packaged the fix into an OXP and zipped it. The OXP can be downloaded from:
https://app.box.com/s/kms7v4ulmypuwjdjzv8e