Vulkan: Workbench Shadow Drawing #114673
|
@ -158,9 +158,17 @@ void VKFrameBuffer::clear(const eGPUFrameBufferBits buffers,
|
|||
Vector<VkClearAttachment> attachments;
|
||||
if (buffers & (GPU_DEPTH_BIT | GPU_STENCIL_BIT)) {
|
||||
VKContext &context = *VKContext::get();
|
||||
/* Clearing depth via vkCmdClearAttachments requires a render pass with write depth enabled.
|
||||
* When not enabled, clearing should be done via texture directly. */
|
||||
if (context.state_manager_get().state.write_mask & GPU_WRITE_DEPTH) {
|
||||
eGPUWriteMask needed_mask = GPU_WRITE_NONE;
|
||||
if (buffers & GPU_DEPTH_BIT) {
|
||||
needed_mask |= GPU_WRITE_DEPTH;
|
||||
}
|
||||
if (buffers & GPU_STENCIL_BIT) {
|
||||
needed_mask |= GPU_WRITE_STENCIL;
|
||||
}
|
||||
|
||||
/* Clearing depth via vkCmdClearAttachments requires a render pass with write depth or stencil
|
||||
* enabled. When not enabled, clearing should be done via texture directly. */
|
||||
if ((context.state_manager_get().state.write_mask & needed_mask) == needed_mask) {
|
||||
build_clear_attachments_depth_stencil(buffers, clear_depth, clear_stencil, attachments);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -159,7 +159,9 @@ void VKPipeline::finalize(VKContext &context,
|
|||
pipeline_input_assembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||
pipeline_input_assembly.topology = to_vk_primitive_topology(prim_type);
|
||||
pipeline_input_assembly.primitiveRestartEnable =
|
||||
ELEM(prim_type, GPU_PRIM_TRIS, GPU_PRIM_LINES, GPU_PRIM_POINTS) ? VK_FALSE : VK_TRUE;
|
||||
ELEM(prim_type, GPU_PRIM_TRIS, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_PRIM_LINES_ADJ) ?
|
||||
VK_FALSE :
|
||||
VK_TRUE;
|
||||
pipeline_create_info.pInputAssemblyState = &pipeline_input_assembly;
|
||||
|
||||
/* Viewport state. */
|
||||
|
|
|
@ -262,18 +262,18 @@ void VKPipelineStateManager::set_stencil_test(const eGPUStencilTest test,
|
|||
|
||||
case GPU_STENCIL_OP_COUNT_DEPTH_PASS:
|
||||
depth_stencil_state.front.failOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.front.passOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
depth_stencil_state.front.passOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.back = depth_stencil_state.front;
|
||||
depth_stencil_state.back.depthFailOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
depth_stencil_state.back.passOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
break;
|
||||
|
||||
case GPU_STENCIL_OP_COUNT_DEPTH_FAIL:
|
||||
depth_stencil_state.front.failOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.front.passOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.front.passOp = VK_STENCIL_OP_KEEP;
|
||||
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
depth_stencil_state.back = depth_stencil_state.front;
|
||||
depth_stencil_state.back.depthFailOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
depth_stencil_state.back.passOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
break;
|
||||
|
||||
case GPU_STENCIL_OP_NONE:
|
||||
|
@ -319,7 +319,10 @@ void VKPipelineStateManager::set_stencil_mask(const eGPUStencilTest test,
|
|||
return;
|
||||
}
|
||||
|
||||
depth_stencil_state.back = depth_stencil_state.front;
|
||||
depth_stencil_state.back.writeMask = depth_stencil_state.front.writeMask;
|
||||
depth_stencil_state.back.reference = depth_stencil_state.front.reference;
|
||||
depth_stencil_state.back.compareOp = depth_stencil_state.front.compareOp;
|
||||
depth_stencil_state.back.compareMask = depth_stencil_state.front.compareMask;
|
||||
}
|
||||
|
||||
void VKPipelineStateManager::set_clip_distances(const int /*new_dist_len*/,
|
||||
|
|
Loading…
Reference in New Issue