gfx_capabilities(3alleg4)
π gfx_capabilities π
okay bestie, welcome to the Allegro manual β this one's all about gfx_capabilities, and no cap, it's lowkey one of the most useful little globals in the whole game programming library. let's get into it π«Ά
β¨ NAME β¨
gfx_capabilities β a bitfield that spills all the tea about what your video hardware can actually do. it's part of the Allegro game programming library, and it's giving "receipts for your GPU" energy. π
π¦ SYNOPSIS π¦
#include <allegro.h>
extern int gfx_capabilities;
πΈ DESCRIPTION πΈ
So. gfx_capabilities is a bitfield that describes the capabilities of the current graphics driver and the video hardware underneath it. It can contain any combination of these flags, bestie β mix and match, it's a vibe:
GFX_CAN_SCROLLβ this one means thescroll_screen()function is allowed to be used with this driver. scroll girl summer. β¨GFX_CAN_TRIPLE_BUFFERβ says thatrequest_scroll()andpoll_scroll()are usable with this driver. if this flag is not set, it's possible thatenable_triple_buffer()might be able to activate it anyway. so like, don't lose hope πGFX_HW_CURSORβ a hardware mouse cursor is in use. when this is set, it is safe to draw onto the screen without hiding the mouse pointer first. but okay, listen: 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 literally any point while your program runs, so do not assume this flag stays constant for long stretches 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 who changes outfits mid-scene. πGFX_SYSTEM_CURSORβ the mouse cursor is the default system cursor, not Allegro's custom cursor. iconic, honestly.GFX_HW_HLINEβ the normal opaque version of thehline()function is implemented using a hardware accelerator. and this improves performance not just forhline()itself, but for soooo many other functions that use it as a workhorse, for examplecirclefill(),triangle(), andfloodfill(). it's giving teamwork. πGFX_HW_HLINE_XORβ the XOR version ofhline(), plus any other functions that use it as a workhorse, are implemented using a hardware accelerator.GFX_HW_HLINE_SOLID_PATTERNβ the solid and masked pattern modes ofhline(), and any other functions that use it as a workhorse, are implemented using a hardware accelerator (peep the note below π).GFX_HW_HLINE_COPY_PATTERNβ the copy pattern mode ofhline(), and any other functions that use it as a workhorse, are implemented using a hardware accelerator (again, note below π).GFX_HW_FILLβ the opaque version ofrectfill(), theclear_bitmap()routine, andclear_to_color()are all implemented using a hardware accelerator.GFX_HW_FILL_XORβ the XOR version ofrectfill()is implemented using a hardware accelerator.GFX_HW_FILL_SOLID_PATTERNβ the solid and masked pattern modes ofrectfill()are implemented using a hardware accelerator (note below, bestie π).GFX_HW_FILL_COPY_PATTERNβ the copy pattern mode ofrectfill()is implemented using a hardware accelerator (yes, note below π).GFX_HW_LINEβ the opaque modeline()andvline()functions are implemented using a hardware accelerator.GFX_HW_LINE_XORβ the XOR version ofline()andvline()are implemented using a hardware accelerator.GFX_HW_TRIANGLEβ the opaque modetriangle()function is implemented using a hardware accelerator.GFX_HW_TRIANGLE_XORβ the XOR version oftriangle()is implemented using a hardware accelerator.GFX_HW_GLYPHβ monochrome character expansion (you know, for text drawing) is implemented using a hardware accelerator.GFX_HW_VRAM_BLITβ 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. strategic queen behavior. π§GFX_HW_VRAM_BLIT_MASKEDβ themasked_blit()routine is capable of a hardware accelerated copy from one part of video memory to another, anddraw_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()anddraw_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. fr fr, do not test this one. π
GFX_HW_MEM_BLITβ blitting from a memory bitmap onto the screen is being accelerated in hardware.GFX_HW_MEM_BLIT_MASKEDβ themasked_blit()anddraw_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β 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 byGFX_HW_MEM_BLIT. it's giving "overachiever only" energy. πGFX_HW_SYS_TO_VRAM_BLIT_MASKEDβ themasked_blit()anddraw_sprite()functions are being accelerated in hardware when the source image is a system bitmap and the destination is the physical screen. again, 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 byGFX_HW_MEM_BLIT_MASKED.GFX_HW_VRAM_STRETCH_BLITβ stretched blitting of video bitmaps onto the screen is implemented using hardware acceleration. stretch. that's it. that's the tweet. πGFX_HW_SYS_STRETCH_BLITβ stretched blitting of system bitmaps onto the screen is implemented using hardware acceleration.GFX_HW_VRAM_STRETCH_BLIT_MASKEDβ masked stretched blitting (includingstretch_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. πGFX_HW_SYS_STRETCH_BLIT_MASKEDβ masked stretched blitting (includingstretch_sprite) of system bitmaps onto the screen is implemented using hardware acceleration. NOTE: some display drivers may show artefact's when this function is used. if the image does not look correct, try updating your video drivers. π
π the notes, bestie π
Note: even if the capabilities info says 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. so like... don't get too comfortable. π
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. sorry to the classics. π
π₯ SEE ALSO π₯
screen(3alleg4)create_video_bitmap(3alleg4)scroll_screen(3alleg4)request_scroll(3alleg4)show_mouse(3alleg4)enable_triple_buffer(3alleg4)ex3buf(3alleg4)exaccel(3alleg4)exsyscur(3alleg4)exupdate(3alleg4)
and that's the whole page, bestie π this one's from the Allegro manual, version 4.4.3, filed under gfx_capabilities(3alleg4) β go forth and check your capabilities before you blit, it's literally self care. π¦β¨π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms