From faa91734d9f29abfd0f5dcbe9b5fc41f13b36046 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 22 Jun 2015 17:21:59 +1200 Subject: vulkan.h: Split attachment and image clears (#13914, v126) - Add bit flags for image aspects. - Replace VkRect with VkRect2D and VkRect3D. - Rename vkCmdClearDepthStencil to vkCmdClearDepthStencilImage - Add vkCmdClearColorAttachment and vkCmdClearDepthStencilAttachment Remaining to be done: - Actually implement vkCmdClearColorAttachment, vkCmdClearDepthStencilAttachment in the Intel ICD - Enforce renderpass interactions: CmdClear*Attachment may only be called within a renderpass; CmdClear*Image may only be called outside a renderpass. Signed-off-by: Chris Forbes --- loader/gpa_helper.h | 8 ++++++-- loader/table_ops.h | 12 +++++++++--- loader/trampoline.c | 22 ++++++++++++++++++++-- 3 files changed, 35 insertions(+), 7 deletions(-) (limited to 'loader') diff --git a/loader/gpa_helper.h b/loader/gpa_helper.h index 1ead95c7..26eefc6e 100644 --- a/loader/gpa_helper.h +++ b/loader/gpa_helper.h @@ -223,8 +223,12 @@ static inline void* globalGetProcAddr(const char *name) return (void*) vkCmdFillBuffer; if (!strcmp(name, "CmdClearColorImage")) return (void*) vkCmdClearColorImage; - if (!strcmp(name, "CmdClearDepthStencil")) - return (void*) vkCmdClearDepthStencil; + if (!strcmp(name, "CmdClearDepthStencilImage")) + return (void*) vkCmdClearDepthStencilImage; + if (!strcmp(name, "CmdClearColorAttachment")) + return (void*) vkCmdClearColorAttachment; + if (!strcmp(name, "CmdClearDepthStencilAttachment")) + return (void*) vkCmdClearDepthStencilAttachment; if (!strcmp(name, "CmdResolveImage")) return (void*) vkCmdResolveImage; if (!strcmp(name, "CmdSetEvent")) diff --git a/loader/table_ops.h b/loader/table_ops.h index 52cb9c12..39370f36 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -116,7 +116,9 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) gpa(dev, "vkCmdUpdateBuffer"); table->CmdFillBuffer = (PFN_vkCmdFillBuffer) gpa(dev, "vkCmdFillBuffer"); table->CmdClearColorImage = (PFN_vkCmdClearColorImage) gpa(dev, "vkCmdClearColorImage"); - table->CmdClearDepthStencil = (PFN_vkCmdClearDepthStencil) gpa(dev, "vkCmdClearDepthStencil"); + table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) gpa(dev, "vkCmdClearDepthStencilImage"); + table->CmdClearColorAttachment = (PFN_vkCmdClearColorAttachment) gpa(dev, "vkCmdClearColorAttachment"); + table->CmdClearDepthStencilAttachment = (PFN_vkCmdClearDepthStencilAttachment) gpa(dev, "vkCmdClearDepthStencilAttachment"); table->CmdResolveImage = (PFN_vkCmdResolveImage) gpa(dev, "vkCmdResolveImage"); table->CmdSetEvent = (PFN_vkCmdSetEvent) gpa(dev, "vkCmdSetEvent"); table->CmdResetEvent = (PFN_vkCmdResetEvent) gpa(dev, "vkCmdResetEvent"); @@ -309,8 +311,12 @@ static inline void *loader_lookup_device_dispatch_table( return (void *) table->CmdFillBuffer; if (!strcmp(name, "CmdClearColorImage")) return (void *) table->CmdClearColorImage; - if (!strcmp(name, "CmdClearDepthStencil")) - return (void *) table->CmdClearDepthStencil; + if (!strcmp(name, "CmdClearDepthStencilImage")) + return (void *) table->CmdClearDepthStencilImage; + if (!strcmp(name, "CmdClearColorAttachment")) + return (void *) table->CmdClearColorAttachment; + if (!strcmp(name, "CmdClearDepthStencilAttachment")) + return (void *) table->CmdClearDepthStencilAttachment; if (!strcmp(name, "CmdResolveImage")) return (void *) table->CmdResolveImage; if (!strcmp(name, "CmdSetEvent")) diff --git a/loader/trampoline.c b/loader/trampoline.c index 242f04e0..ef8e4f5e 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -999,13 +999,31 @@ LOADER_EXPORT void VKAPI vkCmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage ima disp->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges); } -LOADER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) +LOADER_EXPORT void VKAPI vkCmdClearDepthStencilImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(cmdBuffer); - disp->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges); + disp->CmdClearDepthStencilImage(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges); +} + +LOADER_EXPORT void VKAPI vkCmdClearColorAttachment(VkCmdBuffer cmdBuffer, uint32_t colorAttachment, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rectCount, const VkRect3D* pRects) +{ + const VkLayerDispatchTable *disp; + + disp = loader_get_dispatch(cmdBuffer); + + disp->CmdClearColorAttachment(cmdBuffer, colorAttachment, imageLayout, pColor, rectCount, pRects); +} + +LOADER_EXPORT void VKAPI vkCmdClearDepthStencilAttachment(VkCmdBuffer cmdBuffer, VkImageAspectFlags imageAspectMask, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rectCount, const VkRect3D* pRects) +{ + const VkLayerDispatchTable *disp; + + disp = loader_get_dispatch(cmdBuffer); + + disp->CmdClearDepthStencilAttachment(cmdBuffer, imageAspectMask, imageLayout, depth, stencil, rectCount, pRects); } LOADER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) -- cgit v1.2.3