/* * Copyright (c) 2021, Stephan Unverwerth * Copyright (c) 2022, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include 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 const& value) { inputs[index] = value.x(); inputs[index + 1] = value.y(); inputs[index + 2] = value.z(); inputs[index + 3] = value.w(); } Vector4 get_input_vector4(int index) const { return Vector4( 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 const& value) { outputs[index] = value.x(); outputs[index + 1] = value.y(); outputs[index + 2] = value.z(); outputs[index + 3] = value.w(); } Vector4 get_output_vector4(int index) const { return Vector4( outputs[index], outputs[index + 1], outputs[index + 2], outputs[index + 3]); } Vector2 screen_coordinates; Vector3 barycentrics; f32x4 depth; Array inputs; Array outputs; f32x4 fog_depth; i32x4 mask; f32x4 coverage { expand4(1.f) }; }; }