radv: add some assertions in vkCmdSetViewport()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 18 Sep 2017 09:42:53 +0000 (11:42 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 20 Sep 2017 08:27:32 +0000 (10:27 +0200)
To check some valid usage requirements.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c

index 07c16cb4fbd6ba4de41c8dddffe1df4c86210311..5644c1584e7f479c735c388d5b9c23c196dcadb0 100644 (file)
@@ -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;