summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL/Tex
AgeCommit message (Collapse)Author
2023-01-01LibGL: Implement `GL_TEXTURE_ENV_COLOR`Jelle Raaijmakers
This sets a constant color in the texture's environment for the fixed function pipeline.
2022-11-26LibGL: Refactor TextureNameAllocator to a more general NameAllocatorcflip
This functionality can also be used for other types of objects.
2022-10-19LibGL+LibGPU+LibSoftGPU: Report maximum texture sizecflip
2022-09-13LibGL: Implement `GL_TEXTURE_LOD_BIAS` for texture objectsJelle Raaijmakers
2022-09-11LibGL+LibGPU+LibSoftGPU: Implement matrix stack per texture unitJelle Raaijmakers
Each texture unit now has its own texture transformation matrix stack. Introduce a new texture unit configuration that is synced when changed. Because we're no longer passing a silly `Vector` when drawing each primitive, this results in a slightly improved frames per second :^)
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-09-11LibGL: Calculate maximum log2 of texture sizeJelle Raaijmakers
2022-09-11LibGL+LibSoftGPU: Implement fixed pipeline support for `GL_COMBINE`Jelle Raaijmakers
`GL_COMBINE` is basically a fixed function calculator to perform simple arithmetics on configurable fragment sources. This patch implements a number of texture env parameters with support for the RGBA internal format.
2022-09-11LibGL: Verify `Texture2D` existenceJelle Raaijmakers
The code currently guarantees that we always have a target texture.
2022-09-03LibGL: Implement `glGetTexImage`Jelle Raaijmakers
The plumbing was already there in LibGPU, so all that was left was to implement the API :^)
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-09LibGL: Add `border_color` to `Sampler2D`Jesse Buhagiar
We need this to plumb the per-sampler border color into the GPU's sampler border color
2022-04-06AK+Userland: Rename Array::front/back to first/lastSam Atkins
This is the name that is used for every other collection type so let's be consistent.
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.
2022-04-06LibGL+LibGPU+LibSoftGPU: Move ImageDataLayout.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move ImageFormat.h to LibGPUStephan Unverwerth
2022-03-10Libraries: Use default constructors/destructors in LibGLLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-08LibGL: Better handling of texture targets and default texturesJelle Raaijmakers
We were lacking support for default textures (i.e. calling `glBindTexture` with a `texture` argument of `0`) which caused our Quake2 port to render red screens whenever a video was playing. Every texture unit is now initialized with a default 2D texture. Additionally, we had this concept of a "currently bound target" on our texture units which is not how OpenGL wants us to handle targets. Calling `glBindTexture` should set the texture for the provided target only, making it sort of an alias for future operations on the same target. Finally, `glDeleteTextures` should not remove the bound texture from the target in the texture unit, but it should reset it to the default texture.
2022-03-08LibGL: Remove duplicate `public:` from `Texture2D.h`Jelle Raaijmakers
2022-02-22LibGL: East-const two methods in `Texture2D`Jelle Raaijmakers
No functional changes.
2021-12-27LibGL: Remove stubbed border from `glTexImage2D`Jelle Raaijmakers
Providing anything else than `border == 0` is deprecated and should result in an invalid value error.
2021-12-24LibGL: Remove image storage from MipMapStephan Unverwerth
Images are stored on the device side. Texture2D and MipMap are now only used to store imformation about the texture and reference to the device image.
2021-12-24LibGL: Remove sampling code from Sampler2DStephan Unverwerth
Texture sampling now happens entirely in SoftGPU thus this class will now only be used to hold the sampler configuration.
2021-12-24LibGL+LibSoftGPU: Use device samplers for renderingStephan Unverwerth
We now sample textures from the device owned image samplers. Passing of enabled texture units has been simplified by only passing a list of texture unit indices.
2021-12-24LibGL: Attach device image to texture object and upload image dataStephan Unverwerth
2021-12-21LibGL: Make texture coordinates a `FloatVector4`Jelle Raaijmakers
In OpenGL, texture coordinates can have up to 4 values. This change will help with easy application of texture coordinate matrix transformations in the future. Additionally, correct the initial value for texture coordinates to `{ 0.f, 0.f, 0.f, 1.f}`.
2021-12-20LibGL: Only pass bound texture units to rasterizerJelle Raaijmakers
Before, `SoftwareRasterizer` was iterating over all 32 possible texture units for each fragment and checking each if they're bound to a texture. After this change, an intrusive list containing only texture units with bound textures is passed to the rasterizer. In GLQuake, this results in a performance improvement of ~30% (from 12 to 16 FPS in the first demo) on my machine.
2021-12-19LibGL: Fix texture sampling texel coordinate calculationStephan Unverwerth
Previously we multiplied the interpolated texture coordinates by width - 1 and height - 1 instead of width and height which resulted in some wrongly mapped textures, especially visible in the glquake light maps. This also corrects the wrap mode being wrongly swapped for s/t coordinates. Since we do not have texture borders implemented yet we always use GL_CLAMP_TO_EDGE for all clamping wrap modes for the time being.
2021-12-12LibGL: Simplify Texture2D reading; add support for RGB565Jelle Raaijmakers
2021-12-11LibGL: Improve mipmap lookup in Texture2DJelle Raaijmakers
We can get rid of a `VERIFY` since we already do this in `Array::at()`. Also move `::mipmap()` to the header file so it is inlined in `Sampler2D`.
2021-12-11LibGL: Make `glDeleteTextures` skip over 0 namesJelle Raaijmakers
As stated in the manual: glDeleteTextures silently ignores 0's and names that do not correspond to existing textures. If we do not skip these 0 names, they end up as invalid free texture names in our name allocator.
2021-12-11LibGL: Implement `GL_(UN)PACK_ALIGNMENT`Jelle Raaijmakers
These enums are used to indicate byte-alignment when reading from and to textures. The `GL_UNPACK_ROW_LENGTH` value was reimplemented to support overriding the source data row width.
2021-12-11LibGL: Use `Array::back()` for last mipmap selectionJelle Raaijmakers
2021-12-01LibGL: Remove `TextureUnit::unbind_texture()`Jelle Raaijmakers
2021-12-01LibGL: Implement texture unit texturing statesJelle Raaijmakers
2021-10-08Libraries: Fix -Wunreachable-code warnings from clangNico Weber
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-09-03Everywhere: Prevent risky implicit casts of (Nonnull)RefPtrDaniel Bertalan
Our existing implementation did not check the element type of the other pointer in the constructors and move assignment operators. This meant that some operations that would require explicit casting on raw pointers were done implicitly, such as: - downcasting a base class to a derived class (e.g. `Kernel::Inode` => `Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp), - casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>` in LibIMAP/Client.cpp) This, of course, allows gross violations of the type system, and makes the need to type-check less obvious before downcasting. Luckily, while adding the `static_ptr_cast`s, only two truly incorrect usages were found; in the other instances, our casts just needed to be made explicit.
2021-09-02LibGL: Implement glTexSubImage2DStephan Unverwerth
2021-08-26LibGL: Implement glTexEnvfStephan Unverwerth
This controls how fetched texels are combined with the color that was produced by a preceding texture unit or with the vertex color if it is the first texture unit. Currently only a small subset of possible combine modes is implemented as required by glquake.
2021-08-26LibGL: Implement glPixelStoreiStephan Unverwerth
This sets the length of a row for the image to be transferred. This value is measured in pixels. When a rectangle with a width less than this value is transferred the remaining pixels of this row are skipped.
2021-08-18LibGL: Improve texture sampling performanceStephan Unverwerth
GL_NEAREST: Remove unnecessary modulo. UV is always in range due to wrapping. GL_LINEAR: Rewrite filter equation to save a few math operations.
2021-08-18LibGL: Return white texel when sampling uninitialized textureStephan Unverwerth
2021-08-18LibGL: Allow glTexImage2D to create uninitialized texturesStephan Unverwerth
When passing a nullptr as the pixel array LibGL now allocates texture memory but does not initialize the texture contents.
2021-08-18LibGL: Fix interpretation of BGRA byte orderStephan Unverwerth
This fixes byte order interpretation in several places.
2021-08-12LibGL: Implement GL_LINEAR texture filterStephan Unverwerth
2021-08-12LibGL: Implement glTexParameter{i,f}Stephan Unverwerth
This currently only implements a subset of this function. Namely setting wrap, mag and min modes for the GL_TETXURE_2D target.
2021-08-12LibGL: Implement "mirrored repeat" wrap modeStephan Unverwerth
2021-08-12LibGL: Implement "clamp" wrap modeStephan Unverwerth