About Running in software mode

I must use this Fragment Shader:

varying vec2 texture_coordinate;
varying vec2 map_coordinate;
uniform sampler2D current_image;
uniform sampler2D current_map;
uniform float u_pixel_size;
uniform float v_pixel_size;

void main()
{
	// Produco la mappa di movimento
	//					N    E    S    W
	gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
	
	vec2 vDeltaU = vec2(u_pixel_size, 0.0);
	vec2 vDeltaV = vec2(0.0, v_pixel_size);
	
	// Se sono una preda
	if (texture2D(current_image, texture_coordinate).x == 1.0)
	{
		// Vedo dove ci sono piu' predatori
		// Nord
		float northPredators = texture2D(current_image, texture_coordinate+vDeltaV).z;
		northPredators += texture2D(current_image, texture_coordinate+vDeltaV+vDeltaU).z;
		northPredators += texture2D(current_image, texture_coordinate+vDeltaV-vDeltaU).z;
		northPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaV).z;
		northPredators += texture2D(current_image, texture_coordinate+2.0*(vDeltaV+vDeltaU)).z;
		northPredators += texture2D(current_image, texture_coordinate+2.0*(vDeltaV-vDeltaU)).z;
		northPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaV+vDeltaU).z;
		northPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaV-vDeltaU).z;
		// Est
		float eastPredators = texture2D(current_image, texture_coordinate+vDeltaU).z;
		eastPredators += texture2D(current_image, texture_coordinate+vDeltaU+vDeltaV).z;
		eastPredators += texture2D(current_image, texture_coordinate+vDeltaU-vDeltaV).z;
		eastPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaU).z;
		eastPredators += texture2D(current_image, texture_coordinate+2.0*(vDeltaU+vDeltaV)).z;
		eastPredators += texture2D(current_image, texture_coordinate+2.0*(vDeltaU-vDeltaV)).z;
		eastPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaU+vDeltaV).z;
		eastPredators += texture2D(current_image, texture_coordinate+2.0*vDeltaU-vDeltaV).z;
		// Sud
		float southPredators = texture2D(current_image, texture_coordinate-vDeltaV).z;
		southPredators += texture2D(current_image, texture_coordinate-vDeltaV+vDeltaU).z;
		southPredators += texture2D(current_image, texture_coordinate-vDeltaV-vDeltaU).z;
		southPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaV).z;
		southPredators += texture2D(current_image, texture_coordinate-2.0*(vDeltaV+vDeltaU)).z;
		southPredators += texture2D(current_image, texture_coordinate-2.0*(vDeltaV-vDeltaU)).z;
		southPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaV+vDeltaU).z;
		southPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaV-vDeltaU).z;
		// Ovest
		float westPredators = texture2D(current_image, texture_coordinate-vDeltaU).z;
		westPredators += texture2D(current_image, texture_coordinate-vDeltaU+vDeltaV).z;
		westPredators += texture2D(current_image, texture_coordinate-vDeltaU-vDeltaV).z;
		westPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaU).z;
		westPredators += texture2D(current_image, texture_coordinate-2.0*(vDeltaU+vDeltaV)).z;
		westPredators += texture2D(current_image, texture_coordinate-2.0*(vDeltaU-vDeltaV)).z;
		westPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaU+vDeltaV).z;
		westPredators += texture2D(current_image, texture_coordinate-2.0*vDeltaU-vDeltaV).z;
		if (northPredators + southPredators + eastPredators + westPredators > 0.0)
		{
			float maxV = max(max(northPredators, southPredators), max(eastPredators, westPredators));
			if (maxV == northPredators) gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);
			else if (maxV == southPredators) gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
			else if (maxV == eastPredators) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
			else gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
		}
	}
	// Se sono un predatore
	else if (texture2D(current_image, texture_coordinate).z == 1.0)
	{
		// Vedo dove ci sono piu' prede
		// Nord
		float northPreys = texture2D(current_image, texture_coordinate+vDeltaV).x;
		northPreys += texture2D(current_image, texture_coordinate+vDeltaV+vDeltaU).x;
		northPreys += texture2D(current_image, texture_coordinate+vDeltaV-vDeltaU).x;
		northPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaV).x;
		northPreys += texture2D(current_image, texture_coordinate+2.0*(vDeltaV+vDeltaU)).x;
		northPreys += texture2D(current_image, texture_coordinate+2.0*(vDeltaV-vDeltaU)).x;
		northPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaV+vDeltaU).x;
		northPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaV-vDeltaU).x;
		// Est
		float eastPreys = texture2D(current_image, texture_coordinate+vDeltaU).x;
		eastPreys += texture2D(current_image, texture_coordinate+vDeltaU+vDeltaV).x;
		eastPreys += texture2D(current_image, texture_coordinate+vDeltaU-vDeltaV).x;
		eastPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaU).x;
		eastPreys += texture2D(current_image, texture_coordinate+2.0*(vDeltaU+vDeltaV)).x;
		eastPreys += texture2D(current_image, texture_coordinate+2.0*(vDeltaU-vDeltaV)).x;
		eastPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaU+vDeltaV).x;
		eastPreys += texture2D(current_image, texture_coordinate+2.0*vDeltaU-vDeltaV).x;
		// Sud
		float southPreys = texture2D(current_image, texture_coordinate-vDeltaV).x;
		southPreys += texture2D(current_image, texture_coordinate-vDeltaV+vDeltaU).x;
		southPreys += texture2D(current_image, texture_coordinate-vDeltaV-vDeltaU).x;
		southPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaV).x;
		southPreys += texture2D(current_image, texture_coordinate-2.0*(vDeltaV+vDeltaU)).x;
		southPreys += texture2D(current_image, texture_coordinate-2.0*(vDeltaV-vDeltaU)).x;
		southPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaV+vDeltaU).x;
		southPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaV-vDeltaU).x;
		// Ovest
		float westPreys = texture2D(current_image, texture_coordinate-vDeltaU).x;
		westPreys += texture2D(current_image, texture_coordinate-vDeltaU+vDeltaV).x;
		westPreys += texture2D(current_image, texture_coordinate-vDeltaU-vDeltaV).x;
		westPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaU).x;
		westPreys += texture2D(current_image, texture_coordinate-2.0*(vDeltaU+vDeltaV)).x;
		westPreys += texture2D(current_image, texture_coordinate-2.0*(vDeltaU-vDeltaV)).x;
		westPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaU+vDeltaV).x;
		westPreys += texture2D(current_image, texture_coordinate-2.0*vDeltaU-vDeltaV).x;
		if (northPreys + southPreys + eastPreys + westPreys > 0.0)
		{
			float maxZ = max(max(northPreys, southPreys), max(eastPreys, westPreys));
			if (maxZ == northPreys) gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
			else if (maxZ == southPreys) gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);
			else if (maxZ == eastPreys) gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
			else gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
		}
	}
}

And this one too :

varying vec2 texture_coordinate;
varying vec2 map_coordinate;
uniform sampler2D current_image;
uniform sampler2D current_map;
uniform float u_pixel_size;
uniform float v_pixel_size;

void main()
{
	// Completo la mappa di movimento
	//					N    E    S    W
	//			   vec4(0.0, 0.0, 0.0, 0.0);
	
	gl_FragColor = texture2D(current_image, texture_coordinate);
	
	vec2 vDeltaU = vec2(u_pixel_size, 0.0);
	vec2 vDeltaV = vec2(0.0, v_pixel_size);
	
	// il vettore in uscita deve essere come quello in entrata
	vec4 mapDir = texture2D(current_map, map_coordinate);
	
	// Se nell'intorno c'e' una direzione uguale ed occupata da
	// una cella vuota allora metti il valore out
	vec4 tmpDirN = texture2D(current_image, texture_coordinate+vDeltaV);
	vec4 tmpDirE = texture2D(current_image, texture_coordinate+vDeltaU);
	vec4 tmpDirS = texture2D(current_image, texture_coordinate-vDeltaV);
	vec4 tmpDirW = texture2D(current_image, texture_coordinate-vDeltaU);
	
	// Se sono una cella vuota
	if (dot(gl_FragColor, gl_FragColor) == 0.0)
	{
		if (dot(mapDir, texture2D(current_map, map_coordinate+vDeltaV)) > 0.0 && texture2D(current_map, map_coordinate+vDeltaV).z == 1.0) gl_FragColor = texture2D(current_image, texture_coordinate+vDeltaV);
		if (dot(mapDir, texture2D(current_map, map_coordinate+vDeltaU)) > 0.0 && texture2D(current_map, map_coordinate+vDeltaU).w == 1.0) gl_FragColor = texture2D(current_image, texture_coordinate+vDeltaU);
		if (dot(mapDir, texture2D(current_map, map_coordinate-vDeltaV)) > 0.0 && texture2D(current_map, map_coordinate-vDeltaV).x == 1.0) gl_FragColor = texture2D(current_image, texture_coordinate-vDeltaV);
		if (dot(mapDir, texture2D(current_map, map_coordinate-vDeltaU)) > 0.0 && texture2D(current_map, map_coordinate-vDeltaU).y == 1.0) gl_FragColor = texture2D(current_image, texture_coordinate-vDeltaU);
		gl_FragColor.w = 0.0;
	}
	else
	{ 
		// Se la cella nord e' vuota e le map sono uguali
		if (dot(tmpDirN, tmpDirN) == 0.0 && dot(mapDir, texture2D(current_map, map_coordinate+vDeltaV)) > 0.0 && mapDir.x == 1.0) gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
		// Se la cella est e' vuota e le map sono uguali
		if (dot(tmpDirE, tmpDirE) == 0.0 && dot(mapDir, texture2D(current_map, map_coordinate+vDeltaU)) > 0.0 && mapDir.y == 1.0) gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
		// Se la cella sud e' vuota e le map sono uguali
		if (dot(tmpDirS, tmpDirS) == 0.0 && dot(mapDir, texture2D(current_map, map_coordinate-vDeltaV)) > 0.0 && mapDir.z == 1.0) gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
		// Se la cella nord e' vuota e le map sono uguali
		if (dot(tmpDirW, tmpDirW) == 0.0 && dot(mapDir, texture2D(current_map, map_coordinate-vDeltaU)) > 0.0 && mapDir.w == 1.0) gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
	}
}

Basically this is an advanced Cellular Automata.
I need it for my thesis.

It runs well on a Radeon 9800 Pro but…in software mode!
Link successful. The GLSL vertex shader will run in software due to the GLSL fragment shader running in software. The GLSL fragment shader will run in software.
It’s what the GL drivers tells me when it compiles the above fragment shader(s).

I think that it goes in software mode because of many instructions.
Should I get a 6800 GT to run it fine on hardware?
Where can I see all the specs and limits of current video cards?

Is there someone at ATi or nVidia that I can contact?

Thxn, Emanem! :smiley:

Follow this thread:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_t opic;f=11;t=000409

yooyo

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.