diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-11-12 01:37:02 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-11-14 07:18:16 -0600 |
| commit | bf6b4e2e8ebb63f6b8466bc98650ce75f3bdc79f (patch) | |
| tree | d3fbcb5b8582fce317fdae71e4b32c9398266a6a /rtl/gfx/gfx_lerp.sv | |
| parent | 50440e25024b5d64b36396d2a5f5b8413d93eefc (diff) | |
rtl/gfx: implement fragment shading
Diffstat (limited to 'rtl/gfx/gfx_lerp.sv')
| -rw-r--r-- | rtl/gfx/gfx_lerp.sv | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/rtl/gfx/gfx_lerp.sv b/rtl/gfx/gfx_lerp.sv new file mode 100644 index 0000000..42e4393 --- /dev/null +++ b/rtl/gfx/gfx_lerp.sv @@ -0,0 +1,32 @@ +`include "gfx/gfx_defs.sv" + +module gfx_lerp +( + input logic clk, + + input fixed b1, + b2, + q0, + q1_q0, + q2_q0, + input logic stall, + + output fixed q +); + + /* Interpolación lineal, trivializada. + * + * Esta es la clave: https://fgiesen.wordpress.com/2013/02/06/the-barycentric-conspirac/ + */ + + gfx_fixed_fma_dot fma + ( + .c(q0), + .a0(b1), + .b0(q1_q0), + .a1(b2), + .b1(q2_q0), + .* + ); + +endmodule |
