Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 8 | ||
---|---|---|---|
Line 67... | Line 67... | ||
67 | 67 | ||
68 | /** |
68 | /** |
69 | * \brief Dynamically load a Vulkan loader library. |
69 | * \brief Dynamically load a Vulkan loader library. |
70 | * |
70 | * |
71 | * \param [in] path The platform dependent Vulkan loader library name, or |
71 | * \param [in] path The platform dependent Vulkan loader library name, or |
72 | * \c NULL |
72 | * \c NULL. |
73 | * |
73 | * |
74 | * \return \c 0 on success, or \c -1 if the library couldn't be loaded. |
74 | * \return \c 0 on success, or \c -1 if the library couldn't be loaded. |
75 | * |
75 | * |
- | 76 | * If \a path is NULL SDL will use the value of the environment variable |
|
- | 77 | * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan |
|
- | 78 | * loader library. |
|
- | 79 | * |
|
76 | * This should be |
80 | * This should be called after initializing the video driver, but before |
77 | * creating any Vulkan windows. If no Vulkan loader library is loaded, the |
81 | * creating any Vulkan windows. If no Vulkan loader library is loaded, the |
78 | * default library will be loaded upon creation of the first Vulkan window. |
82 | * default library will be loaded upon creation of the first Vulkan window. |
79 | * |
83 | * |
- | 84 | * \note It is fairly common for Vulkan applications to link with \a libvulkan |
|
- | 85 | * instead of explicitly loading it at run time. This will work with |
|
- | 86 | * SDL provided the application links to a dynamic library and both it |
|
- | 87 | * and SDL use the same search path. |
|
- | 88 | * |
|
80 | * \note If you specify a non-NULL |
89 | * \note If you specify a non-NULL \c path, an application should retrieve all |
81 | * Vulkan functions |
90 | * of the Vulkan functions it uses from the dynamic library using |
82 | * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee |
91 | * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee |
83 | * |
92 | * \c path points to the same vulkan loader library the application |
- | 93 | * linked to. |
|
84 | * |
94 | * |
85 | * \note On Apple devices, if \a path is NULL, SDL will attempt to find |
95 | * \note On Apple devices, if \a path is NULL, SDL will attempt to find |
86 | * the vkGetInstanceProcAddr address within all the mach-o images of |
96 | * the vkGetInstanceProcAddr address within all the mach-o images of |
87 | * the current process. This is because |
97 | * the current process. This is because it is fairly common for Vulkan |
- | 98 | * applications to link with libvulkan (and historically MoltenVK was |
|
- | 99 | * provided as a static library). If it is not found then, on macOS, SDL |
|
- | 100 | * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, |
|
88 | * |
101 | * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. |
89 | * |
102 | * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications |
90 | * |
103 | * using a dynamic framework or .dylib must ensure it is included in its |
91 | * |
104 | * application bundle. |
92 | * |
105 | * |
93 | * \note On non-Apple devices, |
106 | * \note On non-Apple devices, application linking with a static libvulkan is |
94 | * |
107 | * not supported. Either do not link to the Vulkan loader or link to a |
95 | * |
108 | * dynamic library version. |
96 | * |
109 | * |
97 | * \note This function will fail if there are no working Vulkan drivers |
110 | * \note This function will fail if there are no working Vulkan drivers |
98 | * installed. |
111 | * installed. |
99 | * |
112 | * |
100 | * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() |
113 | * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() |
Line 120... | Line 133... | ||
120 | 133 | ||
121 | /** |
134 | /** |
122 | * \brief Get the names of the Vulkan instance extensions needed to create |
135 | * \brief Get the names of the Vulkan instance extensions needed to create |
123 | * a surface with \c SDL_Vulkan_CreateSurface(). |
136 | * a surface with \c SDL_Vulkan_CreateSurface(). |
124 | * |
137 | * |
125 | * \param [in] window Window for which the required Vulkan instance |
138 | * \param [in] \c NULL or window Window for which the required Vulkan instance |
126 | * extensions should be retrieved |
139 | * extensions should be retrieved |
127 | * \param [in,out] |
140 | * \param [in,out] pCount pointer to an \c unsigned related to the number of |
128 | * required Vulkan instance extensions |
141 | * required Vulkan instance extensions |
129 | * \param [out] |
142 | * \param [out] pNames \c NULL or a pointer to an array to be filled with the |
130 | * required Vulkan instance extensions |
143 | * required Vulkan instance extensions |
131 | * |
144 | * |
132 | * \return \c SDL_TRUE on success, \c SDL_FALSE on error. |
145 | * \return \c SDL_TRUE on success, \c SDL_FALSE on error. |
133 | * |
146 | * |
134 | * If \a pNames is \c NULL, then the number of required Vulkan instance |
147 | * If \a pNames is \c NULL, then the number of required Vulkan instance |
Line 138... | Line 151... | ||
138 | * written to \a pNames. If \a pCount is less than the number of required |
151 | * written to \a pNames. If \a pCount is less than the number of required |
139 | * extensions, at most \a pCount structures will be written. If \a pCount |
152 | * extensions, at most \a pCount structures will be written. If \a pCount |
140 | * is smaller than the number of required extensions, \c SDL_FALSE will be |
153 | * is smaller than the number of required extensions, \c SDL_FALSE will be |
141 | * returned instead of \c SDL_TRUE, to indicate that not all the required |
154 | * returned instead of \c SDL_TRUE, to indicate that not all the required |
142 | * extensions were returned. |
155 | * extensions were returned. |
- | 156 | * |
|
- | 157 | * \note If \c window is not NULL, it will be checked against its creation |
|
- | 158 | * flags to ensure that the Vulkan flag is present. This parameter |
|
- | 159 | * will be removed in a future major release. |
|
143 | * |
160 | * |
144 | * \note The returned list of extensions will contain \c VK_KHR_surface |
161 | * \note The returned list of extensions will contain \c VK_KHR_surface |
145 | * and zero or more platform specific extensions |
162 | * and zero or more platform specific extensions |
146 | * |
163 | * |
147 | * \note The extension names queried here must be enabled when calling |
164 | * \note The extension names queried here must be enabled when calling |
148 | * VkCreateInstance, otherwise surface creation will fail. |
165 | * VkCreateInstance, otherwise surface creation will fail. |
149 | * |
166 | * |
150 | * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag |
167 | * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag |
- | 168 | * or be \c NULL |
|
151 | * |
169 | * |
152 | * \code |
170 | * \code |
153 | * unsigned int count; |
171 | * unsigned int count; |
154 | * // get count of required extensions |
172 | * // get count of required extensions |
155 | * if(!SDL_Vulkan_GetInstanceExtensions( |
173 | * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) |
156 | * handle_error(); |
174 | * handle_error(); |
157 | * |
175 | * |
158 | * static const char *const additionalExtensions[] = |
176 | * static const char *const additionalExtensions[] = |
159 | * { |
177 | * { |
160 | * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension |
178 | * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension |
Line 164... | Line 182... | ||
164 | * const char **names = malloc(sizeof(const char *) * extensionCount); |
182 | * const char **names = malloc(sizeof(const char *) * extensionCount); |
165 | * if(!names) |
183 | * if(!names) |
166 | * handle_error(); |
184 | * handle_error(); |
167 | * |
185 | * |
168 | * // get names of required extensions |
186 | * // get names of required extensions |
169 | * if(!SDL_Vulkan_GetInstanceExtensions( |
187 | * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) |
170 | * handle_error(); |
188 | * handle_error(); |
171 | * |
189 | * |
172 | * // copy additional extensions after required extensions |
190 | * // copy additional extensions after required extensions |
173 | * for(size_t i = 0; i < additionalExtensionsCount; i++) |
191 | * for(size_t i = 0; i < additionalExtensionsCount; i++) |
174 | * names[i + count] = additionalExtensions[i]; |
192 | * names[i + count] = additionalExtensions[i]; |
Line 237... | Line 255... | ||
237 | * |
255 | * |
238 | * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI |
256 | * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI |
239 | * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a |
257 | * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a |
240 | * platform with high-DPI support (Apple calls this "Retina"), and not disabled |
258 | * platform with high-DPI support (Apple calls this "Retina"), and not disabled |
241 | * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. |
259 | * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. |
- | 260 | * |
|
- | 261 | * \note On macOS high-DPI support must be enabled for an application by |
|
- | 262 | * setting NSHighResolutionCapable to true in its Info.plist. |
|
242 | * |
263 | * |
243 | * \sa SDL_GetWindowSize() |
264 | * \sa SDL_GetWindowSize() |
244 | * \sa SDL_CreateWindow() |
265 | * \sa SDL_CreateWindow() |
245 | */ |
266 | */ |
246 | extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, |
267 | extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, |