Mesa (master): radv: add more constants to avoid using magic numbers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 28 10:24:29 UTC 2019
Module: Mesa
Branch: master
Commit: d347f2805d8d8c37eb3e50483346bff9583c8e48
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d347f2805d8d8c37eb3e50483346bff9583c8e48
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Tue Nov 26 08:32:02 2019 +0100
radv: add more constants to avoid using magic numbers
Trivial.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
src/amd/vulkan/radv_constants.h | 11 +++++++++++
src/amd/vulkan/radv_device.c | 9 +++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/amd/vulkan/radv_constants.h b/src/amd/vulkan/radv_constants.h
index 6abcf085206..a12e79e9623 100644
--- a/src/amd/vulkan/radv_constants.h
+++ b/src/amd/vulkan/radv_constants.h
@@ -78,5 +78,16 @@
#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 */
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 71b529c07a5..f2c802f9210 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -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: {
More information about the mesa-commit
mailing list