mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 18:20:10 +01:00
nvk: Emit inactive vertex attributes
VK_KHR_maintenance9 requires that vertex attributes in shaders which map to vertex attributes that aren't bound at the API return a consistent value. In order to do this, we need toemit SET_VERTEX_ATTRIBUTE_A, even for unused attributes. The RGBA32F format was chosen to ensure we return (0, 0, 0, 0) from unbound attributes. Fixes:7692d3c0e1("nvk: Advertise VK_KHR_maintenance9") (cherry picked from commitd39221cef3) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38167>
This commit is contained in:
parent
fb2273df78
commit
b74000dbce
2 changed files with 22 additions and 11 deletions
|
|
@ -184,7 +184,7 @@
|
|||
"description": "nvk: Emit inactive vertex attributes",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "7692d3c0e1a2b54c82c945335d23fc174252fda1",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1822,17 +1822,28 @@ nvk_flush_vi_state(struct nvk_cmd_buffer *cmd)
|
|||
|
||||
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VI) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VI_BINDINGS_VALID)) {
|
||||
u_foreach_bit(a, dyn->vi->attributes_valid) {
|
||||
const struct nvk_va_format *fmt =
|
||||
nvk_get_va_format(pdev, dyn->vi->attributes[a].format);
|
||||
P_MTHD(p, NV9097, SET_VERTEX_ATTRIBUTE_A(0));
|
||||
for (uint32_t a = 0; a < 32; a++) {
|
||||
if (dyn->vi->attributes_valid & BITFIELD_BIT(a)) {
|
||||
const struct nvk_va_format *fmt =
|
||||
nvk_get_va_format(pdev, dyn->vi->attributes[a].format);
|
||||
|
||||
P_IMMD(p, NV9097, SET_VERTEX_ATTRIBUTE_A(a), {
|
||||
.stream = dyn->vi->attributes[a].binding,
|
||||
.offset = dyn->vi->attributes[a].offset,
|
||||
.component_bit_widths = fmt->bit_widths,
|
||||
.numerical_type = fmt->type,
|
||||
.swap_r_and_b = fmt->swap_rb,
|
||||
});
|
||||
P_NV9097_SET_VERTEX_ATTRIBUTE_A(p, a, {
|
||||
.stream = dyn->vi->attributes[a].binding,
|
||||
.source = SOURCE_ACTIVE,
|
||||
.offset = dyn->vi->attributes[a].offset,
|
||||
.component_bit_widths = fmt->bit_widths,
|
||||
.numerical_type = fmt->type,
|
||||
.swap_r_and_b = fmt->swap_rb,
|
||||
});
|
||||
} else {
|
||||
P_NV9097_SET_VERTEX_ATTRIBUTE_A(p, a, {
|
||||
.source = SOURCE_INACTIVE,
|
||||
/* Using RGBA32 gives us (0, 0, 0, 0) for inactive attributes. */
|
||||
.component_bit_widths = COMPONENT_BIT_WIDTHS_R32_G32_B32_A32,
|
||||
.numerical_type = NUMERICAL_TYPE_NUM_FLOAT,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
u_foreach_bit(b, dyn->vi->bindings_valid) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue