1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:47:44 +00:00

LibSoftGPU: Make output in PixelQuad generic

Same as with inputs, we define outputs as a generic array of floats.
This can later be expanded to accomodate multiple render targets or
vertex attributes in the case of a vertex shader.
This commit is contained in:
Stephan Unverwerth 2022-09-17 17:16:31 +02:00 committed by Andrew Kaster
parent c008b6ce18
commit bb28492af0
3 changed files with 40 additions and 10 deletions

View file

@ -40,11 +40,30 @@ struct PixelQuad final {
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;
Vector4<f32x4> out_color;
Array<f32x4, NUM_SHADER_OUTPUTS> outputs;
f32x4 fog_depth;
i32x4 mask;
f32x4 coverage { expand4(1.f) };