From: Jason Ekstrand Date: Thu, 14 Jan 2016 14:50:18 +0000 (-0800) Subject: anv/cmd_buffer: Fix setting of viewport/scissor count X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=08735ba91c9aa2cdfe138fdc314f8071cb0b5617;p=mesa.git anv/cmd_buffer: Fix setting of viewport/scissor count --- diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index ae33822b633..3df34a511eb 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -383,7 +383,10 @@ void anv_CmdSetViewport( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); - cmd_buffer->state.dynamic.viewport.count = viewportCount; + const uint32_t total_count = firstViewport + viewportCount; + if (cmd_buffer->state.dynamic.viewport.count < total_count); + cmd_buffer->state.dynamic.viewport.count = total_count; + memcpy(cmd_buffer->state.dynamic.viewport.viewports + firstViewport, pViewports, viewportCount * sizeof(*pViewports)); @@ -398,7 +401,10 @@ void anv_CmdSetScissor( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); - cmd_buffer->state.dynamic.scissor.count = scissorCount; + const uint32_t total_count = firstScissor + scissorCount; + if (cmd_buffer->state.dynamic.scissor.count < total_count); + cmd_buffer->state.dynamic.scissor.count = total_count; + memcpy(cmd_buffer->state.dynamic.scissor.scissors + firstScissor, pScissors, scissorCount * sizeof(*pScissors));