[Mesa-dev] [PATCH] swr: fix clang warnings

Ilia Mirkin imirkin at alum.mit.edu
Thu Apr 21 16:48:21 UTC 2016


On Thu, Apr 21, 2016 at 12:38 PM, Cherniak, Bruce
<bruce.cherniak at intel.com> wrote:
>>
>> On Apr 21, 2016, at 11:20 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>
>> On Thu, Apr 21, 2016 at 12:17 PM, Tim Rowley <timothy.o.rowley at intel.com> wrote:
>>> ---
>>> src/gallium/drivers/swr/swr_query.cpp | 2 +-
>>> src/gallium/drivers/swr/swr_shader.h  | 8 ++++----
>>> 2 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
>>> index e4b8b68..92a1a0b 100644
>>> --- a/src/gallium/drivers/swr/swr_query.cpp
>>> +++ b/src/gallium/drivers/swr/swr_query.cpp
>>> @@ -314,7 +314,7 @@ swr_check_render_cond(struct pipe_context *pipe)
>>>    b = pipe->get_query_result(
>>>       pipe, ctx->render_cond_query, wait, (union pipe_query_result *)&result);
>>>    if (b)
>>> -      return (!result == ctx->render_cond_cond);
>>> +      return (!(result == ctx->render_cond_cond));
>>
>> Perhaps simpler expressed as
>>
>> result != ctx->render_cond_cond
>>
>> ?
>>
> This cam from the llvmpipe code that I used as the original template and was fixed by Roland
> on 25-MAY-15 in commit 6a111e54d7578abee6bce4a75ce1399ed369ab5f.
>
> Correct fix should be:
>         return ((!result) == lp->render_cond_cond);

Ah yes, you need to cast it to a bool to make things work out. the
query might be GL_SAMPLES_PASSED or something, and not return a 1/0.

  -ilia


More information about the mesa-dev mailing list