2018-05-20 21:41:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-01 01:39:24 +02:00
|
|
|
#define VK_NO_PROTOTYPES
|
2018-05-20 21:41:48 +02:00
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
2018-09-25 22:32:52 +02:00
|
|
|
//https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#features-limits
|
2018-08-26 15:11:43 +02:00
|
|
|
static VkPhysicalDeviceLimits _limits =
|
2018-05-20 21:41:48 +02:00
|
|
|
{
|
2019-09-29 20:53:08 +02:00
|
|
|
//TODO we could use these hard limits to optimise some of the driver code
|
|
|
|
//eg. staticcally allocated buffers instead of dynamically growing ones
|
|
|
|
.maxImageDimension1D = 2048,
|
|
|
|
.maxImageDimension2D = 2048,
|
2020-04-26 21:21:18 +02:00
|
|
|
.maxImageDimension3D = 0, //3D textures not supported
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxImageDimensionCube = 2048,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxImageArrayLayers = 2048,
|
|
|
|
.maxTexelBufferElements = 134217728,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxUniformBufferRange = 4294967295, //handled as buffers
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxStorageBufferRange = 4294967295,
|
|
|
|
.maxPushConstantsSize = 256,
|
|
|
|
.maxMemoryAllocationCount = 4096,
|
|
|
|
.maxSamplerAllocationCount = 4000,
|
|
|
|
.bufferImageGranularity = 0x400, //TODO 1KB?
|
|
|
|
.sparseAddressSpaceSize = 0xffffffff, //32 bits
|
|
|
|
.maxBoundDescriptorSets = 8,
|
|
|
|
.maxPerStageDescriptorSamplers = 4000,
|
|
|
|
.maxPerStageDescriptorUniformBuffers = 12,
|
|
|
|
.maxPerStageDescriptorStorageBuffers = 4096,
|
|
|
|
.maxPerStageDescriptorSampledImages = 16384,
|
|
|
|
.maxPerStageDescriptorStorageImages = 16384,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxPerStageDescriptorInputAttachments = 8,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxPerStageResources = 53268,
|
|
|
|
.maxDescriptorSetSamplers = 4000,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxDescriptorSetUniformBuffers = 72,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxDescriptorSetUniformBuffersDynamic = 72,
|
|
|
|
.maxDescriptorSetStorageBuffers = 4096,
|
|
|
|
.maxDescriptorSetStorageBuffersDynamic = 16,
|
|
|
|
.maxDescriptorSetSampledImages = 98304,
|
|
|
|
.maxDescriptorSetStorageImages = 98304,
|
|
|
|
.maxDescriptorSetInputAttachments = 8, //TODO
|
2018-11-18 15:21:33 +01:00
|
|
|
.maxVertexInputAttributes = 8, //TODO will fail CTS, MIN is 16
|
|
|
|
.maxVertexInputBindings = 8, //TODO will fail CTS, MIN is 16
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxVertexInputAttributeOffset = 2047,
|
|
|
|
.maxVertexInputBindingStride = 2048,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxVertexOutputComponents = 128,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxTessellationGenerationLevel = 0, //No tessellation
|
|
|
|
.maxTessellationPatchSize = 0,
|
|
|
|
.maxTessellationControlPerVertexInputComponents = 0,
|
|
|
|
.maxTessellationControlPerVertexOutputComponents = 0,
|
|
|
|
.maxTessellationControlPerPatchOutputComponents = 0,
|
|
|
|
.maxTessellationControlTotalOutputComponents = 0,
|
|
|
|
.maxTessellationEvaluationInputComponents = 0,
|
|
|
|
.maxTessellationEvaluationOutputComponents = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxGeometryShaderInvocations = 0, //no geometry shaders
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxGeometryInputComponents = 0,
|
|
|
|
.maxGeometryOutputComponents = 0,
|
|
|
|
.maxGeometryOutputVertices = 0,
|
|
|
|
.maxGeometryTotalOutputComponents = 0,
|
|
|
|
.maxFragmentInputComponents = 128,
|
|
|
|
.maxFragmentOutputAttachments = 8,
|
|
|
|
.maxFragmentDualSrcAttachments = 1,
|
|
|
|
.maxFragmentCombinedOutputResources = 16,
|
2018-11-18 15:21:33 +01:00
|
|
|
.maxComputeSharedMemorySize = 0, //TODO no compute for now, fails CTS
|
|
|
|
.maxComputeWorkGroupCount = {0,0,0}, //TODO no compute for now, fails CTS
|
|
|
|
.maxComputeWorkGroupInvocations = 0, //TODO no compute for now, fails CTS
|
|
|
|
.maxComputeWorkGroupSize = {0,0,0}, //TODO no compute for now, fails CTS
|
2018-05-20 21:41:48 +02:00
|
|
|
.subPixelPrecisionBits = 8,
|
|
|
|
.subTexelPrecisionBits = 8,
|
|
|
|
.mipmapPrecisionBits = 8,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxDrawIndexedIndexValue = 65535,
|
|
|
|
.maxDrawIndirectCount = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxSamplerLodBias = 15,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxSamplerAnisotropy = 1.0,
|
2018-10-21 14:33:02 +02:00
|
|
|
.maxViewports = 1,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxViewportDimensions = {4096,4096},
|
|
|
|
.viewportBoundsRange = {-8192,8192},
|
2018-05-20 21:41:48 +02:00
|
|
|
.viewportSubPixelBits = 8,
|
|
|
|
.minMemoryMapAlignment = 0x40, //TODO
|
|
|
|
.minTexelBufferOffsetAlignment = 0x10,
|
|
|
|
.minUniformBufferOffsetAlignment = 0x100,
|
|
|
|
.minStorageBufferOffsetAlignment = 0x20,
|
|
|
|
.minTexelOffset = -8,
|
|
|
|
.maxTexelOffset = 7,
|
2019-09-29 20:53:08 +02:00
|
|
|
.minTexelGatherOffset = 0,
|
|
|
|
.maxTexelGatherOffset = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.minInterpolationOffset = -0.5,
|
|
|
|
.maxInterpolationOffset = 0.4375,
|
|
|
|
.subPixelInterpolationOffsetBits = 4,
|
2019-09-29 20:53:08 +02:00
|
|
|
.maxFramebufferWidth = 4096,
|
|
|
|
.maxFramebufferHeight = 4096,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxFramebufferLayers = 2048,
|
2019-09-29 20:53:08 +02:00
|
|
|
.framebufferColorSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.framebufferDepthSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.framebufferStencilSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.framebufferNoAttachmentsSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxColorAttachments = 8,
|
2019-09-29 20:53:08 +02:00
|
|
|
.sampledImageColorSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.sampledImageIntegerSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.sampledImageDepthSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.sampledImageStencilSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
|
|
|
.storageImageSampleCounts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT,
|
2018-05-20 21:41:48 +02:00
|
|
|
.maxSampleMaskWords = 1,
|
|
|
|
.timestampComputeAndGraphics = 1,
|
|
|
|
.timestampPeriod = 1,
|
|
|
|
.maxClipDistances = 8,
|
|
|
|
.maxCullDistances = 8,
|
|
|
|
.maxCombinedClipAndCullDistances = 8,
|
2018-11-18 15:21:33 +01:00
|
|
|
.discreteQueuePriorities = 1, //TODO will fail CTS, MIN is 2
|
|
|
|
.pointSizeRange = {1, 64}, //TODO [1] has to be 64 - pointSizeGranularity
|
2018-05-20 21:41:48 +02:00
|
|
|
.lineWidthRange = {0.5, 10},
|
2018-11-18 15:21:33 +01:00
|
|
|
.pointSizeGranularity = 0.0, //TODO
|
2018-05-20 21:41:48 +02:00
|
|
|
.lineWidthGranularity = 0.125,
|
|
|
|
.strictLines = 0, //TODO
|
|
|
|
.standardSampleLocations = 1,
|
|
|
|
.optimalBufferCopyOffsetAlignment = 0x1,
|
|
|
|
.optimalBufferCopyRowPitchAlignment = 0x1,
|
|
|
|
.nonCoherentAtomSize = 0x40
|
|
|
|
};
|
|
|
|
|
2018-08-26 15:11:43 +02:00
|
|
|
static VkPhysicalDeviceFeatures _features =
|
2018-05-20 21:41:48 +02:00
|
|
|
{
|
|
|
|
//TODO this might change
|
2019-09-29 20:53:08 +02:00
|
|
|
.robustBufferAccess = 0,
|
|
|
|
.fullDrawIndexUint32 = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.imageCubeArray = 1, //TODO
|
|
|
|
.independentBlend = 1,
|
|
|
|
.geometryShader = 0,
|
|
|
|
.tessellationShader = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.sampleRateShading = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.dualSrcBlend = 1,
|
2019-09-29 20:53:08 +02:00
|
|
|
.logicOp = 0, //TODO
|
|
|
|
.multiDrawIndirect = 0,
|
|
|
|
.drawIndirectFirstInstance = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.depthClamp = 1,
|
|
|
|
.depthBiasClamp = 1,
|
|
|
|
.fillModeNonSolid = 1,
|
|
|
|
.depthBounds = 1,
|
|
|
|
.wideLines = 1,
|
|
|
|
.largePoints = 1,
|
|
|
|
.alphaToOne = 1,
|
2018-11-18 15:21:33 +01:00
|
|
|
.multiViewport = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.samplerAnisotropy = 0,
|
|
|
|
.textureCompressionETC2 = 1,
|
2018-05-20 21:41:48 +02:00
|
|
|
.textureCompressionASTC_LDR = 0,
|
|
|
|
.textureCompressionBC = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.occlusionQueryPrecise = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.pipelineStatisticsQuery = 1,
|
2019-09-29 20:53:08 +02:00
|
|
|
.vertexPipelineStoresAndAtomics = 0,
|
|
|
|
.fragmentStoresAndAtomics = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.shaderTessellationAndGeometryPointSize = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.shaderImageGatherExtended = 0,
|
|
|
|
.shaderStorageImageExtendedFormats = 0,
|
|
|
|
.shaderStorageImageMultisample = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.shaderStorageImageReadWithoutFormat = 0,
|
|
|
|
.shaderStorageImageWriteWithoutFormat = 0,
|
|
|
|
.shaderUniformBufferArrayDynamicIndexing = 1,
|
|
|
|
.shaderSampledImageArrayDynamicIndexing = 1,
|
|
|
|
.shaderStorageBufferArrayDynamicIndexing = 1,
|
|
|
|
.shaderStorageImageArrayDynamicIndexing = 1,
|
|
|
|
.shaderClipDistance = 1,
|
|
|
|
.shaderCullDistance = 1,
|
|
|
|
.shaderFloat64 = 0,
|
|
|
|
.shaderInt64 = 0,
|
2020-04-26 21:21:18 +02:00
|
|
|
.shaderInt16 = 1,
|
2019-09-29 20:53:08 +02:00
|
|
|
.shaderResourceResidency = 0,
|
|
|
|
.shaderResourceMinLod = 0,
|
|
|
|
.sparseBinding = 0,
|
|
|
|
.sparseResidencyBuffer = 0,
|
|
|
|
.sparseResidencyImage2D = 0,
|
|
|
|
.sparseResidencyImage3D = 0,
|
|
|
|
.sparseResidency2Samples = 0,
|
|
|
|
.sparseResidency4Samples = 0,
|
|
|
|
.sparseResidency8Samples = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.sparseResidency16Samples = 0,
|
2019-09-29 20:53:08 +02:00
|
|
|
.sparseResidencyAliased = 0,
|
|
|
|
.variableMultisampleRate = 0,
|
2018-05-20 21:41:48 +02:00
|
|
|
.inheritedQueries = 1,
|
|
|
|
};
|
|
|
|
#define numFeatures (sizeof(_features)/sizeof(VkBool32))
|
|
|
|
|
2018-08-26 15:11:43 +02:00
|
|
|
static VkQueueFamilyProperties _queueFamilyProperties[] =
|
2018-05-20 21:41:48 +02:00
|
|
|
{
|
|
|
|
{
|
|
|
|
.queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT | VK_QUEUE_SPARSE_BINDING_BIT,
|
|
|
|
.queueCount = 1,
|
2018-08-25 14:50:03 +02:00
|
|
|
.timestampValidBits = 64, //wait timeout is 64bits
|
2018-05-20 21:41:48 +02:00
|
|
|
.minImageTransferGranularity = {1, 1, 1}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#define numQueueFamilies (sizeof(_queueFamilyProperties)/sizeof(VkQueueFamilyProperties))
|
|
|
|
|
2018-08-26 15:11:43 +02:00
|
|
|
static VkSurfaceFormatKHR supportedSurfaceFormats[] =
|
2018-08-25 14:50:03 +02:00
|
|
|
{
|
|
|
|
{
|
2020-05-31 15:18:32 +02:00
|
|
|
.format = VK_FORMAT_B8G8R8A8_UNORM,
|
2018-08-25 14:50:03 +02:00
|
|
|
.colorSpace = VK_COLOR_SPACE_PASS_THROUGH_EXT
|
2019-09-29 20:53:08 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.format = VK_FORMAT_B5G6R5_UNORM_PACK16,
|
|
|
|
.colorSpace = VK_COLOR_SPACE_PASS_THROUGH_EXT
|
2018-08-25 14:50:03 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
#define numSupportedSurfaceFormats (sizeof(supportedSurfaceFormats) / sizeof(VkSurfaceFormatKHR))
|
|
|
|
|
2018-05-20 21:41:48 +02:00
|
|
|
static VkExtensionProperties instanceExtensions[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_surface",
|
|
|
|
.specVersion = 25
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_display",
|
|
|
|
.specVersion = 21
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_EXT_debug_report",
|
|
|
|
.specVersion = 9
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_EXT_debug_utils",
|
|
|
|
.specVersion = 1
|
2020-04-16 01:04:41 +02:00
|
|
|
}
|
2018-05-20 21:41:48 +02:00
|
|
|
};
|
|
|
|
#define numInstanceExtensions (sizeof(instanceExtensions) / sizeof(VkExtensionProperties))
|
|
|
|
|
|
|
|
static VkExtensionProperties deviceExtensions[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_display_swapchain",
|
|
|
|
.specVersion = 9
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_maintenance1",
|
|
|
|
.specVersion = 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_maintenance2",
|
|
|
|
.specVersion = 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_maintenance3",
|
|
|
|
.specVersion = 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_swapchain",
|
|
|
|
.specVersion = 70
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_EXT_debug_marker",
|
|
|
|
.specVersion = 4
|
2019-04-10 22:13:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_driver_properties",
|
|
|
|
.specVersion = 1
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.extensionName = "VK_KHR_performance_query",
|
|
|
|
.specVersion = 1
|
2018-05-20 21:41:48 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
#define numDeviceExtensions (sizeof(deviceExtensions) / sizeof(VkExtensionProperties))
|
2018-09-09 16:45:07 +02:00
|
|
|
|
|
|
|
static VkMemoryType memoryTypes[] =
|
|
|
|
{
|
2019-09-29 20:53:08 +02:00
|
|
|
//TODO might change this
|
2018-09-09 16:45:07 +02:00
|
|
|
{
|
|
|
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
|
|
|
0
|
|
|
|
},
|
|
|
|
};
|
|
|
|
#define numMemoryTypes (sizeof(memoryTypes) / sizeof(VkMemoryType))
|
|
|
|
|
|
|
|
static VkMemoryHeap memoryHeaps[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
0, //will be filled from /proc/meminfo
|
|
|
|
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#define numMemoryHeaps (sizeof(memoryHeaps) / sizeof(VkMemoryHeap))
|
2018-11-18 15:21:33 +01:00
|
|
|
|
2019-09-29 20:53:08 +02:00
|
|
|
static VkFormat supportedFormats[] =
|
2019-02-09 17:18:15 +01:00
|
|
|
{
|
2019-09-29 20:53:08 +02:00
|
|
|
VK_FORMAT_R16G16B16A16_SFLOAT,
|
|
|
|
VK_FORMAT_R8G8B8_UNORM,
|
2020-05-31 15:18:32 +02:00
|
|
|
VK_FORMAT_B8G8R8_UNORM,
|
2019-09-29 20:53:08 +02:00
|
|
|
VK_FORMAT_R8G8B8A8_UNORM,
|
2020-05-31 15:18:32 +02:00
|
|
|
VK_FORMAT_B8G8R8A8_UNORM,
|
2019-09-29 20:53:08 +02:00
|
|
|
VK_FORMAT_R5G5B5A1_UNORM_PACK16,
|
|
|
|
VK_FORMAT_R4G4B4A4_UNORM_PACK16,
|
|
|
|
VK_FORMAT_R5G6B5_UNORM_PACK16,
|
2020-05-31 15:18:32 +02:00
|
|
|
VK_FORMAT_B5G6R5_UNORM_PACK16,
|
2019-09-29 20:53:08 +02:00
|
|
|
VK_FORMAT_R8G8_UNORM,
|
|
|
|
VK_FORMAT_R16_SFLOAT,
|
|
|
|
VK_FORMAT_R16_SINT,
|
|
|
|
VK_FORMAT_R8_UNORM,
|
|
|
|
VK_FORMAT_R8_SINT,
|
|
|
|
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
|
|
|
|
VK_FORMAT_G8B8G8R8_422_UNORM
|
2019-02-09 17:18:15 +01:00
|
|
|
};
|
2019-09-29 20:53:08 +02:00
|
|
|
#define numSupportedFormats (sizeof(supportedFormats)/sizeof(VkFormat))
|
2019-02-09 17:18:15 +01:00
|
|
|
|
2020-02-22 22:50:53 +01:00
|
|
|
static VkPerformanceCounterKHR performanceCounterTypes[] =
|
|
|
|
{ //TODO UUID
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.unit = VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR,
|
|
|
|
.scope = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR,
|
|
|
|
.storage = VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static VkPerformanceCounterDescriptionKHR performanceCounterDescriptions[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.name = "FRONT_END_PIPELINE_VALID_PRIMS_NO_RENDER",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "FEP Valid primitives that result in no rendered pixels, for all rendered tiles"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "FRONT_END_PIPELINE_VALID_PRIMS_RENDER",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "FEP Valid primitives for all rendered tiles. (primitives may be counted in more than one tile)"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "FRONT_END_PIPELINE_CLIPPED_QUADS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "FEP Early-Z/Near/Far clipped quads"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "FRONT_END_PIPELINE_VALID_QUADS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "FEP Valid quads"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_NOT_PASSING_STENCIL",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with no pixels passing the stencil test"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_NOT_PASSING_Z_AND_STENCIL",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with no pixels passing the Z and stencil tests"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_PASSING_Z_AND_STENCIL",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with any pixels passing the Z and stencil tests"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_ZERO_COVERAGE",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with all pixels having zero coverage"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_NON_ZERO_COVERAGE",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with any pixels having non-zero coverage"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TILE_BUFFER_QUADS_WRITTEN_TO_COLOR_BUF",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TLB Quads with valid pixels written to color buffer"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "PLB_PRIMS_OUTSIDE_VIEWPORT",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "PTB Primitives discarded by being outside the viewport"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "PLB_PRIMS_NEED_CLIPPING",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "PTB Primitives that need clipping"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "PRIMITIVE_SETUP_ENGINE_PRIMS_REVERSED",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "PSE Primitives that are discarded because they are reversed"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_IDLE_CYCLES",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total idle clock cycles for all QPUs"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_VERTEX_COORD_SHADING",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs doing vertex/coordinate shading"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_FRAGMENT_SHADING",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs doing fragment shading"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_EXEC_VALID_INST",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs executing valid instructions"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_WAITING_TMUS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs stalled waiting for TMUs"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_WAITING_SCOREBOARD",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs stalled waiting for Scoreboard"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_CLK_CYCLES_WAITING_VARYINGS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total clock cycles for all QPUs stalled waiting for Varyings"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_INST_CACHE_HIT",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total instruction cache hits for all slices"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_INST_CACHE_MISS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total instruction cache misses for all slices"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_UNIFORM_CACHE_HIT",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total uniforms cache hits for all slices"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "QUAD_PROCESSOR_UNIT_TOTAL_UNIFORM_CACHE_MISS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "QPU Total uniforms cache misses for all slices"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TEXTURE_MEMORY_LOOKUP_UNIT_TOTAL_TEXT_QUADS_PROCESSED",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TMU Total texture quads processed"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "TEXTURE_MEMORY_LOOKUP_UNIT_TOTAL_TEXT_CACHE_MISS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "TMU Total texture cache misses (number of fetches from memory/L2cache)"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "VERTEX_PIPE_MEMORY_TOTAL_CLK_CYCLES_VERTEX_DMA_WRITE_STALLED",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "VPM Total clock cycles VDW is stalled waiting for VPM access"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "VERTEX_PIPE_MEMORY_TOTAL_CLK_CYCLES_VERTEX_DMA_STALLED",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "VPM Total clock cycles VCD is stalled waiting for VPM access"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "L2C_TOTAL_L2_CACHE_HIT",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "L2C Total Level 2 cache hits"
|
2020-02-22 22:50:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "L2C_TOTAL_L2_CACHE_MISS",
|
2020-02-24 22:45:47 +01:00
|
|
|
.description = "L2C Total Level 2 cache misses"
|
2020-02-22 22:50:53 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-02-23 14:29:01 +01:00
|
|
|
#define numPerformanceCounterTypes (sizeof(performanceCounterTypes)/sizeof(VkPerformanceCounterKHR))
|
2020-02-22 22:50:53 +01:00
|
|
|
|
2020-04-26 21:21:18 +02:00
|
|
|
static VkPresentModeKHR supportedPresentModes[] =
|
|
|
|
{
|
2020-05-31 16:00:45 +02:00
|
|
|
VK_PRESENT_MODE_IMMEDIATE_KHR,
|
|
|
|
VK_PRESENT_MODE_FIFO_KHR
|
2020-04-26 21:21:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define numSupportedPresentModes (sizeof(supportedPresentModes)/sizeof(VkPresentModeKHR))
|
|
|
|
|
2018-11-18 15:21:33 +01:00
|
|
|
#define VK_DRIVER_VERSION VK_MAKE_VERSION(1, 1, 0)
|