[Mesa-dev] [PATCH 3/3] util/primconvert: take ib offset into account

Jose Fonseca jfonseca at vmware.com
Fri Dec 5 06:19:39 PST 2014


On 05/12/14 14:12, Ilia Mirkin wrote:
> On Fri, Dec 5, 2014 at 9:10 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
>> On 05/12/14 00:01, Ilia Mirkin wrote:
>>>
>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> Cc: "10.4 10.3" <mesa-stable at lists.freedesktop.org>
>>> ---
>>>    src/gallium/auxiliary/indices/u_primconvert.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/auxiliary/indices/u_primconvert.c
>>> b/src/gallium/auxiliary/indices/u_primconvert.c
>>> index 539ca53..4632781 100644
>>> --- a/src/gallium/auxiliary/indices/u_primconvert.c
>>> +++ b/src/gallium/auxiliary/indices/u_primconvert.c
>>> @@ -137,7 +137,7 @@ util_primconvert_draw_vbo(struct primconvert_context
>>> *pc,
>>>          src = ib->user_buffer;
>>>          if (!src) {
>>>             src = pipe_buffer_map(pc->pipe, ib->buffer,
>>> -                               PIPE_TRANSFER_READ, &src_transfer);
>>> +                               PIPE_TRANSFER_READ, &src_transfer) +
>>> ib->offset;
>>>          }
>>>       }
>>>       else {
>>>
>>
>> This change made MSVC unhappy due to the void pointer arithmetic, which is
>> trivial to fix, but it made be notice something: shouldn't the ib->offset
>> also be added when src == ib->user_buffer?
>
> I grepped around for user_buffer usage and it does not seem like
> anything else applies ib->offset to it either. Perhaps I missed it
> though. I'm a little weak on the exact gallium interface meanings, so
> perhaps it _is_ supposed to be added?

I'm not sure either. But at least u_vbuf_get_minmax_index() does it so 
seems safer to do it.

> Sorry about the MSVC breakage, I even thought about the void ptr
> arithmetic, but discounted it as "well, nobody builds freedreno or vc4
>  on windows". But of course you still end up building primconvert :)

No prob.  I should add -Wpointer-arith to the automake build.  The only 
difficulty with that is that (as you mentioned) some code is never meant 
to be built on MSVC, hence doesn't need such restriction on coding 
style.  Therefore I need a way to add more warnings only on the 
cross-platform portions of Mesa source tree.

Jose



More information about the mesa-dev mailing list