summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGPU/Image.h
AgeCommit message (Collapse)Author
2022-12-26LibGPU+LibSoftGPU: Move size and pixel format information to GPU::ImageStephan Unverwerth
Size and format information are the same for every implementation and do not need to be virtual. This removes the need to reimplement them for each driver.
2022-09-11LibGL+LibGPU+LibSoftGPU: Implement `GL_GENERATE_MIPMAP`Jelle Raaijmakers
We can now generate texture mipmaps on the fly if the client requests it. This fixes the missing textures in our PrBoom+ port.
2022-09-11LibGL+LibGPU+LibSoftGPU: Remove concept of `layer` in favor of `depth`Jelle Raaijmakers
Looking at how Khronos defines layers: https://www.khronos.org/opengl/wiki/Array_Texture We both have 3D textures and layers of 2D textures, which can both be encoded in our existing `Typed3DBuffer` as depth. Since we support depth already in the GPU API, remove layer everywhere. Also pass in `Texture2D::LOG2_MAX_TEXTURE_SIZE` as the maximum number of mipmap levels, so we do not allocate 999 levels on each Image instantiation.
2022-08-27LibGL+LibGPU+LibSoftGPU: Implement texture pixel format supportJelle Raaijmakers
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.
2022-08-27LibGL+LibGPU+LibSoftGPU: Implement flexible pixel format conversionJelle Raaijmakers
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. :^)
2022-04-06LibGL+LibGPU+LibSoftGPU: Add virtual base class for ImagesStephan Unverwerth
This introduces a new device independent base class for Images in LibGPU that also keeps track of the device from which it was created in order to prevent assigning images across devices.