Commit Graph

  • e27c1820cb Figuring out what's wrong in FF Nightly Rezmason 2021-12-05 19:30:49 -08:00
  • d19f78319b Rewrite loadTexture, for now, to use GPUQueue::writeTexture (from data supplied by a CanvasContext2D) instead of GPUQueue::copyExternalToTexture (from createImageBitmap). Rezmason 2021-12-04 15:40:33 -08:00
  • 743ba87e86 Renaming some variables in the rainPass WGSL shader from what they were in the GLSL version. Rezmason 2021-11-21 00:50:10 -08:00
  • b540ef4620 Explicitly using rgba8unorm format for rain pass render targets Rezmason 2021-11-17 18:27:10 -08:00
  • c0bd6945ed The twilight version flickered an unhealthy amount, so I lengthened its raindrops. Rezmason 2021-11-15 23:52:39 -08:00
  • e95d826fb3 Adding huberfish A and D glyph sets; adding palimpsest and twilight versions. Rezmason 2021-11-15 23:47:10 -08:00
  • 3acce2001e Update README.md to mention WebGPU Rezmason 2021-11-15 18:21:28 -08:00
  • b39ae896b5 A temporary fix for the WebGPU detector. Also, Firefox doesn't support GPUQueue::copyExternalImageToTexture yet, so they'll fall back to regl until I work out a temporary alternative for that, too. Rezmason 2021-11-15 09:19:00 -08:00
  • d273573348 Non-module scripts are now imported through the JS. It's not pretty, but it keeps the WebGPU project from loading regl unnecessarily. Rezmason 2021-11-15 08:05:31 -08:00
  • aa56cc4256 Changed the gpu-buffer imports to use a relative path. Rezmason 2021-11-15 07:41:33 -08:00
  • b5d9e106fb prettier has some opinions about bloomPass. Rezmason 2021-11-15 07:41:18 -08:00
  • 3e6196a964 A merge into master revealed some problems with the way ES modules are imported. This will require some investigation. Rezmason 2021-11-15 01:35:05 -08:00
  • 29329aed7f Messing with the weights in the WebGPU bloom pass's combine shader to better resemble what's in the regl version. Rezmason 2021-11-15 01:06:10 -08:00
  • b26155d20e Adding some more comments. Destructuring the context object in the pass modules. A little code cleanup in bloomPass. Changing the endPass sampler to be cheaper. Rezmason 2021-11-15 01:05:05 -08:00
  • 1b61e304a5 Refactoring the pass and pipeline, so that inputs and size are handed to and returned from the build function (formerly setSize). This is now the earliest place to build bind groups, which makes sense, because it's also the earliest place to create textures that are proportional to the size of the canvas. Rezmason 2021-11-15 00:30:09 -08:00
  • b0a4acdfdb Rewrote the WebGPU bloom pass based on the classic Unreal solution of blurring and combining the levels of an image pyramid. Fixed the regl bloom pass to use the downscaled blurred mipmap levels to build the first pyramid. Rezmason 2021-11-14 22:01:56 -08:00
  • f907c1c91b Fixing a vague comment that got pasted to all the post processing passes. Rezmason 2021-11-14 09:04:41 -08:00
  • 7eecace634 My friend recommended a much simpler blur that doesn't build any image pyramids. Unfortunately my work towards an implementation isn't very promising— it doesn't pack the same wollop as the WebGL version— but I can built my pyramids on top of it. Rezmason 2021-11-13 21:22:15 -08:00
  • cebd6877bb Just learned about the private storage class. The rain pass can use it to look up the corner positions of quads, rather than derive them mathematically. Rezmason 2021-11-12 00:03:06 -08:00
  • 910d29e175 Poking gpu-buffer a bit because I'm apparently afraid of writing a blur shader which I've already written once. Rezmason 2021-11-11 23:30:37 -08:00
  • d05cb3928d Discovered an overlooked vertical flip I wasn't performing in the WGSL resurrection shader. Rezmason 2021-11-11 21:56:44 -08:00
  • db928bbe7a All the post processing passes are now based on compute pipelines instead of render pipelines. Rezmason 2021-11-11 21:50:27 -08:00
  • 9ad655ca2e Created a pass-through post processing compute pass. The other post-processing passes will be changed over to this kind of thing. makePassFBO has now been split into makeRenderTarget and makeComputeTarget. Rezmason 2021-11-11 09:18:32 -08:00
  • 9c861fd50b Replacing the final copyToTexture call with a tiny render pass, so that the postprocessing passes can be compute shaders working off of storage textures instead. Rezmason 2021-11-11 08:24:30 -08:00
  • 9813e76ffb The stripe pass wasn't properly handling custom colors. Rezmason 2021-11-11 08:01:43 -08:00
  • 159e205019 Planning out the bloom pass. Rezmason 2021-11-10 18:10:57 -08:00
  • dc4032e42a A little reorganization of methods in the passes. Rezmason 2021-11-10 18:10:26 -08:00
  • f4130013f4 Moved the makePyramid and resizePyramid methods from the regl solution's util module to bloomPass. Adding the canvas context's preferred format to the shared pass context (named "canvasFormat"). Added a placeholder bloomPass, which the existing passes now receive input from. Rezmason 2021-11-09 20:06:59 -08:00
  • f0f422e933 Only load one solution— regl, or webgpu, not both. This requires dynamic import. Rezmason 2021-11-09 18:26:00 -08:00
  • 87c2093281 Unifying the interfaces of regl and webgpu makePass and makePipeline. Rezmason 2021-11-09 09:17:01 -08:00
  • 6586badf42 The WebGPU rainPass now performs a high pass filter on its own fragments. I think I prefer this to a separate high pass filter, because this one is pre-blendfunc, ie. fragments will only be added to the texture if they are individually bright enough to contribute. Rezmason 2021-11-09 07:08:07 -08:00
  • 786c83cca0 More tweaks to the volumetric mode debug view. Rezmason 2021-11-08 23:04:08 -08:00
  • a143e3fc03 Renamed gpu-uniforms to gpu-buffer, and messed around with its API. I believe all the align, size, stride and byteOffset values are now in the proper units, ie. bytes. Rezmason 2021-11-08 22:56:00 -08:00
  • cf02073ff3 Added orthographic projection and a profile angle to the volumetric mode when effects are off. Rezmason 2021-11-08 09:47:56 -08:00
  • 11bba1020d Changing my mind a little about how to render the "behind the scenes" version of the effect, in regular and volumetric mode. An isometric perspective would be neat. Rezmason 2021-11-08 09:29:04 -08:00
  • bd17549619 I believe I've added support for generating the array buffer for layouts ending in runtime-sized arrays to gpu-uniforms.js. Rezmason 2021-11-08 09:15:00 -08:00
  • 5747fb74a3 Fixing what I think was a stride bug in gpu-uniforms. This library seriously needs some extensive unit testing. Rezmason 2021-11-08 09:09:12 -08:00
  • 6ab16b3091 Trying to implement the spec for the alignment and size of struct and array fields in gpu-uniforms. Rezmason 2021-11-08 08:58:55 -08:00
  • bbe3d62331 Wrote another utility method for cramming an array of resources into a bind group. Rezmason 2021-11-08 08:05:56 -08:00
  • 1528ca39a5 Commenting out the tables and adding select to some shaders in place of the original ternary operator. Rezmason 2021-11-08 03:45:06 -08:00
  • a4e08c0ceb Refining gpu-uniforms warnings, which are now only emitted if requested. Hypothetically a user could call write() on the ArrayBuffer to update only some of its values. Rezmason 2021-11-08 03:08:25 -08:00
  • 415ffa77ee Driving more uniforms.read calls from the actual shaders. Rezmason 2021-11-08 03:01:46 -08:00
  • 61a3a6d783 Moved the WebGPU code off of "std140" and onto gpu-uniforms. Rezmason 2021-11-08 02:23:33 -08:00
  • 8f226be368 Wrote some code to parse structs in a WGSL shader, calculate its fields' offsets into an ArrayBuffer, generate a JS object that represents it, and write such a JS object to an ArrayBuffer. Rezmason 2021-11-08 01:13:42 -08:00
  • bd3d0c76d2 Fixing the names of shaders in the passes. The loadShader utility function now returns the code and the module, since I'm hoping to parse uniform buffer layouts from the code. Rezmason 2021-11-07 00:40:50 -07:00
  • bade1667ad Making some comments in the WebGPU rainPass and changing the "effect=none" view to be easier on the eyes. Rezmason 2021-11-06 15:19:56 -07:00
  • 335ff5ddb7 The main module can now pick a renderer based on the "renderer" URL parameter. Rezmason 2021-11-06 05:03:38 -07:00
  • 89b9f4e363 Ported all the post processing regl passes to WebGPU. Fixed the CORS stuff in loadTexture. Renamed createRenderTargetTexture to makePassFBO, to conform with the regl project. Added make1DTexture, which stripePass uses. Rezmason 2021-11-06 05:03:16 -07:00
  • 230847e5b8 Added runtime texture targets. A pass now returns its resources in getOutputs(), which subsequent passes access as getInputs(). render-to-canvas-wgsl Rezmason 2021-11-05 01:06:39 -07:00
  • f0ae7731bb The webgpu project's multi-pass pipeline is borrowed from the regl project, but the outputs don't exist yet. Outputs will be tricky, because RTTs are thrown out and recreated when the canvas resizes, which I think means all the bind groups referencing the old texture have to be destroyed and recreated, too. Rezmason 2021-11-03 21:42:01 -07:00
  • 0b04947425 Implemented makePass(). Moved rain compute and render stuff into a pass. Rezmason 2021-11-03 21:29:38 -07:00
  • f8959cd7d9 Renaming msdfSampler to linearSampler; adding loadShaderModule utility method; busting the rain render out of its render bundle (which won't be useful long-term). Rezmason 2021-11-03 20:01:59 -07:00
  • 7eab0fd654 Runtime target textures seem to need to be the same format as the canvas current texture. Requires additional investigation. dead-end Rezmason 2021-11-03 09:03:05 -07:00
  • 35afa7ca01 Pulled the rain render out of the render bundle, I won't likely benefit from it. Threw together renderToCanvas, which renders a texture to the canvas texture. Rezmason 2021-11-03 01:19:22 -07:00
  • 8f09fade43 Contemplating my next steps. Rezmason 2021-11-02 23:20:54 -07:00
  • 8048c9c690 That's funny, you can blob a fetch response and chuck it into createImageBitmap(). Rezmason 2021-11-02 23:19:54 -07:00
  • b31e70c1e1 Removing the channel override in the vertex shader. Rezmason 2021-11-02 07:35:19 -07:00
  • 4294932d5f Fixed the flickering leftmost column. Rezmason 2021-11-01 08:49:33 -07:00
  • 348b07d237 Actually the ping-pong setup isn't necessary for this compute shader, since it does everything in-place. Undid all the y-flips I could find, and they all canceled one another out, except for the glyph UVs in the fragment shader. Rezmason 2021-11-01 08:38:48 -07:00
  • 6460f4401a Ported the rain compute shader to wgsl. Tons of inverted-y errors abound. Rezmason 2021-11-01 01:52:57 -07:00
  • 1c1b1e4f03 We have ping-pong! And all the rain pass's shaders can coexist in one module! And I met and received ample help from @kainino0x and others on the WebGPU Matrix chat! webgpu-ping-pong Rezmason 2021-11-01 00:28:40 -07:00
  • 6f58882851 The MSDF stuff shouldn't be in its own uniform buffer. This is basically config stuff. Rezmason 2021-10-31 20:00:11 -07:00
  • 53e1c5502c There's no existing infrastructure for WGSL yet, so to clean up the shader I'm making do with some simple greps and short-term meticulousness. Rezmason 2021-10-30 23:18:39 -07:00
  • 375560d6a1 Fixed a math issue in the symbol UV function. Rezmason 2021-10-30 20:30:55 -07:00
  • 4ea6cadd2f Fixing some y-flip related stuff in the rain pass fragment shader. Consolidating and changing the type of a bunch of info in the config uniform. Improving the code comments. Rezmason 2021-10-30 20:05:07 -07:00
  • d8701c9408 Ported the rain vertex shader to wgsl. Rezmason 2021-10-30 18:07:07 -07:00
  • 923992660c Ported the rain fragment shader to wgsl. Made a small change in both to the function that resolves the glyph symbol float to the coordinate of a glyph in the MSDF texture. Rezmason 2021-10-30 14:44:09 -07:00
  • 4dd0c1be50 Organizing shader functions' input and output types. I don't know if this is a good idea in the long run, but it seems useful in the short term. Rezmason 2021-10-30 13:50:46 -07:00
  • cc75938fcb Passing all the rain pass configs through a giant struct into the rain shader. I've included the compute shader fields, because I have hope that the compute pass can use the same shader module. Rezmason 2021-10-30 12:53:26 -07:00
  • 1516f82554 Adding random functions to rain render pass shader Rezmason 2021-10-30 08:41:00 -07:00
  • 33437a722d Finding ways to construct WebGPU descriptors more concisely. Moving some functions to webgpu's utils.js. Rezmason 2021-10-30 08:40:31 -07:00
  • 0c26cc7660 Moving assets into a subdirectory. Rezmason 2021-10-29 12:21:40 -07:00
  • 94f5f1e5ec Rearranging the shaders and scripts to hopefully make the project easier to work on Rezmason 2021-10-29 09:27:28 -07:00
  • dd4fe3cac6 Looks like uniform buffers don't need to specify which shader stages use them. Rezmason 2021-10-29 09:20:37 -07:00
  • fb6406e753 The texture sampler should operate linearly Rezmason 2021-10-29 09:16:28 -07:00
  • 23d397fa11 Now that I can pack integer and float data into one uniform buffer, time.seconds can be represented as a float while time.frames is an integer. Rezmason 2021-10-29 09:02:20 -07:00
  • f9b80224fe More std140 tweaks Rezmason 2021-10-29 08:57:23 -07:00
  • d4b21a0e4c Moving std140 code to its own module. Here it can evolve into a class or whatever, and it won't clutter the rest of the code. Rezmason 2021-10-29 08:03:55 -07:00
  • e79e741fcf Fixed a struct layout bug. Struct layout and builder now support mixing integer and float data in a struct, and output an ArrayBuffer. Rezmason 2021-10-29 07:43:39 -07:00
  • 81f77c70ae Slowly working out what's required to support uniform buffers that store integers as well as floats Rezmason 2021-10-29 00:38:58 -07:00
  • ad2b7e53af buildStruct needs to convert values into arrays Rezmason 2021-10-28 23:56:31 -07:00
  • 1b53b8be1f Experimenting with simplifying the names of the uniform buffers in the rain render pass shader. Rezmason 2021-10-28 22:21:01 -07:00
  • c500bdcef0 Implemented rudimentary support for std140 alignment of values in uniform buffers. Rezmason 2021-10-28 21:22:13 -07:00
  • a3c99ff4c0 Swapping the camera perspective generating function to mat4.perspectiveZO. Rezmason 2021-10-27 22:45:29 -07:00
  • 3d9050c9aa Upgraded glMatrix to the latest version, which contains mat4.perspectiveZO, the perspective function that works for WebGPU. Rezmason 2021-10-27 22:45:01 -07:00
  • c3254c3aa1 Adding WebGPU to TODO.md. Annotating the parts of the WebGPU code that involve uniform buffer layout issues. Rezmason 2021-10-27 22:34:47 -07:00
  • c27c20f2cf Consolidating all the bind groups, because I only have four. Stuff shared between render passes will get isolated somehow, but it might be by binding one buffer to multiple render passes' bind group at zero rather than having more than one bind group. Rezmason 2021-10-27 21:08:20 -07:00
  • a0649bdb34 Added screenSize in camera uniforms. Rezmason 2021-10-27 20:22:06 -07:00
  • f2a54b3141 A little bit of shader variable renaming and const declaration during a walkthrough of the existing code on-stream Rezmason 2021-10-27 20:00:39 -07:00
  • c716d30808 Merged the vertex and fragment shader WGSL files, because their bindings can't collide anyhow. The rain render shader now accepts a bind group of time uniforms, which change on every frame, as well as MSDF uniforms, along with an MSDF sampler and texture that's loaded in from the PNG. The shader currently renders the correct grid of quads for volumetric mode, displays the first glyph raw in each one, and every sixty frames, turns on and off the blue channel. Rezmason 2021-10-27 18:16:07 -07:00
  • 8c62146884 Fetching WebGPU shaders. Created my first bona fide pipeline. The vertex shader compares the built-in vertex index and the numRows/numColumns uniforms to produce a grid of quads with no vertex or index buffer whatsoever! Rezmason 2021-10-27 01:35:23 -07:00
  • 1827fd94a6 Removing document onload function from webgpu_main that I left in by mistake Rezmason 2021-10-24 11:17:33 -07:00
  • 3cb20139c4 Creating stump render bundle array. This is how WebGPU command buffers are created and executed. Rezmason 2021-10-24 06:24:47 -07:00
  • 6b317af0bb Broke ground on webgpu version. Split regl_main.js off of main.js, which now detects navigator.gpu. If it exists, it initializes webgpu_main instead. Rezmason 2021-10-24 05:37:56 -07:00
  • 48a6f2cf34 Fixing a typo and adding looping functionality to the TODO list Rezmason 2021-10-27 19:03:38 -07:00
  • 348c384de5 More small config tweaks to paradise matrix. Rezmason 2021-10-23 01:54:09 -07:00
  • 7f42280eeb More small config tweaks. Rezmason 2021-10-23 01:38:05 -07:00
  • 69d4e7365c Renaming the shaders again, because the extensions I gave them were confusing GitHub's syntax highlighting. Rezmason 2021-10-23 01:28:32 -07:00
  • a979e87564 More tweaks to Resurrections version. Rezmason 2021-10-23 01:12:50 -07:00
  • cf5f8c2113 Simplifying rainPass.compute's weirder operations. Rezmason 2021-10-23 01:12:31 -07:00