Add renderer depth state contract
This commit is contained in:
@@ -88,6 +88,17 @@ enum class BlendOp : std::uint8_t {
|
||||
reverse_subtract,
|
||||
};
|
||||
|
||||
enum class CompareOp : std::uint8_t {
|
||||
never,
|
||||
less,
|
||||
equal,
|
||||
less_or_equal,
|
||||
greater,
|
||||
not_equal,
|
||||
greater_or_equal,
|
||||
always,
|
||||
};
|
||||
|
||||
struct BlendState {
|
||||
bool enabled = false;
|
||||
BlendFactor source_color = BlendFactor::one;
|
||||
@@ -102,6 +113,12 @@ struct BlendState {
|
||||
bool write_a = true;
|
||||
};
|
||||
|
||||
struct DepthState {
|
||||
bool test_enabled = false;
|
||||
bool write_enabled = false;
|
||||
CompareOp compare = CompareOp::less_or_equal;
|
||||
};
|
||||
|
||||
struct MeshDesc {
|
||||
std::uint32_t vertex_count = 0;
|
||||
std::uint32_t index_count = 0;
|
||||
@@ -165,6 +182,7 @@ public:
|
||||
[[nodiscard]] virtual pp::foundation::Status set_viewport(Viewport viewport) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status set_scissor(ScissorRect scissor) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status set_blend_state(BlendState state) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status set_depth_state(DepthState 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,
|
||||
@@ -206,6 +224,8 @@ public:
|
||||
[[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_compare_op(CompareOp op) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_depth_state(DepthState 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;
|
||||
@@ -224,5 +244,6 @@ public:
|
||||
[[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;
|
||||
[[nodiscard]] const char* compare_op_name(CompareOp op) noexcept;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user