diff options
| author | Dustin Graves <dustin@lunarg.com> | 2016-05-11 18:31:44 -0600 |
|---|---|---|
| committer | Dustin Graves <dustin@lunarg.com> | 2016-05-12 11:30:00 -0600 |
| commit | 37c4c06347ad58d2a259b693e17efc7d646449fc (patch) | |
| tree | 5fb6748f6b20f6ba51f5061c473defc1d39f8985 /layers/parameter_validation_utils.h | |
| parent | 243c5fb0b0d4237f9bd5c8fed01dfd87c126dc2e (diff) | |
| download | usermoji-37c4c06347ad58d2a259b693e17efc7d646449fc.tar.xz | |
layers: Additional vkCreateImage param validation
Add more vkCreateImage parameter validation, based on the valid usage
section for VkImageCreateInfo.
Issues-Addressed: GitHub #354
Change-Id: Ia978a64f6c03c3cf115a07e707099253104e04a1
Diffstat (limited to 'layers/parameter_validation_utils.h')
| -rw-r--r-- | layers/parameter_validation_utils.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/layers/parameter_validation_utils.h b/layers/parameter_validation_utils.h index 6660ab3d..1683f31f 100644 --- a/layers/parameter_validation_utils.h +++ b/layers/parameter_validation_utils.h @@ -85,6 +85,32 @@ template <> bool is_extension_added_token(VkSamplerAddressMode value) { } /** +* Validate a minimum value. +* +* Verify that the specified value is greater than the specified lower bound. +* +* @param report_data debug_report_data object for routing validation messages. +* @param api_name Name of API call being validated. +* @param parameter_name Name of parameter being validated. +* @param value Value to validate. +* @param lower_bound Lower bound value to use for validation. +* @return Boolean value indicating that the call should be skipped. +*/ +template <typename T> +bool ValidateGreaterThan(debug_report_data *report_data, const char *api_name, const char *parameter_name, T value, + T lower_bound) { + bool skip_call = false; + + if (value <= lower_bound) { + skip_call |= + log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, + LayerName, "%s: parameter %s must be greater than %d", api_name, parameter_name, lower_bound); + } + + return skip_call; +} + +/** * Validate a required pointer. * * Verify that a required pointer is not NULL. |
