mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 00:08:55 +00:00
LibGL+LibGPU+LibSoftGPU: Implement flexible pixel format conversion
A GPU (driver) is now responsible for reading and writing pixels from and to user data. The client (LibGL) is responsible for specifying how the user data must be interpreted or written to. This allows us to centralize all pixel format conversion in one class, `LibSoftGPU::PixelConverter`. For both the input and output image, it takes a specification containing the image dimensions, the pixel type and the selection (basically a clipping rect), and converts the pixels from the input image to the output image. Effectively this means we now support almost all OpenGL 1.5 formats, and all custom logic has disappeared from: - `glDrawPixels` - `glReadPixels` - `glTexImage2D` - `glTexSubImage2D` The new logic is still unoptimized, but on my machine I experienced no noticeable slowdown. :^)
This commit is contained in:
parent
d7cfdfe633
commit
eb7c3d16fb
Notes:
sideshowbarker
2024-07-17 07:41:52 +09:00
Author: https://github.com/gmta
Commit: eb7c3d16fb
Pull-request: https://github.com/SerenityOS/serenity/pull/15007
Reviewed-by: https://github.com/sunverwerth ✅
24 changed files with 1350 additions and 705 deletions
20
Userland/Libraries/LibGL/Image.h
Normal file
20
Userland/Libraries/LibGL/Image.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <LibGL/GL/gl.h>
|
||||
#include <LibGL/GLContext.h>
|
||||
#include <LibGPU/ImageDataLayout.h>
|
||||
#include <LibGPU/ImageFormat.h>
|
||||
|
||||
namespace GL {
|
||||
|
||||
GPU::PixelType get_format_specification(GLenum format, GLenum type);
|
||||
ErrorOr<GPU::PixelType> get_validated_pixel_type(GLenum target, GLenum internal_format, GLenum format, GLenum type);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue