viewport.width = (float) demo->width;
viewport.minDepth = (float) 0.0f;
viewport.maxDepth = (float) 1.0f;
+ vkCmdSetViewport(cmd_buf, 1, &viewport);
VkRect2D scissor;
memset(&scissor, 0, sizeof(scissor));
scissor.extent.height = demo->height;
scissor.offset.x = 0;
scissor.offset.y = 0;
- vkCmdSetViewport(cmd_buf, 1, &viewport, &scissor);
+ vkCmdSetScissor(cmd_buf, 1, &scissor);
vkCmdSetLineWidth(cmd_buf, 1.0);
vkCmdSetDepthBias(cmd_buf, 0.0f, 0.0f, 0.0f);
viewport.width = (float) demo->width;
viewport.minDepth = (float) 0.0f;
viewport.maxDepth = (float) 1.0f;
+ vkCmdSetViewport(demo->draw_cmd, 1, &viewport);
VkRect2D scissor;
memset(&scissor, 0, sizeof(scissor));
scissor.extent.height = demo->height;
scissor.offset.x = 0;
scissor.offset.y = 0;
- vkCmdSetViewport(demo->draw_cmd, 1, &viewport, &scissor);
+ vkCmdSetScissor(demo->draw_cmd, 1, &scissor);
vkCmdSetLineWidth(demo->draw_cmd, 1.0);
vkCmdSetDepthBias(demo->draw_cmd, 0.0f, 0.0f, 0.0f);
NULLDRV_LOG_FUNC;
}
-ICD_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportAndScissorCount, const VkViewport* pViewports, const VkRect2D* pScissors)
+ICD_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports)
+{
+ NULLDRV_LOG_FUNC;
+}
+
+ICD_EXPORT void VKAPI vkCmdSetScissor(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors)
{
NULLDRV_LOG_FUNC;
}
PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
PFN_vkCmdSetViewport CmdSetViewport;
+ PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdSetLineWidth CmdSetLineWidth;
PFN_vkCmdSetDepthBias CmdSetDepthBias;
PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
typedef VkResult (VKAPI *PFN_vkEndCommandBuffer)(VkCmdBuffer cmdBuffer);
typedef VkResult (VKAPI *PFN_vkResetCommandBuffer)(VkCmdBuffer cmdBuffer, VkCmdBufferResetFlags flags);
typedef void (VKAPI *PFN_vkCmdBindPipeline)(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
-typedef void (VKAPI *PFN_vkCmdSetViewport)(VkCmdBuffer cmdBuffer, uint32_t viewportAndScissorCount, const VkViewport* pViewports, const VkRect2D* pScissors);
+typedef void (VKAPI *PFN_vkCmdSetViewport)(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports);
+typedef void (VKAPI *PFN_vkCmdSetScissor)(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors);
typedef void (VKAPI *PFN_vkCmdSetLineWidth)(VkCmdBuffer cmdBuffer, float lineWidth);
typedef void (VKAPI *PFN_vkCmdSetDepthBias)(VkCmdBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias);
typedef void (VKAPI *PFN_vkCmdSetBlendConstants)(VkCmdBuffer cmdBuffer, const float blendConst[4]);
void VKAPI vkCmdSetViewport(
VkCmdBuffer cmdBuffer,
- uint32_t viewportAndScissorCount,
- const VkViewport* pViewports,
+ uint32_t viewportCount,
+ const VkViewport* pViewports);
+
+void VKAPI vkCmdSetScissor(
+ VkCmdBuffer cmdBuffer,
+ uint32_t scissorCount,
const VkRect2D* pScissors);
void VKAPI vkCmdSetLineWidth(
VK_LAYER_EXPORT void VKAPI vkCmdSetViewport(
VkCmdBuffer cmdBuffer,
- uint32_t viewportAndScissorCount,
- const VkViewport* pViewports,
+ uint32_t viewportCount,
+ const VkViewport* pViewports)
+{
+ VkBool32 skipCall = VK_FALSE;
+ /* TODO: Verify viewportCount < maxViewports from VkPhysicalDeviceLimits */
+ if (VK_FALSE == skipCall) {
+ get_dispatch_table(device_limits_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportCount, pViewports);
+ }
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdSetScissor(
+ VkCmdBuffer cmdBuffer,
+ uint32_t scissorCount,
const VkRect2D* pScissors)
{
VkBool32 skipCall = VK_FALSE;
- /* TODO: Verify viewportAndScissorCount < maxViewports from VkPhysicalDeviceLimits */
+ /* TODO: Verify scissorCount < maxViewports from VkPhysicalDeviceLimits */
+ /* TODO: viewportCount and scissorCount must match at draw time */
if (VK_FALSE == skipCall) {
- get_dispatch_table(device_limits_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportAndScissorCount, pViewports, pScissors);
+ get_dispatch_table(device_limits_device_table_map, cmdBuffer)->CmdSetScissor(cmdBuffer, scissorCount, pScissors);
}
}
VK_LAYER_EXPORT void VKAPI vkCmdSetViewport(
VkCmdBuffer cmdBuffer,
- uint32_t viewportAndScissorCount,
- const VkViewport* pViewports,
- const VkRect2D* pScissors)
+ uint32_t viewportCount,
+ const VkViewport* pViewports)
{
VkBool32 skipCall = VK_FALSE;
GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
}
loader_platform_thread_lock_mutex(&globalLock);
pCB->status |= CBSTATUS_VIEWPORT_SET;
- pCB->viewports.resize(viewportAndScissorCount);
- memcpy(pCB->viewports.data(), pViewports, viewportAndScissorCount);
- pCB->scissors.resize(viewportAndScissorCount);
- memcpy(pCB->scissors.data(), pScissors, viewportAndScissorCount);
+ pCB->viewports.resize(viewportCount);
+ memcpy(pCB->viewports.data(), pViewports, viewportCount);
loader_platform_thread_unlock_mutex(&globalLock);
} else {
skipCall |= report_error_no_cb_begin(cmdBuffer, "vkCmdSetViewport()");
}
}
if (VK_FALSE == skipCall)
- get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportAndScissorCount, pViewports, pScissors);
+ get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportCount, pViewports);
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdSetScissor(
+ VkCmdBuffer cmdBuffer,
+ uint32_t scissorCount,
+ const VkRect2D* pScissors)
+{
+ VkBool32 skipCall = VK_FALSE;
+ GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
+ if (pCB) {
+ if (pCB->state == CB_UPDATE_ACTIVE) {
+ updateCBTracking(cmdBuffer);
+ skipCall |= addCmd(pCB, CMD_SETSCISSORSTATE);
+ if (!pCB->activeRenderPass) {
+ skipCall |= log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS",
+ "Incorrect call to vkCmdSetScissor() without an active RenderPass.");
+ }
+ loader_platform_thread_lock_mutex(&globalLock);
+ pCB->status |= CBSTATUS_SCISSOR_SET;
+ pCB->scissors.resize(scissorCount);
+ memcpy(pCB->scissors.data(), pScissors, scissorCount);
+ loader_platform_thread_unlock_mutex(&globalLock);
+ } else {
+ skipCall |= report_error_no_cb_begin(cmdBuffer, "vkCmdSetScissor()");
+ }
+ }
+ if (VK_FALSE == skipCall)
+ get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdSetScissor(cmdBuffer, scissorCount, pScissors);
}
VK_LAYER_EXPORT void VKAPI vkCmdSetLineWidth(VkCmdBuffer cmdBuffer, float lineWidth)
if (pCB->state == CB_UPDATE_ACTIVE) {
pCB->drawCount[DRAW]++;
skipCall |= validate_draw_state(pCB, VK_FALSE);
+ /* TODO: Check that scissor and viewport counts are the same */
// TODO : Need to pass cmdBuffer as srcObj here
skipCall |= log_msg(mdd(cmdBuffer), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, DRAWSTATE_NONE, "DS",
"vkCmdDraw() call #%lu, reporting DS state:", g_drawCount[DRAW]++);
return (PFN_vkVoidFunction) vkCmdBindPipeline;
if (!strcmp(funcName, "vkCmdSetViewport"))
return (PFN_vkVoidFunction) vkCmdSetViewport;
+ if (!strcmp(funcName, "vkCmdSetScissor"))
+ return (PFN_vkVoidFunction) vkCmdSetScissor;
if (!strcmp(funcName, "vkCmdSetLineWidth"))
return (PFN_vkVoidFunction) vkCmdSetLineWidth;
if (!strcmp(funcName, "vkCmdSetDepthBias"))
CMD_BINDPIPELINE,
CMD_BINDPIPELINEDELTA,
CMD_SETVIEWPORTSTATE,
+ CMD_SETSCISSORSTATE,
CMD_SETLINEWIDTHSTATE,
CMD_SETDEPTHBIASSTATE,
CMD_SETBLENDSTATE,
CBSTATUS_STENCIL_WRITE_MASK_SET = 0x00000200, // Stencil write mask has been set
CBSTATUS_STENCIL_REFERENCE_SET = 0x00000400, // Stencil reference has been set
CBSTATUS_INDEX_BUFFER_BOUND = 0x00000800, // Index buffer has been set
+ CBSTATUS_SCISSOR_SET = 0x00001000, // Scissor has been set
} CBStatusFlagBits;
typedef struct stencil_data {
VK_LAYER_EXPORT void VKAPI vkCmdSetViewport(
VkCmdBuffer cmdBuffer,
- uint32_t viewportAndScissorCount,
- const VkViewport* pViewports,
+ uint32_t viewportCount,
+ const VkViewport* pViewports)
+{
+ VkBool32 skipCall = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
+ MT_CB_INFO *pCmdBuf = get_cmd_buf_info(cmdBuffer);
+ if (!pCmdBuf) {
+ skipCall = log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, (uint64_t)cmdBuffer, 0,
+ MEMTRACK_INVALID_CB, "MEM", "Unable to find command buffer object %p, was it ever created?", (void*)cmdBuffer);
+ }
+ loader_platform_thread_unlock_mutex(&globalLock);
+ if (VK_FALSE == skipCall) {
+ get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportCount, pViewports);
+ }
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdSetScissor(
+ VkCmdBuffer cmdBuffer,
+ uint32_t scissorCount,
const VkRect2D* pScissors)
{
VkBool32 skipCall = VK_FALSE;
}
loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall) {
- get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportAndScissorCount, pViewports, pScissors);
+ get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdSetScissor(cmdBuffer, scissorCount, pScissors);
}
}
return (PFN_vkVoidFunction) vkCmdBindPipeline;
if (!strcmp(funcName, "vkCmdSetViewport"))
return (PFN_vkVoidFunction) vkCmdSetViewport;
+ if (!strcmp(funcName, "vkCmdSetScissor"))
+ return (PFN_vkVoidFunction) vkCmdSetScissor;
if (!strcmp(funcName, "vkCmdSetLineWidth"))
return (PFN_vkVoidFunction) vkCmdSetLineWidth;
if (!strcmp(funcName, "vkCmdSetDepthBias"))
PostCmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
}
-VK_LAYER_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportAndScissorCount, const VkViewport* pViewports, const VkRect2D* pScissors)
+VK_LAYER_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports)
{
- get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportAndScissorCount, pViewports, pScissors);
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdSetViewport(cmdBuffer, viewportCount, pViewports);
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdSetScissor(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors)
+{
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdSetScissor(cmdBuffer, scissorCount, pScissors);
}
VK_LAYER_EXPORT void VKAPI vkCmdSetLineWidth(VkCmdBuffer cmdBuffer, float lineWidth)
return (PFN_vkVoidFunction) vkAllocDescriptorSets;
if (!strcmp(funcName, "vkCmdSetViewport"))
return (PFN_vkVoidFunction) vkCmdSetViewport;
+ if (!strcmp(funcName, "vkCmdSetScissor"))
+ return (PFN_vkVoidFunction) vkCmdSetScissor;
if (!strcmp(funcName, "vkCmdSetLineWidth"))
return (PFN_vkVoidFunction) vkCmdSetLineWidth;
if (!strcmp(funcName, "vkCmdSetDepthBias"))
return (void*) vkCmdBindPipeline;
if (!strcmp(name, "CmdSetViewport"))
return (void*) vkCmdSetViewport;
+ if (!strcmp(name, "CmdSetScissor"))
+ return (void*) vkCmdSetScissor;
if (!strcmp(name, "CmdSetLineWidth"))
return (void*) vkCmdSetLineWidth;
if (!strcmp(name, "CmdSetDepthBias"))
table->ResetCommandBuffer = (PFN_vkResetCommandBuffer) gpa(dev, "vkResetCommandBuffer");
table->CmdBindPipeline = (PFN_vkCmdBindPipeline) gpa(dev, "vkCmdBindPipeline");
table->CmdSetViewport = (PFN_vkCmdSetViewport) gpa(dev, "vkCmdSetViewport");
+ table->CmdSetScissor = (PFN_vkCmdSetScissor) gpa(dev, "vkCmdSetScissor");
table->CmdSetLineWidth = (PFN_vkCmdSetLineWidth) gpa(dev, "vkCmdSetLineWidth");
table->CmdSetDepthBias = (PFN_vkCmdSetDepthBias) gpa(dev, "vkCmdSetDepthBias");
table->CmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) gpa(dev, "vkCmdSetBlendConstants");
return (void *) table->CmdBindPipeline;
if (!strcmp(name, "CmdSetViewport"))
return (void *) table->CmdSetViewport;
+ if (!strcmp(name, "CmdSetScissor"))
+ return (void *) table->CmdSetScissor;
if (!strcmp(name, "CmdSetLineWidth"))
return (void *) table->CmdSetLineWidth;
if (!strcmp(name, "CmdSetDepthBias"))
disp->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
}
-LOADER_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportAndScissorCount, const VkViewport* pViewports, const VkRect2D* pScissors)
+LOADER_EXPORT void VKAPI vkCmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports)
{
const VkLayerDispatchTable *disp;
disp = loader_get_dispatch(cmdBuffer);
- disp->CmdSetViewport(cmdBuffer, viewportAndScissorCount, pViewports, pScissors);
+ disp->CmdSetViewport(cmdBuffer, viewportCount, pViewports);
+}
+
+LOADER_EXPORT void VKAPI vkCmdSetScissor(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdSetScissor(cmdBuffer, scissorCount, pScissors);
}
LOADER_EXPORT void VKAPI vkCmdSetLineWidth(VkCmdBuffer cmdBuffer, float lineWidth)
Proto("void", "CmdSetViewport",
[Param("VkCmdBuffer", "cmdBuffer"),
- Param("uint32_t", "viewportAndScissorCount"),
- Param("const VkViewport*", "pViewports"),
+ Param("uint32_t", "viewportCount"),
+ Param("const VkViewport*", "pViewports")]),
+
+ Proto("void", "CmdSetScissor",
+ [Param("VkCmdBuffer", "cmdBuffer"),
+ Param("uint32_t", "scissorCount"),
Param("const VkRect2D*", "pScissors")]),
Proto("void", "CmdSetLineWidth",