summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
AgeCommit message (Collapse)Author
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.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-06-13LibGL: Add ability to retrieve current clear values from GLContextLuke Wilde
This allows WebGL to preserve the clear values as it performs an implicit clear to certain values.
2022-06-04LibGL: Reject GL_LEFT and GL_RIGHT in glCullFaceLuke Wilde
glCullFace only accepts GL_FRONT, GL_BACK and GL_FRONT_AND_BACK. We checked if the mode was valid by performing ``` cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK ``` However, this range also contains GL_LEFT and GL_RIGHT, which we would accept when we should return a GL_INVALID_ENUM error.
2022-06-02LibGL: Check that texture name is allocated before marking it as freeLuke Wilde
glDeleteTextures previously did not check that the texture name was allocated by glGenTextures before adding it to the free texture name list. This means that if you delete a texture twice in a row, the name will appear twice in the free texture list, making glGenTextures return the same texture name twice in a row.
2022-05-11LibGL+LibGPU+LibSoftGPU: Implement and expose glClipPlaneRKBethke
This commit implements glClipPlane and its supporting calls, backed by new support for user-defined clip planes in the software GPU clipper. This fixes some visual bugs seen in the Quake III port, in which mirrors would only reflect correctly from close distances.
2022-05-09LibGL+LibGPU+LibSoftGPU: Implement point and line drawingJelle Raaijmakers
Implement (anti)aliased point drawing and anti-aliased line drawing. Supported through LibGL's `GL_POINTS`, `GL_LINES`, `GL_LINE_LOOP` and `GL_LINE_STRIP`. In order to support this, `LibSoftGPU`s rasterization logic was reworked. Now, any primitive can be drawn by invoking `rasterize()` which takes care of the quad loop and fragment testing logic. Three callbacks need to be passed: * `set_coverage_mask`: the primitive needs to provide initial coverage mask information so fragments can be discarded early. * `set_quad_depth`: fragments survived stencil testing, so depth values need to be set so depth testing can take place. * `set_quad_attributes`: fragments survived depth testing, so fragment shading is going to take place. All attributes like color, tex coords and fog depth need to be set so alpha testing and eventually, fragment rasterization can take place. As of this commit, there are four instantiations of this function: * Triangle rasterization * Points - aliased * Points - anti-aliased * Lines - anti-aliased In order to standardize vertex processing for all primitive types, things like vertex transformation, lighting and tex coord generation are now taking place before clipping.
2022-05-09LibGL+LibGPU: Copy line width to rasterizer in `glLineWidth`Jelle Raaijmakers
2022-05-09LibGL+LibGPU: Implement `GL_LINE_SMOOTH` context parameterJelle Raaijmakers
2022-05-09LibGL+LibGPU: Implement `GL_POINT_SMOOTH` context parameterJelle Raaijmakers
2022-05-09LibGL+LibGPU: Implement `glPointSize`Jelle Raaijmakers
2022-05-09LibGL: Remove `break` from `GL_SCISSOR_BOX` context parameterJelle Raaijmakers
We already `return` immediately before; no functional changes.
2022-05-09LibGL: Alphabetize `GL_LIGHT*` cases in `gl_enable()`Jelle Raaijmakers
No functional changes.
2022-05-05LibGL: Split up GLContext implementation into logical unitsJelle Raaijmakers
This allows for faster rebuilds when the implementation changes.
2022-05-05LibGL: Put the OpenGL API wrapper in a single code unitJelle Raaijmakers
We were splitting these API wrappers up into different files without a quantifiable benefit. Now, it's extremely clear where the direct API implementation lives. :^)
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.