mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 14:00:37 +02:00
intel/compiler: properly size attribute wa_flags array for Vulkan
Mesa will map user defined vertex input attributes to slots starting at VERT_ATTRIB_GENERIC0 which gives us room for only 16 slots (up to GL_VERT_ATTRIB_MAX). This sufficient for GL, where we expose exactly 16 vertex attributes for user defined inputs, but in Vulkan we can expose up to 28 (which are also mapped from VERT_ATTRIB_GENERIC0 onwards) so we need to account for this when we scope the size of the array of attribute workaround flags that is used during the brw_vertex_workarounds NIR pass. This prevents out-of-bounds accesses in that array for NIR shaders that use more than 16 vertex input attributes. Fixes: dEQP-VK.pipeline.vertex_input.max_attributes.* Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
9d41ec2182
commit
81615ad444
1 changed files with 17 additions and 1 deletions
|
|
@ -188,6 +188,15 @@ struct brw_sampler_prog_key_data {
|
|||
#define BRW_ATTRIB_WA_SIGN 32 /* interpret as signed in shader */
|
||||
#define BRW_ATTRIB_WA_SCALE 64 /* interpret as scaled in shader */
|
||||
|
||||
/**
|
||||
* OpenGL attribute slots fall in [0, VERT_ATTRIB_MAX - 1] with the range
|
||||
* [VERT_ATTRIB_GENERIC0, VERT_ATTRIB_MAX - 1] reserved for up to 16 user
|
||||
* input vertex attributes. In Vulkan, we expose up to 28 user vertex input
|
||||
* attributes that are mapped to slots also starting at VERT_ATTRIB_GENERIC0.
|
||||
*/
|
||||
#define MAX_GL_VERT_ATTRIB VERT_ATTRIB_MAX
|
||||
#define MAX_VK_VERT_ATTRIB (VERT_ATTRIB_GENERIC0 + 28)
|
||||
|
||||
/** The program key for Vertex Shaders. */
|
||||
struct brw_vs_prog_key {
|
||||
unsigned program_string_id;
|
||||
|
|
@ -196,8 +205,15 @@ struct brw_vs_prog_key {
|
|||
* Per-attribute workaround flags
|
||||
*
|
||||
* For each attribute, a combination of BRW_ATTRIB_WA_*.
|
||||
*
|
||||
* For OpenGL, where we expose a maximum of 16 user input atttributes
|
||||
* we only need up to VERT_ATTRIB_MAX slots, however, in Vulkan
|
||||
* slots preceding VERT_ATTRIB_GENERIC0 are unused and we can
|
||||
* expose up to 28 user input vertex attributes that are mapped to slots
|
||||
* starting at VERT_ATTRIB_GENERIC0, so this array needs to be large
|
||||
* enough to hold this many slots.
|
||||
*/
|
||||
uint8_t gl_attrib_wa_flags[VERT_ATTRIB_MAX];
|
||||
uint8_t gl_attrib_wa_flags[MAX2(MAX_GL_VERT_ATTRIB, MAX_VK_VERT_ATTRIB)];
|
||||
|
||||
bool copy_edgeflag:1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue