Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
tz::gpu::pass_graphics_state Struct Reference

Description

Specifies creation flags for a new graphics pass.

See tz::gpu::pass_info for usage.

#include "pass.hpp"

Public Attributes

tz::v4f clear_colour = {0.0f, 0.0f, 0.0f, 1.0f}
 When a colour target is cleared, what colour (RGBA normalised floats) should it be cleared to?
 
tz::v4u scissor = tz::v4u::filled(-1)
 Scissor rectangle, components represent {offsetx, offsety, extentx, extenty} in pixels. If all values are -1, the scissor offset will be {0, 0} and the extent equal to the dimensions of the colour_targets you have provided.
 
std::span< const resource_handlecolour_targets = {}
 List of all colour targets. The n'th colour target specified here will be the n'th output of the fragment shader. If you want the window itself to be a colour target, pass tz::gpu::window_resource. You must provide at least one colour target, and all colour targets must have the same dimensions.
 
resource_handle depth_target = tz::nullhand
 Optional depth target. This will act as the depth image when performing depth testing/writes.
 
resource_handle index_buffer = tz::nullhand
 Buffer containing indices drawn in a single invocation of the pass.
 
resource_handle draw_buffer = tz::nullhand
 Buffer containing an initial count and draw commands which may or may not be used in a single invocation of the pass.
 
cull culling = cull::back
 Describe which faces will be culled during rendering.
 
graphics_flag flags = static_cast<graphics_flag>(0)
 Specifies extra optional behaviour for the pass.
 
std::size_t triangle_count = 0
 Number of triangles to draw in a single invocation of the pass.
 

Member Data Documentation

◆ clear_colour

tz::v4f tz::gpu::pass_graphics_state::clear_colour = {0.0f, 0.0f, 0.0f, 1.0f}

When a colour target is cleared, what colour (RGBA normalised floats) should it be cleared to?

◆ scissor

tz::v4u tz::gpu::pass_graphics_state::scissor = tz::v4u::filled(-1)

Scissor rectangle, components represent {offsetx, offsety, extentx, extenty} in pixels. If all values are -1, the scissor offset will be {0, 0} and the extent equal to the dimensions of the colour_targets you have provided.

◆ colour_targets

std::span<const resource_handle> tz::gpu::pass_graphics_state::colour_targets = {}

List of all colour targets. The n'th colour target specified here will be the n'th output of the fragment shader. If you want the window itself to be a colour target, pass tz::gpu::window_resource. You must provide at least one colour target, and all colour targets must have the same dimensions.

◆ depth_target

resource_handle tz::gpu::pass_graphics_state::depth_target = tz::nullhand

Optional depth target. This will act as the depth image when performing depth testing/writes.

◆ index_buffer

resource_handle tz::gpu::pass_graphics_state::index_buffer = tz::nullhand

Buffer containing indices drawn in a single invocation of the pass.

The memory contents of the index buffer are expected to be:

{indices...}

Where a single index is equal to a index_t.

  • The number of indices in the buffer does not affect how many vertices ultimately get drawn. That is always controlled by the draw_buffer, or triangle_count if no draw buffer is used.

◆ draw_buffer

resource_handle tz::gpu::pass_graphics_state::draw_buffer = tz::nullhand

Buffer containing an initial count and draw commands which may or may not be used in a single invocation of the pass.

The memory contents of the draw buffer are expected to be:

{drawcount, draws...}

Where drawcount is a unsigned 32-bit integer representing the number of proceeding draws which will occur in a single invocation of the pass. Following the draw count, the buffer should contain a tightly-packed array of draw commands.

  • If an index buffer has been provided (i.e index_buffer is not null), then a draw command should be a draw_indexed_t. Otherwise, a draw command should be a draw_t.
  • The drawcount does not have to match the number of draw commands proceeding it in the buffer. If the drawcount is less than the number of draw commands, than the excess commands will not occur. If the drawcount is greater than the number of draw commands, then the entire array of draw commands will safely be used without any buffer overreads.

◆ culling

cull tz::gpu::pass_graphics_state::culling = cull::back

Describe which faces will be culled during rendering.

◆ flags

graphics_flag tz::gpu::pass_graphics_state::flags = static_cast<graphics_flag>(0)

Specifies extra optional behaviour for the pass.

◆ triangle_count

std::size_t tz::gpu::pass_graphics_state::triangle_count = 0

Number of triangles to draw in a single invocation of the pass.

The count you specify affects how many vertices are drawn every frame. You can change this count later on via pass_set_triangle_count.

If you have specified an index_buffer, then 3*triangle_count indices will be drawn, sourced from the start of the index buffer.

If you have specified a draw_buffer, then this field is entirely ignored and the draw buffer becomes the only source of truth.