mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
LibSoftGPU: Allow binding a fragment shader
This commit is contained in:
parent
93ab2db80f
commit
49139d5f4e
3 changed files with 19 additions and 0 deletions
|
@ -70,6 +70,8 @@ public:
|
|||
virtual RasterPosition raster_position() const = 0;
|
||||
virtual void set_raster_position(RasterPosition const& raster_position) = 0;
|
||||
virtual void set_raster_position(FloatVector4 const& position, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform) = 0;
|
||||
|
||||
virtual void bind_fragment_shader(RefPtr<Shader>) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1700,6 +1700,19 @@ void Device::set_raster_position(FloatVector4 const& position, FloatMatrix4x4 co
|
|||
m_raster_position.eye_coordinate_distance = eye_coordinates.length();
|
||||
}
|
||||
|
||||
void Device::bind_fragment_shader(RefPtr<GPU::Shader> shader)
|
||||
{
|
||||
VERIFY(shader.is_null() || shader->ownership_token() == this);
|
||||
|
||||
if (shader.is_null()) {
|
||||
m_current_fragment_shader = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
auto softgpu_shader = static_ptr_cast<Shader>(shader);
|
||||
m_current_fragment_shader = softgpu_shader;
|
||||
}
|
||||
|
||||
Gfx::IntRect Device::get_rasterization_rect_of_size(Gfx::IntSize size) const
|
||||
{
|
||||
// Round the X and Y floating point coordinates to the nearest integer; OpenGL 1.5 spec:
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <LibSoftGPU/Clipper.h>
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/Sampler.h>
|
||||
#include <LibSoftGPU/Shader.h>
|
||||
#include <LibSoftGPU/Triangle.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
|
@ -78,6 +79,8 @@ public:
|
|||
virtual void set_raster_position(GPU::RasterPosition const& raster_position) override;
|
||||
virtual void set_raster_position(FloatVector4 const& position, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform) override;
|
||||
|
||||
virtual void bind_fragment_shader(RefPtr<GPU::Shader>) override;
|
||||
|
||||
private:
|
||||
void calculate_vertex_lighting(GPU::Vertex& vertex) const;
|
||||
void draw_statistics_overlay(Gfx::Bitmap&);
|
||||
|
@ -116,6 +119,7 @@ private:
|
|||
Vector<FloatVector4> m_clip_planes;
|
||||
Array<GPU::StencilConfiguration, 2u> m_stencil_configuration;
|
||||
Array<GPU::TextureUnitConfiguration, GPU::NUM_TEXTURE_UNITS> m_texture_unit_configuration;
|
||||
RefPtr<Shader> m_current_fragment_shader;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue