[Piglit] [PATCH] glean/tstencil2: check for extension before calling getProcAddress()

Roland Scheidegger rscheidegger_lists at hispeed.ch
Thu Aug 15 14:22:17 PDT 2013


Am 15.08.2013 21:17, schrieb Brian Paul:
> Otherwise, with NVIDIA's driver we were just exiting (with SKIP result)
> when getProcAddress("glStencilOpSeparateATI") failed.  Now the test
> actually runs.
> ---
>  tests/glean/tstencil2.cpp |   20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/glean/tstencil2.cpp b/tests/glean/tstencil2.cpp
> index a7ff1d3..fe5e13e 100644
> --- a/tests/glean/tstencil2.cpp
> +++ b/tests/glean/tstencil2.cpp
> @@ -74,15 +74,17 @@ Stencil2Result::Stencil2Result()
>  void
>  Stencil2Test::get_ext_functions(void)
>  {
> -	// ATI
> -	glStencilOpSeparateATI_func = (PFNGLSTENCILOPSEPARATEATIPROC)
> -		GLUtils::getProcAddress("glStencilOpSeparateATI");
> -	glStencilFuncSeparateATI_func = (PFNGLSTENCILFUNCSEPARATEATIPROC)
> -		GLUtils::getProcAddress("glStencilFuncSeparateATI");
> -
> -	// EXT
> -	glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC)
> -		GLUtils::getProcAddress("glActiveStencilFaceEXT");
> +	if (have_ATI_separate_stencil()) {
> +		glStencilOpSeparateATI_func = (PFNGLSTENCILOPSEPARATEATIPROC)
> +			GLUtils::getProcAddress("glStencilOpSeparateATI");
> +		glStencilFuncSeparateATI_func = (PFNGLSTENCILFUNCSEPARATEATIPROC)
> +			GLUtils::getProcAddress("glStencilFuncSeparateATI");
> +	}
> +
> +	if (have_EXT_stencil_two_side()) {
> +		glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC)
> +			GLUtils::getProcAddress("glActiveStencilFaceEXT");
> +	}
>  
>  	// GL2
>  	glStencilOpSeparate_func = (PFNGLSTENCILOPSEPARATEPROC)
> 

Oh good catch. I guess everybody got accustomed to the standard libGL
behavior of getProcAddress returning pointers for anything :-).

Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the Piglit mailing list