• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 DEFAULT_ENGINE_CONSTANTS_H
17 #define DEFAULT_ENGINE_CONSTANTS_H
18 
19 #include <base/containers/string_view.h>
20 #include <base/math/vector.h>
21 #include <render/namespace.h>
22 
23 RENDER_BEGIN_NAMESPACE()
24 /** \addtogroup group_engine_defaultengineconstants
25  *  @{
26  */
27 /** Default GPU resource constants */
28 struct DefaultEngineGpuResourceConstants {
29     /** Default built-in backbuffer/swapchain */
30     static constexpr const BASE_NS::string_view CORE_DEFAULT_BACKBUFFER { "CORE_DEFAULT_BACKBUFFER" };
31     /** Default backbuffer/swapchain depth (when rendering scene directly to backbuffer) */
32     static constexpr const BASE_NS::string_view CORE_DEFAULT_BACKBUFFER_DEPTH { "CORE_DEFAULT_BACKBUFFER_DEPTH" };
33 
34     /** Default swapchain prefix */
35     static constexpr const BASE_NS::string_view CORE_DEFAULT_SWAPCHAIN { "CORE_DEFAULT_SWAPCHAIN_" };
36 
37     /** Default GPU image, black */
38     static constexpr const BASE_NS::string_view CORE_DEFAULT_GPU_IMAGE { "CORE_DEFAULT_GPU_IMAGE" };
39     /** Default GPU image, white */
40     static constexpr const BASE_NS::string_view CORE_DEFAULT_GPU_IMAGE_WHITE { "CORE_DEFAULT_GPU_IMAGE_WHITE" };
41 
42     /** Default GPU buffer, 1024 bytes */
43     static constexpr const BASE_NS::string_view CORE_DEFAULT_GPU_BUFFER { "CORE_DEFAULT_GPU_BUFFER" };
44 
45     /** Default sampler, nearest repeat */
46     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_NEAREST_REPEAT {
47         "CORE_DEFAULT_SAMPLER_NEAREST_REPEAT"
48     };
49     /** Default sampler, nearest clamp */
50     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_NEAREST_CLAMP {
51         "CORE_DEFAULT_SAMPLER_NEAREST_CLAMP"
52     };
53     /** Default sampler, linear repeat */
54     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_LINEAR_REPEAT {
55         "CORE_DEFAULT_SAMPLER_LINEAR_REPEAT"
56     };
57     /** Default sampler, linear clamp */
58     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_LINEAR_CLAMP {
59         "CORE_DEFAULT_SAMPLER_LINEAR_CLAMP"
60     };
61     /** Default sampler, linear mipmap repeat */
62     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_LINEAR_MIPMAP_REPEAT {
63         "CORE_DEFAULT_SAMPLER_LINEAR_MIPMAP_REPEAT"
64     };
65     /** Default sampler, linear mipmap clamp */
66     static constexpr const BASE_NS::string_view CORE_DEFAULT_SAMPLER_LINEAR_MIPMAP_CLAMP {
67         "CORE_DEFAULT_SAMPLER_LINEAR_MIPMAP_CLAMP"
68     };
69 };
70 
71 struct DefaultDebugConstants {
72     /** Default color used for e.g. debug markers inside render */
73     static constexpr const BASE_NS::Math::Vec4 CORE_DEFAULT_DEBUG_COLOR { 1.0f, 0.5f, 1.0f, 1.0f };
74 };
75 
76 struct DeviceConstants {
77     static constexpr uint32_t MAX_SWAPCHAIN_COUNT { 8U };
78 
79     static constexpr uint32_t MIN_BUFFERING_COUNT { 2U };
80     /** definitely a bit high number, prefer e.g. 3. */
81     static constexpr uint32_t MAX_BUFFERING_COUNT { 6U };
82 };
83 /** @} */
84 RENDER_END_NAMESPACE()
85 
86 #endif // DEFAULT_ENGINE_CONSTANTS_H
87