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

LibGL+LibGPU+LibSoftGPU: Implement glCopyTex(Sub)?Image2d

These two methods copy from the frame buffer to (part of) a texture.
This commit is contained in:
Jelle Raaijmakers 2022-09-04 20:02:37 +02:00 committed by Linus Groh
parent d7f1dc146e
commit 44953a4301
7 changed files with 118 additions and 22 deletions

View file

@ -31,6 +31,8 @@ public:
bool height_is_power_of_two() const { return m_height_is_power_of_two; }
bool depth_is_power_of_two() const { return m_depth_is_power_of_two; }
GPU::ImageDataLayout image_data_layout(u32 level, Vector3<i32> offset) const;
FloatVector4 texel(u32 layer, u32 level, int x, int y, int z) const
{
return *texel_pointer(layer, level, x, y, z);
@ -45,9 +47,6 @@ public:
virtual void read_texels(u32 layer, u32 level, Vector3<i32> const& input_offset, void* output_data, GPU::ImageDataLayout const&) const override;
virtual void copy_texels(GPU::Image const& source, u32 source_layer, u32 source_level, Vector3<u32> const& source_offset, Vector3<u32> const& size, u32 destination_layer, u32 destination_level, Vector3<u32> const& destination_offset) override;
private:
GPU::ImageDataLayout image_data_layout(u32 level, Vector3<i32> offset) const;
FloatVector4 const* texel_pointer(u32 layer, u32 level, int x, int y, int z) const
{
return m_mipmap_buffers[layer * m_num_layers + level]->buffer_pointer(x, y, z);