anv: Rework the way render target surfaces are allocated
This commit moves the allocation and filling out of surface state from CreateImageView time to BeginRenderPass time. Instead of allocating the render target surface state as part of the image view, we allocate it in the command buffer state at the same time that we set up clears. For secondary command buffers, we allocate memory for the surface states in BeginCommandBuffer but don't fill them out; instead, we use our new SOL-based memcpy function to copy the surface states from the primary command buffer. This allows us to handle secondary command buffers without the user specifying the framebuffer ahead-of-time. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
@@ -504,23 +504,6 @@ anv_CreateImageView(VkDevice _device,
|
||||
iview->sampler_surface_state.alloc_size = 0;
|
||||
}
|
||||
|
||||
if (image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
|
||||
iview->color_rt_surface_state = alloc_surface_state(device);
|
||||
|
||||
struct isl_view view = iview->isl;
|
||||
view.usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
|
||||
isl_surf_fill_state(&device->isl_dev,
|
||||
iview->color_rt_surface_state.map,
|
||||
.surf = &surface->isl,
|
||||
.view = &view,
|
||||
.mocs = device->default_mocs);
|
||||
|
||||
if (!device->info.has_llc)
|
||||
anv_state_clflush(iview->color_rt_surface_state);
|
||||
} else {
|
||||
iview->color_rt_surface_state.alloc_size = 0;
|
||||
}
|
||||
|
||||
/* NOTE: This one needs to go last since it may stomp isl_view.format */
|
||||
if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
|
||||
iview->storage_surface_state = alloc_surface_state(device);
|
||||
@@ -565,11 +548,6 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview,
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_image_view, iview, _iview);
|
||||
|
||||
if (iview->color_rt_surface_state.alloc_size > 0) {
|
||||
anv_state_pool_free(&device->surface_state_pool,
|
||||
iview->color_rt_surface_state);
|
||||
}
|
||||
|
||||
if (iview->sampler_surface_state.alloc_size > 0) {
|
||||
anv_state_pool_free(&device->surface_state_pool,
|
||||
iview->sampler_surface_state);
|
||||
|
Reference in New Issue
Block a user