anv: Ignore some CreateInfo structs when rasterization is disabled
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 3 Jan 2020 21:23:32 +0000 (13:23 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 3 Jan 2020 21:57:31 +0000 (13:57 -0800)
commit75a19186b2aad7e588f04e1c554cdfd315dd848a
treed09a17ce12968ecdbc37a7d03b9fdbeb6076f1d1
parent6755b6315b209002f27671febdf2e196a66e3df4
anv: Ignore some CreateInfo structs when rasterization is disabled

According to the description of VkGraphicsPipelineCreateInfo(),
pViewportState, pMultisampleState, pDepthStencilState and
pColorBlendState must be ignored when rasterization is not enabled.

This avoids potentially invalid pointers being dereferenced when
rasterization is disabled.  Tested with `demos_x64 VK_Parameter_Zoo`
from Renderdoc repository.

v2: Don't store the `raster_enabled` as part of anv_pipeline, just
    query it from the create info.  This avoids storing a state that's
    only used during pipeline creation. (Jason)

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2258
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch> [v1]
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> [v1]
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_pipeline.c
src/intel/vulkan/genX_pipeline.c