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

LibGL+LibGPU+LibSoftGPU: Implement texture pixel format support

In OpenGL this is called the (base) internal format which is an
expectation expressed by the client for the minimum supported texel
storage format in the GPU for textures.

Since we store everything as RGBA in a `FloatVector4`, the only thing
we do in this patch is remember the expected internal format, and when
we write new texels we fixate the value for the alpha channel to 1 for
two formats that require it.

`PixelConverter` has learned how to transform pixels during transfer to
support this.
This commit is contained in:
Jelle Raaijmakers 2022-08-26 15:59:51 +02:00 committed by Andreas Kling
parent 6c80d12111
commit 84c4b66721
13 changed files with 141 additions and 32 deletions

View file

@ -57,7 +57,7 @@ public:
virtual RasterizerOptions options() const = 0;
virtual LightModelParameters light_model() const = 0;
virtual NonnullRefPtr<Image> create_image(PixelType const&, u32 width, u32 height, u32 depth, u32 levels, u32 layers) = 0;
virtual NonnullRefPtr<Image> create_image(PixelFormat const&, u32 width, u32 height, u32 depth, u32 levels, u32 layers) = 0;
virtual void set_sampler_config(unsigned, SamplerConfig const&) = 0;
virtual void set_light_state(unsigned, Light const&) = 0;

View file

@ -21,8 +21,8 @@ public:
virtual ~Image() { }
virtual void write_texels(u32 layer, u32 level, Vector3<i32> const& output_offset, void const* data, ImageDataLayout const&) = 0;
virtual void read_texels(u32 layer, u32 level, Vector3<i32> const& input_offset, void* data, ImageDataLayout const&) const = 0;
virtual void write_texels(u32 layer, u32 level, Vector3<i32> const& output_offset, void const* input_data, ImageDataLayout const&) = 0;
virtual void read_texels(u32 layer, u32 level, Vector3<i32> const& input_offset, void* output_data, ImageDataLayout const&) const = 0;
virtual void copy_texels(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) = 0;
void const* ownership_token() const { return m_ownership_token; }