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 RENDER_BACKEND_H 17 #define RENDER_BACKEND_H 18 19 #include <base/containers/vector.h> 20 #include <core/namespace.h> 21 #include <render/datastore/render_data_store_render_pods.h> 22 #include <render/device/pipeline_state_desc.h> 23 #include <render/namespace.h> 24 25 RENDER_BEGIN_NAMESPACE() 26 class Device; 27 class GpuResourceManager; 28 struct RenderCommandContext; 29 struct RenderCommandFrameData; 30 31 struct RenderBackendBackBufferConfiguration { 32 struct SwapchainData { 33 RenderHandle handle; 34 // state after render node graph processing 35 GpuResourceState backBufferState; 36 // layout after render node graph processing 37 ImageLayout layout { ImageLayout::CORE_IMAGE_LAYOUT_UNDEFINED }; 38 // configuration for the back buffer 39 NodeGraphBackBufferConfiguration config; 40 }; 41 BASE_NS::vector<SwapchainData> swapchainData; 42 }; 43 44 class RenderBackend { 45 public: 46 RenderBackend() = default; 47 virtual ~RenderBackend() = default; 48 49 virtual void Render(RenderCommandFrameData& renderCommandFrameData, 50 const RenderBackendBackBufferConfiguration& backBufferConfig) = 0; 51 virtual void Present(const RenderBackendBackBufferConfiguration& backBufferConfig) = 0; 52 53 private: 54 }; 55 RENDER_END_NAMESPACE() 56 57 #endif // RENDER_BACKEND_H 58