radv: re-introduce DGC+multiview support and enable it for vkd3d-proton only

The Vulkan spec says:
    "VUID-vkCmdExecuteGeneratedCommandsEXT-None-11062
     If a rendering pass is currently active, the view mask must be 0."

So, it's invalid with VK_EXT_device_generated_commands but it's allowed
in DX12, it seems we missed this during the spec review.

Crimson Desert uses this and emulating in vkd3d-proton would be complex,
so let's re-introduce this support only for vkd3d-proton.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41153>
This commit is contained in:
Samuel Pitoiset 2026-04-24 12:30:08 +02:00 committed by Marge Bot
parent 2d78546d59
commit 782254b820
5 changed files with 26 additions and 1 deletions

View file

@ -13770,6 +13770,8 @@ radv_CmdExecuteGeneratedCommandsEXT(VkCommandBuffer commandBuffer, VkBool32 isPr
VK_FROM_HANDLE(radv_indirect_execution_set, ies, pGeneratedCommandsInfo->indirectExecutionSet);
VK_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
const struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
const bool use_predication = radv_use_dgc_predication(cmd_buffer, pGeneratedCommandsInfo);
const bool compute = !!(layout->vk.dgc_info & BITFIELD_BIT(MESA_VK_DGC_DISPATCH));
const bool rt = !!(layout->vk.dgc_info & BITFIELD_BIT(MESA_VK_DGC_RT));
@ -13868,7 +13870,22 @@ radv_CmdExecuteGeneratedCommandsEXT(VkCommandBuffer commandBuffer, VkBool32 isPr
ac_emit_cp_pfp_sync_me(cs->b, cmd_buffer->state.predicating);
}
radv_dgc_execute_ib(cmd_buffer, pGeneratedCommandsInfo);
/* The Vulkan spec 1.4.349 says:
*
* "VUID-vkCmdExecuteGeneratedCommandsEXT-None-11062
* If a rendering pass is currently active, the view mask must be 0."
*
* But it's a valid behavior with DX12, so it can be enabled via drirc.
*/
const uint32_t view_mask = instance->drirc.features.allow_dgc_multiview ? cmd_buffer->state.render.view_mask : 0;
if (rt || compute || !view_mask) {
radv_dgc_execute_ib(cmd_buffer, pGeneratedCommandsInfo);
} else {
u_foreach_bit (view, view_mask) {
radv_emit_view_index(&cmd_buffer->state, cmd_buffer->cs, view);
radv_dgc_execute_ib(cmd_buffer, pGeneratedCommandsInfo);
}
}
if (rt) {
cmd_buffer->push_constant_stages |= RADV_RT_STAGE_BITS;

View file

@ -218,6 +218,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_RADV_EMULATE_RT(false)
DRI_CONF_RADV_ENABLE_FLOAT16_GFX8(false)
DRI_CONF_RADV_COOPERATIVE_MATRIX2_NV(false)
DRI_CONF_RADV_ALLOW_DGC_MULTIVIEW(false)
DRI_CONF_RADV_WAIT_FOR_VM_MAP_UPDATES(false)
DRI_CONF_RADV_NO_IMPLICIT_VARYING_SUBGROUP_SIZE(false)
DRI_CONF_RADV_HIDE_REBAR_ON_DGPU(false)
@ -289,6 +290,7 @@ radv_init_dri_features_options(struct radv_instance *instance)
struct radv_drirc *drirc = &instance->drirc;
drirc->features.cooperative_matrix2_nv = driQueryOptionb(&drirc->options, "radv_cooperative_matrix2_nv");
drirc->features.allow_dgc_multiview = driQueryOptionb(&drirc->options, "radv_allow_dgc_multiview");
drirc->features.emulate_rt = driQueryOptionb(&drirc->options, "radv_emulate_rt");
drirc->features.expose_float16_gfx8 = driQueryOptionb(&drirc->options, "radv_enable_float16_gfx8");
drirc->features.vk_require_etc2 = driQueryOptionb(&drirc->options, "vk_require_etc2");

View file

@ -75,6 +75,7 @@ struct radv_drirc {
struct {
bool cooperative_matrix2_nv;
bool allow_dgc_multiview;
bool emulate_rt;
bool expose_float16_gfx8;
bool vk_require_astc;

View file

@ -43,6 +43,7 @@ Application bugs worked around in this file:
<option name="radv_disable_aniso_single_level" value="true" />
<option name="radv_disable_trunc_coord" value="true" />
<option name="radv_cooperative_matrix2_nv" value="true" />
<option name="radv_allow_dgc_multiview" value="true" />
</engine>
<engine engine_name_match="DXVK">

View file

@ -837,6 +837,10 @@
DRI_CONF_OPT_B(radv_cooperative_matrix2_nv, def, \
"Expose VK_NV_cooperative_matrix2 on supported hardware.")
#define DRI_CONF_RADV_ALLOW_DGC_MULTIVIEW(def) \
DRI_CONF_OPT_B(radv_allow_dgc_multiview, def, \
"Allow to use DGC with multiview for DX12 emulation.")
#define DRI_CONF_RADV_GFX12_HIZ_WA() \
DRI_CONF_OPT_S_NODEF(radv_gfx12_hiz_wa, \
"Choose the specific HiZ workaround to apply on GFX12 (RDNA4). " \