anv: limit stack usage for anv_surface_state

Each one is 136 bytes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24109>
This commit is contained in:
Marcin Ślusarz 2023-07-11 14:59:32 +02:00 committed by Marge Bot
parent deaf4f2d57
commit a762fa27db
2 changed files with 11 additions and 11 deletions

View file

@ -1647,12 +1647,12 @@ anv_descriptor_set_write_image_view(struct anv_device *device,
if (image_view) { if (image_view) {
for (unsigned p = 0; p < image_view->n_planes; p++) { for (unsigned p = 0; p < image_view->n_planes; p++) {
struct anv_surface_state sstate = const struct anv_surface_state *sstate =
(desc->layout == VK_IMAGE_LAYOUT_GENERAL) ? (desc->layout == VK_IMAGE_LAYOUT_GENERAL) ?
image_view->planes[p].general_sampler : &image_view->planes[p].general_sampler :
image_view->planes[p].optimal_sampler; &image_view->planes[p].optimal_sampler;
desc_data[p].image = desc_data[p].image =
anv_surface_state_to_handle(device->physical, sstate.state); anv_surface_state_to_handle(device->physical, sstate->state);
} }
} }

View file

@ -1924,12 +1924,12 @@ emit_indirect_descriptor_binding_table_entry(struct anv_cmd_buffer *cmd_buffer,
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: { case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
if (desc->image_view) { if (desc->image_view) {
struct anv_surface_state sstate = const struct anv_surface_state *sstate =
(desc->layout == VK_IMAGE_LAYOUT_GENERAL) ? (desc->layout == VK_IMAGE_LAYOUT_GENERAL) ?
desc->image_view->planes[binding->plane].general_sampler : &desc->image_view->planes[binding->plane].general_sampler :
desc->image_view->planes[binding->plane].optimal_sampler; &desc->image_view->planes[binding->plane].optimal_sampler;
surface_state = surface_state =
anv_bindless_state_for_binding_table(device, sstate.state); anv_bindless_state_for_binding_table(device, sstate->state);
assert(surface_state.alloc_size); assert(surface_state.alloc_size);
} else { } else {
surface_state = anv_null_surface_state_for_binding_table(device); surface_state = anv_null_surface_state_for_binding_table(device);
@ -1939,10 +1939,10 @@ emit_indirect_descriptor_binding_table_entry(struct anv_cmd_buffer *cmd_buffer,
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: { case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: {
if (desc->image_view) { if (desc->image_view) {
struct anv_surface_state sstate = const struct anv_surface_state *sstate =
desc->image_view->planes[binding->plane].storage; &desc->image_view->planes[binding->plane].storage;
surface_state = anv_bindless_state_for_binding_table( surface_state = anv_bindless_state_for_binding_table(
device, sstate.state); device, sstate->state);
assert(surface_state.alloc_size); assert(surface_state.alloc_size);
} else { } else {
surface_state = surface_state =