aboutsummaryrefslogtreecommitdiff
path: root/layers/vk_layer_utils.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-01-13 10:23:15 -0700
committerMark Lobodzinski <mark@lunarg.com>2016-01-18 13:31:19 -0700
commitd2818e486c9eff3e9e97499c0407491601be5a6e (patch)
treebaa8d6c62a72b488f097d7067b53043d2d748a92 /layers/vk_layer_utils.cpp
parent3ca0c82c23d95f2173d5fa93029c74597a04976d (diff)
downloadusermoji-d2818e486c9eff3e9e97499c0407491601be5a6e.tar.xz
layers: LX257, Validate Uniform/Storage buffer offset alignments
Diffstat (limited to 'layers/vk_layer_utils.cpp')
-rw-r--r--layers/vk_layer_utils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp
index 4eb1e905..cfa2f9b7 100644
--- a/layers/vk_layer_utils.cpp
+++ b/layers/vk_layer_utils.cpp
@@ -584,3 +584,15 @@ unsigned int vk_format_get_channel_count(VkFormat format)
{
return vk_format_table[format].channel_count;
}
+
+// Perform a zero-tolerant modulo operation
+VkDeviceSize vk_safe_modulo(VkDeviceSize dividend, VkDeviceSize divisor)
+{
+ VkDeviceSize result = 0;
+ if (divisor != 0) {
+ result = dividend % divisor;
+ }
+ return result;
+}
+
+