[Solved] Oolite 1.77 Intel Graphics problem

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: winston, another_commander, Getafix

drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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.
drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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.
drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Oolite 1.77 Intel Graphics problem

Post 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?)
drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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
drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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.
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: Oolite 1.77 Intel Graphics problem

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Oolite 1.77 Intel Graphics problem

Post 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).
drumz
Competent
Competent
Posts: 36
Joined: Thu Jan 18, 2007 6:18 am

Re: Oolite 1.77 Intel Graphics problem

Post 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.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Oolite 1.77 Intel Graphics problem

Post 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
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Post Reply