
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.
140 lines
1.8 KiB
C++
140 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
|
|
namespace GPU {
|
|
|
|
enum class AlphaTestFunction {
|
|
Never,
|
|
Always,
|
|
Less,
|
|
LessOrEqual,
|
|
Equal,
|
|
NotEqual,
|
|
GreaterOrEqual,
|
|
Greater,
|
|
};
|
|
|
|
enum class BlendFactor {
|
|
Zero,
|
|
One,
|
|
SrcAlpha,
|
|
OneMinusSrcAlpha,
|
|
SrcColor,
|
|
OneMinusSrcColor,
|
|
DstAlpha,
|
|
OneMinusDstAlpha,
|
|
DstColor,
|
|
OneMinusDstColor,
|
|
SrcAlphaSaturate,
|
|
};
|
|
|
|
enum class ColorControl {
|
|
SingleColor,
|
|
SeparateSpecularColor,
|
|
};
|
|
|
|
enum class ColorMaterialFace {
|
|
Front,
|
|
Back,
|
|
FrontAndBack,
|
|
};
|
|
|
|
enum class ColorMaterialMode {
|
|
Ambient,
|
|
AmbientAndDiffuse,
|
|
Diffuse,
|
|
Emissive,
|
|
Specular,
|
|
};
|
|
|
|
enum class DepthTestFunction {
|
|
Never,
|
|
Always,
|
|
Less,
|
|
LessOrEqual,
|
|
Equal,
|
|
NotEqual,
|
|
GreaterOrEqual,
|
|
Greater,
|
|
};
|
|
|
|
enum Face {
|
|
Front = 0,
|
|
Back = 1,
|
|
};
|
|
|
|
enum FogMode {
|
|
Linear,
|
|
Exp,
|
|
Exp2
|
|
};
|
|
|
|
enum class PolygonMode {
|
|
Point,
|
|
Line,
|
|
Fill,
|
|
};
|
|
|
|
enum class WindingOrder {
|
|
Clockwise,
|
|
CounterClockwise,
|
|
};
|
|
|
|
enum class PrimitiveType {
|
|
Lines,
|
|
LineLoop,
|
|
LineStrip,
|
|
Points,
|
|
TriangleFan,
|
|
Triangles,
|
|
TriangleStrip,
|
|
Quads,
|
|
};
|
|
|
|
enum StencilOperation {
|
|
Decrement,
|
|
DecrementWrap,
|
|
Increment,
|
|
IncrementWrap,
|
|
Invert,
|
|
Keep,
|
|
Replace,
|
|
Zero,
|
|
};
|
|
|
|
enum StencilTestFunction {
|
|
Always,
|
|
Equal,
|
|
Greater,
|
|
GreaterOrEqual,
|
|
Less,
|
|
LessOrEqual,
|
|
Never,
|
|
NotEqual,
|
|
};
|
|
|
|
enum TexCoordGenerationCoordinate {
|
|
None = 0x0,
|
|
S = 0x1,
|
|
T = 0x2,
|
|
R = 0x4,
|
|
Q = 0x8,
|
|
All = 0xF,
|
|
};
|
|
|
|
enum class TexCoordGenerationMode {
|
|
ObjectLinear,
|
|
EyeLinear,
|
|
SphereMap,
|
|
ReflectionMap,
|
|
NormalMap,
|
|
};
|
|
|
|
}
|