1 /// Presentation module 2 module gfx.graal.presentation; 3 4 import core.time : Duration; 5 6 import gfx.core.rc; 7 import gfx.graal.format; 8 import gfx.graal.image; 9 import gfx.graal.sync; 10 11 import std.typecons : Tuple; 12 13 struct SurfaceCaps 14 { 15 uint minImages; 16 uint maxImages; 17 uint[2] minSize; 18 uint[2] maxSize; 19 uint maxLayers; 20 ImageUsage usage; 21 CompositeAlpha supportedAlpha; 22 } 23 24 enum CompositeAlpha { 25 opaque = 0x01, 26 preMultiplied = 0x02, 27 postMultiplied = 0x04, 28 inherit = 0x08, 29 } 30 31 enum PresentMode { 32 immediate, 33 fifo, 34 mailbox, 35 } 36 37 interface Surface : AtomicRefCounted 38 {} 39 40 interface Swapchain : AtomicRefCounted 41 { 42 /// The image format of this swapchain 43 @property Format format(); 44 45 /// Get the list of images owned by this swapchain. 46 /// The index of each image is meaningful and is often used to reference 47 /// the image (such as the index returned by acquireNextImage) 48 @property ImageBase[] images(); 49 50 /// use negative timeout to specify no timeout at all 51 /// Params: 52 /// timeout = the maximum time to wait until the call returns 53 /// semaphore = the semaphore 54 /// suboptimal = a flag that implementation may set if the swapchain need 55 /// to be recreated 56 /// Returns: the index of an available image or uint.max if timeout expired 57 /// before any image was returned to the application 58 uint acquireNextImage(Duration timeout, Semaphore semaphore, out bool suboptimal); 59 }