Remove mutex locks on MVKDescriptorPool.

Update docs to indicate support for Vulkan 1.0, instead of 1.1.
This commit is contained in:
Bill Hollings 2018-05-14 15:48:27 -04:00
parent e443796c84
commit 40cdcbba5c
6 changed files with 6 additions and 24 deletions

View File

@ -52,7 +52,7 @@ distribution package, see the main [`README.md`](../README.md) document in the `
About **MoltenVK** About **MoltenVK**
------------------ ------------------
**MoltenVK** is an implementation of the [*Vulkan*](https://www.khronos.org/vulkan) **MoltenVK** is an implementation of the [*Vulkan 1.0*](https://www.khronos.org/vulkan)
graphics and compute API, that runs on Apple's [*Metal*](https://developer.apple.com/metal) graphics and compute API, that runs on Apple's [*Metal*](https://developer.apple.com/metal)
graphics and compute framework on both *iOS* and *macOS*. graphics and compute framework on both *iOS* and *macOS*.
@ -441,10 +441,10 @@ Known **MoltenVK** Limitations
This section documents the known limitations in this version of **MoltenVK**. This section documents the known limitations in this version of **MoltenVK**.
- **MoltenVK** is a Layer-0 driver implementation of *Vulkan*, and currently does not - **MoltenVK** is a Layer-0 driver implementation of *Vulkan 1.0*, and currently does not
support the loading of higher level *Vulkan Layers*. support the loading of higher level *Vulkan Layers*.
The following *Vulkan* features have not been implemented in this version of **MoltenVK**: The following *Vulkan 1.0* features have not been implemented in this version of **MoltenVK**:
- Tessellation and Geometry shader stages. - Tessellation and Geometry shader stages.

View File

@ -22,7 +22,6 @@
#include "MVKCommand.h" #include "MVKCommand.h"
#include "MVKCommandEncoderState.h" #include "MVKCommandEncoderState.h"
#include "MVKCmdPipeline.h" #include "MVKCmdPipeline.h"
#include <mutex>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>

View File

@ -29,8 +29,6 @@
#include "MVKCmdQueries.h" #include "MVKCmdQueries.h"
#include "MVKMTLBufferAllocation.h" #include "MVKMTLBufferAllocation.h"
#include <unordered_set> #include <unordered_set>
#include <list>
#include <mutex>
#import <Metal/Metal.h> #import <Metal/Metal.h>

View File

@ -23,7 +23,6 @@
#include <MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h> #include <MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h>
#include <forward_list> #include <forward_list>
#include <vector> #include <vector>
#include <mutex>
using namespace mvk; using namespace mvk;
@ -289,7 +288,6 @@ protected:
uint32_t _maxSets; uint32_t _maxSets;
std::forward_list<MVKDescriptorSet*> _allocatedSets; std::forward_list<MVKDescriptorSet*> _allocatedSets;
size_t _allocatedSetCount; size_t _allocatedSetCount;
std::mutex _lock;
}; };

View File

@ -610,10 +610,7 @@ MVKDescriptorSet::MVKDescriptorSet(MVKDevice* device,
VkResult MVKDescriptorPool::allocateDescriptorSets(uint32_t count, VkResult MVKDescriptorPool::allocateDescriptorSets(uint32_t count,
const VkDescriptorSetLayout* pSetLayouts, const VkDescriptorSetLayout* pSetLayouts,
VkDescriptorSet* pDescriptorSets) { VkDescriptorSet* pDescriptorSets) {
lock_guard<mutex> lock(_lock);
if (_allocatedSetCount + count > _maxSets) { if (_allocatedSetCount + count > _maxSets) {
// MVKLogDebug("Pool %p could not allocate %d descriptor sets. There are alreay %d sets, and the maximum for this pool is %d.", this, count, _allocatedSetCount, _maxSets);
return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "The maximum number of descriptor sets that can be allocated by this descriptor pool is %d.", _maxSets); return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "The maximum number of descriptor sets that can be allocated by this descriptor pool is %d.", _maxSets);
} }
@ -624,14 +621,10 @@ VkResult MVKDescriptorPool::allocateDescriptorSets(uint32_t count,
pDescriptorSets[dsIdx] = (VkDescriptorSet)mvkDescSet; pDescriptorSets[dsIdx] = (VkDescriptorSet)mvkDescSet;
_allocatedSetCount++; _allocatedSetCount++;
} }
// MVKLogDebug("Pool %p allocating %d descriptor sets for a new total of %d sets.", this, count, _allocatedSetCount);
return VK_SUCCESS; return VK_SUCCESS;
} }
VkResult MVKDescriptorPool::freeDescriptorSets(uint32_t count, const VkDescriptorSet* pDescriptorSets) { VkResult MVKDescriptorPool::freeDescriptorSets(uint32_t count, const VkDescriptorSet* pDescriptorSets) {
lock_guard<mutex> lock(_lock);
for (uint32_t dsIdx = 0; dsIdx < count; dsIdx++) { for (uint32_t dsIdx = 0; dsIdx < count; dsIdx++) {
MVKDescriptorSet* mvkDS = (MVKDescriptorSet*)pDescriptorSets[dsIdx]; MVKDescriptorSet* mvkDS = (MVKDescriptorSet*)pDescriptorSets[dsIdx];
if (mvkDS) { if (mvkDS) {
@ -640,15 +633,10 @@ VkResult MVKDescriptorPool::freeDescriptorSets(uint32_t count, const VkDescripto
mvkDS->destroy(); mvkDS->destroy();
} }
} }
// MVKLogDebug("Pool %p freed %d descriptor sets for a new total of %d sets.", this, count, _allocatedSetCount);
return VK_SUCCESS; return VK_SUCCESS;
} }
VkResult MVKDescriptorPool::reset(VkDescriptorPoolResetFlags flags) { VkResult MVKDescriptorPool::reset(VkDescriptorPoolResetFlags flags) {
lock_guard<mutex> lock(_lock);
// MVKLogDebug("Pool %p resetting and freeing remaining %d descriptor sets.", this, _allocatedSetCount);
mvkDestroyContainerContents(_allocatedSets); mvkDestroyContainerContents(_allocatedSets);
_allocatedSetCount = 0; _allocatedSetCount = 0;
return VK_SUCCESS; return VK_SUCCESS;
@ -656,7 +644,6 @@ VkResult MVKDescriptorPool::reset(VkDescriptorPoolResetFlags flags) {
MVKDescriptorPool::MVKDescriptorPool(MVKDevice* device, MVKDescriptorPool::MVKDescriptorPool(MVKDevice* device,
const VkDescriptorPoolCreateInfo* pCreateInfo) : MVKBaseDeviceObject(device) { const VkDescriptorPoolCreateInfo* pCreateInfo) : MVKBaseDeviceObject(device) {
// MVKLogDebug("Pool %p created.", this);
_maxSets = pCreateInfo->maxSets; _maxSets = pCreateInfo->maxSets;
_allocatedSetCount = 0; _allocatedSetCount = 0;
} }

View File

@ -49,7 +49,7 @@ Introduction
**MoltenVK** contains two products: **MoltenVK** contains two products:
- **MoltenVK** is an implementation of the [*Vulkan*](https://www.khronos.org/vulkan) - **MoltenVK** is an implementation of the [*Vulkan 1.0*](https://www.khronos.org/vulkan)
graphics and compute API, that runs on Apple's [*Metal*](https://developer.apple.com/metal) graphics and compute API, that runs on Apple's [*Metal*](https://developer.apple.com/metal)
graphics and compute framework on both *iOS* and *macOS*. graphics and compute framework on both *iOS* and *macOS*.
@ -183,11 +183,11 @@ the contents of that directory out of this **MoltenVK** repository into your own
**MoltenVK** and *Vulkan* Compliance **MoltenVK** and *Vulkan* Compliance
------------------------------------ ------------------------------------
**MoltenVK** is designed to be a *Vulkan* driver that runs on *macOS* and *iOS* platforms by mapping *Vulkan* **MoltenVK** is designed to be a *Vulkan 1.0* driver that runs on *macOS* and *iOS* platforms by mapping *Vulkan*
capability to native *Metal* capability. capability to native *Metal* capability.
The fundamental design and development goal of **MoltenVK** is to provide this capability in a way that The fundamental design and development goal of **MoltenVK** is to provide this capability in a way that
is both maximally compliant with the *Vulkan* specification, and maximally performant. is both maximally compliant with the *Vulkan 1.0* specification, and maximally performant.
Such compliance and performance is inherently affected by the capability available through *Metal*, as the Such compliance and performance is inherently affected by the capability available through *Metal*, as the
native driver on *macOS* and *iOS* platforms. *Vulkan* compliance may fall into one of the following categories: native driver on *macOS* and *iOS* platforms. *Vulkan* compliance may fall into one of the following categories: