| 1 |
/* |
| 2 |
* Copyright (c) 2025 The Khronos Group Inc. |
| 3 |
* Copyright (c) 2025 Valve Corporation |
| 4 |
* Copyright (c) 2025 LunarG, Inc. |
| 5 |
* |
| 6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 |
* of this software and/or associated documentation files (the "Materials"), to |
| 8 |
* deal in the Materials without restriction, including without limitation the |
| 9 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 |
* sell copies of the Materials, and to permit persons to whom the Materials are |
| 11 |
* furnished to do so, subject to the following conditions: |
| 12 |
* |
| 13 |
* The above copyright notice(s) and this permission notice shall be included in |
| 14 |
* all copies or substantial portions of the Materials. |
| 15 |
* |
| 16 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 |
* |
| 20 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 21 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 23 |
* USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
#include "equality_helpers.h" |
| 28 |
|
| 29 |
bool operator==(const VkExtent3D& a, const VkExtent3D& b) { |
| 30 |
return a.width == b.width && a.height == b.height && a.depth == b.depth; |
| 31 |
} |
| 32 |
bool operator!=(const VkExtent3D& a, const VkExtent3D& b) { return !(a == b); } |
| 33 |
|
| 34 |
bool operator==(const VkQueueFamilyProperties& a, const VkQueueFamilyProperties& b) { |
| 35 |
return a.minImageTransferGranularity == b.minImageTransferGranularity && a.queueCount == b.queueCount && |
| 36 |
a.queueFlags == b.queueFlags && a.timestampValidBits == b.timestampValidBits; |
| 37 |
} |
| 38 |
bool operator!=(const VkQueueFamilyProperties& a, const VkQueueFamilyProperties& b) { return !(a == b); } |
| 39 |
|
| 40 |
bool operator==(const VkQueueFamilyProperties& a, const VkQueueFamilyProperties2& b) { return a == b.queueFamilyProperties; } |
| 41 |
bool operator!=(const VkQueueFamilyProperties& a, const VkQueueFamilyProperties2& b) { return a != b.queueFamilyProperties; } |
| 42 |
|
| 43 |
bool operator==(const VkLayerProperties& a, const VkLayerProperties& b) { |
| 44 |
return string_eq(a.layerName, b.layerName, 256) && string_eq(a.description, b.description, 256) && |
| 45 |
a.implementationVersion == b.implementationVersion && a.specVersion == b.specVersion; |
| 46 |
} |
| 47 |
bool operator!=(const VkLayerProperties& a, const VkLayerProperties& b) { return !(a == b); } |
| 48 |
|
| 49 |
bool operator==(const VkExtensionProperties& a, const VkExtensionProperties& b) { |
| 50 |
return string_eq(a.extensionName, b.extensionName, 256) && a.specVersion == b.specVersion; |
| 51 |
} |
| 52 |
bool operator!=(const VkExtensionProperties& a, const VkExtensionProperties& b) { return !(a == b); } |
| 53 |
|
| 54 |
bool operator==(const VkPhysicalDeviceFeatures& feats1, const VkPhysicalDeviceFeatures2& feats2) { |
| 55 |
return feats1.robustBufferAccess == feats2.features.robustBufferAccess && |
| 56 |
feats1.fullDrawIndexUint32 == feats2.features.fullDrawIndexUint32 && |
| 57 |
feats1.imageCubeArray == feats2.features.imageCubeArray && feats1.independentBlend == feats2.features.independentBlend && |
| 58 |
feats1.geometryShader == feats2.features.geometryShader && |
| 59 |
feats1.tessellationShader == feats2.features.tessellationShader && |
| 60 |
feats1.sampleRateShading == feats2.features.sampleRateShading && feats1.dualSrcBlend == feats2.features.dualSrcBlend && |
| 61 |
feats1.logicOp == feats2.features.logicOp && feats1.multiDrawIndirect == feats2.features.multiDrawIndirect && |
| 62 |
feats1.drawIndirectFirstInstance == feats2.features.drawIndirectFirstInstance && |
| 63 |
feats1.depthClamp == feats2.features.depthClamp && feats1.depthBiasClamp == feats2.features.depthBiasClamp && |
| 64 |
feats1.fillModeNonSolid == feats2.features.fillModeNonSolid && feats1.depthBounds == feats2.features.depthBounds && |
| 65 |
feats1.wideLines == feats2.features.wideLines && feats1.largePoints == feats2.features.largePoints && |
| 66 |
feats1.alphaToOne == feats2.features.alphaToOne && feats1.multiViewport == feats2.features.multiViewport && |
| 67 |
feats1.samplerAnisotropy == feats2.features.samplerAnisotropy && |
| 68 |
feats1.textureCompressionETC2 == feats2.features.textureCompressionETC2 && |
| 69 |
feats1.textureCompressionASTC_LDR == feats2.features.textureCompressionASTC_LDR && |
| 70 |
feats1.textureCompressionBC == feats2.features.textureCompressionBC && |
| 71 |
feats1.occlusionQueryPrecise == feats2.features.occlusionQueryPrecise && |
| 72 |
feats1.pipelineStatisticsQuery == feats2.features.pipelineStatisticsQuery && |
| 73 |
feats1.vertexPipelineStoresAndAtomics == feats2.features.vertexPipelineStoresAndAtomics && |
| 74 |
feats1.fragmentStoresAndAtomics == feats2.features.fragmentStoresAndAtomics && |
| 75 |
feats1.shaderTessellationAndGeometryPointSize == feats2.features.shaderTessellationAndGeometryPointSize && |
| 76 |
feats1.shaderImageGatherExtended == feats2.features.shaderImageGatherExtended && |
| 77 |
feats1.shaderStorageImageExtendedFormats == feats2.features.shaderStorageImageExtendedFormats && |
| 78 |
feats1.shaderStorageImageMultisample == feats2.features.shaderStorageImageMultisample && |
| 79 |
feats1.shaderStorageImageReadWithoutFormat == feats2.features.shaderStorageImageReadWithoutFormat && |
| 80 |
feats1.shaderStorageImageWriteWithoutFormat == feats2.features.shaderStorageImageWriteWithoutFormat && |
| 81 |
feats1.shaderUniformBufferArrayDynamicIndexing == feats2.features.shaderUniformBufferArrayDynamicIndexing && |
| 82 |
feats1.shaderSampledImageArrayDynamicIndexing == feats2.features.shaderSampledImageArrayDynamicIndexing && |
| 83 |
feats1.shaderStorageBufferArrayDynamicIndexing == feats2.features.shaderStorageBufferArrayDynamicIndexing && |
| 84 |
feats1.shaderStorageImageArrayDynamicIndexing == feats2.features.shaderStorageImageArrayDynamicIndexing && |
| 85 |
feats1.shaderClipDistance == feats2.features.shaderClipDistance && |
| 86 |
feats1.shaderCullDistance == feats2.features.shaderCullDistance && |
| 87 |
feats1.shaderFloat64 == feats2.features.shaderFloat64 && feats1.shaderInt64 == feats2.features.shaderInt64 && |
| 88 |
feats1.shaderInt16 == feats2.features.shaderInt16 && |
| 89 |
feats1.shaderResourceResidency == feats2.features.shaderResourceResidency && |
| 90 |
feats1.shaderResourceMinLod == feats2.features.shaderResourceMinLod && |
| 91 |
feats1.sparseBinding == feats2.features.sparseBinding && |
| 92 |
feats1.sparseResidencyBuffer == feats2.features.sparseResidencyBuffer && |
| 93 |
feats1.sparseResidencyImage2D == feats2.features.sparseResidencyImage2D && |
| 94 |
feats1.sparseResidencyImage3D == feats2.features.sparseResidencyImage3D && |
| 95 |
feats1.sparseResidency2Samples == feats2.features.sparseResidency2Samples && |
| 96 |
feats1.sparseResidency4Samples == feats2.features.sparseResidency4Samples && |
| 97 |
feats1.sparseResidency8Samples == feats2.features.sparseResidency8Samples && |
| 98 |
feats1.sparseResidency16Samples == feats2.features.sparseResidency16Samples && |
| 99 |
feats1.sparseResidencyAliased == feats2.features.sparseResidencyAliased && |
| 100 |
feats1.variableMultisampleRate == feats2.features.variableMultisampleRate && |
| 101 |
feats1.inheritedQueries == feats2.features.inheritedQueries; |
| 102 |
} |
| 103 |
|
| 104 |
bool operator==(const VkPhysicalDeviceMemoryProperties& props1, const VkPhysicalDeviceMemoryProperties2& props2) { |
| 105 |
bool equal = true; |
| 106 |
equal = equal && props1.memoryTypeCount == props2.memoryProperties.memoryTypeCount; |
| 107 |
equal = equal && props1.memoryHeapCount == props2.memoryProperties.memoryHeapCount; |
| 108 |
for (uint32_t i = 0; i < props1.memoryHeapCount; ++i) { |
| 109 |
equal = equal && props1.memoryHeaps[i].size == props2.memoryProperties.memoryHeaps[i].size; |
| 110 |
equal = equal && props1.memoryHeaps[i].flags == props2.memoryProperties.memoryHeaps[i].flags; |
| 111 |
} |
| 112 |
for (uint32_t i = 0; i < props1.memoryTypeCount; ++i) { |
| 113 |
equal = equal && props1.memoryTypes[i].propertyFlags == props2.memoryProperties.memoryTypes[i].propertyFlags; |
| 114 |
equal = equal && props1.memoryTypes[i].heapIndex == props2.memoryProperties.memoryTypes[i].heapIndex; |
| 115 |
} |
| 116 |
return equal; |
| 117 |
} |
| 118 |
bool operator==(const VkSparseImageFormatProperties& props1, const VkSparseImageFormatProperties& props2) { |
| 119 |
return props1.aspectMask == props2.aspectMask && props1.imageGranularity.width == props2.imageGranularity.width && |
| 120 |
props1.imageGranularity.height == props2.imageGranularity.height && |
| 121 |
props1.imageGranularity.depth == props2.imageGranularity.depth && props1.flags == props2.flags; |
| 122 |
} |
| 123 |
bool operator==(const VkSparseImageFormatProperties& props1, const VkSparseImageFormatProperties2& props2) { |
| 124 |
return props1 == props2.properties; |
| 125 |
} |
| 126 |
bool operator==(const VkExternalMemoryProperties& props1, const VkExternalMemoryProperties& props2) { |
| 127 |
return props1.externalMemoryFeatures == props2.externalMemoryFeatures && |
| 128 |
props1.exportFromImportedHandleTypes == props2.exportFromImportedHandleTypes && |
| 129 |
props1.compatibleHandleTypes == props2.compatibleHandleTypes; |
| 130 |
} |
| 131 |
bool operator==(const VkExternalSemaphoreProperties& props1, const VkExternalSemaphoreProperties& props2) { |
| 132 |
return props1.externalSemaphoreFeatures == props2.externalSemaphoreFeatures && |
| 133 |
props1.exportFromImportedHandleTypes == props2.exportFromImportedHandleTypes && |
| 134 |
props1.compatibleHandleTypes == props2.compatibleHandleTypes; |
| 135 |
} |
| 136 |
bool operator==(const VkExternalFenceProperties& props1, const VkExternalFenceProperties& props2) { |
| 137 |
return props1.externalFenceFeatures == props2.externalFenceFeatures && |
| 138 |
props1.exportFromImportedHandleTypes == props2.exportFromImportedHandleTypes && |
| 139 |
props1.compatibleHandleTypes == props2.compatibleHandleTypes; |
| 140 |
} |
| 141 |
bool operator==(const VkSurfaceCapabilitiesKHR& props1, const VkSurfaceCapabilitiesKHR& props2) { |
| 142 |
return props1.minImageCount == props2.minImageCount && props1.maxImageCount == props2.maxImageCount && |
| 143 |
props1.currentExtent.width == props2.currentExtent.width && props1.currentExtent.height == props2.currentExtent.height && |
| 144 |
props1.minImageExtent.width == props2.minImageExtent.width && |
| 145 |
props1.minImageExtent.height == props2.minImageExtent.height && |
| 146 |
props1.maxImageExtent.width == props2.maxImageExtent.width && |
| 147 |
props1.maxImageExtent.height == props2.maxImageExtent.height && |
| 148 |
props1.maxImageArrayLayers == props2.maxImageArrayLayers && props1.supportedTransforms == props2.supportedTransforms && |
| 149 |
props1.currentTransform == props2.currentTransform && props1.supportedCompositeAlpha == props2.supportedCompositeAlpha && |
| 150 |
props1.supportedUsageFlags == props2.supportedUsageFlags; |
| 151 |
} |
| 152 |
bool operator==(const VkSurfacePresentScalingCapabilitiesEXT& caps1, const VkSurfacePresentScalingCapabilitiesEXT& caps2) { |
| 153 |
return caps1.supportedPresentScaling == caps2.supportedPresentScaling && |
| 154 |
caps1.supportedPresentGravityX == caps2.supportedPresentGravityX && |
| 155 |
caps1.supportedPresentGravityY == caps2.supportedPresentGravityY && |
| 156 |
caps1.minScaledImageExtent.width == caps2.minScaledImageExtent.width && |
| 157 |
caps1.minScaledImageExtent.height == caps2.minScaledImageExtent.height && |
| 158 |
caps1.maxScaledImageExtent.width == caps2.maxScaledImageExtent.width && |
| 159 |
caps1.maxScaledImageExtent.height == caps2.maxScaledImageExtent.height; |
| 160 |
} |
| 161 |
bool operator==(const VkSurfaceFormatKHR& format1, const VkSurfaceFormatKHR& format2) { |
| 162 |
return format1.format == format2.format && format1.colorSpace == format2.colorSpace; |
| 163 |
} |
| 164 |
bool operator==(const VkSurfaceFormatKHR& format1, const VkSurfaceFormat2KHR& format2) { return format1 == format2.surfaceFormat; } |
| 165 |
bool operator==(const VkDisplayPropertiesKHR& props1, const VkDisplayPropertiesKHR& props2) { |
| 166 |
return props1.display == props2.display && props1.physicalDimensions.width == props2.physicalDimensions.width && |
| 167 |
props1.physicalDimensions.height == props2.physicalDimensions.height && |
| 168 |
props1.physicalResolution.width == props2.physicalResolution.width && |
| 169 |
props1.physicalResolution.height == props2.physicalResolution.height && |
| 170 |
props1.supportedTransforms == props2.supportedTransforms && props1.planeReorderPossible == props2.planeReorderPossible && |
| 171 |
props1.persistentContent == props2.persistentContent; |
| 172 |
} |
| 173 |
bool operator==(const VkDisplayPropertiesKHR& props1, const VkDisplayProperties2KHR& props2) { |
| 174 |
return props1 == props2.displayProperties; |
| 175 |
} |
| 176 |
bool operator==(const VkDisplayModePropertiesKHR& disp1, const VkDisplayModePropertiesKHR& disp2) { |
| 177 |
return disp1.displayMode == disp2.displayMode && disp1.parameters.visibleRegion.width == disp2.parameters.visibleRegion.width && |
| 178 |
disp1.parameters.visibleRegion.height == disp2.parameters.visibleRegion.height && |
| 179 |
disp1.parameters.refreshRate == disp2.parameters.refreshRate; |
| 180 |
} |
| 181 |
|
| 182 |
bool operator==(const VkDisplayModePropertiesKHR& disp1, const VkDisplayModeProperties2KHR& disp2) { |
| 183 |
return disp1 == disp2.displayModeProperties; |
| 184 |
} |
| 185 |
bool operator==(const VkDisplayPlaneCapabilitiesKHR& caps1, const VkDisplayPlaneCapabilitiesKHR& caps2) { |
| 186 |
return caps1.supportedAlpha == caps2.supportedAlpha && caps1.minSrcPosition.x == caps2.minSrcPosition.x && |
| 187 |
caps1.minSrcPosition.y == caps2.minSrcPosition.y && caps1.maxSrcPosition.x == caps2.maxSrcPosition.x && |
| 188 |
caps1.maxSrcPosition.y == caps2.maxSrcPosition.y && caps1.minSrcExtent.width == caps2.minSrcExtent.width && |
| 189 |
caps1.minSrcExtent.height == caps2.minSrcExtent.height && caps1.maxSrcExtent.width == caps2.maxSrcExtent.width && |
| 190 |
caps1.maxSrcExtent.height == caps2.maxSrcExtent.height && caps1.minDstPosition.x == caps2.minDstPosition.x && |
| 191 |
caps1.minDstPosition.y == caps2.minDstPosition.y && caps1.maxDstPosition.x == caps2.maxDstPosition.x && |
| 192 |
caps1.maxDstPosition.y == caps2.maxDstPosition.y && caps1.minDstExtent.width == caps2.minDstExtent.width && |
| 193 |
caps1.minDstExtent.height == caps2.minDstExtent.height && caps1.maxDstExtent.width == caps2.maxDstExtent.width && |
| 194 |
caps1.maxDstExtent.height == caps2.maxDstExtent.height; |
| 195 |
} |
| 196 |
|
| 197 |
bool operator==(const VkDisplayPlaneCapabilitiesKHR& caps1, const VkDisplayPlaneCapabilities2KHR& caps2) { |
| 198 |
return caps1 == caps2.capabilities; |
| 199 |
} |
| 200 |
bool operator==(const VkDisplayPlanePropertiesKHR& props1, const VkDisplayPlanePropertiesKHR& props2) { |
| 201 |
return props1.currentDisplay == props2.currentDisplay && props1.currentStackIndex == props2.currentStackIndex; |
| 202 |
} |
| 203 |
bool operator==(const VkDisplayPlanePropertiesKHR& props1, const VkDisplayPlaneProperties2KHR& props2) { |
| 204 |
return props1 == props2.displayPlaneProperties; |
| 205 |
} |
| 206 |
bool operator==(const VkExtent2D& ext1, const VkExtent2D& ext2) { return ext1.height == ext2.height && ext1.width == ext2.width; } |