nvk: EXT_conditional_rendering
This reads the buffer value, combines it with the inverted setting and sets SET_RENDER_ENABLE depending on this. This works for draw and clear calls, but not for dispatch. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24520>
This commit is contained in:

committed by
Faith Ekstrand

parent
07c70c77de
commit
8c25cd307a
@@ -546,7 +546,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||
VK_EXT_buffer_device_address DONE (anv/gen8+, hasvk, nvk, radv)
|
||||
VK_EXT_calibrated_timestamps DONE (anv, hasvk, lvp, radv, vn)
|
||||
VK_EXT_color_write_enable DONE (anv, hasvk, lvp, radv, tu, v3dv, vn)
|
||||
VK_EXT_conditional_rendering DONE (anv, hasvk, lvp, radv, tu, vn)
|
||||
VK_EXT_conditional_rendering DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
|
||||
VK_EXT_conservative_rasterization DONE (anv/gen9+, radv, vn)
|
||||
VK_EXT_custom_border_color DONE (anv, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
|
||||
VK_EXT_debug_marker DONE (radv)
|
||||
|
@@ -176,6 +176,7 @@ nvk_BindBufferMemory2(VkDevice device,
|
||||
VK_FROM_HANDLE(nvk_device_memory, mem, pBindInfos[i].memory);
|
||||
VK_FROM_HANDLE(nvk_buffer, buffer, pBindInfos[i].buffer);
|
||||
|
||||
buffer->is_local = !(mem->bo->flags & NOUVEAU_WS_BO_GART);
|
||||
#if NVK_NEW_UAPI == 1
|
||||
if (buffer->vma_size_B) {
|
||||
VK_FROM_HANDLE(nvk_device, dev, device);
|
||||
|
@@ -25,6 +25,7 @@ struct nvk_buffer {
|
||||
#else
|
||||
struct nvk_device_memory *mem;
|
||||
#endif
|
||||
bool is_local;
|
||||
};
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_buffer, vk.base, VkBuffer, VK_OBJECT_TYPE_BUFFER)
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "nvk_cl902d.h"
|
||||
#include "nvk_cl9039.h"
|
||||
#include "nvk_cl906f.h"
|
||||
#include "nvk_cl90b5.h"
|
||||
#include "nvk_cl90c0.h"
|
||||
#include "nvk_clb0c0.h"
|
||||
|
||||
@@ -557,7 +558,7 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
|
||||
render->stencil_att.iview == NULL)
|
||||
render->color_att_count = 1;
|
||||
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, render->color_att_count * 10 + 25);
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, render->color_att_count * 10 + 27);
|
||||
|
||||
P_IMMD(p, NV9097, SET_MME_SHADOW_SCRATCH(NVK_MME_SCRATCH_VIEW_MASK),
|
||||
render->view_mask);
|
||||
@@ -767,8 +768,15 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = render->view_mask ? 1 : render->layer_count,
|
||||
};
|
||||
|
||||
P_MTHD(p, NV9097, SET_RENDER_ENABLE_OVERRIDE);
|
||||
P_NV9097_SET_RENDER_ENABLE_OVERRIDE(p, MODE_ALWAYS_RENDER);
|
||||
|
||||
nvk_CmdClearAttachments(nvk_cmd_buffer_to_handle(cmd),
|
||||
clear_count, clear_att, 1, &clear_rect);
|
||||
p = nvk_cmd_buffer_push(cmd, 2);
|
||||
P_MTHD(p, NV9097, SET_RENDER_ENABLE_OVERRIDE);
|
||||
P_NV9097_SET_RENDER_ENABLE_OVERRIDE(p, MODE_USE_RENDER_ENABLE);
|
||||
}
|
||||
|
||||
/* TODO: Attachment clears */
|
||||
@@ -2458,3 +2466,74 @@ nvk_CmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer,
|
||||
counterBufferOffset, 4);
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
nvk_CmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer,
|
||||
const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin)
|
||||
{
|
||||
VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer);
|
||||
VK_FROM_HANDLE(nvk_buffer, buffer, pConditionalRenderingBegin->buffer);
|
||||
|
||||
uint64_t addr = nvk_buffer_address(buffer, pConditionalRenderingBegin->offset);
|
||||
bool inverted = pConditionalRenderingBegin->flags &
|
||||
VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT;
|
||||
|
||||
nvk_flush_descriptors(cmd);
|
||||
|
||||
if (addr & 0x3f || buffer->is_local) {
|
||||
uint64_t tmp_addr;
|
||||
VkResult result = nvk_cmd_buffer_cond_render_alloc(cmd, &tmp_addr);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_command_buffer_set_error(&cmd->vk, result);
|
||||
return;
|
||||
}
|
||||
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, 12);
|
||||
P_MTHD(p, NV90B5, OFFSET_IN_UPPER);
|
||||
P_NV90B5_OFFSET_IN_UPPER(p, addr >> 32);
|
||||
P_NV90B5_OFFSET_IN_LOWER(p, addr & 0xffffffff);
|
||||
P_NV90B5_OFFSET_OUT_UPPER(p, tmp_addr >> 32);
|
||||
P_NV90B5_OFFSET_OUT_LOWER(p, tmp_addr & 0xffffffff);
|
||||
P_NV90B5_PITCH_IN(p, 4);
|
||||
P_NV90B5_PITCH_OUT(p, 4);
|
||||
P_NV90B5_LINE_LENGTH_IN(p, 4);
|
||||
P_NV90B5_LINE_COUNT(p, 1);
|
||||
|
||||
P_IMMD(p, NV90B5, LAUNCH_DMA, {
|
||||
.data_transfer_type = DATA_TRANSFER_TYPE_PIPELINED,
|
||||
.multi_line_enable = MULTI_LINE_ENABLE_TRUE,
|
||||
.flush_enable = FLUSH_ENABLE_TRUE,
|
||||
.src_memory_layout = SRC_MEMORY_LAYOUT_PITCH,
|
||||
.dst_memory_layout = DST_MEMORY_LAYOUT_PITCH,
|
||||
});
|
||||
addr = tmp_addr;
|
||||
}
|
||||
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, 12);
|
||||
P_MTHD(p, NV9097, SET_RENDER_ENABLE_A);
|
||||
P_NV9097_SET_RENDER_ENABLE_A(p, addr >> 32);
|
||||
P_NV9097_SET_RENDER_ENABLE_B(p, addr & 0xfffffff0);
|
||||
P_NV9097_SET_RENDER_ENABLE_C(p, inverted ? MODE_RENDER_IF_EQUAL : MODE_RENDER_IF_NOT_EQUAL);
|
||||
|
||||
P_MTHD(p, NV90C0, SET_RENDER_ENABLE_A);
|
||||
P_NV90C0_SET_RENDER_ENABLE_A(p, addr >> 32);
|
||||
P_NV90C0_SET_RENDER_ENABLE_B(p, addr & 0xfffffff0);
|
||||
P_NV90C0_SET_RENDER_ENABLE_C(p, inverted ? MODE_RENDER_IF_EQUAL : MODE_RENDER_IF_NOT_EQUAL);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
nvk_CmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer);
|
||||
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, 12);
|
||||
P_MTHD(p, NV9097, SET_RENDER_ENABLE_A);
|
||||
P_NV9097_SET_RENDER_ENABLE_A(p, 0);
|
||||
P_NV9097_SET_RENDER_ENABLE_B(p, 0);
|
||||
P_NV9097_SET_RENDER_ENABLE_C(p, MODE_TRUE);
|
||||
|
||||
P_MTHD(p, NV90C0, SET_RENDER_ENABLE_A);
|
||||
P_NV90C0_SET_RENDER_ENABLE_A(p, 0);
|
||||
P_NV90C0_SET_RENDER_ENABLE_B(p, 0);
|
||||
P_NV90C0_SET_RENDER_ENABLE_C(p, MODE_TRUE);
|
||||
}
|
||||
|
@@ -398,6 +398,7 @@ nvk_get_device_extensions(const struct nv_device_info *info,
|
||||
.EXT_4444_formats = true,
|
||||
.EXT_border_color_swizzle = true,
|
||||
.EXT_buffer_device_address = true,
|
||||
.EXT_conditional_rendering = true,
|
||||
.EXT_custom_border_color = true,
|
||||
.EXT_depth_clip_control = true,
|
||||
.EXT_depth_clip_enable = true,
|
||||
@@ -535,6 +536,8 @@ nvk_get_device_features(const struct nv_device_info *info,
|
||||
.bufferDeviceAddressMultiDevice = false,
|
||||
.drawIndirectCount = info->cls_eng3d >= TURING_A,
|
||||
.samplerFilterMinmax = info->cls_eng3d >= MAXWELL_B,
|
||||
.conditionalRendering = true,
|
||||
.inheritedConditionalRendering = true,
|
||||
|
||||
/* Vulkan 1.3 */
|
||||
.robustImageAccess = true,
|
||||
|
Reference in New Issue
Block a user