Skip to content

Commit

Permalink
support stencil and depth bound test in render pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Hatrickek authored and martty committed Nov 25, 2023
1 parent f8b61ef commit 3b87992
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/vuk/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,9 @@ namespace vuk {

static constexpr ClearDepth DepthOne = { 1.f };
static constexpr ClearDepth DepthZero = { 0.f };

static constexpr ClearDepthStencil DepthStencilOne = { 1.f, 1 };
static constexpr ClearDepthStencil DepthStencilZero = { 0.f, 0 };

struct Clear {
constexpr Clear() = default;
Expand Down
24 changes: 20 additions & 4 deletions src/CommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,15 @@ namespace vuk {
records.depth_stencil = true;
pi.extended_size += sizeof(GraphicsPipelineInstanceCreateInfo::Depth);

assert(depth_stencil_state->stencilTestEnable == false); // TODO: stencil unsupported
assert(depth_stencil_state->depthBoundsTestEnable == false); // TODO: depth bounds unsupported
if (depth_stencil_state->stencilTestEnable) {
records.stencil_state = true;
pi.extended_size += sizeof(GraphicsPipelineInstanceCreateInfo::Stencil);
}

if (depth_stencil_state->depthBoundsTestEnable) {
records.depth_bounds = true;
pi.extended_size += sizeof(GraphicsPipelineInstanceCreateInfo::DepthBounds);
}
}

if (ongoing_render_pass->samples != SampleCountFlagBits::e1) {
Expand Down Expand Up @@ -1697,8 +1704,17 @@ namespace vuk {
.depthWriteEnable = (bool)depth_stencil_state->depthWriteEnable,
.depthCompareOp = (uint8_t)depth_stencil_state->depthCompareOp };
write(data_ptr, ds);
// TODO: support stencil
// TODO: support depth bounds

if (depth_stencil_state->stencilTestEnable) {
GraphicsPipelineInstanceCreateInfo::Stencil ss = { .front = depth_stencil_state->front, .back = depth_stencil_state->back };
write(data_ptr, ss);
}

if (depth_stencil_state->depthBoundsTestEnable) {
GraphicsPipelineInstanceCreateInfo::DepthBounds dps = { .minDepthBounds = depth_stencil_state->minDepthBounds,
.maxDepthBounds = depth_stencil_state->maxDepthBounds };
write(data_ptr, dps);
}
}

if (ongoing_render_pass->samples != SampleCountFlagBits::e1) {
Expand Down

0 comments on commit 3b87992

Please sign in to comment.