nvk: Support dynamic state for enabling sample locations

When switching dynamically we should also push the corresponding sample
locations, the default when disabled or the custom ones when enabled.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24592>
This commit is contained in:
George Ouzounoudis 2023-08-10 00:03:24 +03:00 committed by Marge Bot
parent 2de545c68f
commit 41d094c2cc
2 changed files with 12 additions and 5 deletions

View file

@ -11,6 +11,7 @@
#include "nil_format.h"
#include "util/bitpack_helpers.h"
#include "vulkan/runtime/vk_render_pass.h"
#include "vulkan/runtime/vk_standard_sample_locations.h"
#include "vulkan/util/vk_format.h"
#include "nouveau_context.h"
@ -1206,8 +1207,8 @@ static struct nvk_sample_location
vk_to_nvk_sample_location(VkSampleLocationEXT loc)
{
return (struct nvk_sample_location) {
.x_u4 = util_bitpack_ufixed(loc.x, 0, 3, 4),
.y_u4 = util_bitpack_ufixed(loc.y, 0, 3, 4),
.x_u4 = util_bitpack_ufixed_clamp(loc.x, 0, 3, 4),
.y_u4 = util_bitpack_ufixed_clamp(loc.y, 0, 3, 4),
};
}
@ -1217,8 +1218,14 @@ nvk_flush_ms_state(struct nvk_cmd_buffer *cmd)
const struct vk_dynamic_graphics_state *dyn =
&cmd->vk.dynamic_graphics_state;
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS)) {
const struct vk_sample_locations_state *sl = dyn->ms.sample_locations;
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS) ||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS_ENABLE)) {
const struct vk_sample_locations_state *sl;
if (dyn->ms.sample_locations_enable) {
sl = dyn->ms.sample_locations;
} else {
sl = vk_standard_sample_locations_state(dyn->ms.rasterization_samples);
}
if (nvk_cmd_buffer_3d_cls(cmd) >= MAXWELL_B) {
struct nvk_sample_location loc[16];

View file

@ -293,7 +293,7 @@ nvk_get_device_features(const struct nv_device_info *info,
.extendedDynamicState3ConservativeRasterizationMode = false,
.extendedDynamicState3ExtraPrimitiveOverestimationSize = false,
.extendedDynamicState3DepthClipEnable = false,
.extendedDynamicState3SampleLocationsEnable = false,
.extendedDynamicState3SampleLocationsEnable = info->cls_eng3d >= MAXWELL_B,
.extendedDynamicState3ColorBlendAdvanced = false,
.extendedDynamicState3ProvokingVertexMode = true,
.extendedDynamicState3LineRasterizationMode = true,