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"
14 #define WORKSHOP_PREVIEW_WIDTH 504
15 #define WORKSHOP_PREVIEW_HEIGHT 336
19 typedef struct framebuffer framebuffer
;
22 * All standard buffers used in rendering
24 VG_STATIC
struct pipeline
{
33 float view_render_scale
,
36 gpipeline
= { .view_render_scale
= 1.0f
};
39 const char *display_name
;
40 int resolution_div
, /* definition */
44 render_w
, /* runtime */
47 struct framebuffer_attachment
{
48 const char *display_name
;
50 enum framebuffer_attachment_type
{
51 k_framebuffer_attachment_type_none
,
52 k_framebuffer_attachment_type_texture
,
53 k_framebuffer_attachment_type_renderbuffer
,
54 k_framebuffer_attachment_type_texture_depth
58 enum framebuffer_quality_profile
{
59 k_framebuffer_quality_all
,
60 k_framebuffer_quality_high_only
64 GLenum internalformat
,
82 * The primary draw target
85 .link
= &gpipeline
.fb_main
,
90 "colour", k_framebuffer_attachment_type_texture
,
92 .internalformat
= GL_RGB
,
94 .type
= GL_UNSIGNED_BYTE
,
95 .attachment
= GL_COLOR_ATTACHMENT0
98 "motion", k_framebuffer_attachment_type_texture
,
100 .quality
= k_framebuffer_quality_high_only
,
101 .internalformat
= GL_RG16F
,
104 .attachment
= GL_COLOR_ATTACHMENT1
108 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
110 .internalformat
= GL_DEPTH24_STENCIL8
,
112 "depth_stencil", k_framebuffer_attachment_type_texture_depth
,
113 .internalformat
= GL_DEPTH24_STENCIL8
,
114 .format
= GL_DEPTH_STENCIL
,
115 .type
= GL_UNSIGNED_INT_24_8
,
117 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
123 * Second rendered view from the perspective of the water reflection
126 .link
= &gpipeline
.fb_water_reflection
,
131 "colour", k_framebuffer_attachment_type_texture
,
132 .internalformat
= GL_RGB
,
134 .type
= GL_UNSIGNED_BYTE
,
135 .attachment
= GL_COLOR_ATTACHMENT0
138 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
140 .internalformat
= GL_DEPTH24_STENCIL8
,
141 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
147 * Thid rendered view from the perspective of the camera, but just
148 * captures stuff thats under the water
151 .link
= &gpipeline
.fb_water_beneath
,
156 "colour", k_framebuffer_attachment_type_texture
,
157 .internalformat
= GL_RED
,
159 .type
= GL_UNSIGNED_BYTE
,
160 .attachment
= GL_COLOR_ATTACHMENT0
163 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
165 .internalformat
= GL_DEPTH24_STENCIL8
,
166 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
172 .link
= &gpipeline
.fb_workshop_preview
,
174 .fixed_w
= WORKSHOP_PREVIEW_WIDTH
, .fixed_h
= WORKSHOP_PREVIEW_HEIGHT
,
178 "colour", k_framebuffer_attachment_type_texture
,
179 .internalformat
= GL_RGB
,
181 .type
= GL_UNSIGNED_BYTE
,
182 .attachment
= GL_COLOR_ATTACHMENT0
185 "depth_stencil", k_framebuffer_attachment_type_renderbuffer
,
186 .internalformat
= GL_DEPTH24_STENCIL8
,
187 .attachment
= GL_DEPTH_STENCIL_ATTACHMENT
194 * Get the current (automatically scaled or fixed) resolution of framebuffer
196 VG_STATIC
void render_fb_get_current_res( struct framebuffer
*fb
,
199 if( fb
->resolution_div
){
200 *x
= vg
.window_x
/ fb
->resolution_div
;
201 *y
= vg
.window_y
/ fb
->resolution_div
;
209 VG_STATIC
void render_fb_inverse_ratio( framebuffer
*fb
, v2f inverse
)
213 render_fb_get_current_res( fb
, &x
, &y
);
215 v2f render
= { fb
->render_w
, fb
->render_h
},
218 v2_div( render
, original
, inverse
);
221 v2_div( (v2f
){1.0f
,1.0f
}, (v2f
){ vg
.window_x
, vg
.window_y
}, inverse
);
226 * Bind framebuffer for drawing to
228 VG_STATIC
void render_fb_bind( framebuffer
*fb
, int use_scaling
)
231 render_fb_get_current_res( fb
, &x
, &y
);
234 x
= gpipeline
.view_render_scale
*(float)x
;
235 y
= gpipeline
.view_render_scale
*(float)y
;
244 glBindFramebuffer( GL_FRAMEBUFFER
, fb
->fb
);
245 glViewport( 0, 0, x
, y
);
249 * Bind framebuffer attachment's texture
251 VG_STATIC
void render_fb_bind_texture( framebuffer
*fb
,
252 int attachment
, int slot
)
254 struct framebuffer_attachment
*at
= &fb
->attachments
[attachment
];
256 if( (at
->purpose
!= k_framebuffer_attachment_type_texture
) &&
257 (at
->purpose
!= k_framebuffer_attachment_type_texture_depth
) )
259 vg_fatal_error( "illegal operation: bind non-texture framebuffer"
260 " attachment to texture slot" );
263 glActiveTexture( GL_TEXTURE0
+ slot
);
264 glBindTexture( GL_TEXTURE_2D
, fb
->attachments
[attachment
].id
);
272 #define FB_FORMAT_STR( E ) { E, #E },
275 * Convert OpenGL attachment ID enum to string
277 VG_STATIC
const char *render_fb_attachment_str( GLenum e
)
279 struct { GLenum e
; const char *str
; }
282 FB_FORMAT_STR(GL_COLOR_ATTACHMENT0
)
283 FB_FORMAT_STR(GL_COLOR_ATTACHMENT1
)
284 FB_FORMAT_STR(GL_COLOR_ATTACHMENT2
)
285 FB_FORMAT_STR(GL_COLOR_ATTACHMENT3
)
286 FB_FORMAT_STR(GL_COLOR_ATTACHMENT4
)
287 FB_FORMAT_STR(GL_DEPTH_STENCIL_ATTACHMENT
)
290 for( int i
=0; i
<vg_list_size(formats
); i
++ )
291 if( formats
[i
].e
== e
)
292 return formats
[i
].str
;
298 * Convert OpenGL texture format enums from TexImage2D table 1,2 &
299 * RenderBufferStorage Table 1, into strings
301 VG_STATIC
const char *render_fb_format_str( GLenum format
)
303 struct { GLenum e
; const char *str
; }
307 FB_FORMAT_STR(GL_DEPTH_COMPONENT
)
308 FB_FORMAT_STR(GL_DEPTH_STENCIL
)
309 FB_FORMAT_STR(GL_RED
)
311 FB_FORMAT_STR(GL_RGB
)
312 FB_FORMAT_STR(GL_RGBA
)
314 /* Render buffer formats */
315 FB_FORMAT_STR(GL_DEPTH_COMPONENT16
)
316 FB_FORMAT_STR(GL_DEPTH_COMPONENT24
)
317 FB_FORMAT_STR(GL_DEPTH_COMPONENT32F
)
318 FB_FORMAT_STR(GL_DEPTH24_STENCIL8
)
319 FB_FORMAT_STR(GL_DEPTH32F_STENCIL8
)
320 FB_FORMAT_STR(GL_STENCIL_INDEX8
)
324 FB_FORMAT_STR(GL_R8_SNORM
)
325 FB_FORMAT_STR(GL_R16
)
326 FB_FORMAT_STR(GL_R16_SNORM
)
327 FB_FORMAT_STR(GL_RG8
)
328 FB_FORMAT_STR(GL_RG8_SNORM
)
329 FB_FORMAT_STR(GL_RG16
)
330 FB_FORMAT_STR(GL_RG16_SNORM
)
331 FB_FORMAT_STR(GL_R3_G3_B2
)
332 FB_FORMAT_STR(GL_RGB4
)
333 FB_FORMAT_STR(GL_RGB5
)
334 FB_FORMAT_STR(GL_RGB8
)
335 FB_FORMAT_STR(GL_RGB8_SNORM
)
336 FB_FORMAT_STR(GL_RGB10
)
337 FB_FORMAT_STR(GL_RGB12
)
338 FB_FORMAT_STR(GL_RGB16_SNORM
)
339 FB_FORMAT_STR(GL_RGBA2
)
340 FB_FORMAT_STR(GL_RGBA4
)
341 FB_FORMAT_STR(GL_RGB5_A1
)
342 FB_FORMAT_STR(GL_RGBA8
)
343 FB_FORMAT_STR(GL_RGBA8_SNORM
)
344 FB_FORMAT_STR(GL_RGB10_A2
)
345 FB_FORMAT_STR(GL_RGB10_A2UI
)
346 FB_FORMAT_STR(GL_RGBA12
)
347 FB_FORMAT_STR(GL_RGBA16
)
348 FB_FORMAT_STR(GL_SRGB8
)
349 FB_FORMAT_STR(GL_SRGB8_ALPHA8
)
350 FB_FORMAT_STR(GL_R16F
)
351 FB_FORMAT_STR(GL_RG16F
)
352 FB_FORMAT_STR(GL_RGB16F
)
353 FB_FORMAT_STR(GL_RGBA16F
)
354 FB_FORMAT_STR(GL_R32F
)
355 FB_FORMAT_STR(GL_RG32F
)
356 FB_FORMAT_STR(GL_RGB32F
)
357 FB_FORMAT_STR(GL_RGBA32F
)
358 FB_FORMAT_STR(GL_R11F_G11F_B10F
)
359 FB_FORMAT_STR(GL_RGB9_E5
)
360 FB_FORMAT_STR(GL_R8I
)
361 FB_FORMAT_STR(GL_R8UI
)
362 FB_FORMAT_STR(GL_R16I
)
363 FB_FORMAT_STR(GL_R16UI
)
364 FB_FORMAT_STR(GL_R32I
)
365 FB_FORMAT_STR(GL_R32UI
)
366 FB_FORMAT_STR(GL_RG8I
)
367 FB_FORMAT_STR(GL_RG8UI
)
368 FB_FORMAT_STR(GL_RG16I
)
369 FB_FORMAT_STR(GL_RG16UI
)
370 FB_FORMAT_STR(GL_RG32I
)
371 FB_FORMAT_STR(GL_RG32UI
)
372 FB_FORMAT_STR(GL_RGB8I
)
373 FB_FORMAT_STR(GL_RGB8UI
)
374 FB_FORMAT_STR(GL_RGB16I
)
375 FB_FORMAT_STR(GL_RGB16UI
)
376 FB_FORMAT_STR(GL_RGB32I
)
377 FB_FORMAT_STR(GL_RGB32UI
)
378 FB_FORMAT_STR(GL_RGBA8I
)
379 FB_FORMAT_STR(GL_RGBA8UI
)
380 FB_FORMAT_STR(GL_RGBA16I
)
381 FB_FORMAT_STR(GL_RGBA16UI
)
382 FB_FORMAT_STR(GL_RGBA32I
)
383 FB_FORMAT_STR(GL_RGBA32UI
)
386 for( int i
=0; i
<vg_list_size(formats
); i
++ )
387 if( formats
[i
].e
== format
)
388 return formats
[i
].str
;
394 * Bind and allocate texture for framebuffer attachment
396 VG_STATIC
void render_fb_allocate_texture( struct framebuffer
*fb
,
397 struct framebuffer_attachment
*a
)
400 render_fb_get_current_res( fb
, &rx
, &ry
);
402 if( a
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
403 glBindRenderbuffer( GL_RENDERBUFFER
, a
->id
);
404 glRenderbufferStorage( GL_RENDERBUFFER
, a
->internalformat
, rx
, ry
);
406 else if( a
->purpose
== k_framebuffer_attachment_type_texture
||
407 a
->purpose
== k_framebuffer_attachment_type_texture_depth
)
409 glBindTexture( GL_TEXTURE_2D
, a
->id
);
410 glTexImage2D( GL_TEXTURE_2D
, 0, a
->internalformat
, rx
, ry
,
411 0, a
->format
, a
->type
, NULL
);
416 * Full allocation of a framebuffer
418 VG_STATIC
void render_fb_allocate( struct framebuffer
*fb
)
420 glGenFramebuffers( 1, &fb
->fb
);
421 glBindFramebuffer( GL_FRAMEBUFFER
, fb
->fb
);
424 render_fb_get_current_res( fb
, &rx
, &ry
);
426 vg_info( "allocate_framebuffer( %s, %dx%d )\n", fb
->display_name
, rx
, ry
);
429 GLenum colour_attachments
[4];
430 u32 colour_count
= 0;
432 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
433 struct framebuffer_attachment
*attachment
= &fb
->attachments
[j
];
435 if( attachment
->purpose
== k_framebuffer_attachment_type_none
)
438 vg_info( " %s: %s\n",
439 render_fb_attachment_str( attachment
->attachment
),
440 render_fb_format_str( attachment
->internalformat
) );
442 if( attachment
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
443 glGenRenderbuffers( 1, &attachment
->id
);
444 render_fb_allocate_texture( fb
, attachment
);
445 glFramebufferRenderbuffer( GL_FRAMEBUFFER
,
446 GL_DEPTH_STENCIL_ATTACHMENT
,
447 GL_RENDERBUFFER
, attachment
->id
);
449 else if( attachment
->purpose
== k_framebuffer_attachment_type_texture
||
450 attachment
->purpose
== k_framebuffer_attachment_type_texture_depth
)
452 glGenTextures( 1, &attachment
->id
);
453 render_fb_allocate_texture( fb
, attachment
);
454 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_LINEAR
);
455 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_LINEAR
);
456 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_EDGE
);
457 glTexParameteri( GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_EDGE
);
459 glFramebufferTexture2D( GL_FRAMEBUFFER
, attachment
->attachment
,
460 GL_TEXTURE_2D
, attachment
->id
, 0 );
462 if( attachment
->purpose
== k_framebuffer_attachment_type_texture
)
463 colour_attachments
[ colour_count
++ ] = attachment
->attachment
;
467 glDrawBuffers( colour_count
, colour_attachments
);
472 GLenum result
= glCheckFramebufferStatus( GL_FRAMEBUFFER
);
474 if( result
== GL_FRAMEBUFFER_COMPLETE
){
476 * Attatch to gpipeline
481 vg_success( " status: complete\n" );
485 if( result
== GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
)
486 vg_error( " status: Incomplete attachment" );
487 else if( result
== GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
)
488 vg_error( " status: Missing attachment" );
489 else if( result
== GL_FRAMEBUFFER_UNSUPPORTED
)
490 vg_error( " status: Unsupported framebuffer format" );
492 vg_error( " status: Generic Error" );
495 vg_fatal_error( "Incomplete framebuffer (see logs)" );
500 * Resize/Update all framebuffers(we know about)
502 VG_STATIC
void render_fb_resize(void)
504 if( !gpipeline
.ready
)
507 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
508 struct framebuffer
*fb
= &framebuffers
[i
];
509 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
510 struct framebuffer_attachment
*attachment
= &fb
->attachments
[j
];
511 render_fb_allocate_texture( fb
, attachment
);
516 VG_STATIC
int render_framebuffer_control( int argc
, char const *argv
[] );
517 VG_STATIC
void render_framebuffer_poll( int argc
, char const *argv
[] );
519 VG_STATIC
void async_render_init( void *payload
, u32 size
)
522 * Complete Framebuffers
524 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
525 struct framebuffer
*fb
= &framebuffers
[i
];
526 render_fb_allocate( fb
);
530 0.00f
,0.00f
, 1.00f
,1.00f
, 0.00f
,1.00f
, /* fsquad */
531 0.00f
,0.00f
, 1.00f
,0.00f
, 1.00f
,1.00f
,
533 0.00f
,0.00f
, 1.00f
,0x1p
-4f
,0.00f
,0x1p
-4f
, /* fsquad1 */
534 0.00f
,0.00f
, 1.00f
,0.00f
, 1.00f
,0x1p
-4f
,
538 0.00f
,0.00f
, 0.30f
,0.30f
, 0.00f
,0.30f
,
539 0.00f
,0.00f
, 0.30f
,0.00f
, 0.30f
,0.30f
,
540 0.30f
,0.00f
, 0.60f
,0.30f
, 0.30f
,0.30f
,
541 0.30f
,0.00f
, 0.60f
,0.00f
, 0.60f
,0.30f
,
542 0.60f
,0.00f
, 0.90f
,0.30f
, 0.60f
,0.30f
,
543 0.60f
,0.00f
, 0.90f
,0.00f
, 0.90f
,0.30f
,
545 0.00f
,0.30f
, 0.30f
,0.60f
, 0.00f
,0.60f
,
546 0.00f
,0.30f
, 0.30f
,0.30f
, 0.30f
,0.60f
,
547 0.30f
,0.30f
, 0.60f
,0.60f
, 0.30f
,0.60f
,
548 0.30f
,0.30f
, 0.60f
,0.30f
, 0.60f
,0.60f
,
549 0.60f
,0.30f
, 0.90f
,0.60f
, 0.60f
,0.60f
,
550 0.60f
,0.30f
, 0.90f
,0.30f
, 0.90f
,0.60f
,
552 0.00f
,0.60f
, 0.30f
,0.90f
, 0.00f
,0.90f
,
553 0.00f
,0.60f
, 0.30f
,0.60f
, 0.30f
,0.90f
,
554 0.30f
,0.60f
, 0.60f
,0.90f
, 0.30f
,0.90f
,
555 0.30f
,0.60f
, 0.60f
,0.60f
, 0.60f
,0.90f
,
556 0.60f
,0.60f
, 0.90f
,0.90f
, 0.60f
,0.90f
,
557 0.60f
,0.60f
, 0.90f
,0.60f
, 0.90f
,0.90f
,
560 vg_console_reg_cmd( "fb", render_framebuffer_control
,
561 render_framebuffer_poll
);
562 vg_console_reg_var( "render_scale", &gpipeline
.view_render_scale
,
563 k_var_dtype_f32
, VG_VAR_PERSISTENT
);
565 glGenVertexArrays( 1, &gpipeline
.fsquad
.vao
);
566 glGenBuffers( 1, &gpipeline
.fsquad
.vbo
);
567 glBindVertexArray( gpipeline
.fsquad
.vao
);
568 glBindBuffer( GL_ARRAY_BUFFER
, gpipeline
.fsquad
.vbo
);
569 glBufferData( GL_ARRAY_BUFFER
, sizeof(quad
), quad
, GL_STATIC_DRAW
);
570 glBindVertexArray( gpipeline
.fsquad
.vao
);
571 glVertexAttribPointer( 0, 2, GL_FLOAT
, GL_FALSE
,
572 sizeof(float)*2, (void*)0 );
573 glEnableVertexAttribArray( 0 );
577 glBindFramebuffer( GL_FRAMEBUFFER
, 0 );
581 VG_STATIC
void render_init(void)
583 shader_blit_register();
584 shader_blitblur_register();
585 shader_blitcolour_register();
587 vg_async_call( async_render_init
, NULL
, 0 );
593 VG_STATIC
void render_fsquad(void)
595 glBindVertexArray( gpipeline
.fsquad
.vao
);
596 glDrawArrays( GL_TRIANGLES
, 0, 6 );
599 VG_STATIC
void render_fsquad1(void)
601 glBindVertexArray( gpipeline
.fsquad
.vao
);
602 glDrawArrays( GL_TRIANGLES
, 6, 6 );
606 * Call this inside the UI function
608 VG_STATIC
void render_view_framebuffer_ui(void)
611 int viewing_count
= 0;
613 glBindVertexArray( gpipeline
.fsquad
.vao
);
615 shader_blit_uTexMain( 0 );
617 v2f identity
= { 1.0f
, 1.0f
};
618 shader_blit_uInverseRatio( identity
);
620 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
621 struct framebuffer
*fb
= &framebuffers
[i
];
623 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
624 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
626 if( !at
->debug_view
)
630 window
= { vg
.window_x
, vg
.window_y
};
632 corner
[0] = viewing_count
% 3;
633 corner
[1] = 1 + (viewing_count
/ 3);
634 v2_mul( corner
, window
, corner
);
635 v2_muls( corner
, 0.3f
, corner
);
636 corner
[1] = vg
.window_y
- corner
[1];
638 ui_text( (ui_rect
){ corner
[0], corner
[1], 0.0f
, 0.0f
},
639 fb
->display_name
, 2, k_text_align_left
);
640 ui_text( (ui_rect
){ corner
[0], corner
[1] + 32, 0.0f
, 0.0f
, },
641 at
->display_name
, 1, k_text_align_left
);
643 if( at
->purpose
== k_framebuffer_attachment_type_renderbuffer
){
645 v2_muladds( corner
, window
, 0.15f
, center
);
647 ui_text( (ui_rect
){ center
[0], center
[1], 0.0f
, 0.0f
},
648 "<hardware texture>", 1, k_text_align_center
);
651 render_fb_bind_texture( fb
, j
, 0 );
653 int start
= (viewing_count
+2) * 6,
655 glDrawArrays( GL_TRIANGLES
, start
, count
);
664 VG_STATIC
void render_framebuffer_show( struct framebuffer
*fb
,
665 struct framebuffer_attachment
*at
,
668 at
->debug_view
= operation
;
669 vg_info( "%s %s:%s\n", (operation
?"shown": "hidden"),
670 fb
->display_name
, at
->display_name
);
674 * arg0: command "show"/"hide"
675 * arg1: framebuffer name <name>/"all"
676 * arg2: subname <name>/none
678 VG_STATIC
int render_framebuffer_control( int argc
, char const *argv
[] )
681 vg_error( "Usage: fb \"show/hide\" <name>/\"all\" <name>/none\n" );
688 if( !strcmp( argv
[0], "show" ) )
690 else if( !strcmp( argv
[0], "hide" ) )
693 vg_error( "Unknown framebuffer operation: '%s'\n", argv
[0] );
697 if( !strcmp( argv
[1], "all" ) )
700 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
701 struct framebuffer
*fb
= &framebuffers
[i
];
703 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
704 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
706 if( at
->purpose
== k_framebuffer_attachment_type_none
)
710 render_framebuffer_show( fb
, at
, operation
);
713 if( !strcmp( fb
->display_name
, argv
[1] ) ){
715 render_framebuffer_show( fb
, at
, operation
);
716 else if( !strcmp( at
->display_name
, argv
[2] ) )
717 render_framebuffer_show( fb
, at
, operation
);
726 VG_STATIC
void render_framebuffer_poll( int argc
, char const *argv
[] )
728 const char *term
= argv
[argc
-1];
731 console_suggest_score_text( "show", term
, 0 );
732 console_suggest_score_text( "hide", term
, 0 );
734 else if( argc
== 2 ){
735 console_suggest_score_text( "all", term
, 0 );
737 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
738 struct framebuffer
*fb
= &framebuffers
[i
];
739 console_suggest_score_text( fb
->display_name
, term
, 0 );
742 else if( argc
== 3 ){
745 if( !strcmp( argv
[1], "all" ) )
748 for( int i
=0; i
<vg_list_size(framebuffers
); i
++ ){
749 struct framebuffer
*fb
= &framebuffers
[i
];
751 for( int j
=0; j
<vg_list_size(fb
->attachments
); j
++ ){
752 struct framebuffer_attachment
*at
= &fb
->attachments
[j
];
754 if( at
->purpose
== k_framebuffer_attachment_type_none
)
758 console_suggest_score_text( at
->display_name
, term
, 0 );
760 else if( !strcmp( fb
->display_name
, argv
[1] ) ){
761 console_suggest_score_text( at
->display_name
, term
, 0 );
768 #endif /* RENDER_H */