1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
* Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/SIMD.h>
#include <AK/SIMDExtras.h>
#include <LibGfx/Vector2.h>
#include <LibGfx/Vector3.h>
#include <LibGfx/Vector4.h>
#include <LibSoftGPU/Config.h>
namespace SoftGPU {
using AK::SIMD::expand4;
using AK::SIMD::f32x4;
using AK::SIMD::i32x4;
struct PixelQuad final {
void set_input(int index, f32x4 value) { inputs[index] = value; }
f32x4 get_input_float(int index) const { return inputs[index]; }
void set_input(int index, Vector4<f32x4> const& value)
{
inputs[index] = value.x();
inputs[index + 1] = value.y();
inputs[index + 2] = value.z();
inputs[index + 3] = value.w();
}
Vector4<f32x4> get_input_vector4(int index) const
{
return Vector4<f32x4>(
inputs[index],
inputs[index + 1],
inputs[index + 2],
inputs[index + 3]);
}
void set_output(int index, f32x4 value) { outputs[index] = value; }
f32x4 get_output_float(int index) const { return outputs[index]; }
void set_output(int index, Vector4<f32x4> const& value)
{
outputs[index] = value.x();
outputs[index + 1] = value.y();
outputs[index + 2] = value.z();
outputs[index + 3] = value.w();
}
Vector4<f32x4> get_output_vector4(int index) const
{
return Vector4<f32x4>(
outputs[index],
outputs[index + 1],
outputs[index + 2],
outputs[index + 3]);
}
Vector2<i32x4> screen_coordinates;
Vector3<f32x4> barycentrics;
f32x4 depth;
Array<f32x4, NUM_SHADER_INPUTS> inputs;
Array<f32x4, NUM_SHADER_OUTPUTS> outputs;
f32x4 fog_depth;
i32x4 mask;
f32x4 coverage { expand4(1.f) };
};
}
|