diff --git a/.pick_status.json b/.pick_status.json index a5022e38927..3315d26b133 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -22504,7 +22504,7 @@ "description": "anv: Increase max VBs to 33 on Gen11+", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 180791a2439..bc3c1ce3e20 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -1082,7 +1082,7 @@ void anv_CmdBindVertexBuffers2( /* We have to defer setting up vertex buffer since we need the buffer * stride from the pipeline. */ - assert(firstBinding + bindingCount <= MAX_VBS); + assert(firstBinding + bindingCount <= get_max_vbs(cmd_buffer->device->info)); for (uint32_t i = 0; i < bindingCount; i++) { ANV_FROM_HANDLE(anv_buffer, buffer, pBuffers[i]); diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c index ae6d2eaed70..4daf3f4df2b 100644 --- a/src/intel/vulkan/anv_physical_device.c +++ b/src/intel/vulkan/anv_physical_device.c @@ -1276,7 +1276,7 @@ get_properties(const struct anv_physical_device *pdevice, .maxDescriptorSetStorageImages = desc_limits.max_images, .maxDescriptorSetInputAttachments = MAX_DESCRIPTOR_SET_INPUT_ATTACHMENTS, .maxVertexInputAttributes = MAX_VES, - .maxVertexInputBindings = MAX_VBS, + .maxVertexInputBindings = get_max_vbs(devinfo), /* Broadwell PRMs: Volume 2d: Command Reference: Structures: * * VERTEX_ELEMENT_STATE::Source Element Offset: [0,2047] diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 6dcaf52342e..26c8154e7cb 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -158,8 +158,14 @@ struct intel_perf_query_result; #define BINDING_TABLE_POOL_BLOCK_SIZE (65536) -/* 3DSTATE_VERTEX_BUFFER supports 33 VBs, we use 2 for base & drawid SGVs */ -#define MAX_VBS (33 - 2) +#define HW_MAX_VBS 33 + +/* 3DSTATE_VERTEX_BUFFER supports 33 VBs, but before Gen11 we used 2 + * for base & drawid SGVs */ +static inline int +get_max_vbs(const struct intel_device_info *devinfo) { + return devinfo->ver >= 11 ? HW_MAX_VBS : (HW_MAX_VBS - 2); +} /* 3DSTATE_VERTEX_ELEMENTS supports up to 34 VEs, but our backend compiler * only supports the push model of VS inputs, and we only have 128 GRFs, @@ -210,8 +216,11 @@ struct intel_perf_query_result; */ #define MAX_BINDING_TABLE_SIZE 240 -#define ANV_SVGS_VB_INDEX MAX_VBS -#define ANV_DRAWID_VB_INDEX (MAX_VBS + 1) + /* 3DSTATE_VERTEX_BUFFER supports 33 VBs, but these limits are applied on Gen9 + * graphics, where 2 VBs are reserved for base & drawid SGVs. + */ +#define ANV_SVGS_VB_INDEX (HW_MAX_VBS - 2) +#define ANV_DRAWID_VB_INDEX (ANV_SVGS_VB_INDEX + 1) /* We reserve this MI ALU register for the purpose of handling predication. * Other code which uses the MI ALU should leave it alone. @@ -4031,8 +4040,8 @@ struct anv_cmd_graphics_state { struct anv_vb_cache_range ib_bound_range; struct anv_vb_cache_range ib_dirty_range; - struct anv_vb_cache_range vb_bound_ranges[33]; - struct anv_vb_cache_range vb_dirty_ranges[33]; + struct anv_vb_cache_range vb_bound_ranges[HW_MAX_VBS]; + struct anv_vb_cache_range vb_dirty_ranges[HW_MAX_VBS]; uint32_t restart_index; @@ -4192,7 +4201,12 @@ struct anv_cmd_state { uint64_t address[MAX_SETS]; } descriptor_buffers; - struct anv_vertex_binding vertex_bindings[MAX_VBS]; + /* For Gen 9, this allocation is 2 greater than the maximum allowed + * number of vertex buffers; see comment on get_max_vbs definition. + * Specializing this allocation seems needlessly complicated when we can + * enforce the VB limit elsewhere. + */ + struct anv_vertex_binding vertex_bindings[HW_MAX_VBS]; bool xfb_enabled; struct anv_xfb_binding xfb_bindings[MAX_XFB_BUFFERS]; struct anv_state binding_tables[MESA_VULKAN_SHADER_STAGES]; diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index e5ec60804c5..337dafd3cb1 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -220,7 +220,7 @@ emit_ves_vf_instancing(struct anv_batch *batch, assume(format < ISL_NUM_FORMATS); uint32_t binding = vi->attributes[a].binding; - assert(binding < MAX_VBS); + assert(binding < get_max_vbs(device->info)); if ((elements & (1 << a)) == 0) continue; /* Binding unused */