mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:47:45 +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:
parent
b8bb72abbe
commit
2a72d14336
2 changed files with 13 additions and 0 deletions
|
@ -812,4 +812,11 @@ NonnullRefPtr<Image> Device::create_image(ImageFormat format, unsigned width, un
|
||||||
return adopt_ref(*new Image(format, width, height, depth, levels, layers));
|
return adopt_ref(*new Image(format, width, height, depth, levels, layers));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Device::set_sampler_config(unsigned sampler, SamplerConfig const& config)
|
||||||
|
{
|
||||||
|
VERIFY(sampler < num_samplers);
|
||||||
|
|
||||||
|
m_samplers[sampler].set_config(config);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <LibSoftGPU/DepthBuffer.h>
|
#include <LibSoftGPU/DepthBuffer.h>
|
||||||
#include <LibSoftGPU/Image.h>
|
#include <LibSoftGPU/Image.h>
|
||||||
#include <LibSoftGPU/ImageFormat.h>
|
#include <LibSoftGPU/ImageFormat.h>
|
||||||
|
#include <LibSoftGPU/Sampler.h>
|
||||||
#include <LibSoftGPU/Triangle.h>
|
#include <LibSoftGPU/Triangle.h>
|
||||||
#include <LibSoftGPU/Vertex.h>
|
#include <LibSoftGPU/Vertex.h>
|
||||||
|
|
||||||
|
@ -61,6 +62,8 @@ struct RasterizerOptions {
|
||||||
GLenum culled_sides { GL_BACK };
|
GLenum culled_sides { GL_BACK };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline static constexpr size_t const num_samplers = 32;
|
||||||
|
|
||||||
class Device final {
|
class Device final {
|
||||||
public:
|
public:
|
||||||
Device(const Gfx::IntSize& min_size);
|
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);
|
NonnullRefPtr<Image> create_image(ImageFormat, unsigned width, unsigned height, unsigned depth, unsigned levels, unsigned layers);
|
||||||
|
|
||||||
|
void set_sampler_config(unsigned, SamplerConfig const&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void submit_triangle(Triangle const& triangle, GL::TextureUnit::BoundList const& bound_texture_units);
|
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_triangle_list;
|
||||||
Vector<Triangle> m_processed_triangles;
|
Vector<Triangle> m_processed_triangles;
|
||||||
Vector<Vertex> m_clipped_vertices;
|
Vector<Vertex> m_clipped_vertices;
|
||||||
|
Sampler m_samplers[num_samplers];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue