[Piglit] [PATCH] Test implicit type conversion of out parameters.
Paul Berry
stereotype441 at gmail.com
Thu Aug 4 09:17:57 PDT 2011
On 3 August 2011 11:50, Paul Berry <stereotype441 at gmail.com> wrote:
> On 2 August 2011 18:42, Ian Romanick <idr at freedesktop.org> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 08/02/2011 05:34 PM, Paul Berry wrote:
>>> This patch adds four tests of the proper behavior of function out
>>> parameters when used in a context that requires implicit type
>>> conversion.
>>
>> Do all of these pass on other implementations?
>
> Hmm, on my nVidia system they all fail with error messages like "error
> C1113: actual parameter #1 must be same type as formal out parameter
> ("x")".
>
> The nVidia behavior seems nonconformant by my reading of the standard.
At Ian's suggestion, I made a test based on the example in the GLSL
1.30 standard. Sadly, the example doesn't contain any cases of a call
that should succeed based on conversion of an out parameter. But it
does contain a case that should fail based on an ambiguity introduced
by conversion of an out parameter:
For example,
vec4 f(in vec4 x, out vec4 y);
vec4 f(in vec4 x, out ivec4 y); // okay, different argument type
...
Calling the first two functions above with the following argument
types yields
...
f(ivec4, vec4) // error, convertible to both
On the nVidia linux driver, this call produces neither a compile-time
nor a runtime error. Instead, the call resolves to vec4 f(in vec4 x,
out vec4 y) (converting the in parameter but not the out parameter).
On Mesa (with my patches, and the environment variable
INTEL_GLSL_VERSION=130 set), we get the expected error.
I also checked what happens if you remove the declaration vec4 f(in
vec4 x, out vec4 y) (leaving just the declaration of f that requires
an out parameter conversion). With this change, the call is no longer
ambiguous, so there should be no error. On the nVidia linux driver,
there is a runtime (but not compile-time) error saying "actual
parameter #2 must be same type as formal out parameter". On Mesa, the
call succeeds, as expected.
I think this is sufficient evidence that the nVidia driver is
non-conformant, and that the tests as I've written them correctly
capture the intent of the spec.
I'll send the additional tests to this list later today.
More information about the Piglit
mailing list