Replace use of memcmp() with mvkAreEqual().
This commit is contained in:
parent
4f1cdef6af
commit
04ae0a61e0
@ -112,9 +112,9 @@ namespace std {
|
|||||||
* This structure can be used as a key in a std::map and std::unordered_map.
|
* This structure can be used as a key in a std::map and std::unordered_map.
|
||||||
*/
|
*/
|
||||||
typedef struct MVKRPSKeyClearAtt {
|
typedef struct MVKRPSKeyClearAtt {
|
||||||
uint16_t attachmentMTLPixelFormats[kMVKClearAttachmentCount];
|
uint16_t flags; // bitcount > kMVKClearAttachmentLayeredRenderingBitIndex
|
||||||
uint16_t mtlSampleCount;
|
uint16_t mtlSampleCount;
|
||||||
uint16_t flags; // bitcount > kMVKClearAttachmentLayeredRenderingBitIndex
|
uint16_t attachmentMTLPixelFormats[kMVKClearAttachmentCount];
|
||||||
|
|
||||||
const static uint32_t bitFlag = 1;
|
const static uint32_t bitFlag = 1;
|
||||||
|
|
||||||
@ -126,11 +126,7 @@ typedef struct MVKRPSKeyClearAtt {
|
|||||||
|
|
||||||
bool isLayeredRenderingEnabled() { return mvkIsAnyFlagEnabled(flags, bitFlag << kMVKClearAttachmentLayeredRenderingBitIndex); }
|
bool isLayeredRenderingEnabled() { return mvkIsAnyFlagEnabled(flags, bitFlag << kMVKClearAttachmentLayeredRenderingBitIndex); }
|
||||||
|
|
||||||
bool operator==(const MVKRPSKeyClearAtt& rhs) const {
|
bool operator==(const MVKRPSKeyClearAtt& rhs) const { return mvkAreEqual(this, &rhs); }
|
||||||
return ((flags == rhs.flags) &&
|
|
||||||
(mtlSampleCount == rhs.mtlSampleCount) &&
|
|
||||||
(memcmp(attachmentMTLPixelFormats, rhs.attachmentMTLPixelFormats, sizeof(attachmentMTLPixelFormats)) == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t hash() const {
|
std::size_t hash() const {
|
||||||
std::size_t hash = mvkHash(&flags);
|
std::size_t hash = mvkHash(&flags);
|
||||||
@ -212,9 +208,7 @@ typedef struct MVKMTLDepthStencilDescriptorData {
|
|||||||
MVKMTLStencilDescriptorData frontFaceStencilData;
|
MVKMTLStencilDescriptorData frontFaceStencilData;
|
||||||
MVKMTLStencilDescriptorData backFaceStencilData;
|
MVKMTLStencilDescriptorData backFaceStencilData;
|
||||||
|
|
||||||
bool operator==(const MVKMTLDepthStencilDescriptorData& rhs) const {
|
bool operator==(const MVKMTLDepthStencilDescriptorData& rhs) const { return mvkAreEqual(this, &rhs); }
|
||||||
return (memcmp(this, &rhs, sizeof(*this)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t hash() const {
|
std::size_t hash() const {
|
||||||
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
||||||
@ -270,9 +264,7 @@ typedef struct MVKImageDescriptorData {
|
|||||||
VkSampleCountFlagBits samples;
|
VkSampleCountFlagBits samples;
|
||||||
VkImageUsageFlags usage;
|
VkImageUsageFlags usage;
|
||||||
|
|
||||||
bool operator==(const MVKImageDescriptorData& rhs) const {
|
bool operator==(const MVKImageDescriptorData& rhs) const { return mvkAreEqual(this, &rhs); }
|
||||||
return (memcmp(this, &rhs, sizeof(*this)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t hash() const {
|
std::size_t hash() const {
|
||||||
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
||||||
@ -307,9 +299,7 @@ typedef struct MVKBufferDescriptorData {
|
|||||||
VkDeviceSize size;
|
VkDeviceSize size;
|
||||||
VkBufferUsageFlags usage;
|
VkBufferUsageFlags usage;
|
||||||
|
|
||||||
bool operator==(const MVKBufferDescriptorData& rhs) const {
|
bool operator==(const MVKBufferDescriptorData& rhs) const { return mvkAreEqual(this, &rhs); }
|
||||||
return (memcmp(this, &rhs, sizeof(*this)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t hash() const {
|
std::size_t hash() const {
|
||||||
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
return mvkHash((uint64_t*)this, sizeof(*this) / sizeof(uint64_t));
|
||||||
|
@ -1544,7 +1544,7 @@ void MVKPipelineCache::readData(const VkPipelineCacheCreateInfo* pCreateInfo) {
|
|||||||
if (NSSwapLittleIntToHost(hdrComponent) != pDevProps->deviceID) { return; }
|
if (NSSwapLittleIntToHost(hdrComponent) != pDevProps->deviceID) { return; }
|
||||||
|
|
||||||
reader(pcUUID); // Pipeline cache UUID
|
reader(pcUUID); // Pipeline cache UUID
|
||||||
if (memcmp(pcUUID, pDevProps->pipelineCacheUUID, VK_UUID_SIZE) != 0) { return; }
|
if (mvkAreEqual(pcUUID, pDevProps->pipelineCacheUUID, VK_UUID_SIZE)) { return; }
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while ( !done ) {
|
while ( !done ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user