CMSC23740 Common Code Library
Support code for CS23740 programming projects
Loading...
Searching...
No Matches
cs237::DepthBuffer Class Reference

#include <depth-buffer.hpp>

Public Member Functions

 DepthBuffer (Application *app, uint32_t wid, uint32_t ht)
 construct and initialize a new depth buffer of the give size
 ~DepthBuffer ()
 destructor; this will free the underlying resources
uint32_t width () const
 get the width of the buffer
uint32_t height () const
 get the height of the buffer
vk::Extent2D extent () const
 get the extent of the buffer
vk::Format format () const
 get the depth-buffer image format
vk::Sampler sampler () const
 get the sampler
vk::Image image () const
 get the depth buffer's image
vk::ImageView imageView () const
 get the image view for the depth buffer
vk::DescriptorImageInfo imageInfo () const
 get the image information for the depth buffer
void genRenderBarrier (vk::CommandBuffer &cmdBuf)
 generate a barrier command into the given command buffer that will synchronize rendering access and convert the frame's depth attachment to the optimal layout

Detailed Description

This class is a wrapper around the resources needed to implement a depth buffer that can sampled

Constructor & Destructor Documentation

◆ DepthBuffer()

cs237::DepthBuffer::DepthBuffer ( Application * app,
uint32_t wid,
uint32_t ht )

construct and initialize a new depth buffer of the give size

Parameters
appthe owning application
widthe width of the buffer (should be power of 2)
htthe height of the buffer (should be power of 2)

This function allocates and initializes a frame-buffer object and associated sampler. The sampler is initialized with the following parameters:

  • the filter parameters are set to VK_FILTER_LINEAR
  • the mimap mode is VK_SAMPLER_MIPMAP_MODE_NEAREST
  • the address modes are set to VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE

◆ ~DepthBuffer()

cs237::DepthBuffer::~DepthBuffer ( )

destructor; this will free the underlying resources

Member Function Documentation

◆ extent()

vk::Extent2D cs237::DepthBuffer::extent ( ) const
inline

get the extent of the buffer

◆ format()

vk::Format cs237::DepthBuffer::format ( ) const
inline

get the depth-buffer image format

◆ genRenderBarrier()

void cs237::DepthBuffer::genRenderBarrier ( vk::CommandBuffer & cmdBuf)

generate a barrier command into the given command buffer that will synchronize rendering access and convert the frame's depth attachment to the optimal layout

Parameters
cmdBufthe command buffer that we put the barrier command into.

◆ height()

uint32_t cs237::DepthBuffer::height ( ) const
inline

get the height of the buffer

◆ image()

vk::Image cs237::DepthBuffer::image ( ) const
inline

get the depth buffer's image

◆ imageInfo()

vk::DescriptorImageInfo cs237::DepthBuffer::imageInfo ( ) const
inline

get the image information for the depth buffer

◆ imageView()

vk::ImageView cs237::DepthBuffer::imageView ( ) const
inline

get the image view for the depth buffer

◆ sampler()

vk::Sampler cs237::DepthBuffer::sampler ( ) const
inline

get the sampler

◆ width()

uint32_t cs237::DepthBuffer::width ( ) const
inline

get the width of the buffer


The documentation for this class was generated from the following file:
  • /Users/jhr/Classes/23740/f2026/solutions/cs237-library/include/cs237/depth-buffer.hpp