From 01eaa9a9175a7cb313ff58182a31a964dbac7071 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sun, 12 Nov 2023 23:30:50 -0600 Subject: rtl/gfx: add z, w coordinates to vertices --- rtl/gfx/gfx.sv | 1 + rtl/gfx/gfx_defs.sv | 11 +++++++++++ rtl/gfx/gfx_frag.sv | 2 +- rtl/gfx/gfx_raster.sv | 11 ++++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) (limited to 'rtl/gfx') diff --git a/rtl/gfx/gfx.sv b/rtl/gfx/gfx.sv index 8e6d20f..adb777f 100644 --- a/rtl/gfx/gfx.sv +++ b/rtl/gfx/gfx.sv @@ -43,6 +43,7 @@ module gfx ); logic raster_ready; + fixed_tri ws; bary_lanes barys; paint_lanes raster_valid; frag_xy_lanes fragments; diff --git a/rtl/gfx/gfx_defs.sv b/rtl/gfx/gfx_defs.sv index f7c874c..e9557b9 100644 --- a/rtl/gfx/gfx_defs.sv +++ b/rtl/gfx/gfx_defs.sv @@ -76,6 +76,17 @@ typedef struct packed fixed x, y; } raster_xy; +typedef struct packed +{ + fixed z, w; +} raster_zw; + +typedef struct packed +{ + raster_xy xy; + raster_zw zw; +} raster_xyzw; + typedef logic[7:0] coarse_dim; `define GFX_MASK_SRAM_STAGES 3 diff --git a/rtl/gfx/gfx_frag.sv b/rtl/gfx/gfx_frag.sv index d4b2495..94db287 100644 --- a/rtl/gfx/gfx_frag.sv +++ b/rtl/gfx/gfx_frag.sv @@ -7,6 +7,7 @@ module gfx_frag input frag_xy_lanes fragments, input bary_lanes barys, + input fixed_tri ws, input paint_lanes in_valid, output logic in_ready, @@ -62,7 +63,6 @@ module gfx_frag gfx_frag_bary frag_bary ( - .ws(), .stall(frag_stall), .* ); diff --git a/rtl/gfx/gfx_raster.sv b/rtl/gfx/gfx_raster.sv index ab282e7..e37282b 100644 --- a/rtl/gfx/gfx_raster.sv +++ b/rtl/gfx/gfx_raster.sv @@ -5,7 +5,7 @@ module gfx_raster input logic clk, rst_n, - input raster_xy vertex_a, + input raster_xyzw vertex_a, vertex_b, vertex_c, input logic in_valid, @@ -13,10 +13,16 @@ module gfx_raster output frag_xy_lanes fragments, output bary_lanes barys, + output fixed_tri ws, input logic out_ready, output paint_lanes out_valid ); + //TODO: Es exactamente el mismo asunto que offsets + assign ws[0] = vertex_a.zw.w; + assign ws[1] = vertex_b.zw.w; + assign ws[2] = vertex_c.zw.w; + logic setup_stall, setup_valid; gfx_pipeline_flow #(.STAGES(`GFX_SETUP_STAGES)) setup_flow @@ -35,6 +41,9 @@ module gfx_raster gfx_setup setup ( .stall(setup_stall), + .vertex_a(vertex_a.xy), + .vertex_b(vertex_b.xy), + .vertex_c(vertex_c.xy), .* ); -- cgit v1.2.3