1 #pragma once 2 3 #include <GLES2/gl2.h> 4 5 #include <functional> 6 #include <future> 7 #include <memory> 8 #include <vector> 9 10 class ColorBuffer; 11 12 // Posting 13 enum class PostCmd { 14 Post = 0, 15 Viewport = 1, 16 Compose = 2, 17 Clear = 3, 18 Screenshot = 4, 19 Exit = 5, 20 }; 21 22 struct Post { 23 using ComposeCallback = 24 std::function<void(std::shared_future<void> waitForGpu)>; 25 PostCmd cmd; 26 int composeVersion; 27 std::vector<char> composeBuffer; 28 std::shared_ptr<ComposeCallback> composeCallback = nullptr; 29 union { 30 ColorBuffer* cb; 31 struct { 32 int width; 33 int height; 34 } viewport; 35 struct { 36 ColorBuffer* cb; 37 int screenwidth; 38 int screenheight; 39 GLenum format; 40 GLenum type; 41 int rotation; 42 void* pixels; 43 } screenshot; 44 }; 45 }; 46