mirror of
https://github.com/sotrh/learn-wgpu.git
synced 2024-11-08 07:10:33 +00:00
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{237:function(e,t,a){e.exports=a.p+"assets/img/normal_mapping_correct.2731b486.png"},267:function(e,t,a){"use strict";a.r(t);var s=a(10),n=Object(s.a)({},(function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[s("h1",{attrs:{id:"news"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#news"}},[e._v("#")]),e._v(" News")]),e._v(" "),s("h2",{attrs:{id:"november-2020-cleanup-content-freeze-and-patreon"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#november-2020-cleanup-content-freeze-and-patreon"}},[e._v("#")]),e._v(" November 2020 Cleanup, Content Freeze, and Patreon")]),e._v(" "),s("p",[e._v("School is starting to ramp up, so I haven't had as much time to work on the site as I would like to. Because of that there were some issues piling up. I decided to tackle a bunch of them in one go. Here's a snapshot of what I did:")]),e._v(" "),s("ul",[s("li",[e._v("The tutorial now handles "),s("code",[e._v("SwapChainError")]),e._v(" properly")]),e._v(" "),s("li",[e._v("I'm now using bytemuck's derive feature on all buffer data structs.")]),e._v(" "),s("li",[e._v("The "),s("a",{attrs:{href:"../beginner/tutorial7-instancing"}},[e._v("instancing tutorial")]),e._v(" now uses vertex buffers instead of storage buffers.")]),e._v(" "),s("li",[s("code",[e._v("build.rs")]),e._v(" now updates when individual shaders are changed, not whenever "),s("code",[e._v("/src")]),e._v(" is changed.")]),e._v(" "),s("li",[e._v("Had some help from Github user @kanerogers to clean up the "),s("a",{attrs:{href:"../beginner/tutorial5-textures"}},[e._v("texturing tutorial")]),e._v(".")]),e._v(" "),s("li",[e._v("I made a "),s("a",{attrs:{href:"../showcase/compute"}},[e._v("compute pipeline showcase")]),e._v(" that computes the tangent and bitangent for each vertex in a model.")]),e._v(" "),s("li",[e._v("I made a "),s("a",{attrs:{href:"../showcase/imgui-demo"}},[e._v("imgui showcase")]),e._v(". It's very basic, but it should be a good starting point.")])]),e._v(" "),s("p",[e._v('Now in the headline I mentioned a "Content Freeze". Wgpu is still a moving target. The migration from '),s("code",[e._v("0.4")]),e._v(" to "),s("code",[e._v("0.5")]),e._v(" was lot of work. The same goes for "),s("code",[e._v("0.5")]),e._v(" to "),s("code",[e._v("0.6")]),e._v(". I'm expected the next migration to be just as much work. As such, I won't be added much content until the API becomes a bit more stable. That being said, I still plan on resolving any issues with the content.")]),e._v(" "),s("p",[e._v("One more thing. This is actually quite awkward for me (especially since I'll be slowing down development), but I've started a "),s("a",{attrs:{href:"https://www.patreon.com/sotrh",target:"_blank",rel:"noopener noreferrer"}},[e._v("patreon"),s("OutboundLink")],1),e._v(". My job doesn't give me a ton of hours, so things are a bit tight. You are by no means obligated to donate, but I would appreciate it.")]),e._v(" "),s("p",[e._v("You can find out more about contributing to this project on the "),s("RouterLink",{attrs:{to:"/#contribution-and-support"}},[e._v("introduction page")])],1),e._v(" "),s("h2",{attrs:{id:"_0-6"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_0-6"}},[e._v("#")]),e._v(" 0.6")]),e._v(" "),s("p",[e._v("This took me way too long. The changes weren't difficult, but I had to do a lot of copy pasting. The main changes are using "),s("code",[e._v("queue.write_buffer()")]),e._v(" and "),s("code",[e._v("queue.write_texture()")]),e._v(" everywhere. I won't get into the nitty gritty, but you can checkout the "),s("a",{attrs:{href:"https://github.com/sotrh/learn-wgpu/pull/90",target:"_blank",rel:"noopener noreferrer"}},[e._v("pull request"),s("OutboundLink")],1),e._v(" if you're interested.")]),e._v(" "),s("h2",{attrs:{id:"added-pong-showcase"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#added-pong-showcase"}},[e._v("#")]),e._v(" Added Pong Showcase")]),e._v(" "),s("p",[s("RouterLink",{attrs:{to:"/showcase/pong/"}},[e._v("See it here")])],1),e._v(" "),s("h2",{attrs:{id:"normal-mapping"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#normal-mapping"}},[e._v("#")]),e._v(" Normal mapping")]),e._v(" "),s("p",[e._v('My perfectionism got in my way a bit with this one. I wasn\'t sure that what I was getting was "physically accurate", but it seems to look good.')]),e._v(" "),s("p",[s("img",{attrs:{src:a(237),alt:""}})]),e._v(" "),s("h2",{attrs:{id:"_0-5"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_0-5"}},[e._v("#")]),e._v(" 0.5!")]),e._v(" "),s("p",[e._v("Too many things changed to make note of them here. Check out "),s("a",{attrs:{href:"https://github.com/sotrh/learn-wgpu/pull/29",target:"_blank",rel:"noopener noreferrer"}},[e._v("the 0.5 pull request"),s("OutboundLink")],1),e._v(" if you're curious about specifics. That being said, 2 things are worth mentioning directly: the y-axis now points up like with DirectX and Metal, and requesting an adapter and creating a device now use "),s("code",[e._v("Future")]),e._v("s. The tutorials have been updated as well as the code.")]),e._v(" "),s("h2",{attrs:{id:"reworked-lighting-tutorial"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#reworked-lighting-tutorial"}},[e._v("#")]),e._v(" Reworked lighting tutorial")]),e._v(" "),s("p",[e._v("The "),s("RouterLink",{attrs:{to:"/intermediate/tutorial10-lighting/"}},[e._v("lighting tutorial")]),e._v(" was not up to par, so I redid it.")],1),e._v(" "),s("h2",{attrs:{id:"added-gif-showcase"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#added-gif-showcase"}},[e._v("#")]),e._v(" Added GIF showcase")]),e._v(" "),s("p",[s("RouterLink",{attrs:{to:"/showcase/gifs/"}},[e._v("Creating GIFs")])],1),e._v(" "),s("h2",{attrs:{id:"updated-texture-tutorials"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#updated-texture-tutorials"}},[e._v("#")]),e._v(" Updated texture tutorials")]),e._v(" "),s("p",[e._v("Up to this point, we created textures manually everytime. I've pulled out the texture creation code into a new "),s("code",[e._v("texture.rs")]),e._v(" file and included it every tutorial from the "),s("RouterLink",{attrs:{to:"/beginner/tutorial5-textures/#cleaning-things-up"}},[e._v("textures tutorial")]),e._v(" onward.")],1),e._v(" "),s("h2",{attrs:{id:"fixed-panics-do-to-not-specifying-the-correct-usage"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#fixed-panics-do-to-not-specifying-the-correct-usage"}},[e._v("#")]),e._v(" Fixed panics do to not specifying the correct "),s("code",[e._v("usage")])]),e._v(" "),s("p",[e._v("Wgpu has become more strict about what "),s("code",[e._v("BufferUsage")]),e._v("s and "),s("code",[e._v("TextureUsage")]),e._v("s are required when performing certain operations. For example int the "),s("RouterLink",{attrs:{to:"/intermediate/windowless/"}},[e._v("Wgpu without a window example")]),e._v(", the "),s("code",[e._v("texture_desc")]),e._v(" only specified the usage to by "),s("code",[e._v("COPY_SRC")]),e._v(". This caused a crash when the "),s("code",[e._v("texture")]),e._v(" was used as a render target. Adding "),s("code",[e._v("OUTPUT_ATTACHMENT")]),e._v(" fixed the issue.")],1),e._v(" "),s("h2",{attrs:{id:"updating-winit-from-0-20-0-alpha5-to-0-20"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#updating-winit-from-0-20-0-alpha5-to-0-20"}},[e._v("#")]),e._v(" Updating Winit from 0.20.0-alpha5 to 0.20")]),e._v(" "),s("p",[e._v("There were a lot of small changes to how the dpi stuff works. You can see all the changes "),s("a",{attrs:{href:"https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer"}},[e._v("in the changelog"),s("OutboundLink")],1),e._v(". That means that some of the tutorials had to change.")]),e._v(" "),s("ul",[s("li",[e._v("I've removed "),s("code",[e._v("hidpi_factor")]),e._v(" from "),s("code",[e._v("State")]),e._v(" entirely. They removed the "),s("code",[e._v("hidpi_factor()")]),e._v(" method from "),s("code",[e._v("winit::window::Window")]),e._v(", and changed "),s("code",[e._v("inner_size()")]),e._v(" to return "),s("code",[e._v("PhysicalSize")]),e._v(" instead of "),s("code",[e._v("LogicalSize")]),e._v(", so we don't need to store the "),s("code",[e._v("hidpi_factor")]),e._v(" anymore.")]),e._v(" "),s("li",[s("code",[e._v("update_hidpi_and_resize")]),e._v(" is no more. Since "),s("code",[e._v("ScaleFactorChanged")]),e._v(" passes in the windows new "),s("code",[e._v("PhysicalSize")]),e._v(", we can simply use "),s("code",[e._v("resize()")]),e._v(".")]),e._v(" "),s("li",[s("code",[e._v("State::size")]),e._v(" is now "),s("code",[e._v("PhysicalSize<u32>")]),e._v(" instead of the pre 0.20 "),s("code",[e._v("LogicalSize")]),e._v(".")]),e._v(" "),s("li",[s("code",[e._v("EventsCleared")]),e._v(" is now "),s("code",[e._v("MainEventsCleared")]),e._v(".")])]),e._v(" "),s("p",[e._v("I may have missed a change, but I made sure that all the examples compile an run, so if you have trouble with your code you can use them as a reference.")]),e._v(" "),s("h2",{attrs:{id:"changed-tutorial-examples-to-use-a-src-directory"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#changed-tutorial-examples-to-use-a-src-directory"}},[e._v("#")]),e._v(" Changed tutorial examples to use a src directory")]),e._v(" "),s("p",[e._v("I wasn't using the traditional cargo binary folder setup. I've changed it to the standardized form now.")]),e._v(" "),s("h2",{attrs:{id:"updating-to-0-4-from-0-3"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#updating-to-0-4-from-0-3"}},[e._v("#")]),e._v(" Updating to 0.4 from 0.3")]),e._v(" "),s("p",[e._v("There are a few things that have changed:")]),e._v(" "),s("ol",[s("li",[e._v("The use of "),s("code",[e._v("Instance")]),e._v(" has been removed. Creating a "),s("code",[e._v("Surface")]),e._v(" and requesting an "),s("code",[e._v("Adapter")]),e._v(" are done as follows.")])]),e._v(" "),s("div",{staticClass:"language-rust extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rust"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("let")]),e._v(" surface "),s("span",{pre:!0,attrs:{class:"token operator"}},[e._v("=")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[e._v("wgpu"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")])]),s("span",{pre:!0,attrs:{class:"token class-name"}},[e._v("Surface")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),e._v("window"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(";")]),e._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("let")]),e._v(" adapter "),s("span",{pre:!0,attrs:{class:"token operator"}},[e._v("=")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[e._v("wgpu"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")])]),s("span",{pre:!0,attrs:{class:"token class-name"}},[e._v("Adapter")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("request")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[e._v("&")]),s("span",{pre:!0,attrs:{class:"token namespace"}},[e._v("wgpu"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")])]),s("span",{pre:!0,attrs:{class:"token class-name"}},[e._v("RequestAdapterOptions")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("{")]),e._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("..")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[e._v("Default")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("::")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("default")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),e._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("unwrap")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(";")]),e._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[e._v("// needs to be unwrapped")]),e._v("\n")])])]),s("ol",{attrs:{start:"2"}},[s("li",[e._v("The "),s("code",[e._v("request_device")]),e._v(" method now returns a "),s("code",[e._v("(Device, Queue)")]),e._v(" tuple. This means that you can borrow the "),s("code",[e._v("Queue")]),e._v(" mutably while using the "),s("code",[e._v("Device")]),e._v(" immutably. Because of this change, submitting "),s("code",[e._v("CommandBuffer")]),e._v("s to the queue uses the "),s("code",[e._v("submit")]),e._v(" method on the "),s("code",[e._v("Queue")]),e._v(" directly.")])]),e._v(" "),s("div",{staticClass:"language-rust extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rust"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[e._v("self")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(".")]),e._v("queue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("submit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[e._v("&")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("[")]),e._v("\n encoder"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[e._v("finish")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),e._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[e._v(";")]),e._v("\n")])])]),s("ol",{attrs:{start:"3"}},[s("li",[e._v("The "),s("code",[e._v("create")]),e._v(" method on "),s("code",[e._v("Surface")]),e._v(" takes in any struct that implements the "),s("code",[e._v("HasRawWindow")]),e._v(" trait, instead of a "),s("code",[e._v("RawWindowHandle")]),e._v(". This means that the "),s("code",[e._v('raw-window-handle = "0.3"')]),e._v(" line in "),s("code",[e._v("Cargo.toml")]),e._v(" is no longer needed.")])]),e._v(" "),s("p",[e._v("I don't know if this is a change from 0.4, but you use "),s("code",[e._v('wgpu = "0.4"')]),e._v(" line in dependencies instead of the "),s("code",[e._v("[dependencies.wgpu]")]),e._v(" as wgpu will determine the best back end for you.")]),e._v(" "),s("h2",{attrs:{id:"new-recent-articles"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#new-recent-articles"}},[e._v("#")]),e._v(" New/Recent Articles")]),e._v(" "),s("RecentArticles")],1)}),[],!1,null,null,null);t.default=n.exports}}]); |