gfx_capabilities(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ gfx_capabilities(3) ✨

okay bestie, this is a page from the Allegro manual β€” the game programming library β€” and it's about a lil global int that tells you what your graphics driver and video hardware can actually do. let's get into it πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

extern int gfx_capabilities;

πŸ’– DESCRIPTION πŸ’–

So gfx_capabilities is a bitfield describing the capabilities of the current graphics driver and video hardware. It can contain any combination of these flags, and every single one is listed below, no skipping, we're doing all of them 🫢

  • GFX_CAN_SCROLL β€” tells you the scroll_screen() function may be used with this driver. cute.
  • GFX_CAN_TRIPLE_BUFFER β€” tells you the request_scroll() and poll_scroll() functions may be used with this driver. If this flag is not set, it's possible that the enable_triple_buffer() function may be able to activate it. so like, not over yet.
  • GFX_HW_CURSOR β€” tells you a hardware mouse cursor is in use. When this flag is set, it's safe to draw onto the screen without hiding the mouse pointer first πŸ–±οΈβœ¨ But heads up: not every cursor graphic can be implemented in hardware. In particular, VBE/AF only supports 2-color images up to 32x32 in size, where the second color is an exact inverse of the first. This means Allegro may need to switch between hardware and software cursors at any point during the execution of your program, so do not assume this flag will stay constant for long periods of time. It only tells you whether a hardware cursor is in use at the current time, and it may change whenever you hide/redisplay the pointer. it's giving main character with commitment issues 😭
  • GFX_SYSTEM_CURSOR β€” tells you the mouse cursor is the default system cursor, not Allegro's custom cursor.
  • GFX_HW_HLINE β€” tells you the normal opaque version of the hline() function is implemented using a hardware accelerator. This improves performance not only of hline() itself, but also of tons of other functions that use it as a workhorse, for example circlefill(), triangle(), and floodfill(). one little line function carrying the whole team fr fr πŸ‘‘
  • GFX_HW_HLINE_XOR β€” tells you the XOR version of the hline() function, and any other functions that use it as a workhorse, are implemented using a hardware accelerator.
  • GFX_HW_HLINE_SOLID_PATTERN β€” tells you the solid and masked pattern modes of the hline() function, and any other functions that use it as a workhorse, are implemented using a hardware accelerator (see the note below πŸ‘‡).
  • GFX_HW_HLINE_COPY_PATTERN β€” tells you the copy pattern mode of the hline() function, and any other functions that use it as a workhorse, are implemented using a hardware accelerator (see the note below πŸ‘‡).
  • GFX_HW_FILL β€” tells you the opaque version of the rectfill() function, the clear_bitmap() routine, and clear_to_color(), are implemented using a hardware accelerator.
  • GFX_HW_FILL_XOR β€” tells you the XOR version of the rectfill() function is implemented using a hardware accelerator.
  • GFX_HW_FILL_SOLID_PATTERN β€” tells you the solid and masked pattern modes of the rectfill() function are implemented using a hardware accelerator (see the note below πŸ‘‡).
  • GFX_HW_FILL_COPY_PATTERN β€” tells you the copy pattern mode of the rectfill() function is implemented using a hardware accelerator (see the note below πŸ‘‡).
  • GFX_HW_LINE β€” tells you the opaque mode line() and vline() functions are implemented using a hardware accelerator.
  • GFX_HW_LINE_XOR β€” tells you the XOR version of the line() and vline() functions are implemented using a hardware accelerator.
  • GFX_HW_TRIANGLE β€” tells you the opaque mode triangle() function is implemented using a hardware accelerator.
  • GFX_HW_TRIANGLE_XOR β€” tells you the XOR version of the triangle() function is implemented using a hardware accelerator.
  • GFX_HW_GLYPH β€” tells you monochrome character expansion (for text drawing) is implemented using a hardware accelerator πŸ”€
  • GFX_HW_VRAM_BLIT β€” tells you blitting from one part of the screen to another is implemented using a hardware accelerator. If this flag is set, blitting within the video memory will almost certainly be the fastest possible way to display an image, so it may be worth storing some of your more frequently used graphics in an offscreen portion of the video memory. storage hack, we love it.
  • GFX_HW_VRAM_BLIT_MASKED β€” tells you the masked_blit() routine is capable of a hardware accelerated copy from one part of video memory to another, and that draw_sprite() will use a hardware copy when given a sub-bitmap of the screen or a video memory bitmap as the source image. If this flag is set, copying within the video memory will almost certainly be the fastest possible way to display an image, so it may be worth storing some of your more frequently used sprites in an offscreen portion of the video memory.
⚠️ Warning: if this flag is not set, masked_blit() and draw_sprite() will not work correctly when used with a video memory source image! You must only try to use these functions to copy within the video memory if they are supported in hardware. like, do not play with this one bestie πŸ’€
  • GFX_HW_MEM_BLIT β€” tells you blitting from a memory bitmap onto the screen is being accelerated in hardware.
  • GFX_HW_MEM_BLIT_MASKED β€” tells you the masked_blit() and draw_sprite() functions are being accelerated in hardware when the source image is a memory bitmap and the destination is the physical screen.
  • GFX_HW_SYS_TO_VRAM_BLIT β€” tells you blitting from a system bitmap onto the screen is being accelerated in hardware. Note that some acceleration may be present even if this flag is not set, because system bitmaps can benefit from normal memory to screen blitting as well. This flag will only be set if system bitmaps have further acceleration above and beyond what is provided by GFX_HW_MEM_BLIT.
  • GFX_HW_SYS_TO_VRAM_BLIT_MASKED β€” tells you the masked_blit() and draw_sprite() functions are being accelerated in hardware when the source image is a system bitmap and the destination is the physical screen. Note that some acceleration may be present even if this flag is not set, because system bitmaps can benefit from normal memory to screen blitting as well. This flag will only be set if system bitmaps have further acceleration above and beyond what is provided by GFX_HW_MEM_BLIT_MASKED.
  • GFX_HW_VRAM_STRETCH_BLIT β€” tells you stretched blitting of video bitmaps onto the screen is implemented using hardware acceleration.
  • GFX_HW_SYS_STRETCH_BLIT β€” tells you stretched blitting of system bitmaps onto the screen is implemented using hardware acceleration.
  • GFX_HW_VRAM_STRETCH_BLIT_MASKED β€” tells you masked stretched blitting (including stretch_sprite) of video bitmaps onto the screen is implemented using hardware acceleration. πŸ“Œ NOTE: some display drivers may show artifacts when this function is used. If the image does not look correct, try updating your video drivers. not the drivers catching strays 😭
  • GFX_HW_SYS_STRETCH_BLIT_MASKED β€” tells you masked stretched blitting (including stretch_sprite) of system bitmaps onto the screen is implemented using hardware acceleration. πŸ“Œ NOTE: some display drivers may show artifacts when this function is used. If the image does not look correct, try updating your video drivers.

  • πŸ“ Note: even if the capabilities information says that patterned drawing is supported by the hardware, it will not be possible for every size of pattern. VBE/AF only supports patterns up to 8x8 in size, so Allegro will fall back on the original non-accelerated drawing routines whenever you use a pattern larger than this.
  • πŸ“ Note2: these hardware acceleration features will only take effect when you are drawing directly onto the screen bitmap, a video memory bitmap, or a sub-bitmap thereof. Accelerated hardware is most useful in a page flipping or triple buffering setup, and is unlikely to make any difference to the classic "draw onto a memory bitmap, then blit to the screen" system. iykyk.

πŸ¦‹ SEE ALSO πŸ¦‹

screen(3), create_video_bitmap(3), scroll_screen(3), request_scroll(3), show_mouse(3), enable_triple_buffer(3), ex3buf(3), exaccel(3), exsyscur(3), exupdate(3)


and that's the whole page bestie, you ate it πŸ’… this one came straight out of the Allegro era, version 4.4.3 β€” go forth and vibe check your hardware, mwah πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from