1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GLES_RENDER_FRAME_SYNC_GLES_H 17 #define GLES_RENDER_FRAME_SYNC_GLES_H 18 19 #include <cstdint> 20 21 #include <base/containers/vector.h> 22 #include <render/namespace.h> 23 24 #include "device/render_frame_sync.h" 25 26 RENDER_BEGIN_NAMESPACE() 27 class Device; 28 29 struct LowLevelFenceGLES { 30 void* aFence { nullptr }; 31 }; 32 33 class RenderFrameSyncGLES final : public RenderFrameSync { 34 public: 35 explicit RenderFrameSyncGLES(Device& device); 36 virtual ~RenderFrameSyncGLES(); 37 38 void BeginFrame() override; 39 void WaitForFrameFence() override; 40 41 const LowLevelFenceGLES& GetFrameFence(); 42 43 private: 44 BASE_NS::vector<LowLevelFenceGLES> frameFences_; 45 uint32_t bufferingIndex_ { 0 }; 46 }; 47 RENDER_END_NAMESPACE() 48 49 #endif // GLES_RENDER_FRAME_SYNC_GLES_H 50