[Mesa-dev] [PATCH] mesa: fix bad cast conversions in viewport()

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Aug 1 07:40:19 UTC 2017



On 08/01/2017 02:03 AM, Matt Turner wrote:
> On Mon, Jul 31, 2017 at 12:43 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Fixes: ddc32537d6 ("mesa: clamp viewport values only once when using glViewport()")
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101981
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101989
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> 
> I don't understand how this regression happened. I see in the results
> of your Jenkins build #57 that
> ES3-CTS.functional.state_query.integers.viewport_getfloat fails on all
> platforms. Do we need to improve something in the CI?

No, CI is working fine, I have just bypassed it for this patch, and it 
wasn't a great idea. Sorry again for this useless regression.

> 
>> ---
>>   src/mesa/main/viewport.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
>> index 3dce320d1d..fc384909e6 100644
>> --- a/src/mesa/main/viewport.c
>> +++ b/src/mesa/main/viewport.c
>> @@ -94,9 +94,10 @@ static void
>>   viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width,
>>            GLsizei height)
>>   {
>> +   struct gl_viewport_inputs input = { x, y, width, height };
>> +
>>      /* Clamp the viewport to the implementation dependent values. */
>> -   clamp_viewport(ctx, (GLfloat *)&x, (GLfloat *)&y,
>> -                  (GLfloat *)&width, (GLfloat *)&height);
> 
> As an aside, this is violating C's aliasing rules. This pattern isn't
> allowed in Mesa since commit 88ad8c7dedb87d92a5bed0868f108076185ec089
> 


More information about the mesa-dev mailing list