mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibSoftGPU: Put all constexpr config options into Config.h
This commit is contained in:
parent
4b40d2cc07
commit
fe36edf6ae
4 changed files with 23 additions and 10 deletions
18
Userland/Libraries/LibSoftGPU/Config.h
Normal file
18
Userland/Libraries/LibSoftGPU/Config.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace SoftGPU {
|
||||
|
||||
static constexpr int RASTERIZER_BLOCK_SIZE = 8;
|
||||
static constexpr int NUM_SAMPLERS = 32;
|
||||
|
||||
// See: https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_edge_color_problem
|
||||
// FIXME: make this dynamically configurable through ConfigServer
|
||||
static constexpr bool CLAMP_DEPRECATED_BEHAVIOR = false;
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Vector2.h>
|
||||
#include <LibGfx/Vector3.h>
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/Device.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
|
@ -16,8 +17,6 @@ namespace SoftGPU {
|
|||
using IntVector2 = Gfx::Vector2<int>;
|
||||
using IntVector3 = Gfx::Vector3<int>;
|
||||
|
||||
static constexpr int RASTERIZER_BLOCK_SIZE = 8;
|
||||
|
||||
constexpr static int edge_function(const IntVector2& a, const IntVector2& b, const IntVector2& c)
|
||||
{
|
||||
return ((c.x() - a.x()) * (b.y() - a.y()) - (c.y() - a.y()) * (b.x() - a.x()));
|
||||
|
@ -529,7 +528,7 @@ DeviceInfo Device::info() const
|
|||
return {
|
||||
.vendor_name = "SerenityOS",
|
||||
.device_name = "SoftGPU",
|
||||
.num_texture_units = num_samplers
|
||||
.num_texture_units = NUM_SAMPLERS
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Vector4.h>
|
||||
#include <LibSoftGPU/Clipper.h>
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/DepthBuffer.h>
|
||||
#include <LibSoftGPU/DeviceInfo.h>
|
||||
#include <LibSoftGPU/Enums.h>
|
||||
|
@ -66,8 +67,6 @@ struct RasterizerOptions {
|
|||
Array<TexCoordGenerationConfig, 4> texcoord_generation_config {};
|
||||
};
|
||||
|
||||
inline static constexpr size_t const num_samplers = 32;
|
||||
|
||||
class Device final {
|
||||
public:
|
||||
Device(const Gfx::IntSize& min_size);
|
||||
|
@ -101,7 +100,7 @@ private:
|
|||
Vector<Triangle> m_triangle_list;
|
||||
Vector<Triangle> m_processed_triangles;
|
||||
Vector<Vertex> m_clipped_vertices;
|
||||
Array<Sampler, num_samplers> m_samplers;
|
||||
Array<Sampler, NUM_SAMPLERS> m_samplers;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -4,16 +4,13 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibSoftGPU/Config.h>
|
||||
#include <LibSoftGPU/Image.h>
|
||||
#include <LibSoftGPU/Sampler.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
|
||||
// See: https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_edge_color_problem
|
||||
// FIXME: make this dynamically configurable through ConfigServer
|
||||
static constexpr bool CLAMP_DEPRECATED_BEHAVIOR = false;
|
||||
|
||||
static constexpr float fracf(float value)
|
||||
{
|
||||
return value - floorf(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue