mirror of
https://github.com/sotrh/learn-wgpu.git
synced 2024-11-18 03:25:33 +00:00
23 lines
13 KiB
HTML
23 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>Introduction | Learn Wgpu</title>
|
|
<meta name="description" content="">
|
|
<meta name="generator" content="VuePress 1.4.0">
|
|
|
|
<meta property="article:modified_time" content="2021-11-20T20:24:34.000Z"><meta property="og:site_name" content="Learn Wgpu"><meta property="og:title" content="Introduction"><meta property="og:type" content="website"><meta property="og:url" content="/"><meta name="twitter:title" content="Introduction"><meta name="twitter:url" content="/"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:label1" content="Written by"><meta name="twitter:data2" content="Benjamin Hansen"><meta name="twitter:creator" content="https://twitter.com/sotrh760">
|
|
<link rel="preload" href="/learn-wgpu/assets/css/0.styles.e2608c6d.css" as="style"><link rel="preload" href="/learn-wgpu/assets/js/app.aba49209.js" as="script"><link rel="preload" href="/learn-wgpu/assets/js/2.2694e6b4.js" as="script"><link rel="preload" href="/learn-wgpu/assets/js/24.5e2c93e5.js" as="script"><link rel="prefetch" href="/learn-wgpu/assets/js/10.634b5397.js"><link rel="prefetch" href="/learn-wgpu/assets/js/11.031b1ca8.js"><link rel="prefetch" href="/learn-wgpu/assets/js/12.d174877d.js"><link rel="prefetch" href="/learn-wgpu/assets/js/13.ec63c87c.js"><link rel="prefetch" href="/learn-wgpu/assets/js/14.1c03a39b.js"><link rel="prefetch" href="/learn-wgpu/assets/js/15.a0495455.js"><link rel="prefetch" href="/learn-wgpu/assets/js/16.2ff52c68.js"><link rel="prefetch" href="/learn-wgpu/assets/js/17.115758a0.js"><link rel="prefetch" href="/learn-wgpu/assets/js/18.4b7a320e.js"><link rel="prefetch" href="/learn-wgpu/assets/js/19.1f0de2c3.js"><link rel="prefetch" href="/learn-wgpu/assets/js/20.1cd966d6.js"><link rel="prefetch" href="/learn-wgpu/assets/js/21.745e0d31.js"><link rel="prefetch" href="/learn-wgpu/assets/js/22.2132e362.js"><link rel="prefetch" href="/learn-wgpu/assets/js/23.1a88f225.js"><link rel="prefetch" href="/learn-wgpu/assets/js/25.87991ea0.js"><link rel="prefetch" href="/learn-wgpu/assets/js/26.8eefda0f.js"><link rel="prefetch" href="/learn-wgpu/assets/js/27.d7f5cf22.js"><link rel="prefetch" href="/learn-wgpu/assets/js/28.476932c1.js"><link rel="prefetch" href="/learn-wgpu/assets/js/29.adc9c96e.js"><link rel="prefetch" href="/learn-wgpu/assets/js/3.6161787d.js"><link rel="prefetch" href="/learn-wgpu/assets/js/30.35a5043b.js"><link rel="prefetch" href="/learn-wgpu/assets/js/31.ba2bca1b.js"><link rel="prefetch" href="/learn-wgpu/assets/js/4.0947bf2a.js"><link rel="prefetch" href="/learn-wgpu/assets/js/5.022e952a.js"><link rel="prefetch" href="/learn-wgpu/assets/js/6.bc35a8a9.js"><link rel="prefetch" href="/learn-wgpu/assets/js/7.2856f422.js"><link rel="prefetch" href="/learn-wgpu/assets/js/8.82833106.js"><link rel="prefetch" href="/learn-wgpu/assets/js/9.ecb6e79c.js">
|
|
<link rel="stylesheet" href="/learn-wgpu/assets/css/0.styles.e2608c6d.css">
|
|
</head>
|
|
<body>
|
|
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="inner"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/learn-wgpu/" class="home-link router-link-exact-active router-link-active"><!----> <span class="site-name">Learn Wgpu</span></a> <div class="links"><!----> <div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div></div></div></header> <div class="sidebar-mask"></div> <div class="docs-layout"><aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/learn-wgpu/" class="active sidebar-link">Introduction</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/learn-wgpu/#what-is-wgpu" class="sidebar-link">What is wgpu?</a></li><li class="sidebar-sub-header"><a href="/learn-wgpu/#why-rust" class="sidebar-link">Why Rust?</a></li><li class="sidebar-sub-header"><a href="/learn-wgpu/#contribution-and-support" class="sidebar-link">Contribution and Support</a></li><li class="sidebar-sub-header"><a href="/learn-wgpu/#special-thanks-to-these-patrons" class="sidebar-link">Special thanks to these patrons!</a></li></ul></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>Beginner</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/learn-wgpu/beginner/tutorial1-window/" class="sidebar-link">Dependencies and the window</a></li><li><a href="/learn-wgpu/beginner/tutorial2-surface/" class="sidebar-link">The Surface</a></li><li><a href="/learn-wgpu/beginner/tutorial3-pipeline/" class="sidebar-link">The Pipeline</a></li><li><a href="/learn-wgpu/beginner/tutorial4-buffer/" class="sidebar-link">Buffers and Indices</a></li><li><a href="/learn-wgpu/beginner/tutorial5-textures/" class="sidebar-link">Textures and bind groups</a></li><li><a href="/learn-wgpu/beginner/tutorial6-uniforms/" class="sidebar-link">Uniform buffers and a 3d camera</a></li><li><a href="/learn-wgpu/beginner/tutorial7-instancing/" class="sidebar-link">Instancing</a></li><li><a href="/learn-wgpu/beginner/tutorial8-depth/" class="sidebar-link">The Depth Buffer</a></li><li><a href="/learn-wgpu/beginner/tutorial9-models/" class="sidebar-link">Model Loading</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>Intermediate</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/learn-wgpu/intermediate/tutorial10-lighting/" class="sidebar-link">Working with Lights</a></li><li><a href="/learn-wgpu/intermediate/tutorial11-normals/" class="sidebar-link">Normal Mapping</a></li><li><a href="/learn-wgpu/intermediate/tutorial12-camera/" class="sidebar-link">A Better Camera</a></li><li><a href="/learn-wgpu/intermediate/tutorial13-threading/" class="sidebar-link">Multi-threading with Wgpu and Rayon</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Showcase</span> <span class="arrow right"></span></p> <!----></section></li><li><a href="/learn-wgpu/news/" class="sidebar-link">News</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="introduction"><a href="#introduction" class="header-anchor">#</a> Introduction</h1> <h2 id="what-is-wgpu"><a href="#what-is-wgpu" class="header-anchor">#</a> What is wgpu?</h2> <p><a href="https://github.com/gfx-rs/wgpu" target="_blank" rel="noopener noreferrer">Wgpu<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> is a Rust implementation of the <a href="https://gpuweb.github.io/gpuweb/" target="_blank" rel="noopener noreferrer">WebGPU API spec<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>. WebGPU is a specification published by the GPU for the Web Community Group. It aims to allow web code access to GPU functions in a safe and reliable manner. It does this by mimicking the Vulkan API, and translating that down to whatever API the host hardware is using (ie. DirectX, Metal, Vulkan).</p> <p>Wgpu is still in development, so some of this doc is subject to change.</p> <h2 id="why-rust"><a href="#why-rust" class="header-anchor">#</a> Why Rust?</h2> <p>Wgpu actually has C bindings to allow you to write C/C++ code with it, as well as use other languages that interface with C. That being said, wgpu is written in Rust, and it has some convenient Rust bindings that don't have to jump through any hoops. On top of that, I've been enjoying writing in Rust.</p> <p>You should be fairly familiar with Rust before using this tutorial as I won't go into much detail on Rust syntax. If you're not super comfortable with Rust you can review the <a href="https://www.rust-lang.org/learn" target="_blank" rel="noopener noreferrer">Rust tutorial<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>. You should also be familiar about <a href="https://doc.rust-lang.org/cargo/" target="_blank" rel="noopener noreferrer">Cargo<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p>I'm using this project as a way to learn wgpu myself, so I might miss some important details, or explain things wrong. I'm always open to constructive feedback.</p> <h2 id="contribution-and-support"><a href="#contribution-and-support" class="header-anchor">#</a> Contribution and Support</h2> <ul><li>I accept pull requests (<a href="https://github.com/sotrh/learn-wgpu" target="_blank" rel="noopener noreferrer">GitHub repo<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>) for fixing issues with this tutorial such as typos, incorrect information, and other inconsistencies.</li> <li>Due to wgpu's rapidly changing api, I'm not accepting any new pull requests for showcase demos.</li> <li>If you want to support me directly, check out my <a href="https://www.patreon.com/sotrh" target="_blank" rel="noopener noreferrer">patreon<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>!</li></ul> <h2 id="special-thanks-to-these-patrons"><a href="#special-thanks-to-these-patrons" class="header-anchor">#</a> Special thanks to these patrons!</h2> <p><em>In no particular order</em></p> <ul><li>Jan Šipr</li> <li>Danny McGee</li> <li>Bernard Llanos</li> <li>Ken Kochis</li> <li>Aron Granberg</li> <li>Ben Anderson</li> <li>Ian Gowen</li> <li>Paul E Hansen</li> <li>Lennart</li> <li>Gunstein Vatnar</li> <li>David Laban</li></ul></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">11/20/2021, 8:24:34 PM</span></div></footer> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/learn-wgpu/beginner/tutorial1-window/">
|
|
Dependencies and the window
|
|
</a>
|
|
→
|
|
</span></p></div> </main></div></div><div class="global-ui"><!----></div></div>
|
|
<script src="/learn-wgpu/assets/js/app.aba49209.js" defer></script><script src="/learn-wgpu/assets/js/2.2694e6b4.js" defer></script><script src="/learn-wgpu/assets/js/24.5e2c93e5.js" defer></script>
|
|
</body>
|
|
</html>
|