mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibSoftGPU: Make input in PixelQuad generic
Previously we would store vertex color and texture coordinates in separate fields in PixelQuad. To make them accessible from shaders we need to store them as a completely generic array of floats.
This commit is contained in:
parent
49139d5f4e
commit
c008b6ce18
3 changed files with 45 additions and 14 deletions
|
@ -21,11 +21,29 @@ 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]);
|
||||
}
|
||||
|
||||
Vector2<i32x4> screen_coordinates;
|
||||
Vector3<f32x4> barycentrics;
|
||||
f32x4 depth;
|
||||
Vector4<f32x4> vertex_color;
|
||||
Array<Vector4<f32x4>, GPU::NUM_TEXTURE_UNITS> texture_coordinates;
|
||||
Array<f32x4, NUM_SHADER_INPUTS> inputs;
|
||||
Vector4<f32x4> out_color;
|
||||
f32x4 fog_depth;
|
||||
i32x4 mask;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue