1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibSoftGPU: Make samplers part of device

This adds a sampler array to the device implementation and adds a method
`set_sampler_config` to configure samplers.
This commit is contained in:
Stephan Unverwerth 2021-12-20 16:14:40 +01:00 committed by Brian Gianforcaro
parent b8bb72abbe
commit 2a72d14336
2 changed files with 13 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include <LibSoftGPU/DepthBuffer.h>
#include <LibSoftGPU/Image.h>
#include <LibSoftGPU/ImageFormat.h>
#include <LibSoftGPU/Sampler.h>
#include <LibSoftGPU/Triangle.h>
#include <LibSoftGPU/Vertex.h>
@ -61,6 +62,8 @@ struct RasterizerOptions {
GLenum culled_sides { GL_BACK };
};
inline static constexpr size_t const num_samplers = 32;
class Device final {
public:
Device(const Gfx::IntSize& min_size);
@ -79,6 +82,8 @@ public:
NonnullRefPtr<Image> create_image(ImageFormat, unsigned width, unsigned height, unsigned depth, unsigned levels, unsigned layers);
void set_sampler_config(unsigned, SamplerConfig const&);
private:
void submit_triangle(Triangle const& triangle, GL::TextureUnit::BoundList const& bound_texture_units);
@ -90,6 +95,7 @@ private:
Vector<Triangle> m_triangle_list;
Vector<Triangle> m_processed_triangles;
Vector<Vertex> m_clipped_vertices;
Sampler m_samplers[num_samplers];
};
}