diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 372e88e601d..9c5ed358e0b 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -2088,7 +2088,7 @@ anv_descriptor_set_write_image_view(struct anv_device *device, p, desc->layout), ANV_SURFACE_STATE_SIZE); } else { - memcpy(plane_map, device->null_surface_state.map, ANV_SURFACE_STATE_SIZE); + memcpy(plane_map, &device->host_null_surface_state, ANV_SURFACE_STATE_SIZE); } } } @@ -2107,7 +2107,7 @@ anv_descriptor_set_write_image_view(struct anv_device *device, p, desc->layout), ANV_SURFACE_STATE_SIZE); } else { - memcpy(plane_map, device->null_surface_state.map, ANV_SURFACE_STATE_SIZE); + memcpy(plane_map, &device->host_null_surface_state, ANV_SURFACE_STATE_SIZE); } if (sampler) { @@ -2166,7 +2166,7 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device, if (buffer_view == NULL) { if (data & ANV_DESCRIPTOR_SURFACE) - memcpy(desc_map, device->null_surface_state.map, ANV_SURFACE_STATE_SIZE); + memcpy(desc_map, &device->host_null_surface_state, ANV_SURFACE_STATE_SIZE); else memset(desc_map, 0, bind_layout->descriptor_surface_stride); return; @@ -2252,7 +2252,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device, if (buffer == NULL) { if (data & ANV_DESCRIPTOR_SURFACE) - memcpy(desc_map, device->null_surface_state.map, ANV_SURFACE_STATE_SIZE); + memcpy(desc_map, &device->host_null_surface_state, ANV_SURFACE_STATE_SIZE); else memset(desc_map, 0, bind_layout->descriptor_surface_stride); return; diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index f11bad3bb44..cd0a04716ee 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3542,6 +3542,9 @@ VkResult anv_CreateDevice( .size = isl_extent3d(1, 1, 1) /* This shouldn't matter */); } + isl_null_fill_state(&device->isl_dev, &device->host_null_surface_state, + .size = isl_extent3d(1, 1, 1) /* This shouldn't matter */); + anv_scratch_pool_init(device, &device->scratch_pool); /* TODO(RT): Do we want some sort of data structure for this? */ diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 53e1d8b8bfb..2a2706facaf 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1714,6 +1714,12 @@ struct anv_device { struct anv_bo * trivial_batch_bo; struct anv_state null_surface_state; + /** + * NULL surface state copy stored in host memory for use as a fast + * memcpy() source. + */ + char host_null_surface_state[ANV_SURFACE_STATE_SIZE]; + struct vk_pipeline_cache * default_pipeline_cache; struct vk_pipeline_cache * internal_cache; struct blorp_context blorp;