Add renderer sampler state contract
This commit is contained in:
@@ -99,6 +99,18 @@ enum class CompareOp : std::uint8_t {
|
||||
always,
|
||||
};
|
||||
|
||||
enum class SamplerFilter : std::uint8_t {
|
||||
nearest,
|
||||
linear,
|
||||
};
|
||||
|
||||
enum class SamplerAddressMode : std::uint8_t {
|
||||
clamp_to_edge,
|
||||
repeat,
|
||||
mirrored_repeat,
|
||||
clamp_to_border,
|
||||
};
|
||||
|
||||
struct BlendState {
|
||||
bool enabled = false;
|
||||
BlendFactor source_color = BlendFactor::one;
|
||||
@@ -119,6 +131,15 @@ struct DepthState {
|
||||
CompareOp compare = CompareOp::less_or_equal;
|
||||
};
|
||||
|
||||
struct SamplerDesc {
|
||||
SamplerFilter min_filter = SamplerFilter::linear;
|
||||
SamplerFilter mag_filter = SamplerFilter::linear;
|
||||
SamplerFilter mip_filter = SamplerFilter::linear;
|
||||
SamplerAddressMode address_u = SamplerAddressMode::clamp_to_edge;
|
||||
SamplerAddressMode address_v = SamplerAddressMode::clamp_to_edge;
|
||||
SamplerAddressMode address_w = SamplerAddressMode::clamp_to_edge;
|
||||
};
|
||||
|
||||
struct MeshDesc {
|
||||
std::uint32_t vertex_count = 0;
|
||||
std::uint32_t index_count = 0;
|
||||
@@ -187,6 +208,9 @@ public:
|
||||
[[nodiscard]] virtual pp::foundation::Status bind_texture(
|
||||
std::uint32_t slot,
|
||||
ITexture2D& texture) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status bind_sampler(
|
||||
std::uint32_t slot,
|
||||
SamplerDesc sampler) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status bind_mesh(IMesh& mesh) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status draw() noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Status read_texture(
|
||||
@@ -226,6 +250,9 @@ public:
|
||||
[[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_sampler_filter(SamplerFilter filter) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_sampler_address_mode(SamplerAddressMode mode) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status validate_sampler_desc(SamplerDesc desc) 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;
|
||||
@@ -245,5 +272,7 @@ public:
|
||||
[[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;
|
||||
[[nodiscard]] const char* sampler_filter_name(SamplerFilter filter) noexcept;
|
||||
[[nodiscard]] const char* sampler_address_mode_name(SamplerAddressMode mode) noexcept;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user