mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
LibSoftGPU: Dispatch based on ClipPlane enum at compile-time
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`.
This commit is contained in:
parent
3c11dc5bd3
commit
2e436129b0
2 changed files with 40 additions and 33 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -13,8 +14,6 @@
|
|||
namespace SoftGPU {
|
||||
|
||||
class Clipper final {
|
||||
static constexpr u8 NUMBER_OF_CLIPPING_PLANES = 6;
|
||||
|
||||
public:
|
||||
enum class ClipPlane : u8 {
|
||||
LEFT = 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue