summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSoftGPU/Clipper.h
AgeCommit message (Collapse)Author
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-04-11LibSoftGPU: Optimize clipping codeJelle Raaijmakers
Three optimizations are applied: 1. If the list of vertices to clip is empty, return immediately after clearing the output list. 2. Remember the previous vertex instead of recalculating whether it is within the clip plane. 3. Instead of copying and swapping lists around, operate on the input and output lists directly. This prevents a lot of `malloc`/`free` traffic as a result of vector assignments. This takes the clipping code CPU load from 3.9% down to 1.8% for Quake 3 on my machine.
2022-04-06LibGL+LibGPU+LibSoftGPU: Move Vertex.h to LibGPUStephan Unverwerth
2022-02-10LibSoftGPU: Dispatch based on ClipPlane enum at compile-timeLenny Maiorani
The `ClipPlane` enum is being looped over at run-time performing run-time dispatch to determine the comparison operation in `point_within_clip_plane`. Change this `for` loop to be linear code which dispatches using a template parameter. This allows for the `point_within_clip_plane` function to do compile-time dispatch. Note: This linear code can become a compile-time loop when static reflection lands in C++2[y|z] allowing looping over the reflected `enum class`.
2022-01-27LibSoftGPU: Reduce Clipper class interface to minimumLenny Maiorani
Much of the `Clipper` class can be made free functions and their scope limited. The purpose of this is to prepare the interface for a change to more compile-time dispatch.
2022-01-23LibSoftGPU: Add const to Clipper where possibleLenny Maiorani
2022-01-23LibSoftGPU: Switch to using east const in Clipper.[h,cpp]Lenny Maiorani
2021-12-24LibGL+LibSoftGPU: Move Vertex and Triangle structs to LibSoftGPUStephan 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.