summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGL
AgeCommit message (Collapse)Author
2021-12-27LibGL: Implement `GL_QUAD_STRIP`Jelle Raaijmakers
It seems like we can render this with `GL_TRIANGLE_STRIP`. This makes the track marks in Tux Racer work.
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-27LibGL: Implement `GL_LINEAR_MIPMAP_NEAREST` supportJelle Raaijmakers
2021-12-27LibGL: Stub more API callsJelle Raaijmakers
These stubs are largely implemented the same: their API is exposed, but they print to the debug console and sometimes `TODO()`. These changes allow GLU and Tux Racer to build. Methods stubbed: * `glTexImage1D` * `glTexImage3D` * `glTexCoord2d(v)` * `glNormalPointer` * `glTexGen(d|f|i)` * `glTexGenfv`
2021-12-27LibGL: Stub lots of map-related methodsJelle Raaijmakers
This adds stubs for `glMap(1|2)(d|f)`, `glMapGrid(1|2)(d|f)`, `glEvalCoord(1|2)(d|f)`, `glEvalMesh(1|2)` and `glEvalPoint(1|2)`.
2021-12-27LibGL: Implement `glGetTexLevelParameteriv`Jelle Raaijmakers
2021-12-27LibGL: Implement `glRectf` and `glRecti`Jelle Raaijmakers
2021-12-27LibGL: Implement `glMultMatrixd`Jelle Raaijmakers
2021-12-27LibGL: Stub `glClear` support for stencil bufferJelle Raaijmakers
Previously, if the client supplied `GL_STENCIL_BUFFER_BIT`, `glClear` would return an error. Since it is a valid parameter, we now continue and report that this parameter is unimplemented instead.
2021-12-27LibGL: Uncrash `glMaterialf` on invalid inputJelle Raaijmakers
We should handle this in the context.
2021-12-27LibGL: Implement `glColor3/4dv`Jelle Raaijmakers
2021-12-27LibGL: Stub `GL_(UN)PACK_*` context parametersJelle Raaijmakers
Libraries like GLU depend on their memory initialization by requesting these parameters, so if we do not support them, segfaults will occur.
2021-12-27LibGL: Add glext.h and lots of new defines in gl.hJelle Raaijmakers
These constants are used by GLU and Tux Racer.
2021-12-27LibGL: Extract platform types to `glplatform.h`Jelle Raaijmakers
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: Add method to query device infoStephan Unverwerth
This adds a method `info()` to SoftGPU that returns the name of the hardware vendor and device name, as well as the number of texture untis. LibGL uses the returned texture unit count to initialize its internal texture unit array.
2021-12-24LibSoftGPU: Remove GLenum used for selecting rendered primitive typeStephan Unverwerth
This removes the last reference to LibGL from LibSoftGPU. The GLenum has been replaced by our own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for polygon modeStephan Unverwerth
Replaces the GLenum used to setup polygon mode in RasterizerOptions with our own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for fog modeStephan Unverwerth
Replaces the GLenum used to set up the fog mode in RasterizerOptions with out own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for depth test funcStephan Unverwerth
Replaces the GLenum used in the RasterizerConfig for selecting the depth test function with out own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for draw buffer selectionStephan Unverwerth
Replaces the GLenum used in RasterizerConfig to select the draw buffer with a simple boolean that disabled color output when the draw buffer is set to GL_NONE on the OpenGL side.
2021-12-24LibSoftGPU: Remove OpenGL type for culled side selectionStephan Unverwerth
Replaces the GLenum in RasterizerConfig, that selects the triangle sides to be culled, with two booleans.
2021-12-24LibSoftGPU: Remove OpenGL type for front face selectionStephan Unverwerth
Replaces the GLenum used for selecting the frontface in the rasterizer config with out own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for alpha blend factorsStephan Unverwerth
Replaces the GLenum used for configuring alpha blend factors in the SoftGPU device with out own enum.
2021-12-24LibSoftGPU: Remove OpenGL type for alpha test funcStephan Unverwerth
Replaces the OpenGL enum used for setting the alpha test func in RasterizerOptions with out own enum.
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: Synchronize device config before rendering if anything changedStephan Unverwerth
2021-12-24LibGL: Attach device image to texture object and upload image dataStephan Unverwerth
2021-12-24LibSoftGPU: Rename class SoftwareRasterizer to DeviceStephan Unverwerth
This class does everything related to rendering now. It is the software implementation of a full GPU device.
2021-12-24LibGL: Remove unused GLStruct.hStephan Unverwerth
2021-12-24LibGL+LibSoftGPU: Move Vertex and Triangle structs to LibSoftGPUStephan Unverwerth
2021-12-24LibGL+LibSoftGPU: Move primitive assembly and clipping into LibSoftGPUStephan Unverwerth
2021-12-24LibGL+LibSoftGPU: Add face culling state to rasterizer optionsStephan Unverwerth
2021-12-24LibGL+LibSoftGPU: Move rendering related code to LibSoftGPU libraryStephan Unverwerth
This introduces a new library, LibSoftGPU, that incorporates all rendering related features that formerly resided within LibGL itself. Going forward we will make both libraries completely independent from each other allowing LibGL to load different, possibly accelerated, rendering backends.
2021-12-21LibGL: Simplify `glDrawPixels` checks and reduce debug spamJelle Raaijmakers
2021-12-21LibGL: Implement `GL_POLYGON` renderingJelle Raaijmakers
This is a deprecated feature that is still in use in some older games, most notably Grim Fandango in ScummVM makes heavy use of it. Luckily, since you can only draw convex polygons, the end result is exactly the same as when you would have used `glBegin(GL_TRIANGLE_FAN)` - so we just reuse that code as-is.
2021-12-21LibGL: Allow querying maximum matrix stack depthsJelle Raaijmakers
2021-12-21LibGL: Implement matrix mode `GL_TEXTURE`Jelle Raaijmakers
Implement support for the `GL_TEXTURE` matrix mode, the texture matrix stack and texture coordinate matrix transformation. Also, an unused `m_current_matrix` was removed to make room for `m_texture_matrix`.
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-20LibGL: Use 8x8 block size in `SoftwareRasterizer`Jelle Raaijmakers
This smaller block size allows us to use an `u8` for the pixel mask during triangle rasterization. These changes result in better FPS in 3DFileViewer, which periodically shoots up to 250-300 FPS on my machine. Before, the peaks were somewhere in the range of 160-170 FPS.
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-12LibGL: Prevent limbo state if `glEnd` does not support drawing modeJelle Raaijmakers
If an unsupported drawing mode was configured, `glEnd` would not reach the line where `m_in_draw_state` was set to `false`. This caused all subsequent invocations to `glBegin` to fail.
2021-12-12LibGL: Do not exclude points on the clip planesJelle Raaijmakers
Most resources seem to suggest that points on the clip planes are also inside the frustum, e.g.: https://www.cubic.org/docs/3dclip.htm This seems to resolve some rendering issues in Grim Fandango in OpenGL mode where the screen remained black. This was because of quads being drawn with their vertex positions exactly on the clip planes.
2021-12-12LibGL: Remove unused method from SoftwareRasterizerJelle Raaijmakers
2021-12-12LibGL: Invoke own methods when drawing arrays or elementsJelle Raaijmakers
Instead of calling the public API, call our own internal API.
2021-12-12LibGL: Support missing context in `glGetError` and `glGetIntegerv`Jelle Raaijmakers
In its current state, ScummVM seems to invoke these methods just after destroying the current GL context. According to the OpenGL spec: "Issuing GL commands when the program does not have a current context results in undefined behavior, up to and including program termination." Our old behavior was to deref a `nullptr`, which isn't that great. For now, protect these two methods. If other ports seem to misbehave as well, we can always expand the check to other methods.
2021-12-12LibGL: Implement the `GL_DITHER` parameterJelle Raaijmakers