Antkeeper
0.0.1
|
Graphics pipeline interface. More...
#include <pipeline.hpp>
Public Member Functions | |
pipeline () | |
Constructs a pipeline. More... | |
Vertex input state | |
void | bind_framebuffer (const gl::framebuffer *framebuffer) |
Sets the vertex input. More... | |
void | bind_shader_program (const gl::shader_program *shader_program) |
Sets the vertex input. More... | |
void | bind_vertex_array (const vertex_array *array) |
Binds a vertex array. More... | |
void | bind_vertex_buffers (std::uint32_t first_binding, std::span< const vertex_buffer *const > buffers, std::span< const std::size_t > offsets, std::span< const std::size_t > strides) |
Binds vertex buffers. More... | |
Input assembly state | |
void | set_primitive_topology (primitive_topology topology) |
Sets the primitive topology to use for drawing. More... | |
void | set_primitive_restart_enabled (bool enabled) |
Controls whether a special vertex index value is treated as restarting the assembly of primitives. More... | |
Viewport state | |
void | set_viewport (std::uint32_t first_viewport, std::span< const viewport > viewports) |
Sets one or more viewports. More... | |
void | set_scissor (std::uint32_t first_scissor, std::span< const scissor_region > scissors) |
Sets one or more scissor regions. More... | |
Rasterizer state | |
void | set_rasterizer_discard_enabled (bool enabled) |
Controls whether primitives are discarded before the rasterization stage. More... | |
void | set_fill_mode (fill_mode mode) |
Sets the polygon rasterization mode. More... | |
void | set_cull_mode (cull_mode mode) |
Sets the triangle culling mode. More... | |
void | set_front_face (front_face face) |
Sets the front-facing triangle orientation. More... | |
void | set_depth_bias_enabled (bool enabled) |
Controls whether to bias fragment depth values. More... | |
void | set_depth_bias_factors (float constant_factor, float slope_factor) |
Sets depth bias factors. More... | |
void | set_depth_clamp_enabled (bool enabled) |
Controls whether depth clamping is enabled. More... | |
void | set_scissor_test_enabled (bool enabled) |
Enables or disables scissor testing. More... | |
void | set_provoking_vertex_mode (provoking_vertex_mode mode) |
Sets the vertex to be used as the source of data for flat-shaded varyings. More... | |
void | set_point_size (float size) |
Sets the the diameter of rasterized points. More... | |
void | set_line_width (float width) |
Sets the width of rasterized lines. More... | |
Depth/stencil state | |
void | set_depth_test_enabled (bool enabled) |
Controls whether depth testing is enabled. More... | |
void | set_depth_write_enabled (bool enabled) |
Controls whether depth writes are enabled. More... | |
void | set_depth_compare_op (gl::compare_op compare_op) |
Sets the depth comparison operator. More... | |
void | set_stencil_test_enabled (bool enabled) |
Controls whether stencil testing is enabled. More... | |
void | set_stencil_op (std::uint8_t face_mask, stencil_op fail_op, stencil_op pass_op, stencil_op depth_fail_op, gl::compare_op compare_op) |
Sets the stencil operations. More... | |
void | set_stencil_compare_mask (std::uint8_t face_mask, std::uint32_t compare_mask) |
Sets the stencil compare mask. More... | |
void | set_stencil_reference (std::uint8_t face_mask, std::uint32_t reference) |
Sets the stencil reference value. More... | |
void | set_stencil_write_mask (std::uint8_t face_mask, std::uint32_t write_mask) |
Sets the stencil write mask. More... | |
Color blend state | |
void | set_logic_op_enabled (bool enabled) |
Controls whether whether logical operations are enabled. More... | |
void | set_logic_op (gl::logic_op logic_op) |
Selects which logical operation to apply. More... | |
void | set_color_blend_enabled (bool enabled) |
Controls whether blending is enabled for the corresponding color attachment. More... | |
void | set_color_blend_equation (const color_blend_equation &equation) |
Sets the color blend factors and operations. More... | |
void | set_color_write_mask (std::uint8_t mask) |
Sets the color write mask. More... | |
void | set_blend_constants (const std::array< float, 4 > &blend_constants) |
Sets the values of the blend constants. More... | |
Drawing | |
void | draw (std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance) |
Draws primitives. More... | |
void | draw_indexed (std::uint32_t index_count, std::uint32_t instance_count, std::uint32_t first_index, std::int32_t vertex_offset, std::uint32_t first_instance) |
Draws primitives with indexed vertices. More... | |
Clear | |
void | clear_attachments (std::uint8_t mask, const clear_value &value) |
Clears the color, depth, or stencil buffers of current attachments. More... | |
Limitations | |
constexpr const std::array< std::uint32_t, 2 > & | get_default_framebuffer_dimensions () const noexcept |
Returns the dimensions of the default framebuffer. More... | |
constexpr std::uint32_t | get_max_viewports () const noexcept |
Returns the maximum number of supported viewports. More... | |
constexpr float | get_max_sampler_anisotropy () const noexcept |
Returns the maximum supported degree of sampler anisotropy. More... | |
Friends | |
class | app::sdl_window_manager |
Graphics pipeline interface.
Definition at line 47 of file pipeline.hpp.
gl::pipeline::pipeline | ( | ) |
Constructs a pipeline.
Definition at line 229 of file pipeline.cpp.
void gl::pipeline::bind_framebuffer | ( | const gl::framebuffer * | framebuffer | ) |
Sets the vertex input.
vertex_bindings | Vertex bindings. |
vertex_attributes | Vertex attributes. |
Definition at line 275 of file pipeline.cpp.
void gl::pipeline::bind_shader_program | ( | const gl::shader_program * | shader_program | ) |
Sets the vertex input.
vertex_bindings | Vertex bindings. |
vertex_attributes | Vertex attributes. |
Definition at line 292 of file pipeline.cpp.
void gl::pipeline::bind_vertex_array | ( | const vertex_array * | array | ) |
Binds a vertex array.
array | Vertex array to bind. |
Definition at line 309 of file pipeline.cpp.
void gl::pipeline::bind_vertex_buffers | ( | std::uint32_t | first_binding, |
std::span< const vertex_buffer *const > | buffers, | ||
std::span< const std::size_t > | offsets, | ||
std::span< const std::size_t > | strides | ||
) |
Binds vertex buffers.
first_binding | Index of the first vertex input binding. |
buffers | Sequence of buffers to bind. |
offsets | Sequence of byte offsets into each buffer. |
strides | Sequence of byte strides between consecutive elements within each buffer. |
Definition at line 326 of file pipeline.cpp.
void gl::pipeline::clear_attachments | ( | std::uint8_t | mask, |
const clear_value & | value | ||
) |
Clears the color, depth, or stencil buffers of current attachments.
mask | Bit mask indicating which buffers should be cleared. |
value | Color, depth, and stencil values with which to fill the cleared attachments. |
Definition at line 1053 of file pipeline.cpp.
void gl::pipeline::draw | ( | std::uint32_t | vertex_count, |
std::uint32_t | instance_count, | ||
std::uint32_t | first_vertex, | ||
std::uint32_t | first_instance | ||
) |
Draws primitives.
vertex_count | Number of vertices to draw. |
instance_count | Number of instances to draw. |
first_vertex | Index of the first vertex to draw. |
first_instance | Instance ID of the first instance to draw. (WARNING: not currently supported) |
first_instance
currently not supported. Definition at line 1028 of file pipeline.cpp.
void gl::pipeline::draw_indexed | ( | std::uint32_t | index_count, |
std::uint32_t | instance_count, | ||
std::uint32_t | first_index, | ||
std::int32_t | vertex_offset, | ||
std::uint32_t | first_instance | ||
) |
Draws primitives with indexed vertices.
index_count | Number of vertices to draw. |
instance_count | Number of instances to draw. |
first_index | Base index within the index buffer. |
vertex_offset | Value added to the vertex index before indexing into the vertex buffer. |
first_instance | Instance ID of the first instance to draw. (WARNING: not currently supported) |
first_instance
currently not supported. Definition at line 1040 of file pipeline.cpp.
|
inlineconstexprnoexcept |
Returns the dimensions of the default framebuffer.
Definition at line 383 of file pipeline.hpp.
|
inlineconstexprnoexcept |
Returns the maximum supported degree of sampler anisotropy.
Definition at line 395 of file pipeline.hpp.
|
inlineconstexprnoexcept |
Returns the maximum number of supported viewports.
Definition at line 389 of file pipeline.hpp.
void gl::pipeline::set_blend_constants | ( | const std::array< float, 4 > & | blend_constants | ) |
Sets the values of the blend constants.
blend_constants | RGBA components of the blend constant that are used in blending, depending on the blend factor. |
Definition at line 1019 of file pipeline.cpp.
void gl::pipeline::set_color_blend_enabled | ( | bool | enabled | ) |
Controls whether blending is enabled for the corresponding color attachment.
enabled | true if color blending should be enabled, false otherwise. |
Definition at line 953 of file pipeline.cpp.
void gl::pipeline::set_color_blend_equation | ( | const color_blend_equation & | equation | ) |
Sets the color blend factors and operations.
equation | Color blend factors and operations. |
Definition at line 970 of file pipeline.cpp.
void gl::pipeline::set_color_write_mask | ( | std::uint8_t | mask | ) |
Sets the color write mask.
mask | Bitmask indicating which of the RGBA components are enabled for writing. |
Definition at line 1003 of file pipeline.cpp.
void gl::pipeline::set_cull_mode | ( | cull_mode | mode | ) |
Sets the triangle culling mode.
mode | Triangle culling mode. |
Definition at line 503 of file pipeline.cpp.
void gl::pipeline::set_depth_bias_enabled | ( | bool | enabled | ) |
Controls whether to bias fragment depth values.
enabled | true if fragment depth values should be biased, false otherwise. |
Definition at line 551 of file pipeline.cpp.
void gl::pipeline::set_depth_bias_factors | ( | float | constant_factor, |
float | slope_factor | ||
) |
Sets depth bias factors.
constant_factor | Scalar factor controlling the constant depth value added to each fragment. |
slope_factor | Scalar factor applied to a fragment's slope in depth bias calculations. |
Definition at line 572 of file pipeline.cpp.
void gl::pipeline::set_depth_clamp_enabled | ( | bool | enabled | ) |
Controls whether depth clamping is enabled.
enabled | true if depth clamping should be enabled, false otherwise. |
Definition at line 585 of file pipeline.cpp.
void gl::pipeline::set_depth_compare_op | ( | gl::compare_op | compare_op | ) |
Sets the depth comparison operator.
compare_op | Comparison operator to use in the depth comparison step of the depth test. |
Definition at line 675 of file pipeline.cpp.
void gl::pipeline::set_depth_test_enabled | ( | bool | enabled | ) |
Controls whether depth testing is enabled.
enabled | true if depth testing should be enabled, false otherwise. |
Definition at line 649 of file pipeline.cpp.
void gl::pipeline::set_depth_write_enabled | ( | bool | enabled | ) |
Controls whether depth writes are enabled.
enabled | true if depth writes should be enabled when depth testing is enabled, false otherwise. |
Definition at line 666 of file pipeline.cpp.
void gl::pipeline::set_fill_mode | ( | fill_mode | mode | ) |
Sets the polygon rasterization mode.
mode | Polygon rasterization mode. |
Definition at line 477 of file pipeline.cpp.
void gl::pipeline::set_front_face | ( | front_face | face | ) |
Sets the front-facing triangle orientation.
face | Front-facing triangle orientation. |
Definition at line 541 of file pipeline.cpp.
void gl::pipeline::set_line_width | ( | float | width | ) |
Sets the width of rasterized lines.
width | Width of rasterized line segments. |
Definition at line 639 of file pipeline.cpp.
void gl::pipeline::set_logic_op | ( | gl::logic_op | logic_op | ) |
Selects which logical operation to apply.
logic_op | Logical operation to apply. |
Definition at line 942 of file pipeline.cpp.
void gl::pipeline::set_logic_op_enabled | ( | bool | enabled | ) |
Controls whether whether logical operations are enabled.
enabled | true if logical operations should be enabled, false otherwise. |
Definition at line 925 of file pipeline.cpp.
void gl::pipeline::set_point_size | ( | float | size | ) |
Sets the the diameter of rasterized points.
size | Point size. |
Definition at line 629 of file pipeline.cpp.
void gl::pipeline::set_primitive_restart_enabled | ( | bool | enabled | ) |
Controls whether a special vertex index value is treated as restarting the assembly of primitives.
enabled | true if a special vertex index value should restart the assembly of primitives, false otherwise. |
Definition at line 364 of file pipeline.cpp.
void gl::pipeline::set_primitive_topology | ( | primitive_topology | topology | ) |
Sets the primitive topology to use for drawing.
topology | Primitive topology to use for drawing. |
Definition at line 356 of file pipeline.cpp.
void gl::pipeline::set_provoking_vertex_mode | ( | provoking_vertex_mode | mode | ) |
Sets the vertex to be used as the source of data for flat-shaded varyings.
mode | Provoking vertex mode. |
Definition at line 619 of file pipeline.cpp.
void gl::pipeline::set_rasterizer_discard_enabled | ( | bool | enabled | ) |
Controls whether primitives are discarded before the rasterization stage.
enabled | true if primitives should be discarded before the rasterization stage, false otherwise. |
Definition at line 460 of file pipeline.cpp.
void gl::pipeline::set_scissor | ( | std::uint32_t | first_scissor, |
std::span< const scissor_region > | scissors | ||
) |
Sets one or more scissor regions.
first_scissor | Index of the first scissor region to set. |
scissors | Sequence of scissor regions. |
@except std::out_of_range Scissor region index out of range.
Definition at line 424 of file pipeline.cpp.
void gl::pipeline::set_scissor_test_enabled | ( | bool | enabled | ) |
Enables or disables scissor testing.
enabled | true if scissor testing should be enabled, false otherwise. |
Definition at line 602 of file pipeline.cpp.
void gl::pipeline::set_stencil_compare_mask | ( | std::uint8_t | face_mask, |
std::uint32_t | compare_mask | ||
) |
Sets the stencil compare mask.
face_mask | Bit mask specifying the set of stencil states for which to update the compare mask. |
compare_mask | New value to use as the stencil compare mask. |
Definition at line 786 of file pipeline.cpp.
void gl::pipeline::set_stencil_op | ( | std::uint8_t | face_mask, |
stencil_op | fail_op, | ||
stencil_op | pass_op, | ||
stencil_op | depth_fail_op, | ||
gl::compare_op | compare_op | ||
) |
Sets the stencil operations.
face_mask | Bit mask specifying the set of stencil states for which to update the stencil operation. |
fail_op | Action performed on samples that fail the stencil test. |
pass_op | Action performed on samples that pass both the depth and stencil tests. |
depth_fail_op | Action performed on samples that pass the stencil test and fail the depth test. |
compare_op | Comparison operator used in the stencil test. |
Definition at line 702 of file pipeline.cpp.
void gl::pipeline::set_stencil_reference | ( | std::uint8_t | face_mask, |
std::uint32_t | reference | ||
) |
Sets the stencil reference value.
face_mask | Bit mask specifying the set of stencil states for which to update the reference value. |
reference | New value to use as the stencil reference value. |
Definition at line 841 of file pipeline.cpp.
void gl::pipeline::set_stencil_test_enabled | ( | bool | enabled | ) |
Controls whether stencil testing is enabled.
enabled | true if stencil testing should be enabled, false otherwise. |
Definition at line 685 of file pipeline.cpp.
void gl::pipeline::set_stencil_write_mask | ( | std::uint8_t | face_mask, |
std::uint32_t | write_mask | ||
) |
Sets the stencil write mask.
face_mask | Bit mask specifying the set of stencil states for which to update the write mask. |
write_mask | New value to use as the stencil write mask. |
Definition at line 896 of file pipeline.cpp.
void gl::pipeline::set_viewport | ( | std::uint32_t | first_viewport, |
std::span< const viewport > | viewports | ||
) |
Sets one or more viewports.
first_viewport | Index of the first viewport to set. |
viewports | Sequence of viewports. |
@except std::out_of_range Viewport index out of range.
Definition at line 381 of file pipeline.cpp.
|
friend |
Definition at line 403 of file pipeline.hpp.