(ir.ids[id], std::forward(args)...);
60 | var.self = id;
61 | return var;
62 | }
63 |
64 | template
65 | T &get(uint32_t id)
66 | {
67 | return variant_get(ir.ids[id]);
68 | }
69 |
70 | template
71 | T *maybe_get(uint32_t id)
72 | {
73 | if (ir.ids[id].get_type() == static_cast(T::type))
74 | return &get(id);
75 | else
76 | return nullptr;
77 | }
78 |
79 | template
80 | const T &get(uint32_t id) const
81 | {
82 | return variant_get(ir.ids[id]);
83 | }
84 |
85 | template
86 | const T *maybe_get(uint32_t id) const
87 | {
88 | if (ir.ids[id].get_type() == T::type)
89 | return &get(id);
90 | else
91 | return nullptr;
92 | }
93 |
94 | // This must be an ordered data structure so we always pick the same type aliases.
95 | SmallVector global_struct_cache;
96 | SmallVector> forward_pointer_fixups;
97 |
98 | bool types_are_logically_equivalent(const SPIRType &a, const SPIRType &b) const;
99 | bool variable_storage_is_aliased(const SPIRVariable &v) const;
100 | };
101 | } // namespace SPIRV_CROSS_NAMESPACE
102 |
103 | #endif
104 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/spirv_cross/spirv_reflect.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-2021 Bradley Austin Davis
3 | * SPDX-License-Identifier: Apache-2.0 OR MIT
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | /*
19 | * At your option, you may choose to accept this material under either:
20 | * 1. The Apache License, Version 2.0, found at , or
21 | * 2. The MIT License, found at .
22 | */
23 |
24 | #ifndef SPIRV_CROSS_REFLECT_HPP
25 | #define SPIRV_CROSS_REFLECT_HPP
26 |
27 | #include "spirv_glsl.hpp"
28 | #include
29 |
30 | namespace simple_json
31 | {
32 | class Stream;
33 | }
34 |
35 | namespace SPIRV_CROSS_NAMESPACE
36 | {
37 | class CompilerReflection : public CompilerGLSL
38 | {
39 | using Parent = CompilerGLSL;
40 |
41 | public:
42 | explicit CompilerReflection(std::vector spirv_)
43 | : Parent(std::move(spirv_))
44 | {
45 | options.vulkan_semantics = true;
46 | }
47 |
48 | CompilerReflection(const uint32_t *ir_, size_t word_count)
49 | : Parent(ir_, word_count)
50 | {
51 | options.vulkan_semantics = true;
52 | }
53 |
54 | explicit CompilerReflection(const ParsedIR &ir_)
55 | : CompilerGLSL(ir_)
56 | {
57 | options.vulkan_semantics = true;
58 | }
59 |
60 | explicit CompilerReflection(ParsedIR &&ir_)
61 | : CompilerGLSL(std::move(ir_))
62 | {
63 | options.vulkan_semantics = true;
64 | }
65 |
66 | void set_format(const std::string &format);
67 | std::string compile() override;
68 |
69 | private:
70 | static std::string execution_model_to_str(spv::ExecutionModel model);
71 |
72 | void emit_entry_points();
73 | void emit_types();
74 | void emit_resources();
75 | void emit_specialization_constants();
76 |
77 | void emit_type(uint32_t type_id, bool &emitted_open_tag);
78 | void emit_type_member(const SPIRType &type, uint32_t index);
79 | void emit_type_member_qualifiers(const SPIRType &type, uint32_t index);
80 | void emit_type_array(const SPIRType &type);
81 | void emit_resources(const char *tag, const SmallVector &resources);
82 | bool type_is_reference(const SPIRType &type) const;
83 |
84 | std::string to_member_name(const SPIRType &type, uint32_t index) const;
85 |
86 | std::shared_ptr json_stream;
87 | };
88 |
89 | } // namespace SPIRV_CROSS_NAMESPACE
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vk_video/vulkan_video_codec_h264std_decode.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
2 | #define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // vulkan_video_codec_h264std_decode is a preprocessor guard. Do not pass it to API calls.
23 | #define vulkan_video_codec_h264std_decode 1
24 | #include "vulkan_video_codec_h264std.h"
25 |
26 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
27 |
28 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
29 | #define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
30 | #define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
31 |
32 | typedef enum StdVideoDecodeH264FieldOrderCount {
33 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
34 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1,
35 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF,
36 | STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF
37 | } StdVideoDecodeH264FieldOrderCount;
38 | typedef struct StdVideoDecodeH264PictureInfoFlags {
39 | uint32_t field_pic_flag : 1;
40 | uint32_t is_intra : 1;
41 | uint32_t IdrPicFlag : 1;
42 | uint32_t bottom_field_flag : 1;
43 | uint32_t is_reference : 1;
44 | uint32_t complementary_field_pair : 1;
45 | } StdVideoDecodeH264PictureInfoFlags;
46 |
47 | typedef struct StdVideoDecodeH264PictureInfo {
48 | StdVideoDecodeH264PictureInfoFlags flags;
49 | uint8_t seq_parameter_set_id;
50 | uint8_t pic_parameter_set_id;
51 | uint8_t reserved1;
52 | uint8_t reserved2;
53 | uint16_t frame_num;
54 | uint16_t idr_pic_id;
55 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
56 | } StdVideoDecodeH264PictureInfo;
57 |
58 | typedef struct StdVideoDecodeH264ReferenceInfoFlags {
59 | uint32_t top_field_flag : 1;
60 | uint32_t bottom_field_flag : 1;
61 | uint32_t used_for_long_term_reference : 1;
62 | uint32_t is_non_existing : 1;
63 | } StdVideoDecodeH264ReferenceInfoFlags;
64 |
65 | typedef struct StdVideoDecodeH264ReferenceInfo {
66 | StdVideoDecodeH264ReferenceInfoFlags flags;
67 | uint16_t FrameNum;
68 | uint16_t reserved;
69 | int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
70 | } StdVideoDecodeH264ReferenceInfo;
71 |
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vk_video/vulkan_video_codec_h265std_decode.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
2 | #define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // vulkan_video_codec_h265std_decode is a preprocessor guard. Do not pass it to API calls.
23 | #define vulkan_video_codec_h265std_decode 1
24 | #include "vulkan_video_codec_h265std.h"
25 |
26 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
27 |
28 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0
29 | #define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
30 | #define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
31 | typedef struct StdVideoDecodeH265PictureInfoFlags {
32 | uint32_t IrapPicFlag : 1;
33 | uint32_t IdrPicFlag : 1;
34 | uint32_t IsReference : 1;
35 | uint32_t short_term_ref_pic_set_sps_flag : 1;
36 | } StdVideoDecodeH265PictureInfoFlags;
37 |
38 | typedef struct StdVideoDecodeH265PictureInfo {
39 | StdVideoDecodeH265PictureInfoFlags flags;
40 | uint8_t sps_video_parameter_set_id;
41 | uint8_t pps_seq_parameter_set_id;
42 | uint8_t pps_pic_parameter_set_id;
43 | uint8_t NumDeltaPocsOfRefRpsIdx;
44 | int32_t PicOrderCntVal;
45 | uint16_t NumBitsForSTRefPicSetInSlice;
46 | uint16_t reserved;
47 | uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
48 | uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
49 | uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
50 | } StdVideoDecodeH265PictureInfo;
51 |
52 | typedef struct StdVideoDecodeH265ReferenceInfoFlags {
53 | uint32_t used_for_long_term_reference : 1;
54 | uint32_t unused_for_reference : 1;
55 | } StdVideoDecodeH265ReferenceInfoFlags;
56 |
57 | typedef struct StdVideoDecodeH265ReferenceInfo {
58 | StdVideoDecodeH265ReferenceInfoFlags flags;
59 | int32_t PicOrderCntVal;
60 | } StdVideoDecodeH265ReferenceInfo;
61 |
62 |
63 | #ifdef __cplusplus
64 | }
65 | #endif
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vk_video/vulkan_video_codecs_common.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_
2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls.
23 | #define vulkan_video_codecs_common 1
24 | #if !defined(VK_NO_STDINT_H)
25 | #include
26 | #endif
27 |
28 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
29 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
30 |
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vk_platform.h:
--------------------------------------------------------------------------------
1 | //
2 | // File: vk_platform.h
3 | //
4 | /*
5 | ** Copyright 2014-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 |
11 | #ifndef VK_PLATFORM_H_
12 | #define VK_PLATFORM_H_
13 |
14 | #ifdef __cplusplus
15 | extern "C"
16 | {
17 | #endif // __cplusplus
18 |
19 | /*
20 | ***************************************************************************************************
21 | * Platform-specific directives and type declarations
22 | ***************************************************************************************************
23 | */
24 |
25 | /* Platform-specific calling convention macros.
26 | *
27 | * Platforms should define these so that Vulkan clients call Vulkan commands
28 | * with the same calling conventions that the Vulkan implementation expects.
29 | *
30 | * VKAPI_ATTR - Placed before the return type in function declarations.
31 | * Useful for C++11 and GCC/Clang-style function attribute syntax.
32 | * VKAPI_CALL - Placed after the return type in function declarations.
33 | * Useful for MSVC-style calling convention syntax.
34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
35 | *
36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
38 | */
39 | #if defined(_WIN32)
40 | // On Windows, Vulkan commands use the stdcall convention
41 | #define VKAPI_ATTR
42 | #define VKAPI_CALL __stdcall
43 | #define VKAPI_PTR VKAPI_CALL
44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
45 | #error "Vulkan is not supported for the 'armeabi' NDK ABI"
46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
47 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
48 | // calling convention, i.e. float parameters are passed in registers. This
49 | // is true even if the rest of the application passes floats on the stack,
50 | // as it does by default when compiling for the armeabi-v7a NDK ABI.
51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
52 | #define VKAPI_CALL
53 | #define VKAPI_PTR VKAPI_ATTR
54 | #else
55 | // On other platforms, use the default calling convention
56 | #define VKAPI_ATTR
57 | #define VKAPI_CALL
58 | #define VKAPI_PTR
59 | #endif
60 |
61 | #if !defined(VK_NO_STDDEF_H)
62 | #include
63 | #endif // !defined(VK_NO_STDDEF_H)
64 |
65 | #if !defined(VK_NO_STDINT_H)
66 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
67 | typedef signed __int8 int8_t;
68 | typedef unsigned __int8 uint8_t;
69 | typedef signed __int16 int16_t;
70 | typedef unsigned __int16 uint16_t;
71 | typedef signed __int32 int32_t;
72 | typedef unsigned __int32 uint32_t;
73 | typedef signed __int64 int64_t;
74 | typedef unsigned __int64 uint64_t;
75 | #else
76 | #include
77 | #endif
78 | #endif // !defined(VK_NO_STDINT_H)
79 |
80 | #ifdef __cplusplus
81 | } // extern "C"
82 | #endif // __cplusplus
83 |
84 | #endif
85 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_H_
2 | #define VULKAN_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | #include "vk_platform.h"
11 | #include "vulkan_core.h"
12 |
13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR
14 | #include "vulkan_android.h"
15 | #endif
16 |
17 | #ifdef VK_USE_PLATFORM_FUCHSIA
18 | #include
19 | #include "vulkan_fuchsia.h"
20 | #endif
21 |
22 | #ifdef VK_USE_PLATFORM_IOS_MVK
23 | #include "vulkan_ios.h"
24 | #endif
25 |
26 |
27 | #ifdef VK_USE_PLATFORM_MACOS_MVK
28 | #include "vulkan_macos.h"
29 | #endif
30 |
31 | #ifdef VK_USE_PLATFORM_METAL_EXT
32 | #include "vulkan_metal.h"
33 | #endif
34 |
35 | #ifdef VK_USE_PLATFORM_VI_NN
36 | #include "vulkan_vi.h"
37 | #endif
38 |
39 |
40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR
41 | #include "vulkan_wayland.h"
42 | #endif
43 |
44 |
45 | #ifdef VK_USE_PLATFORM_WIN32_KHR
46 | #include
47 | #include "vulkan_win32.h"
48 | #endif
49 |
50 |
51 | #ifdef VK_USE_PLATFORM_XCB_KHR
52 | #include
53 | #include "vulkan_xcb.h"
54 | #endif
55 |
56 |
57 | #ifdef VK_USE_PLATFORM_XLIB_KHR
58 | #include
59 | #include "vulkan_xlib.h"
60 | #endif
61 |
62 |
63 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT
64 | #include
65 | #include "vulkan_directfb.h"
66 | #endif
67 |
68 |
69 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
70 | #include
71 | #include
72 | #include "vulkan_xlib_xrandr.h"
73 | #endif
74 |
75 |
76 | #ifdef VK_USE_PLATFORM_GGP
77 | #include
78 | #include "vulkan_ggp.h"
79 | #endif
80 |
81 |
82 | #ifdef VK_USE_PLATFORM_SCREEN_QNX
83 | #include
84 | #include "vulkan_screen.h"
85 | #endif
86 |
87 |
88 | #ifdef VK_USE_PLATFORM_SCI
89 | #include
90 | #include
91 | #include "vulkan_sci.h"
92 | #endif
93 |
94 |
95 | #ifdef VK_ENABLE_BETA_EXTENSIONS
96 | #include "vulkan_beta.h"
97 | #endif
98 |
99 | #endif // VULKAN_H_
100 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_directfb.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_DIRECTFB_H_
2 | #define VULKAN_DIRECTFB_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_EXT_directfb_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_EXT_directfb_surface 1
24 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1
25 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface"
26 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT;
27 | typedef struct VkDirectFBSurfaceCreateInfoEXT {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkDirectFBSurfaceCreateFlagsEXT flags;
31 | IDirectFB* dfb;
32 | IDirectFBSurface* surface;
33 | } VkDirectFBSurfaceCreateInfoEXT;
34 |
35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb);
37 |
38 | #ifndef VK_NO_PROTOTYPES
39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(
40 | VkInstance instance,
41 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo,
42 | const VkAllocationCallbacks* pAllocator,
43 | VkSurfaceKHR* pSurface);
44 |
45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT(
46 | VkPhysicalDevice physicalDevice,
47 | uint32_t queueFamilyIndex,
48 | IDirectFB* dfb);
49 | #endif
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_ggp.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_GGP_H_
2 | #define VULKAN_GGP_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_GGP_stream_descriptor_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_GGP_stream_descriptor_surface 1
24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1
25 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface"
26 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP;
27 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkStreamDescriptorSurfaceCreateFlagsGGP flags;
31 | GgpStreamDescriptor streamDescriptor;
32 | } VkStreamDescriptorSurfaceCreateInfoGGP;
33 |
34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
35 |
36 | #ifndef VK_NO_PROTOTYPES
37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP(
38 | VkInstance instance,
39 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo,
40 | const VkAllocationCallbacks* pAllocator,
41 | VkSurfaceKHR* pSurface);
42 | #endif
43 |
44 |
45 | // VK_GGP_frame_token is a preprocessor guard. Do not pass it to API calls.
46 | #define VK_GGP_frame_token 1
47 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1
48 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token"
49 | typedef struct VkPresentFrameTokenGGP {
50 | VkStructureType sType;
51 | const void* pNext;
52 | GgpFrameToken frameToken;
53 | } VkPresentFrameTokenGGP;
54 |
55 |
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_ios.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_IOS_H_
2 | #define VULKAN_IOS_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_MVK_ios_surface 1
24 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3
25 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
26 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
27 | typedef struct VkIOSSurfaceCreateInfoMVK {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkIOSSurfaceCreateFlagsMVK flags;
31 | const void* pView;
32 | } VkIOSSurfaceCreateInfoMVK;
33 |
34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
35 |
36 | #ifndef VK_NO_PROTOTYPES
37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(
38 | VkInstance instance,
39 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
40 | const VkAllocationCallbacks* pAllocator,
41 | VkSurfaceKHR* pSurface);
42 | #endif
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_macos.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_MACOS_H_
2 | #define VULKAN_MACOS_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_MVK_macos_surface 1
24 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3
25 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
26 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
27 | typedef struct VkMacOSSurfaceCreateInfoMVK {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkMacOSSurfaceCreateFlagsMVK flags;
31 | const void* pView;
32 | } VkMacOSSurfaceCreateInfoMVK;
33 |
34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
35 |
36 | #ifndef VK_NO_PROTOTYPES
37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
38 | VkInstance instance,
39 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
40 | const VkAllocationCallbacks* pAllocator,
41 | VkSurfaceKHR* pSurface);
42 | #endif
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_vi.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_VI_H_
2 | #define VULKAN_VI_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_NN_vi_surface 1
24 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1
25 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
26 | typedef VkFlags VkViSurfaceCreateFlagsNN;
27 | typedef struct VkViSurfaceCreateInfoNN {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkViSurfaceCreateFlagsNN flags;
31 | void* window;
32 | } VkViSurfaceCreateInfoNN;
33 |
34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
35 |
36 | #ifndef VK_NO_PROTOTYPES
37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(
38 | VkInstance instance,
39 | const VkViSurfaceCreateInfoNN* pCreateInfo,
40 | const VkAllocationCallbacks* pAllocator,
41 | VkSurfaceKHR* pSurface);
42 | #endif
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_wayland.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_WAYLAND_H_
2 | #define VULKAN_WAYLAND_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_KHR_wayland_surface 1
24 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
25 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
26 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
27 | typedef struct VkWaylandSurfaceCreateInfoKHR {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkWaylandSurfaceCreateFlagsKHR flags;
31 | struct wl_display* display;
32 | struct wl_surface* surface;
33 | } VkWaylandSurfaceCreateInfoKHR;
34 |
35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
37 |
38 | #ifndef VK_NO_PROTOTYPES
39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
40 | VkInstance instance,
41 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
42 | const VkAllocationCallbacks* pAllocator,
43 | VkSurfaceKHR* pSurface);
44 |
45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
46 | VkPhysicalDevice physicalDevice,
47 | uint32_t queueFamilyIndex,
48 | struct wl_display* display);
49 | #endif
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_xcb.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XCB_H_
2 | #define VULKAN_XCB_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_KHR_xcb_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_KHR_xcb_surface 1
24 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
25 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
26 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
27 | typedef struct VkXcbSurfaceCreateInfoKHR {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkXcbSurfaceCreateFlagsKHR flags;
31 | xcb_connection_t* connection;
32 | xcb_window_t window;
33 | } VkXcbSurfaceCreateInfoKHR;
34 |
35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
37 |
38 | #ifndef VK_NO_PROTOTYPES
39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
40 | VkInstance instance,
41 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
42 | const VkAllocationCallbacks* pAllocator,
43 | VkSurfaceKHR* pSurface);
44 |
45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
46 | VkPhysicalDevice physicalDevice,
47 | uint32_t queueFamilyIndex,
48 | xcb_connection_t* connection,
49 | xcb_visualid_t visual_id);
50 | #endif
51 |
52 | #ifdef __cplusplus
53 | }
54 | #endif
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_xlib.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XLIB_H_
2 | #define VULKAN_XLIB_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_KHR_xlib_surface is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_KHR_xlib_surface 1
24 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
25 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
26 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
27 | typedef struct VkXlibSurfaceCreateInfoKHR {
28 | VkStructureType sType;
29 | const void* pNext;
30 | VkXlibSurfaceCreateFlagsKHR flags;
31 | Display* dpy;
32 | Window window;
33 | } VkXlibSurfaceCreateInfoKHR;
34 |
35 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
36 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
37 |
38 | #ifndef VK_NO_PROTOTYPES
39 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
40 | VkInstance instance,
41 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
42 | const VkAllocationCallbacks* pAllocator,
43 | VkSurfaceKHR* pSurface);
44 |
45 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
46 | VkPhysicalDevice physicalDevice,
47 | uint32_t queueFamilyIndex,
48 | Display* dpy,
49 | VisualID visualID);
50 | #endif
51 |
52 | #ifdef __cplusplus
53 | }
54 | #endif
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/include/vulkan/vulkan_xlib_xrandr.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XLIB_XRANDR_H_
2 | #define VULKAN_XLIB_XRANDR_H_ 1
3 |
4 | /*
5 | ** Copyright 2015-2024 The Khronos Group Inc.
6 | **
7 | ** SPDX-License-Identifier: Apache-2.0
8 | */
9 |
10 | /*
11 | ** This header is generated from the Khronos Vulkan XML API Registry.
12 | **
13 | */
14 |
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 |
21 |
22 | // VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls.
23 | #define VK_EXT_acquire_xlib_display 1
24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
25 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
26 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display);
27 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay);
28 |
29 | #ifndef VK_NO_PROTOTYPES
30 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(
31 | VkPhysicalDevice physicalDevice,
32 | Display* dpy,
33 | VkDisplayKHR display);
34 |
35 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(
36 | VkPhysicalDevice physicalDevice,
37 | Display* dpy,
38 | RROutput rrOutput,
39 | VkDisplayKHR* pDisplay);
40 | #endif
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/tests/common/vulkansdk/lib/libvulkan.so.1.3.290:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nemirtingas/ingame_overlay/ff1e5f493cf5bd24f425368114428dda7e5e3bbf/tests/common/vulkansdk/lib/libvulkan.so.1.3.290
--------------------------------------------------------------------------------
/tests/common/vulkansdk/lib/vulkan-1.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nemirtingas/ingame_overlay/ff1e5f493cf5bd24f425368114428dda7e5e3bbf/tests/common/vulkansdk/lib/vulkan-1.lib
--------------------------------------------------------------------------------
/tests/linux_opengl/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd "$(dirname "$0")"
4 |
5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/linux_opengl &&\
6 | cmake --build ../../OUT/linux_opengl
7 |
8 | #../../OUT/linux_opengl/linux_opengl_app
9 |
--------------------------------------------------------------------------------
/tests/linux_vulkan/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd "$(dirname "$0")"
4 |
5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/linux_vulkan &&\
6 | cmake --build ../../OUT/linux_vulkan
7 |
8 | #../../OUT/linux_vulkan/linux_vulkan_app
--------------------------------------------------------------------------------
/tests/macos_metal/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd "$(dirname "$0")"
4 |
5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_metal &&\
6 | cmake --build ../../OUT/macos_metal
7 |
8 | #../../OUT/macos_metal/macos_metal_app
9 |
--------------------------------------------------------------------------------
/tests/macos_metal/macOS/Info-macOS.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | imgui
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSMainStoryboardFile
26 | MainMenu
27 | NSPrincipalClass
28 | NSApplication
29 |
30 |
31 |
--------------------------------------------------------------------------------
/tests/macos_opengl2/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd "$(dirname "$0")"
4 |
5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_opengl2 &&\
6 | cmake --build ../../OUT/macos_opengl2
7 |
8 | #../../OUT/macos_opengl2/macos_opengl2_app
--------------------------------------------------------------------------------
/tests/macos_opengl3/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd "$(dirname "$0")"
4 |
5 | cmake -DIMGUI_USER_CONFIG="$(pwd)/../common/ingameoverlay_imconfig.h" -DINGAMEOVERLAY_BUILD_TESTS=ON -S ../../ -B ../../OUT/macos_opengl3 &&\
6 | cmake --build ../../OUT/macos_opengl3
7 |
8 | #../../OUT/macos_opengl2/macos_opengl3_app
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/dx10_shaders.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "shaders.h"
4 |
5 | std::vector BuildDX10VertexShader()
6 | {
7 | static const char* vertexShader =
8 | "cbuffer vertexBuffer : register(b0) \
9 | {\
10 | float4x4 ProjectionMatrix; \
11 | };\
12 | struct VS_INPUT\
13 | {\
14 | float2 pos : POSITION;\
15 | float4 col : COLOR0;\
16 | float2 uv : TEXCOORD0;\
17 | };\
18 | \
19 | struct PS_INPUT\
20 | {\
21 | float4 pos : SV_POSITION;\
22 | float4 col : COLOR0;\
23 | float2 uv : TEXCOORD0;\
24 | };\
25 | \
26 | PS_INPUT main(VS_INPUT input)\
27 | {\
28 | PS_INPUT output;\
29 | output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
30 | output.col = input.col;\
31 | output.uv = input.uv;\
32 | return output;\
33 | }";
34 |
35 | ID3DBlob* vertexShaderBlob;
36 | if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), nullptr, nullptr, nullptr, "main", "vs_4_0", 0, 0, &vertexShaderBlob, nullptr)))
37 | return {};
38 |
39 | vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize();
40 | std::vector shader(
41 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()),
42 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()) + vertexShaderBlob->GetBufferSize());
43 | vertexShaderBlob->Release();
44 |
45 | return shader;
46 | }
47 |
48 | std::vector BuildDX10PixelShader()
49 | {
50 | static const char* pixelShader =
51 | "struct PS_INPUT\
52 | {\
53 | float4 pos : SV_POSITION;\
54 | float4 col : COLOR0;\
55 | float2 uv : TEXCOORD0;\
56 | };\
57 | sampler sampler0;\
58 | Texture2D texture0;\
59 | \
60 | float4 main(PS_INPUT input) : SV_Target\
61 | {\
62 | float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
63 | return out_col; \
64 | }";
65 |
66 | ID3DBlob* pixelShaderBlob;
67 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_4_0", 0, 0, &pixelShaderBlob, nullptr)))
68 | return {};
69 |
70 | std::vector shader(
71 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()),
72 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize());
73 | pixelShaderBlob->Release();
74 | return shader;
75 | }
76 |
77 | std::vector BuildDX10RGBAPixelShader()
78 | {
79 | static const char* pixelShader = "\
80 | struct PS_INPUT\
81 | {\
82 | float4 pos : SV_POSITION; \
83 | float4 col : COLOR0; \
84 | float2 uv : TEXCOORD0; \
85 | }; \
86 | sampler sampler0; \
87 | Texture2D texture0; \
88 | \
89 | float4 main(PS_INPUT input) : SV_Target\
90 | {\
91 | float4 out_col = texture0.Sample(sampler0, input.uv); \
92 | return float4(out_col.r, out_col.g, out_col.b, 1.0); \
93 | }";
94 |
95 | ID3DBlob* pixelShaderBlob;
96 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_4_0", 0, 0, &pixelShaderBlob, nullptr)))
97 | return {};
98 |
99 | std::vector shader(
100 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()),
101 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize());
102 | pixelShaderBlob->Release();
103 | return shader;
104 | }
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/dx12_shaders.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "shaders.h"
4 |
5 | std::vector BuildDX12VertexShader()
6 | {
7 | static const char* vertexShader =
8 | "cbuffer vertexBuffer : register(b0) \
9 | {\
10 | float4x4 ProjectionMatrix; \
11 | };\
12 | struct VS_INPUT\
13 | {\
14 | float2 pos : POSITION;\
15 | float4 col : COLOR0;\
16 | float2 uv : TEXCOORD0;\
17 | };\
18 | \
19 | struct PS_INPUT\
20 | {\
21 | float4 pos : SV_POSITION;\
22 | float4 col : COLOR0;\
23 | float2 uv : TEXCOORD0;\
24 | };\
25 | \
26 | PS_INPUT main(VS_INPUT input)\
27 | {\
28 | PS_INPUT output;\
29 | output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
30 | output.col = input.col;\
31 | output.uv = input.uv;\
32 | return output;\
33 | }";
34 |
35 | ID3DBlob* vertexShaderBlob;
36 | if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), nullptr, nullptr, nullptr, "main", "vs_5_0", 0, 0, &vertexShaderBlob, nullptr)))
37 | return {};
38 |
39 | std::vector shader(
40 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()),
41 | reinterpret_cast(vertexShaderBlob->GetBufferPointer()) + vertexShaderBlob->GetBufferSize());
42 | vertexShaderBlob->Release();
43 | return shader;
44 | }
45 |
46 | std::vector BuildDX12PixelShader()
47 | {
48 | static const char* pixelShader =
49 | "struct PS_INPUT\
50 | {\
51 | float4 pos : SV_POSITION;\
52 | float4 col : COLOR0;\
53 | float2 uv : TEXCOORD0;\
54 | };\
55 | SamplerState sampler0 : register(s0);\
56 | Texture2D texture0 : register(t0);\
57 | \
58 | float4 main(PS_INPUT input) : SV_Target\
59 | {\
60 | float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
61 | return out_col; \
62 | }";
63 |
64 | ID3DBlob* pixelShaderBlob;
65 | if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_5_0", 0, 0, &pixelShaderBlob, nullptr)))
66 | return {};
67 |
68 | std::vector shader(
69 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()),
70 | reinterpret_cast(pixelShaderBlob->GetBufferPointer()) + pixelShaderBlob->GetBufferSize());
71 | pixelShaderBlob->Release();
72 | return shader;
73 | }
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/dx9_shaders.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "shaders.h"
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/main.cpp:
--------------------------------------------------------------------------------
1 | #include "shaders.h"
2 | #include "sha256.h"
3 | #include
4 |
5 | struct Shader_t
6 | {
7 | std::vector shaderData;
8 | std::string hash;
9 |
10 | Shader_t(std::vector& shaderData) :
11 | shaderData(std::move(shaderData)),
12 | hash(SHA256()(this->shaderData.data(), this->shaderData.size()))
13 | {
14 | }
15 | };
16 |
17 | void WriteShader(Shader_t const& shader, std::string const& fileName)
18 | {
19 | std::ofstream fShader(fileName, std::ios::out | std::ios::trunc | std::ios::binary);
20 |
21 | fShader.write((const char*)shader.shaderData.data(), shader.shaderData.size());
22 | }
23 |
24 | int main(int argc, char* argv[])
25 | {
26 | std::vector pixelShaders;
27 |
28 | pixelShaders.emplace_back(BuildDX10PixelShader());
29 | pixelShaders.emplace_back(BuildDX10RGBAPixelShader());
30 |
31 | WriteShader(pixelShaders[1], "RGBA.shader");
32 |
33 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_1));
34 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_2));
35 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_3));
36 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_0));
37 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_1));
38 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0));
39 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_1));
40 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_0));
41 | pixelShaders.emplace_back(BuildDX11PixelShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_1));
42 |
43 | pixelShaders.emplace_back(BuildDX12PixelShader());
44 |
45 | std::vector vertexShaders;
46 |
47 | vertexShaders.emplace_back(BuildDX10VertexShader());
48 |
49 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_1));
50 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_2));
51 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_9_3));
52 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_0));
53 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_10_1));
54 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0));
55 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_1));
56 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_0));
57 | vertexShaders.emplace_back(BuildDX11VertexShader(D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_12_1));
58 |
59 | vertexShaders.emplace_back(BuildDX12VertexShader());
60 |
61 | return 0;
62 | }
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/sha256.h:
--------------------------------------------------------------------------------
1 | // //////////////////////////////////////////////////////////
2 | // sha256.h
3 | // Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
4 | // see http://create.stephan-brumme.com/disclaimer.html
5 | //
6 |
7 | #pragma once
8 |
9 | //#include "hash.h"
10 | #include
11 |
12 | // define fixed size integer types
13 | #ifdef _MSC_VER
14 | // Windows
15 | typedef unsigned __int8 uint8_t;
16 | typedef unsigned __int32 uint32_t;
17 | typedef unsigned __int64 uint64_t;
18 | #else
19 | // GCC
20 | #include
21 | #endif
22 |
23 |
24 | /// compute SHA256 hash
25 | /** Usage:
26 | SHA256 sha256;
27 | std::string myHash = sha256("Hello World"); // std::string
28 | std::string myHash2 = sha256("How are you", 11); // arbitrary data, 11 bytes
29 |
30 | // or in a streaming fashion:
31 |
32 | SHA256 sha256;
33 | while (more data available)
34 | sha256.add(pointer to fresh data, number of new bytes);
35 | std::string myHash3 = sha256.getHash();
36 | */
37 | class SHA256 //: public Hash
38 | {
39 | public:
40 | /// split into 64 byte blocks (=> 512 bits), hash is 32 bytes long
41 | enum { BlockSize = 512 / 8, HashBytes = 32 };
42 |
43 | /// same as reset()
44 | SHA256();
45 |
46 | /// compute SHA256 of a memory block
47 | std::string operator()(const void* data, size_t numBytes);
48 | /// compute SHA256 of a string, excluding final zero
49 | std::string operator()(const std::string& text);
50 |
51 | /// add arbitrary number of bytes
52 | void add(const void* data, size_t numBytes);
53 |
54 | /// return latest hash as 64 hex characters
55 | std::string getHash();
56 | /// return latest hash as bytes
57 | void getHash(unsigned char buffer[HashBytes]);
58 |
59 | /// restart
60 | void reset();
61 |
62 | private:
63 | /// process 64 bytes
64 | void processBlock(const void* data);
65 | /// process everything left in the internal buffer
66 | void processBuffer();
67 |
68 | /// size of processed data in bytes
69 | uint64_t m_numBytes;
70 | /// valid bytes in m_buffer
71 | size_t m_bufferSize;
72 | /// bytes not processed yet
73 | uint8_t m_buffer[BlockSize];
74 |
75 | enum { HashValues = HashBytes / 4 };
76 | /// hash, stored as integers
77 | uint32_t m_hash[HashValues];
78 | };
79 |
--------------------------------------------------------------------------------
/tests/windows_shaders_precompile/shaders.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | std::vector BuildDX10VertexShader();
8 | std::vector