radv: add more constants to avoid using magic numbers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 26 Nov 2019 07:32:02 +0000 (08:32 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 28 Nov 2019 09:59:14 +0000 (10:59 +0100)
Trivial.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_constants.h
src/amd/vulkan/radv_device.c

index 6abcf08520655941e90dff8d36c4cf22ab49e108..a12e79e96235b1d29f6da484f45d94ccdb335229 100644 (file)
 
 #define RADV_NUM_PHYSICAL_VGPRS 256
 
+/* Make sure everything is addressable by a signed 32-bit int, and
+ * our largest descriptors are 96 bytes.
+ */
+#define RADV_MAX_PER_SET_DESCRIPTORS ((1ull << 31 ) / 96)
+
+/* Our buffer size fields allow only this much */
+#define RADV_MAX_MEMORY_ALLOCATION_SIZE 0xFFFFFFFFull
+
+/* Number of invocations in each subgroup. */
+#define RADV_SUBGROUP_SIZE 64
+
 #endif /* RADV_CONSTANTS_H */
 
index 71b529c07a56a19fe9a936109f97d2434c4acdef..f2c802f9210b83d19d112fa56b474edacd919e7e 100644 (file)
@@ -1393,7 +1393,7 @@ void radv_GetPhysicalDeviceProperties2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: {
                        VkPhysicalDeviceSubgroupProperties *properties =
                            (VkPhysicalDeviceSubgroupProperties*)ext;
-                       properties->subgroupSize = 64;
+                       properties->subgroupSize = RADV_SUBGROUP_SIZE;
                        properties->supportedStages = VK_SHADER_STAGE_ALL;
                        properties->supportedOperations =
                                                        VK_SUBGROUP_FEATURE_BASIC_BIT |
@@ -1414,11 +1414,8 @@ void radv_GetPhysicalDeviceProperties2(
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: {
                        VkPhysicalDeviceMaintenance3Properties *properties =
                            (VkPhysicalDeviceMaintenance3Properties*)ext;
-                       /* Make sure everything is addressable by a signed 32-bit int, and
-                        * our largest descriptors are 96 bytes. */
-                       properties->maxPerSetDescriptors = (1ull << 31) / 96;
-                       /* Our buffer size fields allow only this much */
-                       properties->maxMemoryAllocationSize = 0xFFFFFFFFull;
+                       properties->maxPerSetDescriptors = RADV_MAX_PER_SET_DESCRIPTORS;
+                       properties->maxMemoryAllocationSize = RADV_MAX_MEMORY_ALLOCATION_SIZE;
                        break;
                }
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT: {