anv: Add an anv_physical_device field to anv_device

Having to always pull the physical device from the instance has been
annoying for almost as long as the driver has existed.  It also won't
work in a world where we ever have more than one physical device.  This
commit adds a new field called "physical" to anv_device and switches
every location where we use device->instance->physicalDevice to use the
new field instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3461>
This commit is contained in:
Jason Ekstrand
2020-01-17 22:23:30 -06:00
committed by Marge Bot
parent 735a3ba007
commit 70e8064e13
24 changed files with 90 additions and 128 deletions

View File

@@ -245,8 +245,7 @@ void anv_GetDescriptorSetLayoutSupport(
VkDescriptorSetLayoutSupport* pSupport)
{
ANV_FROM_HANDLE(anv_device, device, _device);
const struct anv_physical_device *pdevice =
&device->instance->physicalDevice;
const struct anv_physical_device *pdevice = device->physical;
uint32_t surface_count[MESA_SHADER_STAGES] = { 0, };
bool needs_descriptor_buffer = false;
@@ -427,7 +426,7 @@ VkResult anv_CreateDescriptorSetLayout(
}
set_layout->binding[b].data =
anv_descriptor_data_for_type(&device->instance->physicalDevice,
anv_descriptor_data_for_type(device->physical,
binding->descriptorType);
set_layout->binding[b].array_size = binding->descriptorCount;
set_layout->binding[b].descriptor_index = set_layout->size;
@@ -683,7 +682,7 @@ VkResult anv_CreateDescriptorPool(
uint32_t descriptor_bo_size = 0;
for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; i++) {
enum anv_descriptor_data desc_data =
anv_descriptor_data_for_type(&device->instance->physicalDevice,
anv_descriptor_data_for_type(device->physical,
pCreateInfo->pPoolSizes[i].type);
if (desc_data & ANV_DESCRIPTOR_BUFFER_VIEW)