Skip to content

Commit

Permalink
Fix crash (#2575)
Browse files Browse the repository at this point in the history
More If statement guards to fix potential crash
  • Loading branch information
Qining authored and AWoloszyn committed Jan 31, 2019
1 parent b89f5de commit 2caca15
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions gapis/api/vulkan/api/draw_commands.api
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,18 @@ sub void readDrawState() {
if dynamicState.contains[as!u32(VK_DYNAMIC_STATE_VIEWPORT)] {
_ = len(dyn.Viewports)
} else {
_ = len(pipeline.ViewportState.Viewports)
if pipeline.ViewportState != null {
_ = len(pipeline.ViewportState.Viewports)
}
}

// read all scissors
if dynamicState.contains[as!u32(VK_DYNAMIC_STATE_SCISSOR)] {
_ = len(dyn.Scissors)
} else {
_ = len(pipeline.ViewportState.Scissors)
if pipeline.ViewportState != null {
_ = len(pipeline.ViewportState.Scissors)
}
}

// read line width
Expand Down Expand Up @@ -537,19 +541,23 @@ sub void readDrawState() {
_ = dyn.BlendConstants[2]
_ = dyn.BlendConstants[3]
} else {
_ = pipeline.ColorBlendState.BlendConstants[0]
_ = pipeline.ColorBlendState.BlendConstants[1]
_ = pipeline.ColorBlendState.BlendConstants[2]
_ = pipeline.ColorBlendState.BlendConstants[3]
if pipeline.ColorBlendState != null {
_ = pipeline.ColorBlendState.BlendConstants[0]
_ = pipeline.ColorBlendState.BlendConstants[1]
_ = pipeline.ColorBlendState.BlendConstants[2]
_ = pipeline.ColorBlendState.BlendConstants[3]
}
}

// read depth bounds
if dynamicState.contains[as!u32(VK_DYNAMIC_STATE_BLEND_CONSTANTS)] {
_ = dyn.MinDepthBounds
_ = dyn.MaxDepthBounds
} else {
_ = pipeline.DepthState.MinDepthBounds
_ = pipeline.DepthState.MaxDepthBounds
if pipeline.DepthState != null {
_ = pipeline.DepthState.MinDepthBounds
_ = pipeline.DepthState.MaxDepthBounds
}
}

// read stencil state
Expand All @@ -561,12 +569,14 @@ sub void readDrawState() {
_ = dyn.StencilBack.writeMask
_ = dyn.StencilBack.reference
} else {
_ = pipeline.DepthState.Front.compareMask
_ = pipeline.DepthState.Front.writeMask
_ = pipeline.DepthState.Front.reference
_ = pipeline.DepthState.Back.compareMask
_ = pipeline.DepthState.Back.writeMask
_ = pipeline.DepthState.Back.reference
if pipeline.DepthState != null {
_ = pipeline.DepthState.Front.compareMask
_ = pipeline.DepthState.Front.writeMask
_ = pipeline.DepthState.Front.reference
_ = pipeline.DepthState.Back.compareMask
_ = pipeline.DepthState.Back.writeMask
_ = pipeline.DepthState.Back.reference
}
}

readPushConstants(VK_PIPELINE_BIND_POINT_GRAPHICS)
Expand Down

0 comments on commit 2caca15

Please sign in to comment.