[Mesa-stable] [Mesa-dev] [PATCH] anv/pipeline: use BITFIELD64_BIT() to check enable vertex inputs
Juan A. Suarez Romero
jasuarez at igalia.com
Fri Jul 14 07:44:50 UTC 2017
On Thu, 2017-07-13 at 09:43 -0700, Matt Turner wrote:
> On Thu, Jul 13, 2017 at 7:48 AM, Juan A. Suarez Romero
> <jasuarez at igalia.com> wrote:
> > When initializing the ANV pipeline, one of the tasks is checking which
> > vertex inputs are enabled. This is done by checking if the enabled bits
> > in inputs_read.
> >
> > But the mask to use is computed doing `(1 << (VERT_ATTRIB_GENERIC0 +
> > desc->location))`. The problem here is that if location is 15 or
> > greater, the sum is 32 or greater. But C is handling 1 as a 32-bit
> > integer, which means the displaced bit is out of range and thus the full
> > value is 0.
> >
> > Rather, use BITFIELD64_BIT() to compute the mask.
> >
> > This fixes:
> > dEQP-VK.pipeline.vertex_input.max_attributes.16_attributes.binding_one_to_one.interleaved
> >
> > Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
> > Cc: mesa-stable at lists.freedesktop.org
> > ---
> > src/intel/vulkan/anv_pipeline.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
> > index 5494a6e..edbe2e7 100644
> > --- a/src/intel/vulkan/anv_pipeline.c
> > +++ b/src/intel/vulkan/anv_pipeline.c
> > @@ -1330,7 +1330,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
> > const VkVertexInputAttributeDescription *desc =
> > &vi_info->pVertexAttributeDescriptions[i];
> >
> > - if (inputs_read & (1 << (VERT_ATTRIB_GENERIC0 + desc->location)))
> > + if (inputs_read & BITFIELD64_BIT(VERT_ATTRIB_GENERIC0 + desc->location))
>
> The BITFIELD64_BIT macro exists just for MSVC support (See commit
> 5fc5820cbc0faf57a48154466b4792294841a690)
>
> Since this code will never be compiled with MSVC, it's safe to use
> 1ull. I'm not really sure how mtypes.h is being indirectly included.
>
OK. I'll use then 1ull instead of the BITFIELD64_BIT(), and push. Thank
you!
J.A.
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>
More information about the mesa-stable
mailing list