Add renderer blend state contract
This commit is contained in:
@@ -65,6 +65,35 @@ enum class BlitFilter : std::uint8_t {
|
||||
linear,
|
||||
};
|
||||
|
||||
enum class BlendFactor : std::uint8_t {
|
||||
zero,
|
||||
one,
|
||||
source_alpha,
|
||||
one_minus_source_alpha,
|
||||
destination_alpha,
|
||||
one_minus_destination_alpha,
|
||||
};
|
||||
|
||||
enum class BlendOp : std::uint8_t {
|
||||
add,
|
||||
subtract,
|
||||
reverse_subtract,
|
||||
};
|
||||
|
||||
struct BlendState {
|
||||
bool enabled = false;
|
||||
BlendFactor source_color = BlendFactor::one;
|
||||
BlendFactor destination_color = BlendFactor::zero;
|
||||
BlendOp color_op = BlendOp::add;
|
||||
BlendFactor source_alpha = BlendFactor::one;
|
||||
BlendFactor destination_alpha = BlendFactor::zero;
|
||||
BlendOp alpha_op = BlendOp::add;
|
||||
bool write_r = true;
|
||||
bool write_g = true;
|
||||
bool write_b = true;
|
||||
bool write_a = true;
|
||||
};
|
||||
|
||||
struct MeshDesc {
|
||||
std::uint32_t vertex_count = 0;
|
||||
std::uint32_t index_count = 0;
|
||||
@@ -126,6 +155,7 @@ public:
|
||||
IRenderTarget& target,
|
||||
ClearColor clear_color) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status set_viewport(Viewport viewport) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status set_blend_state(BlendState state) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status bind_shader(IShaderProgram& shader) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status bind_texture(
|
||||
std::uint32_t slot,
|
||||
@@ -163,6 +193,9 @@ public:
|
||||
[[nodiscard]] std::uint32_t bytes_per_pixel(TextureFormat format) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_extent(Extent2D extent) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_viewport(Viewport viewport, Extent2D target_extent) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_blend_factor(BlendFactor factor) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_blend_op(BlendOp op) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_blend_state(BlendState state) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_mesh_desc(MeshDesc desc) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_texture_slot(std::uint32_t slot) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_shader_program_desc(ShaderProgramDesc desc) noexcept;
|
||||
@@ -179,5 +212,7 @@ public:
|
||||
[[nodiscard]] const char* texture_format_name(TextureFormat format) noexcept;
|
||||
[[nodiscard]] const char* primitive_topology_name(PrimitiveTopology topology) noexcept;
|
||||
[[nodiscard]] const char* blit_filter_name(BlitFilter filter) noexcept;
|
||||
[[nodiscard]] const char* blend_factor_name(BlendFactor factor) noexcept;
|
||||
[[nodiscard]] const char* blend_op_name(BlendOp op) noexcept;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user