mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 01:19:19 +02:00
maintenance: glew update to v 2.1.0, glfw update to v3.3
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.11"/>
|
||||
<meta name="generator" content="Doxygen 1.8.15"/>
|
||||
<title>GLFW: Vulkan guide</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
@@ -11,9 +11,6 @@
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() { init_search(); });
|
||||
</script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="extra.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
@@ -21,45 +18,31 @@
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<div class="glfwheader">
|
||||
<a href="http://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||
<a href="https://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||
<ul class="glfwnavbar">
|
||||
<li><a href="http://www.glfw.org/documentation.html">Documentation</a></li>
|
||||
<li><a href="http://www.glfw.org/download.html">Download</a></li>
|
||||
<li><a href="http://www.glfw.org/media.html">Media</a></li>
|
||||
<li><a href="http://www.glfw.org/community.html">Community</a></li>
|
||||
<li><a href="https://www.glfw.org/documentation.html">Documentation</a></li>
|
||||
<li><a href="https://www.glfw.org/download.html">Download</a></li>
|
||||
<li><a href="https://www.glfw.org/community.html">Community</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.11 -->
|
||||
<!-- Generated by Doxygen 1.8.15 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="navrow1" class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
||||
<li><a href="files.html"><span>Files</span></a></li>
|
||||
<li>
|
||||
<div id="MSearchBox" class="MSearchBoxInactive">
|
||||
<span class="left">
|
||||
<img id="MSearchSelect" src="search/mag_sel.png"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
alt=""/>
|
||||
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
||||
onfocus="searchBox.OnSearchFieldFocus(true)"
|
||||
onblur="searchBox.OnSearchFieldFocus(false)"
|
||||
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
||||
</span><span class="right">
|
||||
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
@@ -75,13 +58,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</div>
|
||||
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="PageDoc"><div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Vulkan guide </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="toc"><h3>Table of Contents</h3>
|
||||
<ul><li class="level1"><a href="#vulkan_include">Including the Vulkan and GLFW header files</a></li>
|
||||
<ul><li class="level1"><a href="#vulkan_loader">Linking against the Vulkan loader</a></li>
|
||||
<li class="level1"><a href="#vulkan_include">Including the Vulkan and GLFW header files</a></li>
|
||||
<li class="level1"><a href="#vulkan_support">Querying for Vulkan support</a><ul><li class="level2"><a href="#vulkan_proc">Querying Vulkan function pointers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -92,8 +76,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</ul>
|
||||
</div>
|
||||
<div class="textblock"><p>This guide is intended to fill the gaps between the <a href="https://www.khronos.org/vulkan/">Vulkan documentation</a> and the rest of the GLFW documentation and is not a replacement for either. It assumes some familiarity with Vulkan concepts like loaders, devices, queues and surfaces and leaves it to the Vulkan documentation to explain the details of Vulkan functions.</p>
|
||||
<p>To develop for Vulkan you should install an SDK for your platform, for example the <a href="https://vulkan.lunarg.com/">LunarG Vulkan SDK</a>. Apart from the headers and libraries, it also provides the validation layers necessary for development.</p>
|
||||
<p>The GLFW library does not need the Vulkan SDK to enable support for Vulkan. However, any Vulkan-specific test and example programs are built only if the CMake files find a Vulkan SDK.</p>
|
||||
<p>To develop for Vulkan you should download the <a href="https://vulkan.lunarg.com/">LunarG Vulkan SDK</a> for your platform. Apart from headers and link libraries, they also provide the validation layers necessary for development.</p>
|
||||
<p>For details on a specific function in this category, see the <a class="el" href="group__vulkan.html">Vulkan reference</a>. There are also guides for the other areas of the GLFW API.</p>
|
||||
<ul>
|
||||
<li><a class="el" href="intro_guide.html">Introduction to the API</a></li>
|
||||
@@ -102,18 +85,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
<li><a class="el" href="monitor_guide.html">Monitor guide</a></li>
|
||||
<li><a class="el" href="input_guide.html">Input guide</a></li>
|
||||
</ul>
|
||||
<h1><a class="anchor" id="vulkan_loader"></a>
|
||||
Linking against the Vulkan loader</h1>
|
||||
<p>By default, GLFW will look for the Vulkan loader on demand at runtime via its standard name (<code>vulkan-1.dll</code> on Windows, <code>libvulkan.so.1</code> on Linux and other Unix-like systems and <code>libvulkan.1.dylib</code> on macOS). This means that GLFW does not need to be linked against the loader. However, it also means that if you are using the static library form of the Vulkan loader GLFW will either fail to find it or (worse) use the wrong one.</p>
|
||||
<p>The <a class="el" href="compile_guide.html#GLFW_VULKAN_STATIC">GLFW_VULKAN_STATIC</a> CMake option makes GLFW call the Vulkan loader directly instead of dynamically loading it at runtime. Not linking against the Vulkan loader will then be a compile-time error.</p>
|
||||
<p><b>macOS:</b> Because the Vulkan loader and ICD are not installed globally on macOS, you need to set up the application bundle according to the LunarG SDK documentation. This is explained in more detail in the <a href="https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html">SDK documentation for macOS</a>.</p>
|
||||
<h1><a class="anchor" id="vulkan_include"></a>
|
||||
Including the Vulkan and GLFW header files</h1>
|
||||
<p>To include the Vulkan header, define <a class="el" href="build_guide.html#build_macros">GLFW_INCLUDE_VULKAN</a> before including the GLFW header.</p>
|
||||
<p>To include the Vulkan header, define <a class="el" href="build_guide.html#GLFW_INCLUDE_VULKAN">GLFW_INCLUDE_VULKAN</a> before including the GLFW header.</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define GLFW_INCLUDE_VULKAN</span></div><div class="line"><span class="preprocessor">#include <GLFW/glfw3.h></span></div></div><!-- fragment --><p>If you instead want to include the Vulkan header from a custom location or use your own custom Vulkan header then do this before the GLFW header.</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#include <path/to/vulkan.h></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="glfw3_8h.html">GLFW/glfw3.h</a>></span></div></div><!-- fragment --><p>Unless a Vulkan header is included, either by the GLFW header or above it, any GLFW functions that take or return Vulkan types will not be declared.</p>
|
||||
<p>The <code>VK_USE_PLATFORM_*_KHR</code> macros do not need to be defined for the Vulkan part of GLFW to work. Define them only if you are using these extensions directly.</p>
|
||||
<h1><a class="anchor" id="vulkan_support"></a>
|
||||
Querying for Vulkan support</h1>
|
||||
<p>If you are linking directly against the Vulkan loader then you can skip this section. The canonical desktop loader library exports all Vulkan core and Khronos extension functions, allowing them to be called directly.</p>
|
||||
<p>If you are loading the Vulkan loader dynamically instead of linking directly against it, you can check for the availability of a loader with <a class="el" href="group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b">glfwVulkanSupported</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b">glfwVulkanSupported</a>())</div><div class="line">{</div><div class="line"> <span class="comment">// Vulkan is available, at least for compute</span></div><div class="line">}</div></div><!-- fragment --><p>This function returns <code>GLFW_TRUE</code> if the Vulkan loader was found. This check is performed by <a class="el" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a>.</p>
|
||||
<p>If no loader was found, calling any other Vulkan related GLFW function will generate a <a class="el" href="group__errors.html#ga56882b290db23261cc6c053c40c2d08e">GLFW_API_UNAVAILABLE</a> error.</p>
|
||||
<p>If you are loading the Vulkan loader dynamically instead of linking directly against it, you can check for the availability of a loader and ICD with <a class="el" href="group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b">glfwVulkanSupported</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b">glfwVulkanSupported</a>())</div><div class="line">{</div><div class="line"> <span class="comment">// Vulkan is available, at least for compute</span></div><div class="line">}</div></div><!-- fragment --><p>This function returns <code>GLFW_TRUE</code> if the Vulkan loader and any minimally functional ICD was found.</p>
|
||||
<p>If if one or both were not found, calling any other Vulkan related GLFW function will generate a <a class="el" href="group__errors.html#ga56882b290db23261cc6c053c40c2d08e">GLFW_API_UNAVAILABLE</a> error.</p>
|
||||
<h2><a class="anchor" id="vulkan_proc"></a>
|
||||
Querying Vulkan function pointers</h2>
|
||||
<p>To load any Vulkan core or extension function from the found loader, call <a class="el" href="group__vulkan.html#gadf228fac94c5fd8f12423ec9af9ff1e9">glfwGetInstanceProcAddress</a>. To load functions needed for instance creation, pass <code>NULL</code> as the instance.</p>
|
||||
@@ -127,7 +115,7 @@ Querying required Vulkan extensions</h1>
|
||||
<p>To query the instance extensions required, call <a class="el" href="group__vulkan.html#ga1abcbe61033958f22f63ef82008874b1">glfwGetRequiredInstanceExtensions</a>.</p>
|
||||
<div class="fragment"><div class="line">uint32_t count;</div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>** extensions = <a class="code" href="group__vulkan.html#ga1abcbe61033958f22f63ef82008874b1">glfwGetRequiredInstanceExtensions</a>(&count);</div></div><!-- fragment --><p>These extensions must all be enabled when creating instances that are going to be passed to <a class="el" href="group__vulkan.html#gaff3823355cdd7e2f3f9f4d9ea9518d92">glfwGetPhysicalDevicePresentationSupport</a> and <a class="el" href="group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965">glfwCreateWindowSurface</a>. The set of extensions will vary depending on platform and may also vary depending on graphics drivers and other factors.</p>
|
||||
<p>If it fails it will return <code>NULL</code> and GLFW will not be able to create Vulkan window surfaces. You can still use Vulkan for off-screen rendering and compute work.</p>
|
||||
<p>The returned array will always contain <code>VK_KHR_surface</code>, so if you don't require any additional extensions you can pass this list directly to the <code>VkInstanceCreateInfo</code> struct.</p>
|
||||
<p>If successful the returned array will always include <code>VK_KHR_surface</code>, so if you don't require any additional extensions you can pass this list directly to the <code>VkInstanceCreateInfo</code> struct.</p>
|
||||
<div class="fragment"><div class="line">VkInstanceCreateInfo ici;</div><div class="line"></div><div class="line">memset(&ici, 0, <span class="keyword">sizeof</span>(ici));</div><div class="line">ici.enabledExtensionCount = count;</div><div class="line">ici.ppEnabledExtensionNames = extensions;</div><div class="line">...</div></div><!-- fragment --><p>Additional extensions may be required by future versions of GLFW. You should check whether any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the <code>VkInstanceCreateInfo</code> struct.</p>
|
||||
<h1><a class="anchor" id="vulkan_present"></a>
|
||||
Querying for Vulkan presentation support</h1>
|
||||
@@ -135,16 +123,18 @@ Querying for Vulkan presentation support</h1>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="group__vulkan.html#gaff3823355cdd7e2f3f9f4d9ea9518d92">glfwGetPhysicalDevicePresentationSupport</a>(instance, physical_device, queue_family_index))</div><div class="line">{</div><div class="line"> <span class="comment">// Queue family supports image presentation</span></div><div class="line">}</div></div><!-- fragment --><p>The <code>VK_KHR_surface</code> extension additionally provides the <code>vkGetPhysicalDeviceSurfaceSupportKHR</code> function, which performs the same test on an existing Vulkan surface.</p>
|
||||
<h1><a class="anchor" id="vulkan_window"></a>
|
||||
Creating the window</h1>
|
||||
<p>Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan, there is no need to create a context. You can disable context creation with the <a class="el" href="window_guide.html#window_hints_ctx">GLFW_CLIENT_API</a> hint.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033">glfwWindowHint</a>(<a class="code" href="glfw3_8h.html#a649309cf72a3d3de5b1348ca7936c95b">GLFW_CLIENT_API</a>, <a class="code" href="glfw3_8h.html#a8f6dcdc968d214ff14779564f1389264">GLFW_NO_API</a>);</div><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* window = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">"Window Title"</span>, NULL, NULL);</div></div><!-- fragment --><p>See <a class="el" href="context_guide.html#context_less">Windows without contexts</a> for more information.</p>
|
||||
<p>Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan, there is no need to create a context. You can disable context creation with the <a class="el" href="window_guide.html#GLFW_CLIENT_API_hint">GLFW_CLIENT_API</a> hint.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033">glfwWindowHint</a>(<a class="code" href="group__window.html#ga649309cf72a3d3de5b1348ca7936c95b">GLFW_CLIENT_API</a>, <a class="code" href="glfw3_8h.html#a8f6dcdc968d214ff14779564f1389264">GLFW_NO_API</a>);</div><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* window = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">"Window Title"</span>, NULL, NULL);</div></div><!-- fragment --><p>See <a class="el" href="context_guide.html#context_less">Windows without contexts</a> for more information.</p>
|
||||
<h1><a class="anchor" id="vulkan_surface"></a>
|
||||
Creating a Vulkan window surface</h1>
|
||||
<p>You can create a Vulkan surface (as defined by the <code>VK_KHR_surface</code> extension) for a GLFW window with <a class="el" href="group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965">glfwCreateWindowSurface</a>.</p>
|
||||
<div class="fragment"><div class="line">VkSurfaceKHR surface;</div><div class="line">VkResult err = <a class="code" href="group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965">glfwCreateWindowSurface</a>(instance, window, NULL, &surface);</div><div class="line"><span class="keywordflow">if</span> (err)</div><div class="line">{</div><div class="line"> <span class="comment">// Window surface creation failed</span></div><div class="line">}</div></div><!-- fragment --><p>It is your responsibility to destroy the surface. GLFW does not destroy it for you. Call <code>vkDestroySurfaceKHR</code> function from the same extension to destroy it. </p>
|
||||
</div></div><!-- contents -->
|
||||
<div class="fragment"><div class="line">VkSurfaceKHR surface;</div><div class="line">VkResult err = <a class="code" href="group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965">glfwCreateWindowSurface</a>(instance, window, NULL, &surface);</div><div class="line"><span class="keywordflow">if</span> (err)</div><div class="line">{</div><div class="line"> <span class="comment">// Window surface creation failed</span></div><div class="line">}</div></div><!-- fragment --><p>If an OpenGL or OpenGL ES context was created on the window, the context has ownership of the presentation on the window and a Vulkan surface cannot be created.</p>
|
||||
<p>It is your responsibility to destroy the surface. GLFW does not destroy it for you. Call <code>vkDestroySurfaceKHR</code> function from the same extension to destroy it. </p>
|
||||
</div></div><!-- PageDoc -->
|
||||
</div><!-- contents -->
|
||||
<address class="footer">
|
||||
<p>
|
||||
Last update on Thu Aug 18 2016 for GLFW 3.2.1
|
||||
Last update on Tue Apr 16 2019 for GLFW 3.3.0
|
||||
</p>
|
||||
</address>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user