- 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 <chrisf@ijw.co.nz>
clear_range.baseArraySlice = 0;
clear_range.arraySize = 1;
- vkCmdClearDepthStencil(cmd_buf, demo->depth.image,
+ vkCmdClearDepthStencilImage(cmd_buf, demo->depth.image,
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
clear_depth, 0, 1, &clear_range);
viewport.minDepth = (float) 0.0f;
viewport.maxDepth = (float) 1.0f;
viewport_create.pViewports = &viewport;
- VkRect scissor;
+ VkRect2D scissor;
memset(&scissor, 0, sizeof(scissor));
scissor.extent.width = demo->width;
scissor.extent.height = demo->height;
&clear_color, 1, &clear_range);
clear_range.aspect = VK_IMAGE_ASPECT_DEPTH;
- vkCmdClearDepthStencil(demo->draw_cmd,
+ vkCmdClearDepthStencilImage(demo->draw_cmd,
demo->depth.image, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
clear_depth, 0, 1, &clear_range);
viewport.minDepth = (float) 0.0f;
viewport.maxDepth = (float) 1.0f;
viewport_create.pViewports = &viewport;
- VkRect scissor;
+ VkRect2D scissor;
memset(&scissor, 0, sizeof(scissor));
scissor.extent.width = demo->width;
scissor.extent.height = demo->height;
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
PFN_vkCmdFillBuffer CmdFillBuffer;
PFN_vkCmdClearColorImage CmdClearColorImage;
- PFN_vkCmdClearDepthStencil CmdClearDepthStencil;
+ PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
+ PFN_vkCmdClearColorAttachment CmdClearColorAttachment;
+ PFN_vkCmdClearDepthStencilAttachment CmdClearDepthStencilAttachment;
PFN_vkCmdResolveImage CmdResolveImage;
PFN_vkCmdSetEvent CmdSetEvent;
PFN_vkCmdResetEvent CmdResetEvent;
typedef VkFlags VkPipelineStageFlags;
+// Image aspect flags
+typedef VkFlags VkImageAspectFlags;
+typedef enum VkImageAspectFlagBits_
+{
+ VK_IMAGE_ASPECT_COLOR_BIT = VK_BIT(0),
+ VK_IMAGE_ASPECT_DEPTH_BIT = VK_BIT(1),
+ VK_IMAGE_ASPECT_STENCIL_BIT = VK_BIT(2),
+} VkImageAspectFlagBits;
+
// Query control flags
typedef VkFlags VkQueryControlFlags;
typedef enum VkQueryControlFlagBits_
float maxDepth;
} VkViewport;
-typedef struct VkRect_
+typedef struct VkRect2D_
{
VkOffset2D offset;
VkExtent2D extent;
-} VkRect;
+} VkRect2D;
+
+typedef struct VkRect3D_
+{
+ VkOffset3D offset;
+ VkExtent3D extent;
+} VkRect3D;
typedef struct VkChannelMapping_
{
const void* pNext; // Pointer to next structure
uint32_t viewportAndScissorCount; // number of entries in pViewports and pScissors
const VkViewport* pViewports;
- const VkRect* pScissors;
+ const VkRect2D* pScissors;
} VkDynamicVpStateCreateInfo;
typedef struct VkDynamicRsStateCreateInfo_
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
const void* pNext; // Pointer to next structure
- VkRect renderArea;
+ VkRect2D renderArea;
uint32_t colorAttachmentCount;
VkExtent2D extent;
uint32_t sampleCount;
typedef void (VKAPI *PFN_vkCmdUpdateBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData);
typedef void (VKAPI *PFN_vkCmdFillBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data);
typedef void (VKAPI *PFN_vkCmdClearColorImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
-typedef void (VKAPI *PFN_vkCmdClearDepthStencil)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI *PFN_vkCmdClearDepthStencilImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI *PFN_vkCmdClearColorAttachment)(VkCmdBuffer cmdBuffer, uint32_t colorAttachment, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rectCount, const VkRect3D* pRects);
+typedef void (VKAPI *PFN_vkCmdClearDepthStencilAttachment)(VkCmdBuffer cmdBuffer, VkImageAspectFlags imageAspectMask, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rectCount, const VkRect3D* pRects);
typedef void (VKAPI *PFN_vkCmdResolveImage)(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
typedef void (VKAPI *PFN_vkCmdSetEvent)(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask);
typedef void (VKAPI *PFN_vkCmdResetEvent)(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask);
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges);
-void VKAPI vkCmdClearDepthStencil(
+void VKAPI vkCmdClearDepthStencilImage(
VkCmdBuffer cmdBuffer,
VkImage image,
VkImageLayout imageLayout,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges);
+void VKAPI vkCmdClearColorAttachment(
+ VkCmdBuffer cmdBuffer,
+ uint32_t colorAttachment,
+ VkImageLayout imageLayout,
+ const VkClearColor* pColor,
+ uint32_t rectCount,
+ const VkRect3D* pRects);
+
+void VKAPI vkCmdClearDepthStencilAttachment(
+ VkCmdBuffer cmdBuffer,
+ VkImageAspectFlags imageAspectMask,
+ VkImageLayout imageLayout,
+ float depth,
+ uint32_t stencil,
+ uint32_t rectCount,
+ const VkRect3D* pRects);
+
void VKAPI vkCmdResolveImage(
VkCmdBuffer cmdBuffer,
VkImage srcImage,
case VK_STRUCTURE_TYPE_DYNAMIC_VP_STATE_CREATE_INFO:
memcpy(&pStateNode->create_info, pCreateInfo, sizeof(VkDynamicVpStateCreateInfo));
pVPCI = (VkDynamicVpStateCreateInfo*)pCreateInfo;
- pStateNode->create_info.vpci.pScissors = new VkRect[pStateNode->create_info.vpci.viewportAndScissorCount];
+ pStateNode->create_info.vpci.pScissors = new VkRect2D[pStateNode->create_info.vpci.viewportAndScissorCount];
pStateNode->create_info.vpci.pViewports = new VkViewport[pStateNode->create_info.vpci.viewportAndScissorCount];
- scSize = pVPCI->viewportAndScissorCount * sizeof(VkRect);
+ scSize = pVPCI->viewportAndScissorCount * sizeof(VkRect2D);
vpSize = pVPCI->viewportAndScissorCount * sizeof(VkViewport);
memcpy((void*)pStateNode->create_info.vpci.pScissors, pVPCI->pScissors, scSize);
memcpy((void*)pStateNode->create_info.vpci.pViewports, pVPCI->pViewports, vpSize);
}
}
-VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer,
+VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencilImage(VkCmdBuffer cmdBuffer,
VkImage image, VkImageLayout imageLayout,
float depth, uint32_t stencil,
uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
if (pCB->state == CB_UPDATE_ACTIVE) {
updateCBTracking(cmdBuffer);
addCmd(pCB, CMD_CLEARDEPTHSTENCIL);
- get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
+ get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdClearDepthStencilImage(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
} else {
report_error_no_cb_begin(cmdBuffer, "vkCmdBindIndexBuffer()");
}
return (void*) vkCmdFillBuffer;
if (!strcmp(funcName, "vkCmdClearColorImage"))
return (void*) vkCmdClearColorImage;
- if (!strcmp(funcName, "vkCmdClearDepthStencil"))
- return (void*) vkCmdClearDepthStencil;
+ if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
+ return (void*) vkCmdClearDepthStencilImage;
if (!strcmp(funcName, "vkCmdResolveImage"))
return (void*) vkCmdResolveImage;
if (!strcmp(funcName, "vkCmdSetEvent"))
get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
}
-VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(
+VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencilImage(
VkCmdBuffer cmdBuffer,
VkImage image,
VkImageLayout imageLayout,
VkDeviceMemory mem = get_mem_binding_from_object(cmdBuffer, image);
if (VK_FALSE == update_cmd_buf_and_mem_references(cmdBuffer, mem)) {
log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM",
- "In vkCmdClearDepthStencil() call unable to update binding of image buffer %p to cmdBuffer %p", image, cmdBuffer);
+ "In vkCmdClearDepthStencilImage() call unable to update binding of image buffer %p to cmdBuffer %p", image, cmdBuffer);
}
loader_platform_thread_unlock_mutex(&globalLock);
- get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdClearDepthStencil(
+ get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdClearDepthStencilImage(
cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
}
return (void*) vkCmdFillBuffer;
if (!strcmp(funcName, "vkCmdClearColorImage"))
return (void*) vkCmdClearColorImage;
- if (!strcmp(funcName, "vkCmdClearDepthStencil"))
- return (void*) vkCmdClearDepthStencil;
+ if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
+ return (void*) vkCmdClearDepthStencilImage;
if (!strcmp(funcName, "vkCmdResolveImage"))
return (void*) vkCmdResolveImage;
if (!strcmp(funcName, "vkCmdBeginQuery"))
PostCmdClearColorImage(cmdBuffer, image, imageLayout, rangeCount);
}
-void PreCmdClearDepthStencil(
+void PreCmdClearDepthStencilImage(
VkCmdBuffer cmdBuffer,
const VkImageSubresourceRange* pRanges)
{
}
}
-void PostCmdClearDepthStencil(
+void PostCmdClearDepthStencilImage(
VkCmdBuffer cmdBuffer,
VkImage image,
VkImageLayout imageLayout,
}
-VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(
+VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencilImage(
VkCmdBuffer cmdBuffer,
VkImage image,
VkImageLayout imageLayout,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
- PreCmdClearDepthStencil(cmdBuffer, pRanges);
- get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
+ PreCmdClearDepthStencilImage(cmdBuffer, pRanges);
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdClearDepthStencilImage(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
- PostCmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount);
+ PostCmdClearDepthStencilImage(cmdBuffer, image, imageLayout, depth, stencil, rangeCount);
}
void PreCmdResolveImage(
"vkCmdResetQueryPool parameter, VkQueryPool queryPool, is null pointer");
return;
}
-
-
}
VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(
return (void*) vkCmdFillBuffer;
if (!strcmp(funcName, "vkCmdClearColorImage"))
return (void*) vkCmdClearColorImage;
- if (!strcmp(funcName, "vkCmdClearDepthStencil"))
- return (void*) vkCmdClearDepthStencil;
+ if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
+ return (void*) vkCmdClearDepthStencilImage;
if (!strcmp(funcName, "vkCmdResolveImage"))
return (void*) vkCmdResolveImage;
if (!strcmp(funcName, "vkCmdSetEvent"))
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"))
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");
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"))
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)
Param("uint32_t", "rangeCount"),
Param("const VkImageSubresourceRange*", "pRanges")]),
- Proto("void", "CmdClearDepthStencil",
+ Proto("void", "CmdClearDepthStencilImage",
[Param("VkCmdBuffer", "cmdBuffer"),
Param("VkImage", "image"),
Param("VkImageLayout", "imageLayout"),
Param("uint32_t", "rangeCount"),
Param("const VkImageSubresourceRange*", "pRanges")]),
+ Proto("void", "CmdClearColorAttachment",
+ [Param("VkCmdBuffer", "cmdBuffer"),
+ Param("uint32_t", "colorAttachment"),
+ Param("VkImageLayout", "imageLayout"),
+ Param("const VkClearColor*", "pColor"),
+ Param("uint32_t", "rectCount"),
+ Param("const VkRect3D*", "pRects")]),
+
+ Proto("void", "CmdClearDepthStencilAttachment",
+ [Param("VkCmdBuffer", "cmdBuffer"),
+ Param("VkImageAspectFlags", "imageAspectMask"),
+ Param("VkImageLayout", "imageLayout"),
+ Param("float", "depth"),
+ Param("uint32_t", "stencil"),
+ Param("uint32_t", "rectCount"),
+ Param("const VkRect3D*", "pRects")]),
+
Proto("void", "CmdResolveImage",
[Param("VkCmdBuffer", "cmdBuffer"),
Param("VkImage", "srcImage"),