mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nvk: Add support for 64-bit vertex attributes
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Mary Guillemard <mary@mary.zone> Acked-by: Mel Henning <mhenning@darkrefraction.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39135>
This commit is contained in:
parent
5ed98c8267
commit
41d8e1ecde
3 changed files with 50 additions and 4 deletions
|
|
@ -1854,17 +1854,37 @@ nvk_flush_vi_state(struct nvk_cmd_buffer *cmd)
|
|||
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 vk_vertex_attribute_state *att =
|
||||
&dyn->vi->attributes[a];
|
||||
const struct nvk_va_format *fmt =
|
||||
nvk_get_va_format(pdev, dyn->vi->attributes[a].format);
|
||||
nvk_get_va_format(pdev, att->format);
|
||||
|
||||
P_NV9097_SET_VERTEX_ATTRIBUTE_A(p, a, {
|
||||
.stream = dyn->vi->attributes[a].binding,
|
||||
.stream = att->binding,
|
||||
.source = SOURCE_ACTIVE,
|
||||
.offset = dyn->vi->attributes[a].offset,
|
||||
.offset = att->offset,
|
||||
.component_bit_widths = fmt->bit_widths,
|
||||
.numerical_type = fmt->type,
|
||||
.swap_r_and_b = fmt->swap_rb,
|
||||
});
|
||||
|
||||
if (fmt->bit_widths_high != NVK_VA_BIT_WIDTH_NONE) {
|
||||
/* 64-bit vec3 and vec4 formats consume two attributes */
|
||||
a++;
|
||||
assert(a < 32);
|
||||
assert(!(dyn->vi->attributes_valid & BITFIELD_BIT(a)));
|
||||
|
||||
/* There are no BGRA 64-bit formats */
|
||||
assert(!fmt->swap_rb);
|
||||
|
||||
P_NV9097_SET_VERTEX_ATTRIBUTE_A(p, a, {
|
||||
.stream = att->binding,
|
||||
.source = SOURCE_ACTIVE,
|
||||
.offset = att->offset + 16,
|
||||
.component_bit_widths = fmt->bit_widths_high,
|
||||
.numerical_type = fmt->type,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
P_NV9097_SET_VERTEX_ATTRIBUTE_A(p, a, {
|
||||
.source = SOURCE_INACTIVE,
|
||||
|
|
|
|||
|
|
@ -48,12 +48,19 @@ nvk_format_supports_storage(const struct nvk_physical_device *pdev,
|
|||
return nil_format_supports_storage(&pdev->info, p_format);
|
||||
}
|
||||
|
||||
#define VA_FMT(vk_fmt, widths, swap_rb, type) \
|
||||
#define NV9097_SET_VERTEX_ATTRIBUTE_A_COMPONENT_BIT_WIDTHS_NONE \
|
||||
NVK_VA_BIT_WIDTH_NONE
|
||||
|
||||
#define VA_FMT64(vk_fmt, widths, widths_high, swap_rb, type) \
|
||||
[VK_FORMAT_##vk_fmt] = \
|
||||
{ NV9097_SET_VERTEX_ATTRIBUTE_A_COMPONENT_BIT_WIDTHS_##widths, \
|
||||
NV9097_SET_VERTEX_ATTRIBUTE_A_COMPONENT_BIT_WIDTHS_##widths_high, \
|
||||
NV9097_SET_VERTEX_ATTRIBUTE_A_SWAP_R_AND_B_##swap_rb, \
|
||||
NV9097_SET_VERTEX_ATTRIBUTE_A_NUMERICAL_TYPE_NUM_##type }
|
||||
|
||||
#define VA_FMT(vk_fmt, widths, swap_rb, type) \
|
||||
VA_FMT64(vk_fmt, widths, NONE, swap_rb, type)
|
||||
|
||||
static const struct nvk_va_format nvk_vf_formats[] = {
|
||||
VA_FMT(R8_UNORM, R8, FALSE, UNORM),
|
||||
VA_FMT(R8_SNORM, R8, FALSE, SNORM),
|
||||
|
|
@ -167,6 +174,22 @@ static const struct nvk_va_format nvk_vf_formats[] = {
|
|||
VA_FMT(R32G32B32A32_UINT, R32_G32_B32_A32, FALSE, UINT),
|
||||
VA_FMT(R32G32B32A32_SINT, R32_G32_B32_A32, FALSE, SINT),
|
||||
VA_FMT(R32G32B32A32_SFLOAT, R32_G32_B32_A32, FALSE, FLOAT),
|
||||
|
||||
VA_FMT64(R64_UINT, R32_G32, NONE, FALSE, UINT),
|
||||
VA_FMT64(R64_SINT, R32_G32, NONE, FALSE, UINT),
|
||||
VA_FMT64(R64_SFLOAT, R32_G32, NONE, FALSE, UINT),
|
||||
|
||||
VA_FMT64(R64G64_UINT, R32_G32_B32_A32, NONE, FALSE, UINT),
|
||||
VA_FMT64(R64G64_SINT, R32_G32_B32_A32, NONE, FALSE, UINT),
|
||||
VA_FMT64(R64G64_SFLOAT, R32_G32_B32_A32, NONE, FALSE, UINT),
|
||||
|
||||
VA_FMT64(R64G64B64_UINT, R32_G32_B32_A32, R32_G32, FALSE, UINT),
|
||||
VA_FMT64(R64G64B64_SINT, R32_G32_B32_A32, R32_G32, FALSE, UINT),
|
||||
VA_FMT64(R64G64B64_SFLOAT, R32_G32_B32_A32, R32_G32, FALSE, UINT),
|
||||
|
||||
VA_FMT64(R64G64B64A64_UINT, R32_G32_B32_A32, R32_G32_B32_A32, FALSE, UINT),
|
||||
VA_FMT64(R64G64B64A64_SINT, R32_G32_B32_A32, R32_G32_B32_A32, FALSE, UINT),
|
||||
VA_FMT64(R64G64B64A64_SFLOAT, R32_G32_B32_A32, R32_G32_B32_A32, FALSE, UINT),
|
||||
};
|
||||
|
||||
#undef VA_FMT
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@
|
|||
|
||||
struct nvk_physical_device;
|
||||
|
||||
#define NVK_VA_BIT_WIDTH_NONE 0
|
||||
|
||||
struct nvk_va_format {
|
||||
uint8_t bit_widths;
|
||||
uint8_t bit_widths_high;
|
||||
uint8_t swap_rb:1;
|
||||
uint8_t type:7;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue