vk: Add support for GetPhysicalDeviceLimits
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 9 Jul 2015 22:38:30 +0000 (15:38 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 9 Jul 2015 23:14:37 +0000 (16:14 -0700)
include/vulkan/vulkan.h
src/vulkan/device.c

index 4f467bb99acba3d99aa1cc3b917c7a2d405fc711..173a697ff62bbf77db15e41841559f5ef39428db 100644 (file)
@@ -1201,6 +1201,100 @@ typedef struct {
     VkFormatFeatureFlags                        optimalTilingFeatures;
 } VkFormatProperties;
 
+typedef struct {
+    uint32_t                                    maxImageDimension1D;
+    uint32_t                                    maxImageDimension2D;
+    uint32_t                                    maxImageDimension3D;
+    uint32_t                                    maxImageDimensionCube;
+    uint32_t                                    maxImageArrayLayers;
+    uint32_t                                    maxTexelBufferSize;
+    uint32_t                                    maxUniformBufferSize;
+    uint32_t                                    maxStorageBufferSize;
+    uint32_t                                    maxPushConstantsSize;
+    uint32_t                                    maxMemoryAllocationCount;
+    uint32_t                                    maxBoundDescriptorSets;
+    uint32_t                                    maxDescriptorSets;
+    uint32_t                                    maxPerStageDescriptorSamplers;
+    uint32_t                                    maxPerStageDescriptorUniformBuffers;
+    uint32_t                                    maxPerStageDescriptorStorageBuffers;
+    uint32_t                                    maxPerStageDescriptorSampledImages;
+    uint32_t                                    maxPerStageDescriptorStorageImages;
+    uint32_t                                    maxDescriptorSetSamplers;
+    uint32_t                                    maxDescriptorSetUniformBuffers;
+    uint32_t                                    maxDescriptorSetStorageBuffers;
+    uint32_t                                    maxDescriptorSetSampledImages;
+    uint32_t                                    maxDescriptorSetStorageImages;
+    uint32_t                                    maxVertexInputAttributes;
+    uint32_t                                    maxVertexInputAttributeOffset;
+    uint32_t                                    maxVertexInputBindingStride;
+    uint32_t                                    maxVertexOutputComponents;
+    uint32_t                                    maxTessGenLevel;
+    uint32_t                                    maxTessPatchSize;
+    uint32_t                                    maxTessControlPerVertexInputComponents;
+    uint32_t                                    maxTessControlPerVertexOutputComponents;
+    uint32_t                                    maxTessControlPerPatchOutputComponents;
+    uint32_t                                    maxTessControlTotalOutputComponents;
+    uint32_t                                    maxTessEvaluationInputComponents;
+    uint32_t                                    maxTessEvaluationOutputComponents;
+    uint32_t                                    maxGeometryShaderInvocations;
+    uint32_t                                    maxGeometryInputComponents;
+    uint32_t                                    maxGeometryOutputComponents;
+    uint32_t                                    maxGeometryOutputVertices;
+    uint32_t                                    maxGeometryTotalOutputComponents;
+    uint32_t                                    maxFragmentInputComponents;
+    uint32_t                                    maxFragmentOutputBuffers;
+    uint32_t                                    maxFragmentDualSourceBuffers;
+    uint32_t                                    maxFragmentCombinedOutputResources;
+    uint32_t                                    maxComputeSharedMemorySize;
+    uint32_t                                    maxComputeWorkGroupCount[3];
+    uint32_t                                    maxComputeWorkGroupInvocations;
+    uint32_t                                    maxComputeWorkGroupSize[3];
+    uint32_t                                    subPixelPrecisionBits;
+    uint32_t                                    subTexelPrecisionBits;
+    uint32_t                                    mipmapPrecisionBits;
+    uint32_t                                    maxDrawIndexedIndexValue;
+    uint32_t                                    maxDrawIndirectInstanceCount;
+    bool32_t                                    primitiveRestartForPatches;
+    float                                       maxSamplerLodBias;
+    uint32_t                                    maxSamplerAnisotropy;
+    uint32_t                                    maxViewports;
+    uint32_t                                    maxDynamicViewportStates;
+    uint32_t                                    maxViewportDimensions[2];
+    float                                       viewportBoundsRange[2];
+    uint32_t                                    viewportSubPixelBits;
+    uint32_t                                    minMemoryMapAlignment;
+    uint32_t                                    minTexelBufferOffsetAlignment;
+    uint32_t                                    minUniformBufferOffsetAlignment;
+    uint32_t                                    minStorageBufferOffsetAlignment;
+    uint32_t                                    minTexelOffset;
+    uint32_t                                    maxTexelOffset;
+    uint32_t                                    minTexelGatherOffset;
+    uint32_t                                    maxTexelGatherOffset;
+    float                                       minInterpolationOffset;
+    float                                       maxInterpolationOffset;
+    uint32_t                                    subPixelInterpolationOffsetBits;
+    uint32_t                                    maxFramebufferWidth;
+    uint32_t                                    maxFramebufferHeight;
+    uint32_t                                    maxFramebufferLayers;
+    uint32_t                                    maxFramebufferColorSamples;
+    uint32_t                                    maxFramebufferDepthSamples;
+    uint32_t                                    maxFramebufferStencilSamples;
+    uint32_t                                    maxColorAttachments;
+    uint32_t                                    maxSampledImageColorSamples;
+    uint32_t                                    maxSampledImageDepthSamples;
+    uint32_t                                    maxSampledImageIntegerSamples;
+    uint32_t                                    maxStorageImageSamples;
+    uint32_t                                    maxSampleMaskWords;
+    uint64_t                                    timestampFrequency;
+    uint32_t                                    maxClipDistances;
+    uint32_t                                    maxCullDistances;
+    uint32_t                                    maxCombinedClipAndCullDistances;
+    float                                       pointSizeRange[2];
+    float                                       lineWidthRange[2];
+    float                                       pointSizeGranularity;
+    float                                       lineWidthGranularity;
+} VkPhysicalDeviceLimits;
+
 typedef struct {
     uint32_t                                    apiVersion;
     uint32_t                                    driverVersion;
@@ -1924,6 +2018,7 @@ typedef VkResult (VKAPI *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, ui
 typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
 typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceInfo)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData);
 typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceFormatInfo)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatInfo);
+typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceLimits)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceLimits* pLimits);
 typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
 typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName);
 typedef VkResult (VKAPI *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice);
@@ -2059,6 +2154,10 @@ VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
     VkFormat                                    format,
     VkFormatProperties*                         pFormatInfo);
 
+VkResult VKAPI vkGetPhysicalDeviceLimits(
+    VkPhysicalDevice                            physicalDevice,
+    VkPhysicalDeviceLimits*                     pLimits);
+
 PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(
     VkInstance                                  instance,
     const char*                                 pName);
index 7df4374c153da2951f45a2d96e94334fe6d49d6d..3f39f61a0dae483b5533b49d126d38454409ecea 100644 (file)
@@ -253,6 +253,120 @@ VkResult anv_GetPhysicalDeviceFeatures(
    return VK_SUCCESS;
 }
 
+VkResult anv_GetPhysicalDeviceLimits(
+    VkPhysicalDevice                            physicalDevice,
+    VkPhysicalDeviceLimits*                     pLimits)
+{
+   ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
+   const struct brw_device_info *devinfo = physical_device->info;
+
+   anv_finishme("Get correct values for PhysicalDeviceLimits");
+
+   *pLimits = (VkPhysicalDeviceLimits) {
+      .maxImageDimension1D                      = (1 << 14),
+      .maxImageDimension2D                      = (1 << 14),
+      .maxImageDimension3D                      = (1 << 10),
+      .maxImageDimensionCube                    = (1 << 14),
+      .maxImageArrayLayers                      = (1 << 10),
+      .maxTexelBufferSize                       = (1 << 14),
+      .maxUniformBufferSize                     = UINT32_MAX,
+      .maxStorageBufferSize                     = UINT32_MAX,
+      .maxPushConstantsSize                     = 128,
+      .maxMemoryAllocationCount                 = UINT32_MAX,
+      .maxBoundDescriptorSets                   = MAX_SETS,
+      .maxDescriptorSets                        = UINT32_MAX,
+      .maxPerStageDescriptorSamplers            = 64,
+      .maxPerStageDescriptorUniformBuffers      = 64,
+      .maxPerStageDescriptorStorageBuffers      = 64,
+      .maxPerStageDescriptorSampledImages       = 64,
+      .maxPerStageDescriptorStorageImages       = 64,
+      .maxDescriptorSetSamplers                 = 256,
+      .maxDescriptorSetUniformBuffers           = 256,
+      .maxDescriptorSetStorageBuffers           = 256,
+      .maxDescriptorSetSampledImages            = 256,
+      .maxDescriptorSetStorageImages            = 256,
+      .maxVertexInputAttributes                 = 32,
+      .maxVertexInputAttributeOffset            = 256,
+      .maxVertexInputBindingStride              = 256,
+      .maxVertexOutputComponents                = 32,
+      .maxTessGenLevel                          = 0,
+      .maxTessPatchSize                         = 0,
+      .maxTessControlPerVertexInputComponents   = 0,
+      .maxTessControlPerVertexOutputComponents  = 0,
+      .maxTessControlPerPatchOutputComponents   = 0,
+      .maxTessControlTotalOutputComponents      = 0,
+      .maxTessEvaluationInputComponents         = 0,
+      .maxTessEvaluationOutputComponents        = 0,
+      .maxGeometryShaderInvocations             = 6,
+      .maxGeometryInputComponents               = 16,
+      .maxGeometryOutputComponents              = 16,
+      .maxGeometryOutputVertices                = 16,
+      .maxGeometryTotalOutputComponents         = 16,
+      .maxFragmentInputComponents               = 16,
+      .maxFragmentOutputBuffers                 = 8,
+      .maxFragmentDualSourceBuffers             = 2,
+      .maxFragmentCombinedOutputResources       = 8,
+      .maxComputeSharedMemorySize               = 1024,
+      .maxComputeWorkGroupCount = {
+         16 * devinfo->max_cs_threads,
+         16 * devinfo->max_cs_threads,
+         16 * devinfo->max_cs_threads,
+      },
+      .maxComputeWorkGroupInvocations           = 16 * devinfo->max_cs_threads,
+      .maxComputeWorkGroupSize = {
+         16 * devinfo->max_cs_threads,
+         16 * devinfo->max_cs_threads,
+         16 * devinfo->max_cs_threads,
+      },
+      .subPixelPrecisionBits                    = 4 /* FIXME */,
+      .subTexelPrecisionBits                    = 4 /* FIXME */,
+      .mipmapPrecisionBits                      = 4 /* FIXME */,
+      .maxDrawIndexedIndexValue                 = UINT32_MAX,
+      .maxDrawIndirectInstanceCount             = UINT32_MAX,
+      .primitiveRestartForPatches               = UINT32_MAX,
+      .maxSamplerLodBias                        = 16,
+      .maxSamplerAnisotropy                     = 16,
+      .maxViewports                             = 32,
+      .maxDynamicViewportStates                 = UINT32_MAX,
+      .maxViewportDimensions                    = { (1 << 14), (1 << 14) },
+      .viewportBoundsRange                      = { -1.0, 1.0 }, /* FIXME */
+      .viewportSubPixelBits                     = 13, /* We take a float? */
+      .minMemoryMapAlignment                    = 64, /* A cache line */
+      .minTexelBufferOffsetAlignment            = 1,
+      .minUniformBufferOffsetAlignment          = 1,
+      .minStorageBufferOffsetAlignment          = 1,
+      .minTexelOffset                           = 0, /* FIXME */
+      .maxTexelOffset                           = 0, /* FIXME */
+      .minTexelGatherOffset                     = 0, /* FIXME */
+      .maxTexelGatherOffset                     = 0, /* FIXME */
+      .minInterpolationOffset                   = 0, /* FIXME */
+      .maxInterpolationOffset                   = 0, /* FIXME */
+      .subPixelInterpolationOffsetBits          = 0, /* FIXME */
+      .maxFramebufferWidth                      = (1 << 14),
+      .maxFramebufferHeight                     = (1 << 14),
+      .maxFramebufferLayers                     = (1 << 10),
+      .maxFramebufferColorSamples               = 8,
+      .maxFramebufferDepthSamples               = 8,
+      .maxFramebufferStencilSamples             = 8,
+      .maxColorAttachments                      = MAX_RTS,
+      .maxSampledImageColorSamples              = 8,
+      .maxSampledImageDepthSamples              = 8,
+      .maxSampledImageIntegerSamples            = 1,
+      .maxStorageImageSamples                   = 1,
+      .maxSampleMaskWords                       = 1,
+      .timestampFrequency                       = 0 /* FIXME */,
+      .maxClipDistances                         = 0 /* FIXME */,
+      .maxCullDistances                         = 0 /* FIXME */,
+      .maxCombinedClipAndCullDistances          = 0 /* FIXME */,
+      .pointSizeRange                           = { 0.125, 255.875 },
+      .lineWidthRange                           = { 0.0, 7.9921875 },
+      .pointSizeGranularity                     = (1.0 / 8.0),
+      .lineWidthGranularity                     = (1.0 / 128.0),
+   };
+
+   return VK_SUCCESS;
+}
+
 VkResult anv_GetPhysicalDeviceInfo(
     VkPhysicalDevice                            physicalDevice,
     VkPhysicalDeviceInfoType                    infoType,