1 // http://www.apache.org/licenses/LICENSE-2.0
2 //
3 // Unless required by applicable law or agreed to in writing, software
4 // distributed under the License is distributed on an "AS IS" BASIS,
5 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6 // See the License for the specific language governing permissions and
7 // limitations under the License.
8 #pragma once
9 
10 #include <vulkan/vulkan.h>
11 
12 #ifdef __cplusplus
13 #include <algorithm>
14 #endif
15 
16 // VulkanStream features
17 #define VULKAN_STREAM_FEATURE_NULL_OPTIONAL_STRINGS_BIT (1 << 0)
18 #define VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT (1 << 1)
19 #define VULKAN_STREAM_FEATURE_SHADER_FLOAT16_INT8_BIT (1 << 2)
20 #define VULKAN_STREAM_FEATURE_QUEUE_SUBMIT_WITH_COMMANDS_BIT (1 << 3)
21 
22 #define VK_YCBCR_CONVERSION_DO_NOTHING ((VkSamplerYcbcrConversion)0x1111111111111111)
23 
24 #ifdef __cplusplus
25 
26 template <class T, typename F>
arrayany(const T * arr,uint32_t begin,uint32_t end,const F & func)27 bool arrayany(const T* arr, uint32_t begin, uint32_t end, const F& func) {
28     const T* e = arr + end;
29     return std::find_if(arr + begin, e, func) != e;
30 }
31 
32 #define DEFINE_ALIAS_FUNCTION(ORIGINAL_FN, ALIAS_FN)                                             \
33     template <typename... Args>                                                                  \
34     inline auto ALIAS_FN(Args&&... args) -> decltype(ORIGINAL_FN(std::forward<Args>(args)...)) { \
35         return ORIGINAL_FN(std::forward<Args>(args)...);                                         \
36     }
37 
38 #endif
39