[Piglit] [PATCH 11/14] glut_waffle: Add libglut_waffle

Chad Versace chad.versace at linux.intel.com
Wed May 23 11:02:16 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/22/2012 05:46 PM, Eric Anholt wrote:
> On Mon, 21 May 2012 23:15:19 -0700, Chad Versace <chad.versace at linux.intel.com> wrote:
>> +void
>> +glutInitAPIMask(int mask)
>> +{
>> +	switch (mask) {
>> +		case GLUT_OPENGL_BIT:
>> +			_glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL;
>> +			break;
>> +		case GLUT_OPENGL_ES1_BIT:
>> +			_glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES1;
>> +			break;
>> +		case GLUT_OPENGL_ES2_BIT:
>> +			_glut->waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES2;
>> +			break;
>> +		default:
>> +			glutFatal("api_mask has bad value %#x", mask);
>> +			break;
>> +	}
>> +}
> 
> Wow, I never caught this before.  piglit introduces new functions in the
> glut namespace?  That's evil.

Yeah, it's evil. But Piglit's has been using this function for a long time
in the GLES tests. I think Chia-I or Shuang-He did it.

As far as I can tell, this is the only glut function added by Piglit.
And no more should be added. The scope of glut in Piglit should only
decrease in the future.
 
>> +	ADD_ATTR(WAFFLE_CONTEXT_API, _glut->waffle_context_api);
>> +
>> +	if (_glut->display_mode & (GLUT_RGB | GLUT_RGBA)) {
>> +		ADD_ATTR(WAFFLE_RED_SIZE,    1);
>> +		ADD_ATTR(WAFFLE_GREEN_SIZE,  1);
>> +		ADD_ATTR(WAFFLE_BLUE_SIZE,   1);
>> +	} else {
>> +		ADD_ATTR(WAFFLE_RED_SIZE,    WAFFLE_DONT_CARE);
>> +		ADD_ATTR(WAFFLE_GREEN_SIZE,  WAFFLE_DONT_CARE);
>> +		ADD_ATTR(WAFFLE_BLUE_SIZE,   WAFFLE_DONT_CARE);
>> +	}
> 
> Isn't not specifying the attrib equivalent to DONT_CARE?  Otherwise,
> what's the point of this varargsy initialization scheme?

You're right. This is ugly. The default is, of course, DONT_CARE.
In the final patch I'll kill the else block.

>> +	// FIXME: Tests run without -auto require basic input.
>> +
>> +	// Workaround for input:
>> +	// Since glut_waffle doesn't handle input yet, it sleeps in order to
>> +	// give the user a chance to see the test output. If the user wishes
>> +	// the test to sleep for a shorter or longer time, he can use Ctrl-C
>> +	// or Ctrl-Z.
>> +	sleep(20);
>> +}
> 
> I think this is the part of this series that I'm least excited about
> right now.  Getting "press escape or q or whatever to exit" into place
> should be easy on GLX at least, right?

Ditto, I don't like this hunk. But it's silly to wait until everything is
perfect before pushing code. Otherwise, code never gets pushed.

I intend to fix this soon, but it requires a small addition to Waffle to
do it right. Until it gets fixed, consider USE_WAFFLE an experimental build
option.

- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPvSYnAAoJEAIvNt057x8iOcAP/2NwDSVjMZaUItxrUOXbAK4n
d472LTICxDEi5+LI0br/SWAl+xZrkcXZsn3WuGiPZLY5mosx0sQXI5wyAmtSEQHj
7MaNbO+CGU/q2AcfMfbh/yxd8Lc7/grHBk9i+WliDAcnNMx4fqptyB5p4k2TnvOs
B6RPafleySYk3KTLgepp7h81Rw/y4rpeWVZvNKgIpNuK7thHes051Y7GO17vD8U4
o6IzfM1hQNutY2T+Em4HauGAiF0FHaPS4D2wkWy8yoN4CG0oc+U3DnLko/ce810R
oVYdsKXtkQKex/t6NmKOZRFwcUnk4uK8mvqIQX9JB0bKpbcwd/L+1QLX4OxwZqJQ
2LgZ+8mybqbb0uBGuq8o2ybWh73cHvczwQcAzzKtNQtmIcMJNtOtWfGBoy4vBWot
JBujgNza6NepEIzndkTgYS88v496Z/J4ebxILSz+4b8vC0TTCQapjYD6Vkn5UHjt
QCEfBqtM6kfiFx2hFUrjEI6L6qL3JkAvPkJ719/em9xIXibyhNQ6lmW5RFytcVBf
yhY7Bdv3pw8ZQK2n7scVRIYAkwJjEr6hZqDA8f7hne9CvE5jB6MHVpa4RWgUFT5M
6f3VhiCSME59sgh/9772s5OCkQPs4BdhUJVYpGif8ewFPecFnqtPXIWUpgF+Un4s
F0pm++6uQO4Vjntnvxuy
=CPMJ
-----END PGP SIGNATURE-----


More information about the Piglit mailing list