summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
AgeCommit message (Collapse)Author
2022-11-26LibGL: Use buffers in vertex pointer functions and glDrawElementscflip
Many of these functions will treat the 'pointer' parameter as an offset into a buffer if one is currently bound. This makes it possible to run ClassiCube with OpenGL 1.5 support!
2022-11-26LibGL: Add simple implementation of buffer objectscflip
For now, buffers are only implemented on the LibGL side, however in the future buffer objects should be stored in LibGPU.
2022-11-26LibGL: Refactor TextureNameAllocator to a more general NameAllocatorcflip
This functionality can also be used for other types of objects.
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-10-19LibGL: Correctly normalize different vertex attribute type pointersJelle Raaijmakers
According to the OpenGL 2.0 spec ยง 2.8, the data for each attribute type pointer is normalized according to the type. The only exception to this is `glVertexAttribPointer` which accepts a `normalized` parameter, but we have not yet implemented that API.
2022-10-19LibGL: Return `GLboolean` value in `glIsEnabled`Jelle Raaijmakers
2022-10-19LibGL: Implement state for all pixel store parametersJelle Raaijmakers
This implements the state and context parameters for all packing and unpacking parameters accepted by `glPixelStore*`.
2022-10-19LibGL: Don't repeat ourselves in `read_from_vertex_attribute_pointer`Jelle Raaijmakers
2022-10-19LibGL: Implement missing `glDeleteLists` error conditionsJelle Raaijmakers
2022-10-19LibGL: Make `read_from_vertex_attribute_pointer` staticJelle Raaijmakers
2022-10-19LibGL: Do not return early if client-side vertex array is disabledJelle Raaijmakers
According to the spec, enabling the client-side vertex array should behave as if `glVertex` is executed after all other states such as the normal, color, etc. have changed. We were not changing these states if the client-side vertex array was disabled which probably does not affect a lot of applications, but this seems like the correct thing to do. :^)
2022-10-19LibGL: Add buffer API stubsJelle Raaijmakers
No implemented functionality, but this makes it easier to see if software is using this family of functions.
2022-10-19LibGL+LibGPU+LibSoftGPU: Report maximum texture sizecflip
2022-10-16LibGL: Immediately dereference vertex attribute data in display listsJelle Raaijmakers
According to the spec, pointers to client data need to be dereferenced immediately when adding calls such as `glDrawElements` or `glArrayElement` to a display list. We were trying to support display lists for these calls but since they only invoke _other_ calls that also support display lists, we can simply defer the display list functionality to them. This fixes the rendering of the ClassiCube port by cflip.
2022-09-17LibGL: Remove `GL::present_context`Jelle Raaijmakers
No need for a static method if all it does is invoke the object method.
2022-09-17LibGL: Prevent segfault due to texture destructionJelle Raaijmakers
Destruction of `GL::GLContext` resulted in the destruction of `GPU::Driver` _before_ the destruction of the allocated textures, which in turn point to `GPU::Image` objects. Since the destruction of `GPU::Driver` unloads the shared library, we were trying to invoke non-existing code. Fix this by moving `m_driver` up in `GLContext` so that it's last in line for destruction.
2022-09-16LibC: Remove the LibM interface targetTim Schumacher
2022-09-16LibGL: Make GL::create_context fallibleAndrew Kaster
Propagate errors in places that are already set up to handle them, like WebGLRenderingContext and the Tubes demo, and convert other callers to using MUST.
2022-09-13LibGL: Simplify setting the color maskJelle Raaijmakers
2022-09-13LibGL: Implement `GL_SAMPLES`, `GL_SAMPLE_BUFFERS` context parametersJelle Raaijmakers
We do not support multisampling right now, so we return constant values that indicate this.
2022-09-13LibGL: Implement all `glMultiTexCoord*f` API methodsJelle Raaijmakers
2022-09-13LibGL: Implement `GL_TEXTURE_LOD_BIAS` for texture objectsJelle Raaijmakers
2022-09-13LibGL: Implement all `glRasterPos2*` API methodsJelle Raaijmakers
2022-09-11LibGL: Implement `glNormal3d`Jelle Raaijmakers
2022-09-11LibGL+LibGPU+LibSoftGPU: Report texture clamp to edge supportJelle Raaijmakers
2022-09-11LibGL: Ensure texture coordinate Q is set to 1 by defaultJelle Raaijmakers
When using vertex attribute pointers, we default the Q coordinate for textures to 0 causing issues if the 4th coordinate is not passed in the vertex data. Clean up these defaults and make sure that Q is always set to `1.f`.
2022-09-11LibGL: Implement `GL_(CLIENT_)?ACTIVE_TEXTURE` context parametersJelle 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+LibGPU+LibSoftGPU: Implement `glCopyTex(Sub)?Image2d`Jelle Raaijmakers
These two methods copy from the frame buffer to (part of) a texture.
2022-09-11LibGL: Calculate maximum log2 of texture sizeJelle Raaijmakers
2022-09-11LibGL+LibGPU+LibSoftGPU: Rename `blit_color_buffer_to`Jelle Raaijmakers
This makes it consistent with our other `blit_from_color_buffer` and paves the way for a third method that will be introduced in one of the next commits.
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-11LibGL: Implement `glMultiTexCoord2fv(ARB)?` APIsJelle Raaijmakers
2022-09-11LibGL: Define `GL_NO_ERROR` as `0`Jelle Raaijmakers
This conforms to the Khronos enum value listing and prevents a redefinition warning when compiling with SDL_opengl.
2022-09-11LibGL: Remove unused/default includes from `GLContext`Jelle Raaijmakers
2022-09-11LibGL: Implement `GL_CURRENT_COLOR` context parameterJelle Raaijmakers
2022-09-08LibGL: Set correct color material mode for `GL_AMBIENT_AND_DIFFUSE`Jelle Raaijmakers
This was a silly mistake :^)
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-09-03LibGL: Correct `GL_BLEND_*_ALPHA` constant valuesJelle Raaijmakers
They were plain wrong; while we're here, also add the `*_EXT` variants.
2022-09-03LibGL: Improve constants and types compatibilityJelle Raaijmakers
When compiling with SDL_opengl, all kinds of differences between LibGL and OpenGL constants and types popped up as redefinition warnings and errors. This fixes all LibGL-related warnings when compiling PrBoom+ :^)
2022-08-28LibGL+LibGPU+LibSoftGPU: Report texture env add extensionJelle Raaijmakers
The Quake 3 port makes use of this extension to determine a more efficient multitexturing strategy. Since LibSoftGPU supports it, let's report the extension in LibGL. :^)
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: Report color buffer bits instead of texture bitsJelle Raaijmakers
For `GL_RED_BITS`, `GL_GREEN_BITS`, `GL_BLUE_BITS` and `GL_ALPHA_BITS` we were reporting the values we use in LibSoftGPU for textures. This fixes these context parameters to actually report the color buffer bits.
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-08-27LibGL: Implement `GL_NORMAL_ARRAY_TYPE` context parameterJelle Raaijmakers
This is used by the Grim/Monkey4 engine in ScummVM.
2022-08-27LibGL: Rename units to all singularJelle Raaijmakers
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.