Skip to content

Commit

Permalink
ViewportCount and ScissorCount should be set even viewport is set dyn…
Browse files Browse the repository at this point in the history
…amically
  • Loading branch information
Qining authored and Andrew Woloszyn committed Feb 5, 2018
1 parent 60e913e commit 6137e46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions gapis/api/vulkan/state_rebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2128,9 +2128,9 @@ func (sb *stateBuilder) createGraphicsPipeline(gp *GraphicsPipelineObject) {
VkStructureType_VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
NewVoidᶜᵖ(memory.Nullptr),
VkPipelineViewportStateCreateFlags(0),
uint32(len(*gp.ViewportState.Viewports.Map)),
gp.ViewportState.ViewportCount,
viewports,
uint32(len(*gp.ViewportState.Scissors.Map)),
gp.ViewportState.ScissorCount,
scissors,
}).Ptr())
}
Expand Down
21 changes: 14 additions & 7 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -4382,25 +4382,30 @@ cmd VkResult vkCreateGraphicsPipelines(

viewport_data := new!ViewportData()

// Even if the viewports and scissors are set dynamically, the number of
// viewports and scissors must match with the viewportCount and
// sicssorCount set in this VkPipelineViewportStateCreateInfo struct.
viewport_data.ViewportCount = pipeline_viewport_state_create_info.viewportCount
viewport_data.ScissorCount = pipeline_viewport_state_create_info.scissorCount

if (!hasDynamicProperty(
create_info.pDynamicState,
VK_DYNAMIC_STATE_VIEWPORT)) {

viewports := pipeline_viewport_state_create_info.pViewports[0:
pipeline_viewport_state_create_info.viewportCount]
for k in (0 .. pipeline_viewport_state_create_info.viewportCount) {
viewports := pipeline_viewport_state_create_info.pViewports[0:viewport_data.ViewportCount]
for k in (0 .. viewport_data.ViewportCount) {
viewport_data.Viewports[k] = viewports[k]
}
}

if (!hasDynamicProperty(
create_info.pDynamicState,
VK_DYNAMIC_STATE_SCISSOR)) {
scissors := pipeline_viewport_state_create_info.pScissors[0:
pipeline_viewport_state_create_info.scissorCount]
for k in (0 .. pipeline_viewport_state_create_info.scissorCount) {
scissors := pipeline_viewport_state_create_info.pScissors[0:viewport_data.ScissorCount]
for k in (0 .. viewport_data.ScissorCount) {
viewport_data.Scissors[k] = scissors[k]
}
}

obj.ViewportState = viewport_data
}
rasterization_state := create_info.pRasterizationState[0]
Expand Down Expand Up @@ -9344,7 +9349,9 @@ enum SemaphoreUpdate {
}

@internal class ViewportData {
@unused u32 ViewportCount
@unused map!(u32, VkViewport) Viewports
@unused u32 ScissorCount
@unused map!(u32, VkRect2D) Scissors
}

Expand Down

0 comments on commit 6137e46

Please sign in to comment.