Add support for LunarG Vulkan Loader ICD API.

Return Loader-compatible structure for dispatchable Vulkan objects.
Add Vulkan-LoaderAndValidationLayers repository as submodule.
This commit is contained in:
Bill Hollings 2017-12-21 10:48:51 -05:00
parent 150b06a189
commit 83f96078ec
42 changed files with 456 additions and 279 deletions

3
.gitmodules vendored
View File

@ -16,3 +16,6 @@
[submodule "External/SPIRV-Cross"]
path = External/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross.git
[submodule "External/Vulkan-LoaderAndValidationLayers"]
path = External/Vulkan-LoaderAndValidationLayers
url = https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers

@ -0,0 +1 @@
Subproject commit 62d8e875b9f3c663dc6448c0db6f599df18711c2

View File

@ -16,3 +16,4 @@
./getLatestSPIRVTools
./getLatestglslang
./getLatestSPIRVCross
./getLatestVulkanLVL

10
External/getLatestVulkanLVL vendored Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#
# Copyright (c) 2016-2017 The Brenwill Workshop Ltd.
#
# getLatestVulkanLVL - Updates to the latest version of Vulkan-LoaderAndValidationLayers submodule.
#
# macOS usage: ./getLatestVulkanLVL
rm -rf Vulkan-LoaderAndValidationLayers
git clone https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers.git

View File

@ -683,7 +683,7 @@
A9F55D25198BE6A7004EC31B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = "The Brenwill Workshop Ltd.";
TargetAttributes = {
A9B8EE091A98D796009C5A02 = {
@ -973,6 +973,7 @@
GENERATE_MASTER_OBJECT_FILE = YES;
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/include\"",
"\"$(SRCROOT)/../External/Vulkan-LoaderAndValidationLayers/include\"",
"\"$(SRCROOT)/../MoltenVKShaderConverter\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1030,6 +1031,7 @@
GENERATE_MASTER_OBJECT_FILE = YES;
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/include\"",
"\"$(SRCROOT)/../External/Vulkan-LoaderAndValidationLayers/include\"",
"\"$(SRCROOT)/../MoltenVKShaderConverter\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -68,8 +68,8 @@ protected:
#pragma mark Command creation functions
/** Adds a compute threadgroup dispatch command to the specified command buffer. */
void mvkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z);
void mvkCmdDispatch(MVKCommandBuffer* cmdBuff, uint32_t x, uint32_t y, uint32_t z);
/** Adds an indirect compute threadgroup dispatch command to the specified command buffer. */
void mvkCmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset);
void mvkCmdDispatchIndirect(MVKCommandBuffer* cmdBuff, VkBuffer buffer, VkDeviceSize offset);

View File

@ -73,15 +73,13 @@ MVKCmdDispatchIndirect::MVKCmdDispatchIndirect(MVKCommandTypePool<MVKCmdDispatch
#pragma mark -
#pragma mark Command creation functions
void mvkCmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
void mvkCmdDispatch(MVKCommandBuffer* cmdBuff, uint32_t x, uint32_t y, uint32_t z) {
MVKCmdDispatch* cmd = cmdBuff->_commandPool->_cmdDispatchPool.acquireObject();
cmd->setContent(x, y, z);
cmdBuff->addCommand(cmd);
}
void mvkCmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
void mvkCmdDispatchIndirect(MVKCommandBuffer* cmdBuff, VkBuffer buffer, VkDeviceSize offset) {
MVKCmdDispatchIndirect* cmd = cmdBuff->_commandPool->_cmdDispatchIndirectPool.acquireObject();
cmd->setContent(buffer, offset);
cmdBuff->addCommand(cmd);

View File

@ -168,27 +168,27 @@ protected:
#pragma mark Command creation functions
/** Adds a vertex bind command to the specified command buffer. */
void mvkCmdBindVertexBuffers(VkCommandBuffer cmdBuffer,
void mvkCmdBindVertexBuffers(MVKCommandBuffer* cmdBuff,
uint32_t startBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets);
/** Adds a bind index buffer command to the specified command buffer. */
void mvkCmdBindIndexBuffer(VkCommandBuffer cmdBuffer,
void mvkCmdBindIndexBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType);
/** Adds a vertex draw command to the specified command buffer. */
void mvkCmdDraw(VkCommandBuffer cmdBuffer,
void mvkCmdDraw(MVKCommandBuffer* cmdBuff,
uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance);
/** Adds an indexed draw command to the specified command buffer. */
void mvkCmdDrawIndexed(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndexed(MVKCommandBuffer* cmdBuff,
uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
@ -196,14 +196,14 @@ void mvkCmdDrawIndexed(VkCommandBuffer cmdBuffer,
uint32_t firstInstance);
/** Adds an indirect draw command to the specified command buffer. */
void mvkCmdDrawIndirect(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndirect(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t count,
uint32_t stride);
/** Adds an indirect indexed draw command to the specified command buffer. */
void mvkCmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndexedIndirect(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t count,

View File

@ -251,67 +251,61 @@ MVKCmdDrawIndexedIndirect::MVKCmdDrawIndexedIndirect(MVKCommandTypePool<MVKCmdDr
#pragma mark -
#pragma mark Command creation functions
void mvkCmdBindVertexBuffers(VkCommandBuffer cmdBuffer,
void mvkCmdBindVertexBuffers(MVKCommandBuffer* cmdBuff,
uint32_t startBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdBindVertexBuffers* cmd = cmdBuff->_commandPool->_cmdBindVertexBuffersPool.acquireObject();
cmd->setContent(startBinding, bindingCount, pBuffers, pOffsets);
cmdBuff->addCommand(cmd);
}
void mvkCmdDraw(VkCommandBuffer cmdBuffer,
void mvkCmdDraw(MVKCommandBuffer* cmdBuff,
uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdDraw* cmd = cmdBuff->_commandPool->_cmdDrawPool.acquireObject();
cmd->setContent(vertexCount, instanceCount, firstVertex, firstInstance);
cmdBuff->addCommand(cmd);
}
void mvkCmdDrawIndexed(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndexed(MVKCommandBuffer* cmdBuff,
uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
int32_t vertexOffset,
uint32_t firstInstance) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdDrawIndexed* cmd = cmdBuff->_commandPool->_cmdDrawIndexedPool.acquireObject();
cmd->setContent(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
cmdBuff->addCommand(cmd);
}
void mvkCmdBindIndexBuffer(VkCommandBuffer cmdBuffer,
void mvkCmdBindIndexBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdBindIndexBuffer* cmd = cmdBuff->_commandPool->_cmdBindIndexBufferPool.acquireObject();
cmd->setContent(buffer, offset, indexType);
cmdBuff->addCommand(cmd);
}
void mvkCmdDrawIndirect(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndirect(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t count,
uint32_t stride) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdDrawIndirect* cmd = cmdBuff->_commandPool->_cmdDrawIndirectPool.acquireObject();
cmd->setContent(buffer, offset, count, stride);
cmdBuff->addCommand(cmd);
}
void mvkCmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer,
void mvkCmdDrawIndexedIndirect(MVKCommandBuffer* cmdBuff,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t count,
uint32_t stride) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdDrawIndexedIndirect* cmd = cmdBuff->_commandPool->_cmdDrawIndexedIndirectPool.acquireObject();
cmd->setContent(buffer, offset, count, stride);
cmdBuff->addCommand(cmd);

View File

@ -135,7 +135,7 @@ private:
#pragma mark Command creation functions
/** Adds commands to the specified command buffer that insert the specified pipeline barriers. */
void mvkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
void mvkCmdPipelineBarrier(MVKCommandBuffer* cmdBuff,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
VkDependencyFlags dependencyFlags,
@ -147,12 +147,12 @@ void mvkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
const VkImageMemoryBarrier* pImageMemoryBarriers);
/** Adds a command to the specified command buffer that binds the specified pipeline. */
void mvkCmdBindPipeline(VkCommandBuffer cmdBuffer,
void mvkCmdBindPipeline(MVKCommandBuffer* cmdBuff,
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline);
/** Adds commands to the specified command buffer that insert the specified descriptor sets. */
void mvkCmdBindDescriptorSets(VkCommandBuffer cmdBuffer,
void mvkCmdBindDescriptorSets(MVKCommandBuffer* cmdBuff,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t firstSet,
@ -162,7 +162,7 @@ void mvkCmdBindDescriptorSets(VkCommandBuffer cmdBuffer,
const uint32_t* pDynamicOffsets);
/** Adds a vertex bind command to the specified command buffer. */
void mvkCmdPushConstants(VkCommandBuffer cmdBuffer,
void mvkCmdPushConstants(MVKCommandBuffer* cmdBuff,
VkPipelineLayout layout,
VkShaderStageFlags stageFlags,
uint32_t offset,

View File

@ -183,7 +183,7 @@ MVKCmdPushConstants::MVKCmdPushConstants(MVKCommandTypePool<MVKCmdPushConstants>
#pragma mark -
#pragma mark Command creation functions
void mvkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
void mvkCmdPipelineBarrier(MVKCommandBuffer* cmdBuff,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
VkDependencyFlags dependencyFlags,
@ -193,8 +193,6 @@ void mvkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdPipelineBarrier* cmd = cmdBuff->_commandPool->_cmdPipelineBarrierPool.acquireObject();
cmd->setContent(srcStageMask, dstStageMask, dependencyFlags,
memoryBarrierCount, pMemoryBarriers,
@ -203,17 +201,15 @@ void mvkCmdPipelineBarrier(VkCommandBuffer commandBuffer,
cmdBuff->addCommand(cmd);
}
void mvkCmdBindPipeline(VkCommandBuffer cmdBuffer,
void mvkCmdBindPipeline(MVKCommandBuffer* cmdBuff,
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdBindPipeline* cmd = cmdBuff->_commandPool->_cmdBindPipelinePool.acquireObject();
cmd->setContent(pipelineBindPoint, pipeline);
cmdBuff->addCommand(cmd);
}
void mvkCmdBindDescriptorSets(VkCommandBuffer cmdBuffer,
void mvkCmdBindDescriptorSets(MVKCommandBuffer* cmdBuff,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t firstSet,
@ -221,20 +217,17 @@ void mvkCmdBindDescriptorSets(VkCommandBuffer cmdBuffer,
const VkDescriptorSet* pDescriptorSets,
uint32_t dynamicOffsetCount,
const uint32_t* pDynamicOffsets) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdBindDescriptorSets* cmd = cmdBuff->_commandPool->_cmdBindDescriptorSetsPool.acquireObject();
cmd->setContent(pipelineBindPoint, layout, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
cmdBuff->addCommand(cmd);
}
void mvkCmdPushConstants(VkCommandBuffer cmdBuffer,
void mvkCmdPushConstants(MVKCommandBuffer* cmdBuff,
VkPipelineLayout layout,
VkShaderStageFlags stageFlags,
uint32_t offset,
uint32_t size,
const void* pValues) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)cmdBuffer;
MVKCmdPushConstants* cmd = cmdBuff->_commandPool->_cmdPushConstantsPool.acquireObject();
cmd->setContent(layout, stageFlags, offset, size, pValues);
cmdBuff->addCommand(cmd);

View File

@ -143,30 +143,30 @@ protected:
#pragma mark Command creation functions
/** Adds a begin query command to the specified command buffer. */
void mvkCmdBeginQuery(VkCommandBuffer commandBuffer,
void mvkCmdBeginQuery(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t query,
VkQueryControlFlags flags);
/** Adds an end query command to the specified command buffer. */
void mvkCmdEndQuery(VkCommandBuffer commandBuffer,
void mvkCmdEndQuery(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t query);
/** Adds a write timestamp command to the specified command buffer. */
void mvkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
void mvkCmdWriteTimestamp(MVKCommandBuffer* cmdBuff,
VkPipelineStageFlagBits pipelineStage,
VkQueryPool queryPool,
uint32_t query);
/** Adds a reset query pool command to the specified command buffer. */
void mvkCmdResetQueryPool(VkCommandBuffer commandBuffer,
void mvkCmdResetQueryPool(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount);
/** Adds a copy query pool results command to the specified command buffer. */
void mvkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,
void mvkCmdCopyQueryPoolResults(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount,

View File

@ -130,46 +130,42 @@ MVKCmdCopyQueryPoolResults::MVKCmdCopyQueryPoolResults(MVKCommandTypePool<MVKCmd
#pragma mark -
#pragma mark Command creation functions
void mvkCmdBeginQuery(VkCommandBuffer commandBuffer,
void mvkCmdBeginQuery(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t query,
VkQueryControlFlags flags) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdBeginQuery* cmd = cmdBuff->_commandPool->_cmdBeginQueryPool.acquireObject();
cmd->setContent(queryPool, query, flags);
cmdBuff->addCommand(cmd);
}
void mvkCmdEndQuery(VkCommandBuffer commandBuffer,
void mvkCmdEndQuery(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t query) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdEndQuery* cmd = cmdBuff->_commandPool->_cmdEndQueryPool.acquireObject();
cmd->setContent(queryPool, query);
cmdBuff->addCommand(cmd);
}
void mvkCmdWriteTimestamp(VkCommandBuffer commandBuffer,
void mvkCmdWriteTimestamp(MVKCommandBuffer* cmdBuff,
VkPipelineStageFlagBits pipelineStage,
VkQueryPool queryPool,
uint32_t query) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdWriteTimestamp* cmd = cmdBuff->_commandPool->_cmdWriteTimestampPool.acquireObject();
cmd->setContent(pipelineStage, queryPool, query);
cmdBuff->addCommand(cmd);
}
void mvkCmdResetQueryPool(VkCommandBuffer commandBuffer,
void mvkCmdResetQueryPool(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdResetQueryPool* cmd = cmdBuff->_commandPool->_cmdResetQueryPoolPool.acquireObject();
cmd->setContent(queryPool, firstQuery, queryCount);
cmdBuff->addCommand(cmd);
}
void mvkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,
void mvkCmdCopyQueryPoolResults(MVKCommandBuffer* cmdBuff,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount,
@ -177,7 +173,6 @@ void mvkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,
VkDeviceSize destOffset,
VkDeviceSize destStride,
VkQueryResultFlags flags) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdCopyQueryPoolResults* cmd = cmdBuff->_commandPool->_cmdCopyQueryPoolResultsPool.acquireObject();
cmd->setContent(queryPool, firstQuery, queryCount, destBuffer, destOffset, destStride, flags);
cmdBuff->addCommand(cmd);

View File

@ -89,7 +89,7 @@ public:
class MVKCmdExecuteCommands : public MVKCommand {
public:
void setContent(uint32_t commandBuffersCount, const VkCommandBuffer* pCmdBuffers);
void setContent(uint32_t commandBuffersCount, const VkCommandBuffer* pCommandBuffers);
void encode(MVKCommandEncoder* cmdEncoder) override;
@ -278,63 +278,63 @@ private:
#pragma mark Command creation functions
/** Adds a begin render pass command to the specified command buffer. */
void mvkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
void mvkCmdBeginRenderPass(MVKCommandBuffer* cmdBuff,
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents);
/** Adds a next render pass command to the specified command buffer. */
void mvkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents);
void mvkCmdNextSubpass(MVKCommandBuffer* cmdBuff, VkSubpassContents contents);
/** Adds an end render pass command to the specified command buffer. */
void mvkCmdEndRenderPass(VkCommandBuffer commandBuffer);
void mvkCmdEndRenderPass(MVKCommandBuffer* cmdBuff);
/** Adds an execute commands command to the specified command buffer. */
void mvkCmdExecuteCommands(VkCommandBuffer commandBuffer,
uint32_t cmdBuffersCount,
const VkCommandBuffer* pCmdBuffers);
void mvkCmdExecuteCommands(MVKCommandBuffer* cmdBuff,
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers);
/** Adds a set viewport command to the specified command buffer. */
void mvkCmdSetViewport(VkCommandBuffer commandBuffer,
void mvkCmdSetViewport(MVKCommandBuffer* cmdBuff,
uint32_t firstViewport,
uint32_t viewportCount,
const VkViewport* pViewports);
/** Adds a set scissor command to the specified command buffer. */
void mvkCmdSetScissor(VkCommandBuffer commandBuffer,
void mvkCmdSetScissor(MVKCommandBuffer* cmdBuff,
uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D* pScissors);
/** Adds a set line width command to the specified command buffer. */
void mvkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth);
void mvkCmdSetLineWidth(MVKCommandBuffer* cmdBuff, float lineWidth);
/** Adds a set depth bias command to the specified command buffer. */
void mvkCmdSetDepthBias(VkCommandBuffer commandBuffer,
void mvkCmdSetDepthBias(MVKCommandBuffer* cmdBuff,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor);
/** Adds a set blend constants command to the specified command buffer. */
void mvkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
void mvkCmdSetBlendConstants(MVKCommandBuffer* cmdBuff,
const float blendConst[4]);
/** Adds a set depth bounds command to the specified command buffer. */
void mvkCmdSetDepthBounds(VkCommandBuffer commandBuffer,
void mvkCmdSetDepthBounds(MVKCommandBuffer* cmdBuff,
float minDepthBounds,
float maxDepthBounds);
/** Adds a set stencil compare mask command to the specified command buffer. */
void mvkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilCompareMask(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilCompareMask);
/** Adds a set stencil write mask command to the specified command buffer. */
void mvkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilWriteMask(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilWriteMask);
/** Adds a set stencil reference value command to the specified command buffer. */
void mvkCmdSetStencilReference(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilReference(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilReference);

View File

@ -83,12 +83,12 @@ MVKCmdEndRenderPass::MVKCmdEndRenderPass(MVKCommandTypePool<MVKCmdEndRenderPass>
#pragma mark MVKCmdExecuteCommands
void MVKCmdExecuteCommands::setContent(uint32_t commandBuffersCount,
const VkCommandBuffer* pCmdBuffers) {
const VkCommandBuffer* pCommandBuffers) {
// Add clear values
_secondaryCommandBuffers.clear(); // Clear for reuse
_secondaryCommandBuffers.reserve(commandBuffersCount);
for (uint32_t i = 0; i < commandBuffersCount; i++) {
_secondaryCommandBuffers.push_back((MVKCommandBuffer*)pCmdBuffers[i]);
for (uint32_t cbIdx = 0; cbIdx < commandBuffersCount; cbIdx++) {
_secondaryCommandBuffers.push_back(MVKCommandBuffer::getMVKCommandBuffer(pCommandBuffers[cbIdx]));
}
}
@ -272,118 +272,104 @@ MVKCmdSetStencilReference::MVKCmdSetStencilReference(MVKCommandTypePool<MVKCmdSe
#pragma mark -
#pragma mark Command creation functions
void mvkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
void mvkCmdBeginRenderPass(MVKCommandBuffer* cmdBuff,
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdBeginRenderPass* cmd = cmdBuff->_commandPool->_cmdBeginRenderPassPool.acquireObject();
cmd->setContent(pRenderPassBegin, contents);
cmdBuff->addCommand(cmd);
}
void mvkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
void mvkCmdNextSubpass(MVKCommandBuffer* cmdBuff, VkSubpassContents contents) {
MVKCmdNextSubpass* cmd = cmdBuff->_commandPool->_cmdNextSubpassPool.acquireObject();
cmd->setContent(contents);
cmdBuff->addCommand(cmd);
}
void mvkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
void mvkCmdEndRenderPass(MVKCommandBuffer* cmdBuff) {
MVKCmdEndRenderPass* cmd = cmdBuff->_commandPool->_cmdEndRenderPassPool.acquireObject();
cmdBuff->addCommand(cmd);
}
void mvkCmdExecuteCommands(VkCommandBuffer commandBuffer,
void mvkCmdExecuteCommands(MVKCommandBuffer* cmdBuff,
uint32_t commandBuffersCount,
const VkCommandBuffer* pCmdBuffers) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
const VkCommandBuffer* pCommandBuffers) {
MVKCmdExecuteCommands* cmd = cmdBuff->_commandPool->_cmdExecuteCommandsPool.acquireObject();
cmd->setContent(commandBuffersCount, pCmdBuffers);
cmd->setContent(commandBuffersCount, pCommandBuffers);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetViewport(VkCommandBuffer commandBuffer,
void mvkCmdSetViewport(MVKCommandBuffer* cmdBuff,
uint32_t firstViewport,
uint32_t viewportCount,
const VkViewport* pViewports) {
if (viewportCount == 0 || firstViewport > 0) { return; } // Nothing to set
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetViewport* cmd = cmdBuff->_commandPool->_cmdSetViewportPool.acquireObject();
cmd->setContent(firstViewport, viewportCount, pViewports);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetScissor(VkCommandBuffer commandBuffer,
void mvkCmdSetScissor(MVKCommandBuffer* cmdBuff,
uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D* pScissors) {
if (scissorCount == 0) { return; } // Nothing to set
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetScissor* cmd = cmdBuff->_commandPool->_cmdSetScissorPool.acquireObject();
cmd->setContent(firstScissor, scissorCount, pScissors);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
void mvkCmdSetLineWidth(MVKCommandBuffer* cmdBuff, float lineWidth) {
MVKCmdSetLineWidth* cmd = cmdBuff->_commandPool->_cmdSetLineWidthPool.acquireObject();
cmd->setContent(lineWidth);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetDepthBias(VkCommandBuffer commandBuffer,
void mvkCmdSetDepthBias(MVKCommandBuffer* cmdBuff,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetDepthBias* cmd = cmdBuff->_commandPool->_cmdSetDepthBiasPool.acquireObject();
cmd->setContent(depthBiasConstantFactor, depthBiasSlopeFactor, depthBiasClamp);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetBlendConstants(VkCommandBuffer commandBuffer,
void mvkCmdSetBlendConstants(MVKCommandBuffer* cmdBuff,
const float blendConst[4]) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetBlendConstants* cmd = cmdBuff->_commandPool->_cmdSetBlendConstantsPool.acquireObject();
cmd->setContent(blendConst);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetDepthBounds(VkCommandBuffer commandBuffer,
void mvkCmdSetDepthBounds(MVKCommandBuffer* cmdBuff,
float minDepthBounds,
float maxDepthBounds) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetDepthBounds* cmd = cmdBuff->_commandPool->_cmdSetDepthBoundsPool.acquireObject();
cmd->setContent(minDepthBounds, maxDepthBounds);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilCompareMask(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilCompareMask) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetStencilCompareMask* cmd = cmdBuff->_commandPool->_cmdSetStencilCompareMaskPool.acquireObject();
cmd->setContent(faceMask, stencilCompareMask);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilWriteMask(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilWriteMask) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetStencilWriteMask* cmd = cmdBuff->_commandPool->_cmdSetStencilWriteMaskPool.acquireObject();
cmd->setContent(faceMask, stencilWriteMask);
cmdBuff->addCommand(cmd);
}
void mvkCmdSetStencilReference(VkCommandBuffer commandBuffer,
void mvkCmdSetStencilReference(MVKCommandBuffer* cmdBuff,
VkStencilFaceFlags faceMask,
uint32_t stencilReference) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdSetStencilReference* cmd = cmdBuff->_commandPool->_cmdSetStencilReferencePool.acquireObject();
cmd->setContent(faceMask, stencilReference);
cmdBuff->addCommand(cmd);

View File

@ -336,7 +336,7 @@ protected:
#pragma mark Command creation functions
/** Adds a copy image command to the specified command buffer. */
void mvkCmdCopyImage(VkCommandBuffer commandBuffer,
void mvkCmdCopyImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
@ -345,7 +345,7 @@ void mvkCmdCopyImage(VkCommandBuffer commandBuffer,
const VkImageCopy* pRegions);
/** Adds a BLIT image command to the specified command buffer. */
void mvkCmdBlitImage(VkCommandBuffer commandBuffer,
void mvkCmdBlitImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
@ -355,7 +355,7 @@ void mvkCmdBlitImage(VkCommandBuffer commandBuffer,
VkFilter filter);
/** Adds a resolve image command to the specified command buffer. */
void mvkCmdResolveImage(VkCommandBuffer commandBuffer,
void mvkCmdResolveImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
@ -364,14 +364,14 @@ void mvkCmdResolveImage(VkCommandBuffer commandBuffer,
const VkImageResolve* pRegions);
/** Adds a copy buffer command to the specified command buffer. */
void mvkCmdCopyBuffer(VkCommandBuffer commandBuffer,
void mvkCmdCopyBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions);
/** Adds a copy buffer to image command to the specified command buffer. */
void mvkCmdCopyBufferToImage(VkCommandBuffer commandBuffer,
void mvkCmdCopyBufferToImage(MVKCommandBuffer* cmdBuff,
VkBuffer srcBuffer,
VkImage dstImage,
VkImageLayout dstImageLayout,
@ -379,7 +379,7 @@ void mvkCmdCopyBufferToImage(VkCommandBuffer commandBuffer,
const VkBufferImageCopy* pRegions);
/** Adds a copy buffer to image command to the specified command buffer. */
void mvkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer,
void mvkCmdCopyImageToBuffer(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkBuffer dstBuffer,
@ -387,14 +387,14 @@ void mvkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer,
const VkBufferImageCopy* pRegions);
/** Adds a clear attachments command to the specified command buffer. */
void mvkCmdClearAttachments(VkCommandBuffer commandBuffer,
void mvkCmdClearAttachments(MVKCommandBuffer* cmdBuff,
uint32_t attachmentCount,
const VkClearAttachment* pAttachments,
uint32_t rectCount,
const VkClearRect* pRects);
/** Adds a clear color image command to the specified command buffer. */
void mvkCmdClearImage(VkCommandBuffer commandBuffer,
void mvkCmdClearImage(MVKCommandBuffer* cmdBuff,
VkImage image,
VkImageLayout imageLayout,
const VkClearColorValue* pColor,
@ -402,7 +402,7 @@ void mvkCmdClearImage(VkCommandBuffer commandBuffer,
const VkImageSubresourceRange* pRanges);
/** Adds a clear depth stencil image command to the specified command buffer. */
void mvkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer,
void mvkCmdClearDepthStencilImage(MVKCommandBuffer* cmdBuff,
VkImage image,
VkImageLayout imageLayout,
const VkClearDepthStencilValue* pDepthStencil,
@ -410,14 +410,14 @@ void mvkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer,
const VkImageSubresourceRange* pRanges);
/** Adds a fill buffer command to the specified command buffer. */
void mvkCmdFillBuffer(VkCommandBuffer commandBuffer,
void mvkCmdFillBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize size,
uint32_t data);
/** Adds a buffer update command to the specified command buffer. */
void mvkCmdUpdateBuffer(VkCommandBuffer commandBuffer,
void mvkCmdUpdateBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize dataSize,

View File

@ -1044,20 +1044,19 @@ MVKCmdUpdateBuffer::MVKCmdUpdateBuffer(MVKCommandTypePool<MVKCmdUpdateBuffer>* p
#pragma mark -
#pragma mark Command creation functions
void mvkCmdCopyImage(VkCommandBuffer commandBuffer,
void mvkCmdCopyImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageCopy* pRegions) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdCopyImage* cmd = cmdBuff->_commandPool->_cmdCopyImagePool.acquireObject();
cmd->setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
cmdBuff->addCommand(cmd);
}
void mvkCmdBlitImage(VkCommandBuffer commandBuffer,
void mvkCmdBlitImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
@ -1065,78 +1064,71 @@ void mvkCmdBlitImage(VkCommandBuffer commandBuffer,
uint32_t regionCount,
const VkImageBlit* pRegions,
VkFilter filter) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdBlitImage* cmd = cmdBuff->_commandPool->_cmdBlitImagePool.acquireObject();
cmd->setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
cmdBuff->addCommand(cmd);
}
void mvkCmdResolveImage(VkCommandBuffer commandBuffer,
void mvkCmdResolveImage(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageResolve* pRegions) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdResolveImage* cmd = cmdBuff->_commandPool->_cmdResolveImagePool.acquireObject();
cmd->setContent(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
cmdBuff->addCommand(cmd);
}
void mvkCmdCopyBuffer(VkCommandBuffer commandBuffer,
void mvkCmdCopyBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdCopyBuffer* cmd = cmdBuff->_commandPool->_cmdCopyBufferPool.acquireObject();
cmd->setContent(srcBuffer, dstBuffer, regionCount, pRegions);
cmdBuff->addCommand(cmd);
}
void mvkCmdCopyBufferToImage(VkCommandBuffer commandBuffer,
void mvkCmdCopyBufferToImage(MVKCommandBuffer* cmdBuff,
VkBuffer srcBuffer,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkBufferImageCopy* pRegions) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdBufferImageCopy* cmd = cmdBuff->_commandPool->_cmdBufferImageCopyPool.acquireObject();
cmd->setContent(srcBuffer, dstImage, dstImageLayout, regionCount, pRegions, true);
cmdBuff->addCommand(cmd);
}
void mvkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer,
void mvkCmdCopyImageToBuffer(MVKCommandBuffer* cmdBuff,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferImageCopy* pRegions) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdBufferImageCopy* cmd = cmdBuff->_commandPool->_cmdBufferImageCopyPool.acquireObject();
cmd->setContent(dstBuffer, srcImage, srcImageLayout, regionCount, pRegions, false);
cmdBuff->addCommand(cmd);
}
void mvkCmdClearAttachments(VkCommandBuffer commandBuffer,
void mvkCmdClearAttachments(MVKCommandBuffer* cmdBuff,
uint32_t attachmentCount,
const VkClearAttachment* pAttachments,
uint32_t rectCount,
const VkClearRect* pRects) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdClearAttachments* cmd = cmdBuff->_commandPool->_cmdClearAttachmentsPool.acquireObject();
cmd->setContent(attachmentCount, pAttachments, rectCount, pRects);
cmdBuff->addCommand(cmd);
}
void mvkCmdClearImage(VkCommandBuffer commandBuffer,
void mvkCmdClearImage(MVKCommandBuffer* cmdBuff,
VkImage image,
VkImageLayout imageLayout,
const VkClearColorValue* pColor,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdClearImage* cmd = cmdBuff->_commandPool->_cmdClearImagePool.acquireObject();
VkClearValue clrVal;
clrVal.color = *pColor;
@ -1144,13 +1136,12 @@ void mvkCmdClearImage(VkCommandBuffer commandBuffer,
cmdBuff->addCommand(cmd);
}
void mvkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer,
void mvkCmdClearDepthStencilImage(MVKCommandBuffer* cmdBuff,
VkImage image,
VkImageLayout imageLayout,
const VkClearDepthStencilValue* pDepthStencil,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdClearImage* cmd = cmdBuff->_commandPool->_cmdClearImagePool.acquireObject();
VkClearValue clrVal;
clrVal.depthStencil = *pDepthStencil;
@ -1158,23 +1149,21 @@ void mvkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer,
cmdBuff->addCommand(cmd);
}
void mvkCmdFillBuffer(VkCommandBuffer commandBuffer,
void mvkCmdFillBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize size,
uint32_t data) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdFillBuffer* cmd = cmdBuff->_commandPool->_cmdFillBufferPool.acquireObject();
cmd->setContent(dstBuffer, dstOffset, size, data);
cmdBuff->addCommand(cmd);
}
void mvkCmdUpdateBuffer(VkCommandBuffer commandBuffer,
void mvkCmdUpdateBuffer(MVKCommandBuffer* cmdBuff,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize dataSize,
const void* pData) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCmdUpdateBuffer* cmd = cmdBuff->_commandPool->_cmdUpdateBufferPool.acquireObject();
cmd->setContent(dstBuffer, dstOffset, dataSize, pData, cmdBuff->getIsReusable());
cmdBuff->addCommand(cmd);

View File

@ -53,7 +53,7 @@ typedef struct {
#pragma mark MVKCommandBuffer
/** Represents a Vulkan command pool. */
class MVKCommandBuffer : public MVKBaseDeviceObject {
class MVKCommandBuffer : public MVKDispatchableDeviceObject {
public:
@ -127,6 +127,20 @@ public:
~MVKCommandBuffer() override;
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getMVKCommandBuffer() method.
*/
inline VkCommandBuffer getVkCommandBuffer() { return (VkCommandBuffer)getVkHandle(); }
/**
* Retrieves the MVKCommandBuffer instance referenced by the VkCommandBuffer handle.
* This is the compliment of the getVkCommandBuffer() method.
*/
static inline MVKCommandBuffer* getMVKCommandBuffer(VkCommandBuffer vkCommandBuffer) {
return (MVKCommandBuffer*)getDispatchableObject(vkCommandBuffer);
}
protected:
friend class MVKCommandEncoder;

View File

@ -124,7 +124,7 @@ bool MVKCommandBuffer::canExecute() {
#pragma mark Construction
MVKCommandBuffer::MVKCommandBuffer(MVKDevice* device,
const VkCommandBufferAllocateInfo* pAllocateInfo) : MVKBaseDeviceObject(device) {
const VkCommandBufferAllocateInfo* pAllocateInfo) : MVKDispatchableDeviceObject(device) {
_commandPool = (MVKCommandPool*)pAllocateInfo->commandPool;
_commandPool->addCommandBuffer(this);

View File

@ -49,7 +49,7 @@ VkResult MVKCommandPool::allocateCommandBuffers(const VkCommandBufferAllocateInf
uint32_t cbCnt = pAllocateInfo->commandBufferCount;
for (uint32_t cbIdx = 0; cbIdx < cbCnt; cbIdx++) {
MVKCommandBuffer* mvkCmdBuff = new MVKCommandBuffer(_device, pAllocateInfo);
pCmdBuffer[cbIdx] = (VkCommandBuffer)mvkCmdBuff;
pCmdBuffer[cbIdx] = mvkCmdBuff->getVkCommandBuffer();
if (rslt == VK_SUCCESS) { rslt = mvkCmdBuff->getConfigurationResult(); }
}
return rslt;
@ -58,7 +58,7 @@ VkResult MVKCommandPool::allocateCommandBuffers(const VkCommandBufferAllocateInf
void MVKCommandPool::freeCommandBuffers(uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers) {
for (uint32_t cbIdx = 0; cbIdx < commandBufferCount; cbIdx++) {
MVKCommandBuffer* mvkCmdBuff = (MVKCommandBuffer*)pCommandBuffers[cbIdx];
MVKCommandBuffer* mvkCmdBuff = MVKCommandBuffer::getMVKCommandBuffer(pCommandBuffers[cbIdx]);
delete mvkCmdBuff;
}
}

View File

@ -72,7 +72,7 @@ class MVKCommandResourceFactory;
#pragma mark MVKPhysicalDevice
/** Represents a Vulkan physical GPU device. */
class MVKPhysicalDevice : public MVKConfigurableObject {
class MVKPhysicalDevice : public MVKDispatchableObject {
public:
@ -207,6 +207,20 @@ public:
/** Default destructor. */
~MVKPhysicalDevice() override;
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getMVKPhysicalDevice() method.
*/
inline VkPhysicalDevice getVkPhysicalDevice() { return (VkPhysicalDevice)getVkHandle(); }
/**
* Retrieves the MVKPhysicalDevice instance referenced by the VkPhysicalDevice handle.
* This is the compliment of the getVkPhysicalDevice() method.
*/
static inline MVKPhysicalDevice* getMVKPhysicalDevice(VkPhysicalDevice vkPhysicalDevice) {
return (MVKPhysicalDevice*)getDispatchableObject(vkPhysicalDevice);
}
private:
friend class MVKDevice;
@ -236,7 +250,7 @@ private:
#pragma mark MVKDevice
/** Represents a Vulkan logical GPU device, associated with a physical device. */
class MVKDevice : public MVKConfigurableObject {
class MVKDevice : public MVKDispatchableObject {
public:
@ -470,6 +484,20 @@ public:
~MVKDevice() override;
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getMVKDevice() method.
*/
inline VkDevice getVkDevice() { return (VkDevice)getVkHandle(); }
/**
* Retrieves the MVKDevice instance referenced by the VkDevice handle.
* This is the compliment of the getVkDevice() method.
*/
static inline MVKDevice* getMVKDevice(VkDevice vkDevice) {
return (MVKDevice*)getDispatchableObject(vkDevice);
}
protected:
MVKResource* addResource(MVKResource* rez);
MVKResource* removeResource(MVKResource* rez);
@ -523,6 +551,28 @@ protected:
};
#pragma mark -
#pragma mark MVKDispatchableDeviceObject
/** Represents a dispatchable object that is spawned from a Vulkan device, and tracks that device. */
class MVKDispatchableDeviceObject : public MVKDispatchableObject {
public:
/** Returns the device for which this object was created. */
inline MVKDevice* getDevice() { return _device; }
/** Returns the underlying Metal device. */
inline id<MTLDevice> getMTLDevice() { return _device->getMTLDevice(); }
/** Constructs an instance for the specified device. */
MVKDispatchableDeviceObject(MVKDevice* device) : _device(device) {}
protected:
MVKDevice* _device;
};
#pragma mark -
#pragma mark Functions

View File

@ -932,7 +932,7 @@ PFN_vkVoidFunction MVKDevice::getProcAddr(const char* pName) {
}
VkResult MVKDevice::getDeviceQueue(uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
*pQueue = (VkQueue)_queueFamilies[queueFamilyIndex]->getQueue(queueIndex);
*pQueue = _queueFamilies[queueFamilyIndex]->getQueue(queueIndex)->getVkQueue();
return VK_SUCCESS;
}

View File

@ -31,7 +31,7 @@ class MVKPhysicalDevice;
#pragma mark MVKInstance
/** Represents a Vulkan instance. */
class MVKInstance : public MVKConfigurableObject {
class MVKInstance : public MVKDispatchableObject {
public:
@ -80,6 +80,20 @@ public:
~MVKInstance() override;
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getMVKInstance() method.
*/
inline VkInstance getVkInstance() { return (VkInstance)getVkHandle(); }
/**
* Retrieves the MVKInstance instance referenced by the VkInstance handle.
* This is the compliment of the getVkInstance() method.
*/
static inline MVKInstance* getMVKInstance(VkInstance vkInstance) {
return (MVKInstance*)getDispatchableObject(vkInstance);
}
protected:
void initProcAddrs();
void logVersions();

View File

@ -47,7 +47,7 @@ VkResult MVKInstance::getPhysicalDevices(uint32_t* pCount, VkPhysicalDevice* pPh
// Now populate the devices
for (uint32_t pdIdx = 0; pdIdx < *pCount; pdIdx++) {
pPhysicalDevices[pdIdx] = (VkPhysicalDevice)_physicalDevices[pdIdx];
pPhysicalDevices[pdIdx] = _physicalDevices[pdIdx]->getVkPhysicalDevice();
}
return result;

View File

@ -68,7 +68,7 @@ protected:
#pragma mark MVKQueue
/** Represents a Vulkan queue. */
class MVKQueue : public MVKBaseDeviceObject {
class MVKQueue : public MVKDispatchableDeviceObject {
public:
@ -126,6 +126,20 @@ public:
~MVKQueue() override;
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getMVKQueue() method.
*/
inline VkQueue getVkQueue() { return (VkQueue)getVkHandle(); }
/**
* Retrieves the MVKQueue instance referenced by the VkQueue handle.
* This is the compliment of the getVkQueue() method.
*/
static inline MVKQueue* getMVKQueue(VkQueue vkQueue) {
return (MVKQueue*)getDispatchableObject(vkQueue);
}
protected:
friend class MVKQueueSubmission;

View File

@ -192,7 +192,7 @@ void MVKQueue::mtlCommandBufferHasCompleted(id<MTLCommandBuffer> mtlCmdBuff,
#define MVK_DISPATCH_QUEUE_QOS_CLASS QOS_CLASS_USER_INITIATED
MVKQueue::MVKQueue(MVKDevice* device, MVKQueueFamily* queueFamily, uint32_t index, float priority)
: MVKBaseDeviceObject(device), _commandEncodingPool(device) {
: MVKDispatchableDeviceObject(device), _commandEncodingPool(device) {
_queueFamily = queueFamily;
_index = index;
@ -342,7 +342,7 @@ MVKQueueCommandBufferSubmission::MVKQueueCommandBufferSubmission(MVKDevice* devi
uint32_t cbCnt = pSubmit->commandBufferCount;
_cmdBuffers.reserve(cbCnt);
for (uint32_t i = 0; i < cbCnt; i++) {
MVKCommandBuffer* cb = (MVKCommandBuffer*)pSubmit->pCommandBuffers[i];
MVKCommandBuffer* cb = MVKCommandBuffer::getMVKCommandBuffer(pSubmit->pCommandBuffers[i]);
_cmdBuffers.push_back(cb);
recordResult(cb->getRecordingResult());
}

View File

@ -19,6 +19,7 @@
#pragma once
#include <vulkan/vulkan.h>
#include <vulkan/vk_icd.h>
#include <string>
@ -65,3 +66,36 @@ public:
protected:
VkResult _configurationResult = VK_SUCCESS;
};
#pragma mark -
#pragma mark MVKDispatchableObject
/** Abstract class that represents an object that can be used as a Vulkan API dispatchable object. */
class MVKDispatchableObject : public MVKConfigurableObject {
typedef struct {
VK_LOADER_DATA loaderData;
MVKDispatchableObject* mvkObject;
} MVKDispatchableObjectICDRef;
public:
/**
* Returns a reference to this object suitable for use as a Vulkan API handle.
* This is the compliment of the getDispatchableObject() method.
*/
inline void* getVkHandle() { return &_icdRef; }
/**
* Retrieves the MVKDispatchableObject instance referenced by the dispatchable Vulkan handle.
* This is the compliment of the getVkHandle() method.
*/
static inline MVKDispatchableObject* getDispatchableObject(void* vkHandle) {
return ((MVKDispatchableObjectICDRef*)vkHandle)->mvkObject;
}
protected:
MVKDispatchableObjectICDRef _icdRef = { ICD_LOADER_MAGIC, this };
};

View File

@ -30,7 +30,7 @@ MVK_PUBLIC_SYMBOL void vkGetMoltenVKDeviceConfigurationMVK(
VkDevice device,
MVKDeviceConfiguration* pConfiguration) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
if (pConfiguration) { *pConfiguration = mvkDev->_mvkConfig; }
}
@ -38,7 +38,7 @@ MVK_PUBLIC_SYMBOL VkResult vkSetMoltenVKDeviceConfigurationMVK(
VkDevice device,
MVKDeviceConfiguration* pConfiguration) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
if (pConfiguration) { *(MVKDeviceConfiguration*)&mvkDev->_mvkConfig = *pConfiguration; }
return VK_SUCCESS;
}
@ -47,7 +47,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceMetalFeaturesMVK(
VkPhysicalDevice physicalDevice,
MVKPhysicalDeviceMetalFeatures* pMetalFeatures) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getMetalFeatures(pMetalFeatures);
}
@ -64,7 +64,7 @@ MVK_PUBLIC_SYMBOL void vkGetShaderCompilationPerformanceMVK(
VkDevice device,
MVKShaderCompilationPerformance* pShaderCompPerf) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->getShaderCompilationPerformanceStatistics(pShaderCompPerf);
}
@ -99,7 +99,7 @@ MVK_PUBLIC_SYMBOL void vkGetMTLDeviceMVK(
VkPhysicalDevice physicalDevice,
id<MTLDevice>* pMTLDevice) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
*pMTLDevice = mvkPD->getMTLDevice();
}

View File

@ -52,7 +52,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateInstance(
VkInstance* pInstance) {
MVKInstance* mvkInst = new MVKInstance(pCreateInfo);
*pInstance = (VkInstance)(mvkInst);
*pInstance = mvkInst->getVkInstance();
return mvkInst->getConfigurationResult();
}
@ -60,7 +60,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyInstance(
VkInstance instance,
const VkAllocationCallbacks* pAllocator) {
MVKInstance* mvkInst = (MVKInstance*)instance;
MVKInstance* mvkInst = MVKInstance::getMVKInstance(instance);
delete mvkInst;
}
@ -69,7 +69,7 @@ MVK_PUBLIC_SYMBOL VkResult vkEnumeratePhysicalDevices(
uint32_t* pPhysicalDeviceCount,
VkPhysicalDevice* pPhysicalDevices) {
MVKInstance* mvkInst = (MVKInstance*)instance;
MVKInstance* mvkInst = MVKInstance::getMVKInstance(instance);
return mvkInst->getPhysicalDevices(pPhysicalDeviceCount, pPhysicalDevices);
}
@ -77,7 +77,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceFeatures(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures* pFeatures) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getFeatures(pFeatures);
}
@ -86,7 +86,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceFormatProperties(
VkFormat format,
VkFormatProperties* pFormatProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getFormatProperties(format, pFormatProperties);
}
@ -99,7 +99,7 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceImageFormatProperties(
VkImageCreateFlags flags,
VkImageFormatProperties* pImageFormatProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
return mvkPD->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties);
}
@ -107,7 +107,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getProperties(pProperties);
}
@ -116,7 +116,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceQueueFamilyProperties(
uint32_t* pCount,
VkQueueFamilyProperties* pQueueFamilyProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getQueueFamilyProperties(pCount, pQueueFamilyProperties);
}
@ -124,7 +124,7 @@ MVK_PUBLIC_SYMBOL void vkGetPhysicalDeviceMemoryProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
mvkPD->getPhysicalDeviceMemoryProperties(pMemoryProperties);
}
@ -138,7 +138,7 @@ MVK_PUBLIC_SYMBOL PFN_vkVoidFunction vkGetInstanceProcAddr(
if (strcmp(pName, "vkEnumerateInstanceExtensionProperties") == 0) { return (PFN_vkVoidFunction)vkEnumerateInstanceExtensionProperties; }
if (strcmp(pName, "vkEnumerateInstanceLayerProperties") == 0) { return (PFN_vkVoidFunction)vkEnumerateInstanceLayerProperties; }
MVKInstance* mvkInst = (MVKInstance*)instance;
MVKInstance* mvkInst = MVKInstance::getMVKInstance(instance);
return mvkInst->getProcAddr(pName);
}
@ -146,7 +146,7 @@ MVK_PUBLIC_SYMBOL PFN_vkVoidFunction vkGetDeviceProcAddr(
VkDevice device,
const char* pName) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
return mvkDev->getProcAddr(pName);
}
@ -156,9 +156,9 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateDevice(
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
MVKDevice* mvkDev = new MVKDevice(mvkPD, pCreateInfo);
*pDevice = (VkDevice)(mvkDev);
*pDevice = mvkDev->getVkDevice();
return VK_SUCCESS;
}
@ -166,7 +166,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyDevice(
VkDevice device,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
delete mvkDev;
}
@ -184,7 +184,7 @@ MVK_PUBLIC_SYMBOL VkResult vkEnumerateDeviceExtensionProperties(
uint32_t* pCount,
VkExtensionProperties* pProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
return mvkPD->getLayerManager()->getLayerNamed(pLayerName)->getExtensionProperties(pCount, pProperties);
}
@ -200,7 +200,7 @@ MVK_PUBLIC_SYMBOL VkResult vkEnumerateDeviceLayerProperties(
uint32_t* pCount,
VkLayerProperties* pProperties) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
return mvkPD->getLayerManager()->getLayerProperties(pCount, pProperties);
}
@ -210,7 +210,7 @@ MVK_PUBLIC_SYMBOL void vkGetDeviceQueue(
uint32_t queueIndex,
VkQueue* pQueue) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->getDeviceQueue(queueFamilyIndex, queueIndex, pQueue);
}
@ -220,21 +220,21 @@ MVK_PUBLIC_SYMBOL VkResult vkQueueSubmit(
const VkSubmitInfo* pSubmits,
VkFence fence) {
MVKQueue* mvkQ = (MVKQueue*)queue;
MVKQueue* mvkQ = MVKQueue::getMVKQueue(queue);
return mvkQ->submit(submitCount, pSubmits, fence, kMVKCommandUseQueueSubmit);
}
MVK_PUBLIC_SYMBOL VkResult vkQueueWaitIdle(
VkQueue queue) {
MVKQueue* mvkQ = (MVKQueue*)queue;
MVKQueue* mvkQ = MVKQueue::getMVKQueue(queue);
return mvkQ->waitIdle(kMVKCommandUseQueueWaitIdle);
}
MVK_PUBLIC_SYMBOL VkResult vkDeviceWaitIdle(
VkDevice device) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
return mvkDev->waitIdle();
}
@ -244,7 +244,7 @@ MVK_PUBLIC_SYMBOL VkResult vkAllocateMemory(
const VkAllocationCallbacks* pAllocator,
VkDeviceMemory* pMem) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKDeviceMemory* mvkMem = mvkDev->allocateMemory(pAllocateInfo, pAllocator);
VkResult rslt = mvkMem->getConfigurationResult();
*pMem = (VkDeviceMemory)((rslt == VK_SUCCESS) ? mvkMem : VK_NULL_HANDLE);
@ -256,7 +256,7 @@ MVK_PUBLIC_SYMBOL void vkFreeMemory(
VkDeviceMemory mem,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->freeMemory((MVKDeviceMemory*)mem, pAllocator);
}
@ -394,7 +394,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateFence(
const VkAllocationCallbacks* pAllocator,
VkFence* pFence) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKFence* mvkFence = mvkDev->createFence(pCreateInfo, pAllocator);
*pFence = (VkFence)mvkFence;
return mvkFence->getConfigurationResult();
@ -405,7 +405,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyFence(
VkFence fence,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyFence((MVKFence*)fence, pAllocator);
}
@ -441,7 +441,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateSemaphore(
const VkAllocationCallbacks* pAllocator,
VkSemaphore* pSemaphore) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKSemaphore* mvkSem4 = mvkDev->createSemaphore(pCreateInfo, pAllocator);
*pSemaphore = (VkSemaphore)mvkSem4;
return mvkSem4->getConfigurationResult();
@ -452,7 +452,7 @@ MVK_PUBLIC_SYMBOL void vkDestroySemaphore(
VkSemaphore semaphore,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroySemaphore((MVKSemaphore*)semaphore, pAllocator);
}
@ -500,7 +500,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateQueryPool(
const VkAllocationCallbacks* pAllocator,
VkQueryPool* pQueryPool) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKQueryPool* mvkQP = mvkDev->createQueryPool(pCreateInfo, pAllocator);
*pQueryPool = (VkQueryPool)mvkQP;
return mvkQP->getConfigurationResult();
@ -511,7 +511,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyQueryPool(
VkQueryPool queryPool,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyQueryPool((MVKQueryPool*)queryPool, pAllocator);
}
@ -535,7 +535,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateBuffer(
const VkAllocationCallbacks* pAllocator,
VkBuffer* pBuffer) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKBuffer* mvkBuff = mvkDev->createBuffer(pCreateInfo, pAllocator);
*pBuffer = (VkBuffer)mvkBuff;
return mvkBuff->getConfigurationResult();
@ -546,7 +546,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyBuffer(
VkBuffer buffer,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyBuffer((MVKBuffer*)buffer, pAllocator);
}
@ -556,7 +556,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateBufferView(
const VkAllocationCallbacks* pAllocator,
VkBufferView* pView) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKBufferView* mvkBuffView = mvkDev->createBufferView(pCreateInfo, pAllocator);
*pView = (VkBufferView)mvkBuffView;
return mvkBuffView->getConfigurationResult();
@ -567,7 +567,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyBufferView(
VkBufferView bufferView,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyBufferView((MVKBufferView*)bufferView, pAllocator);
}
@ -577,7 +577,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateImage(
const VkAllocationCallbacks* pAllocator,
VkImage* pImage) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKImage* mvkImg = mvkDev->createImage(pCreateInfo, pAllocator);
*pImage = (VkImage)mvkImg;
return mvkImg->getConfigurationResult();
@ -588,7 +588,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyImage(
VkImage image,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyImage((MVKImage*)image, pAllocator);
}
@ -608,7 +608,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateImageView(
const VkAllocationCallbacks* pAllocator,
VkImageView* pView) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKImageView* mvkImgView = mvkDev->createImageView(pCreateInfo, pAllocator);
*pView = (VkImageView)mvkImgView;
return mvkImgView->getConfigurationResult();
@ -619,7 +619,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyImageView(
VkImageView imageView,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyImageView((MVKImageView*)imageView, pAllocator);
}
@ -629,7 +629,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateShaderModule(
const VkAllocationCallbacks* pAllocator,
VkShaderModule* pShaderModule) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKShaderModule* mvkShdrMod = mvkDev->createShaderModule(pCreateInfo, pAllocator);
*pShaderModule = (VkShaderModule)mvkShdrMod;
return mvkShdrMod->getConfigurationResult();
@ -640,7 +640,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyShaderModule(
VkShaderModule shaderModule,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyShaderModule((MVKShaderModule*)shaderModule, pAllocator);
}
@ -650,7 +650,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreatePipelineCache(
const VkAllocationCallbacks* pAllocator,
VkPipelineCache* pPipelineCache) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKPipelineCache* mvkPLC = mvkDev->createPipelineCache(pCreateInfo, pAllocator);
*pPipelineCache = (VkPipelineCache)mvkPLC;
return mvkPLC->getConfigurationResult();
@ -661,7 +661,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyPipelineCache(
VkPipelineCache pipelineCache,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyPipelineCache((MVKPipelineCache*)pipelineCache, pAllocator);
}
@ -693,7 +693,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateGraphicsPipelines(
const VkAllocationCallbacks* pAllocator,
VkPipeline* pPipelines) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
return mvkDev->createPipelines<MVKGraphicsPipeline, VkGraphicsPipelineCreateInfo>(pipelineCache, count, pCreateInfos, pAllocator, pPipelines);
}
@ -705,7 +705,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateComputePipelines(
const VkAllocationCallbacks* pAllocator,
VkPipeline* pPipelines) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
return mvkDev->createPipelines<MVKComputePipeline, VkComputePipelineCreateInfo>(pipelineCache, count, pCreateInfos, pAllocator, pPipelines);
}
@ -714,7 +714,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyPipeline(
VkPipeline pipeline,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyPipeline((MVKPipeline*)pipeline, pAllocator);
}
@ -724,7 +724,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreatePipelineLayout(
const VkAllocationCallbacks* pAllocator,
VkPipelineLayout* pPipelineLayout) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKPipelineLayout* mvkPLL = mvkDev->createPipelineLayout(pCreateInfo, pAllocator);
*pPipelineLayout = (VkPipelineLayout)mvkPLL;
return mvkPLL->getConfigurationResult();
@ -735,7 +735,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyPipelineLayout(
VkPipelineLayout pipelineLayout,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyPipelineLayout((MVKPipelineLayout*)pipelineLayout, pAllocator);
}
@ -745,7 +745,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateSampler(
const VkAllocationCallbacks* pAllocator,
VkSampler* pSampler) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKSampler* mvkSamp = mvkDev->createSampler(pCreateInfo, pAllocator);
*pSampler = (VkSampler)mvkSamp;
return mvkSamp->getConfigurationResult();
@ -756,7 +756,7 @@ MVK_PUBLIC_SYMBOL void vkDestroySampler(
VkSampler sampler,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroySampler((MVKSampler*)sampler, pAllocator);
}
@ -766,7 +766,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateDescriptorSetLayout(
const VkAllocationCallbacks* pAllocator,
VkDescriptorSetLayout* pSetLayout) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKDescriptorSetLayout* mvkDSL = mvkDev->createDescriptorSetLayout(pCreateInfo, pAllocator);
*pSetLayout = (VkDescriptorSetLayout)mvkDSL;
return mvkDSL->getConfigurationResult();
@ -777,7 +777,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyDescriptorSetLayout(
VkDescriptorSetLayout descriptorSetLayout,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyDescriptorSetLayout((MVKDescriptorSetLayout*)descriptorSetLayout, pAllocator);
}
@ -787,7 +787,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateDescriptorPool(
const VkAllocationCallbacks* pAllocator,
VkDescriptorPool* pDescriptorPool) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKDescriptorPool* mvkDP = mvkDev->createDescriptorPool(pCreateInfo, pAllocator);
*pDescriptorPool = (VkDescriptorPool)mvkDP;
return mvkDP->getConfigurationResult();
@ -798,7 +798,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyDescriptorPool(
VkDescriptorPool descriptorPool,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyDescriptorPool((MVKDescriptorPool*)descriptorPool, pAllocator);
}
@ -848,7 +848,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateFramebuffer(
const VkAllocationCallbacks* pAllocator,
VkFramebuffer* pFramebuffer) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKFramebuffer* mvkFB = mvkDev->createFramebuffer(pCreateInfo, pAllocator);
*pFramebuffer = (VkFramebuffer)mvkFB;
return mvkFB->getConfigurationResult();
@ -859,7 +859,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyFramebuffer(
VkFramebuffer framebuffer,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyFramebuffer((MVKFramebuffer*)framebuffer, pAllocator);
}
@ -869,7 +869,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateRenderPass(
const VkAllocationCallbacks* pAllocator,
VkRenderPass* pRenderPass) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKRenderPass* mvkRendPass = mvkDev->createRenderPass(pCreateInfo, pAllocator);
*pRenderPass = (VkRenderPass)mvkRendPass;
return mvkRendPass->getConfigurationResult();
@ -880,7 +880,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyRenderPass(
VkRenderPass renderPass,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyRenderPass((MVKRenderPass*)renderPass, pAllocator);
}
@ -901,7 +901,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateCommandPool(
const VkAllocationCallbacks* pAllocator,
VkCommandPool* pCmdPool) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKCommandPool* mvkCmdPool = mvkDev->createCommandPool(pCreateInfo, pAllocator);
*pCmdPool = (VkCommandPool)mvkCmdPool;
return mvkCmdPool->getConfigurationResult();
@ -912,7 +912,7 @@ MVK_PUBLIC_SYMBOL void vkDestroyCommandPool(
VkCommandPool commandPool,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroyCommandPool((MVKCommandPool*)commandPool, pAllocator);
}
@ -948,14 +948,14 @@ MVK_PUBLIC_SYMBOL VkResult vkBeginCommandBuffer(
VkCommandBuffer commandBuffer,
const VkCommandBufferBeginInfo* pBeginInfo) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
return cmdBuff->begin(pBeginInfo);
}
MVK_PUBLIC_SYMBOL VkResult vkEndCommandBuffer(
VkCommandBuffer commandBuffer) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
return cmdBuff->end();
}
@ -963,7 +963,7 @@ MVK_PUBLIC_SYMBOL VkResult vkResetCommandBuffer(
VkCommandBuffer commandBuffer,
VkCommandBufferResetFlags flags) {
MVKCommandBuffer* cmdBuff = (MVKCommandBuffer*)commandBuffer;
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
return cmdBuff->reset(flags);
}
@ -972,7 +972,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBindPipeline(
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline) {
mvkCmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBindPipeline(cmdBuff, pipelineBindPoint, pipeline);
}
MVK_PUBLIC_SYMBOL void vkCmdSetViewport(
@ -981,7 +982,8 @@ MVK_PUBLIC_SYMBOL void vkCmdSetViewport(
uint32_t viewportCount,
const VkViewport* pViewports) {
mvkCmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetViewport(cmdBuff, firstViewport, viewportCount, pViewports);
}
MVK_PUBLIC_SYMBOL void vkCmdSetScissor(
@ -990,14 +992,16 @@ MVK_PUBLIC_SYMBOL void vkCmdSetScissor(
uint32_t scissorCount,
const VkRect2D* pScissors) {
mvkCmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetScissor(cmdBuff, firstScissor, scissorCount, pScissors);
}
MVK_PUBLIC_SYMBOL void vkCmdSetLineWidth(
VkCommandBuffer commandBuffer,
float lineWidth) {
mvkCmdSetLineWidth(commandBuffer, lineWidth);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetLineWidth(cmdBuff, lineWidth);
}
MVK_PUBLIC_SYMBOL void vkCmdSetDepthBias(
@ -1006,14 +1010,16 @@ MVK_PUBLIC_SYMBOL void vkCmdSetDepthBias(
float depthBiasClamp,
float depthBiasSlopeFactor) {
mvkCmdSetDepthBias(commandBuffer,depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetDepthBias(cmdBuff,depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
}
MVK_PUBLIC_SYMBOL void vkCmdSetBlendConstants(
VkCommandBuffer commandBuffer,
const float blendConst[4]) {
mvkCmdSetBlendConstants(commandBuffer, blendConst);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetBlendConstants(cmdBuff, blendConst);
}
MVK_PUBLIC_SYMBOL void vkCmdSetDepthBounds(
@ -1021,7 +1027,8 @@ MVK_PUBLIC_SYMBOL void vkCmdSetDepthBounds(
float minDepthBounds,
float maxDepthBounds) {
mvkCmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetDepthBounds(cmdBuff, minDepthBounds, maxDepthBounds);
}
MVK_PUBLIC_SYMBOL void vkCmdSetStencilCompareMask(
@ -1029,7 +1036,8 @@ MVK_PUBLIC_SYMBOL void vkCmdSetStencilCompareMask(
VkStencilFaceFlags faceMask,
uint32_t stencilCompareMask) {
mvkCmdSetStencilCompareMask(commandBuffer, faceMask, stencilCompareMask);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetStencilCompareMask(cmdBuff, faceMask, stencilCompareMask);
}
MVK_PUBLIC_SYMBOL void vkCmdSetStencilWriteMask(
@ -1037,7 +1045,8 @@ MVK_PUBLIC_SYMBOL void vkCmdSetStencilWriteMask(
VkStencilFaceFlags faceMask,
uint32_t stencilWriteMask) {
mvkCmdSetStencilWriteMask(commandBuffer, faceMask, stencilWriteMask);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetStencilWriteMask(cmdBuff, faceMask, stencilWriteMask);
}
MVK_PUBLIC_SYMBOL void vkCmdSetStencilReference(
@ -1045,7 +1054,8 @@ MVK_PUBLIC_SYMBOL void vkCmdSetStencilReference(
VkStencilFaceFlags faceMask,
uint32_t stencilReference) {
mvkCmdSetStencilReference(commandBuffer, faceMask, stencilReference);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdSetStencilReference(cmdBuff, faceMask, stencilReference);
}
@ -1059,7 +1069,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBindDescriptorSets(
uint32_t dynamicOffsetCount,
const uint32_t* pDynamicOffsets) {
mvkCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, setCount,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBindDescriptorSets(cmdBuff, pipelineBindPoint, layout, firstSet, setCount,
pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
}
@ -1069,7 +1080,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBindIndexBuffer(
VkDeviceSize offset,
VkIndexType indexType) {
mvkCmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBindIndexBuffer(cmdBuff, buffer, offset, indexType);
}
MVK_PUBLIC_SYMBOL void vkCmdBindVertexBuffers(
@ -1079,7 +1091,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBindVertexBuffers(
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets) {
mvkCmdBindVertexBuffers(commandBuffer, startBinding, bindingCount, pBuffers, pOffsets);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBindVertexBuffers(cmdBuff, startBinding, bindingCount, pBuffers, pOffsets);
}
MVK_PUBLIC_SYMBOL void vkCmdDraw(
@ -1089,7 +1102,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDraw(
uint32_t firstVertex,
uint32_t firstInstance) {
mvkCmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDraw(cmdBuff, vertexCount, instanceCount, firstVertex, firstInstance);
}
MVK_PUBLIC_SYMBOL void vkCmdDrawIndexed(
@ -1100,7 +1114,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDrawIndexed(
int32_t vertexOffset,
uint32_t firstInstance) {
mvkCmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDrawIndexed(cmdBuff, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
}
MVK_PUBLIC_SYMBOL void vkCmdDrawIndirect(
@ -1110,7 +1125,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDrawIndirect(
uint32_t count,
uint32_t stride) {
mvkCmdDrawIndirect(commandBuffer, buffer, offset, count, stride);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDrawIndirect(cmdBuff, buffer, offset, count, stride);
}
MVK_PUBLIC_SYMBOL void vkCmdDrawIndexedIndirect(
@ -1120,7 +1136,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDrawIndexedIndirect(
uint32_t count,
uint32_t stride) {
mvkCmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDrawIndexedIndirect(cmdBuff, buffer, offset, count, stride);
}
MVK_PUBLIC_SYMBOL void vkCmdDispatch(
@ -1129,7 +1146,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDispatch(
uint32_t y,
uint32_t z) {
mvkCmdDispatch(commandBuffer, x, y, z);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDispatch(cmdBuff, x, y, z);
}
MVK_PUBLIC_SYMBOL void vkCmdDispatchIndirect(
@ -1137,7 +1155,8 @@ MVK_PUBLIC_SYMBOL void vkCmdDispatchIndirect(
VkBuffer buffer,
VkDeviceSize offset) {
mvkCmdDispatchIndirect(commandBuffer, buffer, offset);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdDispatchIndirect(cmdBuff, buffer, offset);
}
MVK_PUBLIC_SYMBOL void vkCmdCopyBuffer(
@ -1147,7 +1166,8 @@ MVK_PUBLIC_SYMBOL void vkCmdCopyBuffer(
uint32_t regionCount,
const VkBufferCopy* pRegions) {
mvkCmdCopyBuffer(commandBuffer, srcBuffer, destBuffer, regionCount, pRegions);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdCopyBuffer(cmdBuff, srcBuffer, destBuffer, regionCount, pRegions);
}
MVK_PUBLIC_SYMBOL void vkCmdCopyImage(
@ -1159,7 +1179,8 @@ MVK_PUBLIC_SYMBOL void vkCmdCopyImage(
uint32_t regionCount,
const VkImageCopy* pRegions) {
mvkCmdCopyImage(commandBuffer,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdCopyImage(cmdBuff,
srcImage, srcImageLayout,
dstImage, dstImageLayout,
regionCount, pRegions);
@ -1175,7 +1196,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBlitImage(
const VkImageBlit* pRegions,
VkFilter filter) {
mvkCmdBlitImage(commandBuffer,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBlitImage(cmdBuff,
srcImage, srcImageLayout,
dstImage, dstImageLayout,
regionCount, pRegions, filter);
@ -1189,7 +1211,8 @@ MVK_PUBLIC_SYMBOL void vkCmdCopyBufferToImage(
uint32_t regionCount,
const VkBufferImageCopy* pRegions) {
mvkCmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdCopyBufferToImage(cmdBuff, srcBuffer, dstImage,
dstImageLayout, regionCount, pRegions);
}
@ -1201,7 +1224,8 @@ MVK_PUBLIC_SYMBOL void vkCmdCopyImageToBuffer(
uint32_t regionCount,
const VkBufferImageCopy* pRegions) {
mvkCmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdCopyImageToBuffer(cmdBuff, srcImage, srcImageLayout,
dstBuffer, regionCount, pRegions);
}
@ -1212,7 +1236,8 @@ MVK_PUBLIC_SYMBOL void vkCmdUpdateBuffer(
VkDeviceSize dataSize,
const void* pData) {
mvkCmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdUpdateBuffer(cmdBuff, dstBuffer, dstOffset, dataSize, pData);
}
MVK_PUBLIC_SYMBOL void vkCmdFillBuffer(
@ -1222,7 +1247,8 @@ MVK_PUBLIC_SYMBOL void vkCmdFillBuffer(
VkDeviceSize size,
uint32_t data) {
mvkCmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdFillBuffer(cmdBuff, dstBuffer, dstOffset, size, data);
}
MVK_PUBLIC_SYMBOL void vkCmdClearColorImage(
@ -1233,7 +1259,8 @@ MVK_PUBLIC_SYMBOL void vkCmdClearColorImage(
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) {
mvkCmdClearImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdClearImage(cmdBuff, image, imageLayout, pColor, rangeCount, pRanges);
}
MVK_PUBLIC_SYMBOL void vkCmdClearDepthStencilImage(
@ -1244,7 +1271,8 @@ MVK_PUBLIC_SYMBOL void vkCmdClearDepthStencilImage(
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges) {
mvkCmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdClearDepthStencilImage(cmdBuff, image, imageLayout, pDepthStencil, rangeCount, pRanges);
}
MVK_PUBLIC_SYMBOL void vkCmdClearAttachments(
@ -1254,7 +1282,8 @@ MVK_PUBLIC_SYMBOL void vkCmdClearAttachments(
uint32_t rectCount,
const VkClearRect* pRects) {
mvkCmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdClearAttachments(cmdBuff, attachmentCount, pAttachments, rectCount, pRects);
}
MVK_PUBLIC_SYMBOL void vkCmdResolveImage(
@ -1266,7 +1295,8 @@ MVK_PUBLIC_SYMBOL void vkCmdResolveImage(
uint32_t regionCount,
const VkImageResolve* pRegions) {
mvkCmdResolveImage(commandBuffer, srcImage, srcImageLayout,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdResolveImage(cmdBuff, srcImage, srcImageLayout,
dstImage, dstImageLayout, regionCount, pRegions);
}
@ -1314,7 +1344,8 @@ MVK_PUBLIC_SYMBOL void vkCmdPipelineBarrier(
uint32_t imageMemoryBarrierCount,
const VkImageMemoryBarrier* pImageMemoryBarriers) {
mvkCmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdPipelineBarrier(cmdBuff, srcStageMask, dstStageMask,
dependencyFlags, memoryBarrierCount, pMemoryBarriers,
bufferMemoryBarrierCount, pBufferMemoryBarriers,
imageMemoryBarrierCount, pImageMemoryBarriers);
@ -1326,7 +1357,8 @@ MVK_PUBLIC_SYMBOL void vkCmdBeginQuery(
uint32_t query,
VkQueryControlFlags flags) {
mvkCmdBeginQuery(commandBuffer, queryPool, query, flags);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBeginQuery(cmdBuff, queryPool, query, flags);
}
MVK_PUBLIC_SYMBOL void vkCmdEndQuery(
@ -1334,7 +1366,8 @@ MVK_PUBLIC_SYMBOL void vkCmdEndQuery(
VkQueryPool queryPool,
uint32_t query) {
mvkCmdEndQuery(commandBuffer, queryPool, query);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdEndQuery(cmdBuff, queryPool, query);
}
MVK_PUBLIC_SYMBOL void vkCmdResetQueryPool(
@ -1343,7 +1376,8 @@ MVK_PUBLIC_SYMBOL void vkCmdResetQueryPool(
uint32_t firstQuery,
uint32_t queryCount) {
mvkCmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdResetQueryPool(cmdBuff, queryPool, firstQuery, queryCount);
}
MVK_PUBLIC_SYMBOL void vkCmdWriteTimestamp(
@ -1352,7 +1386,8 @@ MVK_PUBLIC_SYMBOL void vkCmdWriteTimestamp(
VkQueryPool queryPool,
uint32_t query) {
mvkCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdWriteTimestamp(cmdBuff, pipelineStage, queryPool, query);
}
MVK_PUBLIC_SYMBOL void vkCmdCopyQueryPoolResults(
@ -1365,7 +1400,8 @@ MVK_PUBLIC_SYMBOL void vkCmdCopyQueryPoolResults(
VkDeviceSize destStride,
VkQueryResultFlags flags) {
mvkCmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount,
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdCopyQueryPoolResults(cmdBuff, queryPool, firstQuery, queryCount,
destBuffer, destOffset, destStride, flags);
}
@ -1377,7 +1413,8 @@ MVK_PUBLIC_SYMBOL void vkCmdPushConstants(
uint32_t size,
const void* pValues) {
mvkCmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdPushConstants(cmdBuff, layout, stageFlags, offset, size, pValues);
}
MVK_PUBLIC_SYMBOL void vkCmdBeginRenderPass(
@ -1385,28 +1422,32 @@ MVK_PUBLIC_SYMBOL void vkCmdBeginRenderPass(
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents) {
mvkCmdBeginRenderPass(commandBuffer,pRenderPassBegin, contents);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdBeginRenderPass(cmdBuff,pRenderPassBegin, contents);
}
MVK_PUBLIC_SYMBOL void vkCmdNextSubpass(
VkCommandBuffer commandBuffer,
VkSubpassContents contents) {
mvkCmdNextSubpass(commandBuffer, contents);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdNextSubpass(cmdBuff, contents);
}
MVK_PUBLIC_SYMBOL void vkCmdEndRenderPass(
VkCommandBuffer commandBuffer) {
mvkCmdEndRenderPass(commandBuffer);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdEndRenderPass(cmdBuff);
}
MVK_PUBLIC_SYMBOL void vkCmdExecuteCommands(
VkCommandBuffer commandBuffer,
uint32_t cmdBuffersCount,
const VkCommandBuffer* pCmdBuffers) {
const VkCommandBuffer* pCommandBuffers) {
mvkCmdExecuteCommands(commandBuffer, cmdBuffersCount, pCmdBuffers);
MVKCommandBuffer* cmdBuff = MVKCommandBuffer::getMVKCommandBuffer(commandBuffer);
mvkCmdExecuteCommands(cmdBuff, cmdBuffersCount, pCommandBuffers);
}
@ -1419,7 +1460,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreateSwapchainKHR(
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchain) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
MVKSwapchain* mvkSwpChn = mvkDev->createSwapchain(pCreateInfo, pAllocator);
*pSwapchain = (VkSwapchainKHR)(mvkSwpChn);
return mvkSwpChn->getConfigurationResult();
@ -1430,7 +1471,7 @@ MVK_PUBLIC_SYMBOL void vkDestroySwapchainKHR(
VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator) {
MVKDevice* mvkDev = (MVKDevice*)device;
MVKDevice* mvkDev = MVKDevice::getMVKDevice(device);
mvkDev->destroySwapchain((MVKSwapchain*)swapchain, pAllocator);
}
@ -1460,7 +1501,7 @@ MVK_PUBLIC_SYMBOL VkResult vkQueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo) {
MVKQueue* mvkQ = (MVKQueue*)queue;
MVKQueue* mvkQ = MVKQueue::getMVKQueue(queue);
return mvkQ->submitPresentKHR(pPresentInfo);
}
@ -1473,7 +1514,7 @@ MVK_PUBLIC_SYMBOL void vkDestroySurfaceKHR(
VkSurfaceKHR surface,
const VkAllocationCallbacks* pAllocator) {
MVKInstance* mvkInst = (MVKInstance*)instance;
MVKInstance* mvkInst = MVKInstance::getMVKInstance(instance);
mvkInst->destroySurface((MVKSurface*)surface, pAllocator);
}
@ -1483,7 +1524,7 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
VkSurfaceKHR surface,
VkBool32* pSupported) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
MVKSurface* mvkSrfc = (MVKSurface*)surface;
return mvkPD->getSurfaceSupport(queueFamilyIndex, mvkSrfc, pSupported);
}
@ -1493,7 +1534,7 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
MVKSurface* mvkSrfc = (MVKSurface*)surface;
return mvkPD->getSurfaceCapabilities(mvkSrfc, pSurfaceCapabilities);
}
@ -1504,7 +1545,7 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
MVKSurface* mvkSrfc = (MVKSurface*)surface;
return mvkPD->getSurfaceFormats(mvkSrfc, pSurfaceFormatCount, pSurfaceFormats);
}
@ -1515,7 +1556,7 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes) {
MVKPhysicalDevice* mvkPD = (MVKPhysicalDevice*)physicalDevice;
MVKPhysicalDevice* mvkPD = MVKPhysicalDevice::getMVKPhysicalDevice(physicalDevice);
MVKSurface* mvkSrfc = (MVKSurface*)surface;
return mvkPD->getSurfacePresentModes(mvkSrfc, pPresentModeCount, pPresentModes);
}
@ -1530,7 +1571,7 @@ MVK_PUBLIC_SYMBOL VkResult vkCreate_PLATFORM_SurfaceMVK(
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface) {
MVKInstance* mvkInst = (MVKInstance*)instance;
MVKInstance* mvkInst = MVKInstance::getMVKInstance(instance);
MVKSurface* mvkSrfc = mvkInst->createSurface(pCreateInfo, pAllocator);
*pSurface = (VkSurfaceKHR)mvkSrfc;
return mvkSrfc->getConfigurationResult();

View File

@ -11,8 +11,13 @@ For best results, use a Markdown reader.*
Table of Contents
-----------------
- [Using the *Vulkan-Hpp* Spec Repository with **MoltenVK**](#install_vulkan_spec)
- [Updating the *Vulkan-Hpp* library version](#update_vulkan_spec)
- *Vulkan-Hpp*
- [Using the *Vulkan-Hpp* Spec Repository with **MoltenVK**](#install_vulkan_spec)
- [Updating the *Vulkan-Hpp* library version](#update_vulkan_spec)
- *Vulkan-LoaderAndValidationLayers*
- [Using the *Vulkan-LoaderAndValidationLayers* Repository with **MoltenVK**](#install_vulkan_lvl)
- [Updating the *Vulkan-LoaderAndValidationLayers* library version](#update_vulkan_lvl)
<a name="install_vulkan_spec"></a>
@ -58,3 +63,34 @@ used by **MoltenVK** to the latest version available by re-cloning and re-buildi
The updated version will then be "locked in" the next time the `MoltenVK` repository is committed to `git`.
<a name="install_vulkan_lvl"></a>
Using the *Vulkan-LoaderAndValidationLayers* Spec Repository with *MoltenVK*
----------------------------------------------------------------------------
**MoltenVK** uses the *Khronos Vulkan Loader and Validation Layers* repository to allow **MoltenVK**
to act as an *Installable Client Driver* to support the *Vulkan Loader API*.
If you used the `--recursive` option when cloning the `MoltenVK` repository, you should already
have the `Vulkan-LoaderAndValidationLayers` submodule. If you did **_not_** use the `--recursive`
option when cloning the `MoltenVK` repository, retrieve the `Vulkan-LoaderAndValidationLayers`
submodule into the `External` directory as follows, from within the `MoltenVK` repository directory:
git submodule update --init External/Vulkan-LoaderAndValidationLayers
<a name="update_vulkan_lvl"></a>
Updating the *Vulkan-LoaderAndValidationLayers* library version
---------------------------------------------------------------
If you are developing enhancements to **MoltenVK**, you can update the version of `Vulkan-LoaderAndValidationLayers`
used by **MoltenVK** to the latest version available by re-cloning and re-building the `Vulkan-LoaderAndValidationLayers`
submodule using the `getLatestVulkanLVL` script:
cd External
./getLatestVulkanLVL
The updated version will then be "locked in" the next time the `MoltenVK` repository is committed to `git`.

View File

@ -141,6 +141,7 @@
A939A6FD1F547A12006ACA0C /* makeglslang */ = {isa = PBXFileReference; lastKnownFileType = text; path = makeglslang; sourceTree = "<group>"; };
A939A6FE1F547A12006ACA0C /* makeSPIRVTools */ = {isa = PBXFileReference; lastKnownFileType = text; path = makeSPIRVTools; sourceTree = "<group>"; };
A939A6FF1F547A12006ACA0C /* makeVulkanSpec */ = {isa = PBXFileReference; lastKnownFileType = text; path = makeVulkanSpec; sourceTree = "<group>"; };
A94545691FEB1C23000C2CB2 /* getLatestVulkanLVL */ = {isa = PBXFileReference; lastKnownFileType = text; path = getLatestVulkanLVL; sourceTree = "<group>"; };
A98149E51FB78829005F00B4 /* MoltenVK_Runtime_UserGuide.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = MoltenVK_Runtime_UserGuide.md; path = Docs/MoltenVK_Runtime_UserGuide.md; sourceTree = "<group>"; };
A9B732A31FC9C588006721CB /* getLatestglslang */ = {isa = PBXFileReference; lastKnownFileType = text; path = getLatestglslang; sourceTree = "<group>"; };
A9B732A41FC9C588006721CB /* getLatestSPIRVTools */ = {isa = PBXFileReference; lastKnownFileType = text; path = getLatestSPIRVTools; sourceTree = "<group>"; };
@ -191,6 +192,7 @@
A9B732A31FC9C588006721CB /* getLatestglslang */,
A9B732A51FC9C588006721CB /* getLatestSPIRVCross */,
A9B732A41FC9C588006721CB /* getLatestSPIRVTools */,
A94545691FEB1C23000C2CB2 /* getLatestVulkanLVL */,
A9B732A61FC9C588006721CB /* getLatestVulkanSpec */,
);
path = External;
@ -214,7 +216,7 @@
A90B2B1D1A9B6170008EE819 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
LastUpgradeCheck = 0920;
TargetAttributes = {
A9FEADBC1F3517480010240E = {
DevelopmentTeam = VU3TCKU48B;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1126,8 +1126,7 @@
A9B735B01FCA2450006721CB /* text_handler.cpp */,
A9B735B11FCA2450006721CB /* val */,
);
name = source;
path = "source";
path = source;
sourceTree = "<group>";
};
A9B734FE1FCA2450006721CB /* util */ = {
@ -1920,7 +1919,7 @@
A9F55D25198BE6A7004EC31B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = "The Brenwill Workshop Ltd.";
TargetAttributes = {
A9092A8C1A81717B00051823 = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -193,6 +193,7 @@ Third-Party Credits
- [*Vulkan-Hpp*](https://github.com/KhronosGroup/Vulkan-Hpp)
- [*Vulkan-Docs*](https://github.com/KhronosGroup/Vulkan-Docs)
- [*Vulkan-LoaderAndValidationLayers*](https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers)
- [*tinyxml2*](https://github.com/leethomason/tinyxml2)
**MoltenVKShaderConverter** uses technology from the following open-source frameworks: