summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
AgeCommit message (Collapse)Author
2022-04-20LibGL: Set W-coordinate to 1 in `glRect*`Jelle Raaijmakers
According to the spec, these calls should be identical to an invocation of `glVertex2*`, which sets the W-coordinate to 1 by default. This fixes the credits sequence rendering of Tux Racer.
2022-04-17LibGL: Implement `GLContext::frontbuffer()`Jelle Raaijmakers
2022-04-09LibGL: Add stub for glCopyTexSubImage2DJesse Buhagiar
2022-04-09LibGL: Implement `glArrayElement`Jesse Buhagiar
2022-04-09LibGL: Implement `gl_tex_parameterfv`Jesse Buhagiar
This is the vectorized version of `gl_tex_parameter`, which sets the parameters of a texture's sampler. We currently only support one single pname, `GL_TEXTURE_BORDER_COLOR`, which sets the border color of a texel for if it is sampled outside of a mip-map's range.
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-09LibGL: Add stub `glClipPlane`Jesse Buhagiar
2022-04-09LibGL+LibSoftGPU: Add `GL_ADD` Texture EnvironmentJesse Buhagiar
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: Load SoftGPU driver dynamicallyStephan Unverwerth
This loads libsoftgpu.so during GLContext creation and instantiates the device class which is then passed into the GLContext constructor.
2022-04-06LibGL+LibGPU+LibSoftGPU: Add virtual base class for devicesStephan Unverwerth
This adds a virtual base class for GPU devices located in LibGPU. The OpenGL context now only talks to this device agnostic interface. Currently the device interface is simply a copy of the existing SoftGPU interface to get things going :^)
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 Vertex.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move TexCoordGenerationConfig into LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move StencilConfiguration.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move Material.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move Light.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move SamplerConfig to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move ImageDataLayout.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move ImageFormat.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move Enums.h to LibGPUStephan Unverwerth
2022-04-06LibGL+LibGPU+LibSoftGPU: Move DeviceConfig to LibGPUStephan Unverwerth
This introduces a new abstraction layer, LibGPU, that serves as the usermode interface to GPU devices. To get started we just move the DeviceConfig there and make sure everything still works :^)
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-27LibGL+LibSoftGPU+LibGfx: Reimplement normal transformationJelle Raaijmakers
We now support generating top-left submatrices from a `Gfx::Matrix` and we move the normal transformation calculation into `SoftGPU::Device`. No functional changes.
2022-03-27LibGL: Always normalize vertex attribute dataJelle Raaijmakers
We were normalizing data read from vertex attribute pointers based on their usage, but there is nothing written about this behavior in the spec or in man pages. When we implement `glVertexAttribPointer` however, the user can optionally enable normalization per vertex attribute pointer. This refactors the `VertexAttribPointer` to have a `normalize` field so we can support that future implementation.
2022-03-27LibGL+LibSoftGPU: Implement more of `GL_LIGHT_MODEL_COLOR_CONTROL`Jelle Raaijmakers
This gets rid of a place where OpenGL was leaking into LibSoftGPU.
2022-03-27LibGL: Use correct `GLbyte` range in `glColor4b`Jelle Raaijmakers
We were only setting half the color intensity that we should have set.
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-10LibGL: Keep track of active matrix and stackJelle Raaijmakers
This simplifies a lot of code in `GLContext` and prevents potential errors when testing against the current matrix mode.
2022-03-10LibGL: Only normalize in `glRotate*` if possibleJelle Raaijmakers
Vectors of length 0 cannot be normalized, so prevent dividing by zero in the `glRotate*` API. This fixes the skybox rendering of Quake2.
2022-03-09LibGL: Merge GLContext and SoftwareGLContextStephan Unverwerth
This merges GLContext and SoftwareGLContext into a single GLContext class. Since the hardware abstraction is handled via the GPU device interface we do not need the virtual base of GLContext anymore. All context handling functionality from the old GLContext has been moved into the new version. All methods in GLContext are now non virtual and the class is marked as final.
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: East-const `glTex*` methodsJelle Raaijmakers
2022-03-08LibGL: Remove duplicate `public:` from `Texture2D.h`Jelle Raaijmakers
2022-03-06LibGL: Implement `glNormalPointer`Jelle Raaijmakers
Used for `glDrawArrays` and `glDrawElements`, the normal pointer should point to sets of X, Y and Z values.
2022-03-06LibGL: Support local viewer light modelJelle Raaijmakers
We already had the implementation, but we were erroneously rejecting `GL_LIGHT_MODEL_LOCAL_VIEWER` as a parameter to `glLightModel`.
2022-03-06LibGL: Clean up reading floats and doubles from pointersJelle Raaijmakers
No functional changes, just removal of superfluous braces.
2022-03-06LibGL: Set sampler config to dirty if modifying tex envJelle Raaijmakers
2022-03-05LibGL: Implement lighting parameter error checkingJelle Raaijmakers
2022-03-04LibGfx: Rename Color::from_rgba() => Color::from_argb()Andreas Kling
This matches the rename of RGBA32 to ARGB32. It also makes more sense when you see it used with 32-bit hexadecimal literals: Before: Color::from_rgba(0xaarrggbb) After: Color::from_argb(0xaarrggbb)
2022-03-04LibGfx: Rename RGBA32 => ARGB32Andreas Kling
The ARGB32 typedef is used for 32-bit #AARRGGBB quadruplets. As such, the name RGBA32 was misleading, so let's call it ARGB32 instead. Since endianness is a thing, let's not encode any assumptions about byte order in the name of this type. ARGB32 is basically a "machine word" of color.
2022-03-03LibGL: Fix interpretation of mipmap filtering modesStephan Unverwerth
GL_LINEAR_MIPMAP_NEAREST means choose nearest mipmap level, interpolate texels linearly. GL_NEAREST_MIPMAP_LINEAR means choose the two closest mipmap levels, sample the texels unfiltered and linearly interpolate based on the fractional value of the mipmap level. Previously we had this backwards.
2022-02-22LibGL: Set correct matrices in `glFrustum` and `glOrtho`Jelle Raaijmakers
We were erroneously setting the projection matrix when `GL_MODELVIEW` was supplied.
2022-02-22LibGL: Improve `glFrustum` precision and error handlingJelle Raaijmakers
Do not convert to float too early. Additionally, handle some error cases for the input parameters.
2022-02-22LibGL: Clamp color in `glClearColor` to 0..1Jelle Raaijmakers
2022-02-22LibGL: Implement `glClearDepthf` and store as floatJelle Raaijmakers
Our API still specifies it as a double, but internally we communicate a float to the rasterizer. Additionally, clamp the value to 0..1 as described in the spec.
2022-02-22LibGL: Ignore stack on projection and model view matrix retrievalJelle Raaijmakers
Our implementation keeps the top-most item on the matrix stacks in a member variable, so we can always use that instead of considering the actual stack. Additionally, the current matrix mode should not influence retrieving the projection or model view matrix.
2022-02-22LibGL: East-const two methods in `Texture2D`Jelle Raaijmakers
No functional changes.
2022-02-22LibGL+LibSoftGPU: Use more expressive `is_power_of_two`Jelle Raaijmakers
2022-02-22LibGL: Use `clamp<float>` for depth rangeJelle Raaijmakers
We get `double`s as input, so convert them to `float` first.