anv/cmd_buffer: Fix setting of viewport/scissor count
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 14 Jan 2016 14:50:18 +0000 (06:50 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 14 Jan 2016 15:30:46 +0000 (07:30 -0800)
src/vulkan/anv_cmd_buffer.c

index ae33822b63322b302f240977efea374ef4add6f1..3df34a511eb55c38dae6af5979c23c6472413548 100644 (file)
@@ -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));