2 * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
10 #include "shaders/blit.h"
11 #include "shaders/blitblur.h"
12 #include "shaders/blitcolour.h"
15 #include "shaders/standard.h"
16 #include "shaders/vblend.h"
19 VG_STATIC
void render_water_texture( world_instance
*world
, camera
*cam
,
21 VG_STATIC
void render_water_surface( world_instance
*world
, camera
*cam
);
22 VG_STATIC
void render_world( world_instance
*world
, camera
*cam
,
24 VG_STATIC
void render_world_depth( world_instance
*world
, camera
*cam
);
29 typedef struct framebuffer framebuffer
;
32 * All standard buffers used in rendering
34 VG_STATIC
struct pipeline
{
43 float view_render_scale
,
46 gpipeline
= { .view_render_scale
= 1.0f
};
49 const char *display_name
;
50 int resolution_div
, /* definition */
54 render_w
, /* runtime */
57 struct framebuffer_attachment
{
58 const char *display_name
;
60 enum framebuffer_attachment_type
{
61 k_framebuffer_attachment_type_none
,
62 k_framebuffer_attachment_type_texture
,
63 k_framebuffer_attachment_type_renderbuffer
,
64 k_framebuffer_attachment_type_texture_depth
68 enum framebuffer_quality_profile
{
69 k_framebuffer_quality_all
,
70 k_framebuffer_quality_high_only
74 GLenum internalformat
,
92 * The primary draw target
95 .link
= &gpipeline
.fb_main
,
100 "colour", k_framebuffer_attachment_type_texture
,
102 .internalformat
= GL_RGB
,
104 .type
= GL_UNSIGNED_BYTE
,
105 .attachment
= GL_COLOR_ATTACHMENT0
108 "motion", k_framebuffer_attachment_type_texture
,
110 .quality
= k_framebuffer_quality_high_only
,
111 .internalformat
= GL_RG16F
,
114 .attachment
= GL_COLOR_ATTACHMENT1
118 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
120 .internalformat
= GL_DEPTH24_STENCIL8
,
122 "depth_stencil", k_framebuffer_attachment_type_texture_depth
,
123 .internalformat
= GL_DEPTH24_STENCIL8
,
124 .format
= GL_DEPTH_STENCIL
,
125 .type
= GL_UNSIGNED_INT_24_8
,
127 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
133 * Second rendered view from the perspective of the water reflection
136 .link
= &gpipeline
.fb_water_reflection
,
141 "colour", k_framebuffer_attachment_type_texture
,
142 .internalformat
= GL_RGB
,
144 .type
= GL_UNSIGNED_BYTE
,
145 .attachment
= GL_COLOR_ATTACHMENT0
148 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
150 .internalformat
= GL_DEPTH24_STENCIL8
,
151 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
157 * Thid rendered view from the perspective of the camera, but just
158 * captures stuff thats under the water
161 .link
= &gpipeline
.fb_water_beneath
,
166 "colour", k_framebuffer_attachment_type_texture
,
167 .internalformat
= GL_RED
,
169 .type
= GL_UNSIGNED_BYTE
,
170 .attachment
= GL_COLOR_ATTACHMENT0
173 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
175 .internalformat
= GL_DEPTH24_STENCIL8
,
176 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
182 .link
= &gpipeline
.fb_workshop_preview
,
184 .fixed_w
= 504, .fixed_h
= 336,
188 "colour", k_framebuffer_attachment_type_texture
,
189 .internalformat
= GL_RGB
,
191 .type
= GL_UNSIGNED_BYTE
,
192 .attachment
= GL_COLOR_ATTACHMENT0
195 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
196 .internalformat
= GL_DEPTH24_STENCIL8
,
197 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
204 * Get the current (automatically scaled or fixed) resolution of framebuffer
206 VG_STATIC
void render_fb_get_current_res( struct framebuffer
*fb
,
209 if( fb
->resolution_div
){
210 *x
= vg
.window_x
/ fb
->resolution_div
;
211 *y
= vg
.window_y
/ fb
->resolution_div
;
219 VG_STATIC
void render_fb_inverse_ratio( framebuffer
*fb
, v2f inverse
)
223 render_fb_get_current_res( fb
, &x
, &y
);
225 v2f render
= { fb
->render_w
, fb
->render_h
},
228 v2_div( render
, original
, inverse
);
231 v2_div( (v2f
){1.0f
,1.0f
}, (v2f
){ vg
.window_x
, vg
.window_y
}, inverse
);
236 * Bind framebuffer for drawing to
238 VG_STATIC
void render_fb_bind( framebuffer
*fb
, int use_scaling
)
241 render_fb_get_current_res( fb
, &x
, &y
);
244 x
= gpipeline
.view_render_scale
*(float)x
;
245 y
= gpipeline
.view_render_scale
*(float)y
;
254 glBindFramebuffer( GL_FRAMEBUFFER
, fb
->fb
);
255 glViewport( 0, 0, x
, y
);
259 * Bind framebuffer attachment's texture
261 VG_STATIC
void render_fb_bind_texture( framebuffer
*fb
,
262 int attachment
, int slot
)
264 struct framebuffer_attachment
*at
= &fb
->attachments
[attachment
];
266 if( (at
->purpose
!= k_framebuffer_attachment_type_texture
) &&
267 (at
->purpose
!= k_framebuffer_attachment_type_texture_depth
) )
269 vg_fatal_error( "illegal operation: bind non-texture framebuffer"
270 " attachment to texture slot" );
273 glActiveTexture( GL_TEXTURE0
+ slot
);
274 glBindTexture( GL_TEXTURE_2D
, fb
->attachments
[attachment
].id
);
282 #define FB_FORMAT_STR( E ) { E, #E },
285 * Convert OpenGL attachment ID enum to string
287 VG_STATIC
const char *render_fb_attachment_str( GLenum e
)
289 struct { GLenum e
; const char *str
; }
292 FB_FORMAT_STR(GL_COLOR_ATTACHMENT0
)
293 FB_FORMAT_STR(GL_COLOR_ATTACHMENT1
)
294 FB_FORMAT_STR(GL_COLOR_ATTACHMENT2
)
295 FB_FORMAT_STR(GL_COLOR_ATTACHMENT3
)
296 FB_FORMAT_STR(GL_COLOR_ATTACHMENT4
)
297 FB_FORMAT_STR(GL_DEPTH_STENCIL_ATTACHMENT
)
300 for( int i
=0; i
<vg_list_size(formats
); i
++ )
301 if( formats
[i
].e
== e
)
302 return formats
[i
].str
;
308 * Convert OpenGL texture format enums from TexImage2D table 1,2 &
309 * RenderBufferStorage Table 1, into strings
311 VG_STATIC
const char *render_fb_format_str( GLenum format
)
313 struct { GLenum e
; const char *str
; }
317 FB_FORMAT_STR(GL_DEPTH_COMPONENT
)
318 FB_FORMAT_STR(GL_DEPTH_STENCIL
)
319 FB_FORMAT_STR(GL_RED
)
321 FB_FORMAT_STR(GL_RGB
)
322 FB_FORMAT_STR(GL_RGBA
)
324 /* Render buffer formats */
325 FB_FORMAT_STR(GL_DEPTH_COMPONENT16
)
326 FB_FORMAT_STR(GL_DEPTH_COMPONENT24
)
327 FB_FORMAT_STR(GL_DEPTH_COMPONENT32F
)
328 FB_FORMAT_STR(GL_DEPTH24_STENCIL8
)
329 FB_FORMAT_STR(GL_DEPTH32F_STENCIL8
)
330 FB_FORMAT_STR(GL_STENCIL_INDEX8
)
334 FB_FORMAT_STR(GL_R8_SNORM
)
335 FB_FORMAT_STR(GL_R16
)
336 FB_FORMAT_STR(GL_R16_SNORM
)
337 FB_FORMAT_STR(GL_RG8
)
338 FB_FORMAT_STR(GL_RG8_SNORM
)
339 FB_FORMAT_STR(GL_RG16
)
340 FB_FORMAT_STR(GL_RG16_SNORM
)
341 FB_FORMAT_STR(GL_R3_G3_B2
)
342 FB_FORMAT_STR(GL_RGB4
)
343 FB_FORMAT_STR(GL_RGB5
)
344 FB_FORMAT_STR(GL_RGB8
)
345 FB_FORMAT_STR(GL_RGB8_SNORM
)
346 FB_FORMAT_STR(GL_RGB10
)
347 FB_FORMAT_STR(GL_RGB12
)
348 FB_FORMAT_STR(GL_RGB16_SNORM
)
349 FB_FORMAT_STR(GL_RGBA2
)
350 FB_FORMAT_STR(GL_RGBA4
)
351 FB_FORMAT_STR(GL_RGB5_A1
)
352 FB_FORMAT_STR(GL_RGBA8
)
353 FB_FORMAT_STR(GL_RGBA8_SNORM
)
354 FB_FORMAT_STR(GL_RGB10_A2
)
355 FB_FORMAT_STR(GL_RGB10_A2UI
)
356 FB_FORMAT_STR(GL_RGBA12
)
357 FB_FORMAT_STR(GL_RGBA16
)
358 FB_FORMAT_STR(GL_SRGB8
)
359 FB_FORMAT_STR(GL_SRGB8_ALPHA8
)
360 FB_FORMAT_STR(GL_R16F
)
361 FB_FORMAT_STR(GL_RG16F
)
362 FB_FORMAT_STR(GL_RGB16F
)
363 FB_FORMAT_STR(GL_RGBA16F
)
364 FB_FORMAT_STR(GL_R32F
)
365 FB_FORMAT_STR(GL_RG32F
)
366 FB_FORMAT_STR(GL_RGB32F
)
367 FB_FORMAT_STR(GL_RGBA32F
)
368 FB_FORMAT_STR(GL_R11F_G11F_B10F
)
369 FB_FORMAT_STR(GL_RGB9_E5
)
370 FB_FORMAT_STR(GL_R8I
)
371 FB_FORMAT_STR(GL_R8UI
)
372 FB_FORMAT_STR(GL_R16I
)
373 FB_FORMAT_STR(GL_R16UI
)
374 FB_FORMAT_STR(GL_R32I
)
375 FB_FORMAT_STR(GL_R32UI
)
376 FB_FORMAT_STR(GL_RG8I
)
377 FB_FORMAT_STR(GL_RG8UI
)
378 FB_FORMAT_STR(GL_RG16I
)
379 FB_FORMAT_STR(GL_RG16UI
)
380 FB_FORMAT_STR(GL_RG32I
)
381 FB_FORMAT_STR(GL_RG32UI
)
382 FB_FORMAT_STR(GL_RGB8I
)
383 FB_FORMAT_STR(GL_RGB8UI
)
384 FB_FORMAT_STR(GL_RGB16I
)
385 FB_FORMAT_STR(GL_RGB16UI
)
386 FB_FORMAT_STR(GL_RGB32I
)
387 FB_FORMAT_STR(GL_RGB32UI
)
388 FB_FORMAT_STR(GL_RGBA8I
)
389 FB_FORMAT_STR(GL_RGBA8UI
)
390 FB_FORMAT_STR(GL_RGBA16I
)
391 FB_FORMAT_STR(GL_RGBA16UI
)
392 FB_FORMAT_STR(GL_RGBA32I
)
393 FB_FORMAT_STR(GL_RGBA32UI
)
396 for( int i
=0; i
<vg_list_size(formats
); i
++ )
397 if( formats
[i
].e
== format
)
398 return formats
[i
].str
;
404 * Bind and allocate texture for framebuffer attachment
406 VG_STATIC
void render_fb_allocate_texture( struct framebuffer
*fb
,
407 struct framebuffer_attachment
*a
)
410 render_fb_get_current_res( fb
, &rx
, &ry
);
412 if( a
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
413 glBindRenderbuffer( GL_RENDERBUFFER
, a
->id
);
414 glRenderbufferStorage( GL_RENDERBUFFER
, a
->internalformat
, rx
, ry
);
416 else if( a
->purpose
== k_framebuffer_attachment_type_texture
||
417 a
->purpose
== k_framebuffer_attachment_type_texture_depth
)
419 glBindTexture( GL_TEXTURE_2D
, a
->id
);
420 glTexImage2D( GL_TEXTURE_2D
, 0, a
->internalformat
, rx
, ry
,
421 0, a
->format
, a
->type
, NULL
);
426 * Full allocation of a framebuffer
428 VG_STATIC
void render_fb_allocate( struct framebuffer
*fb
)
430 glGenFramebuffers( 1, &fb
->fb
);
431 glBindFramebuffer( GL_FRAMEBUFFER
, fb
->fb
);
434 render_fb_get_current_res( fb
, &rx
, &ry
);
436 vg_info( "allocate_framebuffer( %s, %dx%d )\n", fb
->display_name
, rx
, ry
);
439 GLenum colour_attachments
[4];
440 u32 colour_count
= 0;
442 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
443 struct framebuffer_attachment
*attachment
= &fb
->attachments
[j
];
445 if( attachment
->purpose
== k_framebuffer_attachment_type_none
)
448 vg_info( " %s: %s\n",
449 render_fb_attachment_str( attachment
->attachment
),
450 render_fb_format_str( attachment
->internalformat
) );
452 if( attachment
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
453 glGenRenderbuffers( 1, &attachment
->id
);
454 render_fb_allocate_texture( fb
, attachment
);
455 glFramebufferRenderbuffer( GL_FRAMEBUFFER
,
456 GL_DEPTH_STENCIL_ATTACHMENT
,
457 GL_RENDERBUFFER
, attachment
->id
);
459 else if( attachment
->purpose
== k_framebuffer_attachment_type_texture
||
460 attachment
->purpose
== k_framebuffer_attachment_type_texture_depth
)
462 glGenTextures( 1, &attachment
->id
);
463 render_fb_allocate_texture( fb
, attachment
);
464 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_LINEAR
);
465 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_LINEAR
);
466 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_EDGE
);
467 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_EDGE
);
469 glFramebufferTexture2D( GL_FRAMEBUFFER
, attachment
->attachment
,
470 GL_TEXTURE_2D
, attachment
->id
, 0 );
472 if( attachment
->purpose
== k_framebuffer_attachment_type_texture
)
473 colour_attachments
[ colour_count
++ ] = attachment
->attachment
;
477 glDrawBuffers( colour_count
, colour_attachments
);
482 GLenum result
= glCheckFramebufferStatus( GL_FRAMEBUFFER
);
484 if( result
== GL_FRAMEBUFFER_COMPLETE
){
486 * Attatch to gpipeline
491 vg_success( " status: complete\n" );
495 if( result
== GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
)
496 vg_error( " status: Incomplete attachment" );
497 else if( result
== GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
)
498 vg_error( " status: Missing attachment" );
499 else if( result
== GL_FRAMEBUFFER_UNSUPPORTED
)
500 vg_error( " status: Unsupported framebuffer format" );
502 vg_error( " status: Generic Error" );
505 vg_fatal_error( "Incomplete framebuffer (see logs)" );
510 * Resize/Update all framebuffers(we know about)
512 VG_STATIC
void render_fb_resize(void)
514 if( !gpipeline
.ready
)
517 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
518 struct framebuffer
*fb
= &framebuffers
[i
];
519 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
520 struct framebuffer_attachment
*attachment
= &fb
->attachments
[j
];
521 render_fb_allocate_texture( fb
, attachment
);
526 VG_STATIC
int render_framebuffer_control( int argc
, char const *argv
[] );
527 VG_STATIC
void render_framebuffer_poll( int argc
, char const *argv
[] );
529 VG_STATIC
void async_render_init( void *payload
, u32 size
)
532 * Complete Framebuffers
534 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
535 struct framebuffer
*fb
= &framebuffers
[i
];
536 render_fb_allocate( fb
);
540 0.00f
,0.00f
, 1.00f
,1.00f
, 0.00f
,1.00f
, /* fsquad */
541 0.00f
,0.00f
, 1.00f
,0.00f
, 1.00f
,1.00f
,
543 0.00f
,0.00f
, 1.00f
,0x1p
-4f
,0.00f
,0x1p
-4f
, /* fsquad1 */
544 0.00f
,0.00f
, 1.00f
,0.00f
, 1.00f
,0x1p
-4f
,
548 0.00f
,0.00f
, 0.30f
,0.30f
, 0.00f
,0.30f
,
549 0.00f
,0.00f
, 0.30f
,0.00f
, 0.30f
,0.30f
,
550 0.30f
,0.00f
, 0.60f
,0.30f
, 0.30f
,0.30f
,
551 0.30f
,0.00f
, 0.60f
,0.00f
, 0.60f
,0.30f
,
552 0.60f
,0.00f
, 0.90f
,0.30f
, 0.60f
,0.30f
,
553 0.60f
,0.00f
, 0.90f
,0.00f
, 0.90f
,0.30f
,
555 0.00f
,0.30f
, 0.30f
,0.60f
, 0.00f
,0.60f
,
556 0.00f
,0.30f
, 0.30f
,0.30f
, 0.30f
,0.60f
,
557 0.30f
,0.30f
, 0.60f
,0.60f
, 0.30f
,0.60f
,
558 0.30f
,0.30f
, 0.60f
,0.30f
, 0.60f
,0.60f
,
559 0.60f
,0.30f
, 0.90f
,0.60f
, 0.60f
,0.60f
,
560 0.60f
,0.30f
, 0.90f
,0.30f
, 0.90f
,0.60f
,
562 0.00f
,0.60f
, 0.30f
,0.90f
, 0.00f
,0.90f
,
563 0.00f
,0.60f
, 0.30f
,0.60f
, 0.30f
,0.90f
,
564 0.30f
,0.60f
, 0.60f
,0.90f
, 0.30f
,0.90f
,
565 0.30f
,0.60f
, 0.60f
,0.60f
, 0.60f
,0.90f
,
566 0.60f
,0.60f
, 0.90f
,0.90f
, 0.60f
,0.90f
,
567 0.60f
,0.60f
, 0.90f
,0.60f
, 0.90f
,0.90f
,
570 vg_console_reg_cmd( "fb", render_framebuffer_control
,
571 render_framebuffer_poll
);
573 glGenVertexArrays( 1, &gpipeline
.fsquad
.vao
);
574 glGenBuffers( 1, &gpipeline
.fsquad
.vbo
);
575 glBindVertexArray( gpipeline
.fsquad
.vao
);
576 glBindBuffer( GL_ARRAY_BUFFER
, gpipeline
.fsquad
.vbo
);
577 glBufferData( GL_ARRAY_BUFFER
, sizeof(quad
), quad
, GL_STATIC_DRAW
);
578 glBindVertexArray( gpipeline
.fsquad
.vao
);
579 glVertexAttribPointer( 0, 2, GL_FLOAT
, GL_FALSE
,
580 sizeof(float)*2, (void*)0 );
581 glEnableVertexAttribArray( 0 );
585 glBindFramebuffer( GL_FRAMEBUFFER
, 0 );
589 VG_STATIC
void render_init(void)
591 shader_blit_register();
592 shader_blitblur_register();
593 shader_blitcolour_register();
595 vg_async_call( async_render_init
, NULL
, 0 );
601 VG_STATIC
void render_fsquad(void)
603 glBindVertexArray( gpipeline
.fsquad
.vao
);
604 glDrawArrays( GL_TRIANGLES
, 0, 6 );
607 VG_STATIC
void render_fsquad1(void)
609 glBindVertexArray( gpipeline
.fsquad
.vao
);
610 glDrawArrays( GL_TRIANGLES
, 6, 6 );
614 * Call this inside the UI function
616 VG_STATIC
void render_view_framebuffer_ui(void)
619 int viewing_count
= 0;
621 glBindVertexArray( gpipeline
.fsquad
.vao
);
623 shader_blit_uTexMain( 0 );
625 v2f identity
= { 1.0f
, 1.0f
};
626 shader_blit_uInverseRatio( identity
);
628 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
629 struct framebuffer
*fb
= &framebuffers
[i
];
631 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
632 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
634 if( !at
->debug_view
)
638 window
= { vg
.window_x
, vg
.window_y
};
640 corner
[0] = viewing_count
% 3;
641 corner
[1] = 1 + (viewing_count
/ 3);
642 v2_mul( corner
, window
, corner
);
643 v2_muls( corner
, 0.3f
, corner
);
644 corner
[1] = vg
.window_y
- corner
[1];
646 ui_text( (ui_rect
){ corner
[0], corner
[1], 0.0f
, 0.0f
},
647 fb
->display_name
, 2, k_text_align_left
);
648 ui_text( (ui_rect
){ corner
[0], corner
[1] + 32, 0.0f
, 0.0f
, },
649 at
->display_name
, 1, k_text_align_left
);
651 if( at
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
653 v2_muladds( corner
, window
, 0.15f
, center
);
655 ui_text( (ui_rect
){ center
[0], center
[1], 0.0f
, 0.0f
},
656 "<hardware texture>", 1, k_text_align_center
);
659 render_fb_bind_texture( fb
, j
, 0 );
661 int start
= (viewing_count
+2) * 6,
663 glDrawArrays( GL_TRIANGLES
, start
, count
);
672 VG_STATIC
void render_framebuffer_show( struct framebuffer
*fb
,
673 struct framebuffer_attachment
*at
,
676 at
->debug_view
= operation
;
677 vg_info( "%s %s:%s\n", (operation
?"shown": "hidden"),
678 fb
->display_name
, at
->display_name
);
682 * arg0: command "show"/"hide"
683 * arg1: framebuffer name <name>/"all"
684 * arg2: subname <name>/none
686 VG_STATIC
int render_framebuffer_control( int argc
, char const *argv
[] )
689 vg_error( "Usage: fb \"show/hide\" <name>/\"all\" <name>/none\n" );
696 if( !strcmp( argv
[0], "show" ) )
698 else if( !strcmp( argv
[0], "hide" ) )
701 vg_error( "Unknown framebuffer operation: '%s'\n", argv
[0] );
705 if( !strcmp( argv
[1], "all" ) )
708 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
709 struct framebuffer
*fb
= &framebuffers
[i
];
711 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
712 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
714 if( at
->purpose
== k_framebuffer_attachment_type_none
)
718 render_framebuffer_show( fb
, at
, operation
);
721 if( !strcmp( fb
->display_name
, argv
[1] ) ){
723 render_framebuffer_show( fb
, at
, operation
);
724 else if( !strcmp( at
->display_name
, argv
[2] ) )
725 render_framebuffer_show( fb
, at
, operation
);
734 VG_STATIC
void render_framebuffer_poll( int argc
, char const *argv
[] )
736 const char *term
= argv
[argc
-1];
739 console_suggest_score_text( "show", term
, 0 );
740 console_suggest_score_text( "hide", term
, 0 );
742 else if( argc
== 2 ){
743 console_suggest_score_text( "all", term
, 0 );
745 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
746 struct framebuffer
*fb
= &framebuffers
[i
];
747 console_suggest_score_text( fb
->display_name
, term
, 0 );
750 else if( argc
== 3 ){
753 if( !strcmp( argv
[1], "all" ) )
756 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
757 struct framebuffer
*fb
= &framebuffers
[i
];
759 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
760 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
762 if( at
->purpose
== k_framebuffer_attachment_type_none
)
766 console_suggest_score_text( at
->display_name
, term
, 0 );
768 else if( !strcmp( fb
->display_name
, argv
[1] ) ){
769 console_suggest_score_text( at
->display_name
, term
, 0 );
776 #endif /* RENDER_H */