From: Samuel Pitoiset Date: Mon, 18 Sep 2017 09:42:53 +0000 (+0200) Subject: radv: add some assertions in vkCmdSetViewport() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ad1f20cd02b1b362d506924a52b7538f9b55d6a;p=mesa.git radv: add some assertions in vkCmdSetViewport() To check some valid usage requirements. Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 07c16cb4fbd..5644c1584e7 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;