[Mesa-dev] [PATCH 1/4] radv: add some assertions in vkCmdSetViewport()
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Sep 18 09:52:09 UTC 2017
To check some valid usage requirements.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_cmd_buffer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 4ba552ebcb..3877c17aed 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2497,8 +2497,11 @@ void radv_CmdSetViewport(
const VkViewport* pViewports)
{
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
-
const uint32_t total_count = firstViewport + viewportCount;
+
+ assert(firstViewport < MAX_VIEWPORTS);
+ assert(total_count >= 1 && total_count <= MAX_VIEWPORTS);
+
if (cmd_buffer->state.dynamic.viewport.count < total_count)
cmd_buffer->state.dynamic.viewport.count = total_count;
--
2.14.1
More information about the mesa-dev
mailing list