@@ -66,7 +66,7 @@ const BG_COLOR = getCssColor('--background');
66
66
const CANVAS_BG = getCssColor ( '--canvas-background' ) ;
67
67
const AXES_COLOR = getCssColor ( '--canvas-axes' ) ;
68
68
const GRID_COLOR = getCssColor ( '--canvas-grid' ) ;
69
- const BLOCK_COLOR = getCssColor ( '--canvas-block ' ) ;
69
+ const CODEGEN_COLOR = getCssColor ( '--canvas-codegen ' ) ;
70
70
const CUSTOM_BUILD_COLOR = getCssColor ( '--canvas-custom-build' ) ;
71
71
const NOT_CUSTOM_BUILD_COLOR = getCssColor ( '--canvas-not-custom-build' ) ;
72
72
const DEP_LINE_COLOR = getCssColor ( '--canvas-dep-line' ) ;
@@ -134,12 +134,17 @@ function render_pipeline_graph() {
134
134
let unit = units [ i ] ;
135
135
let y = i * Y_TICK_DIST + 1 ;
136
136
let x = px_per_sec * unit . start ;
137
- let rmeta_x = null ;
137
+
138
+ const sections = [ ] ;
138
139
if ( unit . rmeta_time != null ) {
139
- rmeta_x = x + px_per_sec * unit . rmeta_time ;
140
+ sections . push ( {
141
+ name : "codegen" ,
142
+ start : x + px_per_sec * unit . rmeta_time ,
143
+ width : ( unit . duration - unit . rmeta_time ) * px_per_sec
144
+ } ) ;
140
145
}
141
146
let width = Math . max ( px_per_sec * unit . duration , 1.0 ) ;
142
- UNIT_COORDS [ unit . i ] = { x, y, width, rmeta_x } ;
147
+ UNIT_COORDS [ unit . i ] = { x, y, width, sections } ;
143
148
144
149
const count = unitCount . get ( unit . name ) || 0 ;
145
150
unitCount . set ( unit . name , count + 1 ) ;
@@ -148,7 +153,7 @@ function render_pipeline_graph() {
148
153
// Draw the blocks.
149
154
for ( i = 0 ; i < units . length ; i ++ ) {
150
155
let unit = units [ i ] ;
151
- let { x, y, width, rmeta_x } = UNIT_COORDS [ unit . i ] ;
156
+ let { x, y, width, sections } = UNIT_COORDS [ unit . i ] ;
152
157
153
158
HIT_BOXES . push ( { x : X_LINE + x , y :MARGIN + y , x2 : X_LINE + x + width , y2 : MARGIN + y + BOX_HEIGHT , i : unit . i } ) ;
154
159
@@ -157,12 +162,11 @@ function render_pipeline_graph() {
157
162
roundedRect ( ctx , x , y , width , BOX_HEIGHT , RADIUS ) ;
158
163
ctx . fill ( ) ;
159
164
160
- if ( unit . rmeta_time != null ) {
161
- ctx . beginPath ( ) ;
162
- ctx . fillStyle = BLOCK_COLOR ;
163
- let ctime = unit . duration - unit . rmeta_time ;
164
- roundedRect ( ctx , rmeta_x , y , px_per_sec * ctime , BOX_HEIGHT , RADIUS ) ;
165
- ctx . fill ( ) ;
165
+ for ( const section of sections ) {
166
+ ctx . beginPath ( ) ;
167
+ ctx . fillStyle = get_section_color ( section . name ) ;
168
+ roundedRect ( ctx , section . start , y , section . width , BOX_HEIGHT , RADIUS ) ;
169
+ ctx . fill ( ) ;
166
170
}
167
171
ctx . fillStyle = TEXT_COLOR ;
168
172
ctx . textAlign = 'start' ;
@@ -180,6 +184,16 @@ function render_pipeline_graph() {
180
184
ctx . restore ( ) ;
181
185
}
182
186
187
+ // Determine the color of a section block based on the section name.
188
+ function get_section_color ( name ) {
189
+ if ( name === "codegen" ) {
190
+ return CODEGEN_COLOR ;
191
+ } else {
192
+ // We do not know what section this is, so just use the default color
193
+ return NOT_CUSTOM_BUILD_COLOR ;
194
+ }
195
+ }
196
+
183
197
// Draws lines from the given unit to the units it unlocks.
184
198
function draw_dep_lines ( ctx , unit_idx , highlighted ) {
185
199
const unit = UNIT_DATA [ unit_idx ] ;
0 commit comments