A modern 3D/2D game engine that uses wgpu.

Overview

Harmony

A modern 3D/2D game engine that uses wgpu and is designed to work out of the box with minimal effort. It uses legion for handling game/rendering data.

Note: Currently this library is very early in development. Things are very likely going to change.

Features

  • A custom async based asset manager that handles loading data for you.
  • Ability to load custom assets via the asset manager.
  • Loads GLTF meshes
  • (png, jpg, hdr) image support.
  • Per-material type forward rendering.
  • Unlit materials.
  • Scene's managed by specs world.
  • Entity Transforms
  • Perspective Camera
  • Frustum Culling
  • Render Graph
  • Skybox rendering from an .hdr texture.
  • Multi-threaded rendering
  • Custom render pipelines
  • Directional lighting
  • Clustered Shading (Point)
  • PBR shading model
  • Multi-point light shadow mapping.
  • IMGui integration
  • Multiple Enviroment probes(almost done).

Future Features (Prioritized)

  1. HDR/Tonemap rendering
  2. Temporal SMAA
  3. SSAO
  4. Directional Shadow Mapping
  5. Asset Bundling
  6. More useful scene features
  7. WASM Support

Long Term

  • Investigate using a hybrid rendering pipeline setup similar to halcyon, but without ray tracing(for now..).
  • Raytracing support?

Running

To run on metal with validation:

METAL_DEVICE_WRAPPER_TYPE=1 cargo run --example hello-cube

To run on vulkan:

cargo run --example hello-cube

Validation should be turned on already you only need to make sure to have the latest vulkan sdk installed. https://vulkan.lunarg.com/

Examples

  • hello-world a simple example showcasing the ability to draw text to the screen.
  • hello-cube a example of how to load gltf files and display them on the screen.
  • benchmark a benchmark that renders 2500 cubes to test performance.

shaderc-rs

We use shaderc-rs in harmony to compile GLSL into spir-v. This process works great once we have compiled shaderc-rs unfortunetly shaderc-rs uses shaderc which is written in C++. It tends to compile very slow and require certain things to compile successfully. We have an issue to eventually replace shaderc with something written in pure rust, but currently that crate does not exist. For now anyone attempting to use harmony who encounters issues compiling shaderc should take a look at the documentation found in the readme of shaderc-rs's github page which can be found here:

https://github.com/google/shaderc-rs

If more help is needed or you feel as though the issue you encountered is directly related to shaderc's usage in harmony feel free to open an issue.

Screenshots

Hello Cube PBR shadow

Known issues

  • No WASM support yet..

Acknowledgements:

Help?

You can find me on the rust game development discord server. I'm more than happy to help out if I am around!

Comments
  • Resize cube example crashed

    Resize cube example crashed

    Here is the failed info, when resize the skybox may need to recreate.

    thread '' panicked at 'assertion failed: (left == right) left: Extent { width: 1280, height: 960, depth: 1 }, right: Extent { width: 1280, height: 963, depth: 1 }: Extent state must match extent from view'

    Type: Bug 
    opened by happydpc 8
  • All examples fail

    All examples fail

    On running any example, I get this output:

    [2020-04-26T22:22:19Z WARN  wgpu_core::device] Requested size 1024x768 is outside of the supported range: Extent2D { width: 1920, height: 1163 }..=Extent2D { width: 1920, height: 1163 }
    [2020-04-26T22:22:19Z ERROR gfx_backend_vulkan]
        VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (2094043421)] : Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x563fa61ff030, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1024,768), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1920,1163), minImageExtent = (1920,1163), maxImageExtent = (1920,1163). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
        object info: (type: DEVICE, hndl: 94831370039344)
    
    [2020-04-26T22:22:27Z WARN  gfx_memory::heaps] Unable to allocate 134217728 with Linear: TooManyObjects
    [2020-04-26T22:22:28Z WARN  wgpu_core::device] Requested size 1024x768 is outside of the supported range: Extent2D { width: 1920, height: 1163 }..=Extent2D { width: 1920, height: 1163 }
    [2020-04-26T22:22:28Z ERROR gfx_backend_vulkan]
        VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (2094043421)] : Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x563fa61ff030, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1024,768), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1920,1163), minImageExtent = (1920,1163), maxImageExtent = (1920,1163). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
        object info: (type: DEVICE, hndl: 94831370039344)
    
    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `Extent { width: 1024, height: 768, depth: 1 }`,
     right: `Extent { width: 1920, height: 1163, depth: 1 }`', <::std::macros::panic macros>:5:6
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    I think it has something to do with multi monitor, but I disabled one and got the same error. For reference, one of my monitors is 1024x768 and the other is 1900x1200

    OS: Void Linux x86_64, kernel 5.4.35_1 GPU: rx 480 CPU: i5 6500 gpu drivers: amdgpu 19.1.0_2, amdvlk 2020.Q2.1_1, mesa-vulkan-radeon 20.0.5_1

    This looks like a promising game engine! I'll try to fix the error myself and possibly make a PR, but I'm short on time so no promises

    Type: Bug 
    opened by mkhan45 5
  • Panic when running hello-cube example

    Panic when running hello-cube example

    Hi. I'm running into the following issue on the current master (47fa1a9a42aaea442d8b359ae80de4a991fd41f5).

    ➜  harmony git:(master) cargo run --example hello-cube
       Compiling harmony v0.1.0 (/home/marek/dev/harmony)
        Finished dev [unoptimized + debuginfo] target(s) in 11.36s
         Running `target/debug/examples/hello-cube`
    [2020-04-26T11:04:11Z WARN  gfx_backend_vulkan] Unable to find extension: VK_KHR_wayland_surface
    [2020-04-26T11:04:11Z WARN  gfx_backend_vulkan] Unable to find layer: VK_LAYER_LUNARG_standard_validation
    [2020-04-26T11:04:11Z WARN  wgpu_core::device] Requested size 1024x768 is outside of the supported range: Extent2D { width: 1914, height: 1151 }..=Extent2D { width: 1914, height: 1151 }
    [2020-04-26T11:04:19Z WARN  gfx_memory::heaps] Unable to allocate 134217728 with Linear: TooManyObjects
    thread 'main' panicked at 'assertion failed: `(left == right)`
      left: `Extent { width: 1024, height: 768, depth: 1 }`,
     right: `Extent { width: 1914, height: 1151, depth: 1 }`', <::std::macros::panic macros>:5:6
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    Removing the resize method from hello-cube.rs fixes the panic and I can see a nice example with rotating cube.

    good first issue Type: Bug 
    opened by mbernat 5
  • Alloc warning & crash on resize

    Alloc warning & crash on resize

    Hey, I noticed some issues running the examples. I know the crate is really young, but I guess it wont hurt. On startup of hello-cube & hello-world I get the following Warnings:

    [harmony\src\graphics\material\hdr.rs:63] image_data.len() = 33554432
    [harmony\src\graphics\material\hdr.rs:64] (w * h) * (4 * 4) = 134217728
    [2020-04-19T21:27:32Z WARN  gfx_memory::heaps] Unable to allocate 134217728 with Linear: TooManyObjects
    Calculating cubemap for: venice_sunrise_4k.hdr
    

    It runs, but the skybox is blurry. Don't know if it's supposed to be that way.

    And on window-resize it crashes while spamming:

    [2020-04-19T21:36:13Z WARN  wgpu_core::swap_chain] present failed: OutOfDate
    [2020-04-19T21:36:13Z WARN  wgpu_core::swap_chain] acquire_image() failed (OutOfDate), 
    reconfiguring swapchain
    

    Win10 with latest harmony. Ran with --release.

    Harmony is exactly what I was looking for and I'm excited to start playing around with it! Great work!

    good first issue 
    opened by floatingmountain 5
  • Rework GPU resources and Pipelines

    Rework GPU resources and Pipelines

    Problem: Sharing textures, uniforms, etc across pipelines is difficult.

    Goal: Create bind groups per pipeline for associated resources. Make pipelines more efficient.

    Idea: Have a resource manager that is separate from the asset pipeline. Brief outline of new process:

    Load:

    1. Asset manager loads images into memory as raw data(does not create GPU data).
    2. Asset manager gives image data to resource manager to create GPU data.
    3. Pipelines are created.

    Prepare: A use for our empty prepare function?

    1. Prepare receives the following data: device, pipeline, and resource manager.
    2. Prepare creates a binding group for each of the different layouts we have only if we do not have an existing bind group. This process needs to be more in-depth for materials. Perhaps the resource manager should store materials as well?
    3. Prepare runs any encode steps needed.

    Render More scaled back. Render no longer lets you create an encoder or render pass instead the render graph should give render a render pass. This means the following props are no longer needed in our render function: frame, depth, device, input, output, asset_manager(resource manager replaces this). Any code that would of used an encoder in render should be moved to prepare instead.

    More info should be included here in the future..

    Type: Enhancement 
    opened by StarArawn 3
  • RenderGraph: Rewrite pipelines

    RenderGraph: Rewrite pipelines

    I originally thought that pipelines similar to rendy might make sense, but we need to structure the trait a bit more inline with how wgpu handles pipelines and rendering. This mainly means getting rid of the prepass phase, or maybe moving any encoder changes to it. Originally I thought we could just reuse command buffers, but wgpu doesn't really let you do that, also I'm not sure there is performance benefit to doing so. Things to do:

    1. Rewrite prepare stuff (remove dirty, remove PrepareResult)
    2. Provide a better mechanism for passing data into a pipeline.
    3. Look into using 1 command buffer over many?
    4. Look into using 1 render pass instead of many?
    5. Perhaps benchmark to see which way seems to be the best.
    Type: Enhancement 
    opened by StarArawn 2
  • RenderGraph: Support custom node's and changing nodes at runtime?

    RenderGraph: Support custom node's and changing nodes at runtime?

    Currently a user can't add new nodes to the render graph. We'll probably tackle this when adding node dependencies. We also need to decide on if we want to support changing nodes during runtime. Initially I can't think of a valid reason for doing so, but perhaps having different nodes per scene might make sense?

    Type: Enhancement 
    opened by StarArawn 2
  • cargo test failures

    cargo test failures

    Trying to run cargo test with current master (b7d1437369a34b9936dcd3a2e4dc59e287a91c73) on macOS gets me

    running 2 tests
    test scene::components::camera_data::tests::test_orthographic_projection ... ok
    test scene::components::camera_data::tests::test_perspective_projection ... FAILED
    
    failures:
    
    ---- scene::components::camera_data::tests::test_perspective_projection stdout ----
    thread 'scene::components::camera_data::tests::test_perspective_projection' panicked at 'assertion failed: `(left == right)`
      left: `Matrix { data: [70.343185, 0.0, 0.0, 0.0, 0.0, 93.79092, 0.0, 0.0, 0.0, 0.0, -1.002002, -1.0, 0.0, 0.0, -0.02002002, 0.0] }`,
     right: `Matrix { data: [1.071111, 0.0, 0.0, 0.0, 0.0, 1.428148, 0.0, 0.0, 0.0, 0.0, -1.002002, -1.0, 0.0, 0.0, -0.02002002, 0.0] }`', src/scene/components/camera_data.rs:165:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    failures:
        scene::components::camera_data::tests::test_perspective_projection
    
    test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
    

    It's possibly worth adding CI testing to fix this?

    good first issue Cleanup 
    opened by palfrey 1
  • GPUResourceManager already borrowed as mutable

    GPUResourceManager already borrowed as mutable

    Greetings! I've been following this project for a bit and think it has great potential. I might want to start contributing a bit when I have time.

    After PBR check-in I now get a panic on hello-cube and benchmark. hello-pipeline has no issues when run.

    thread 'main' panicked at 'called Result::unwrap() on an Err value: "resource already borrowed as mutable: alloc::boxed::Box"'

    The panic occurs during unwrap of GPUResourceManager in brdf.rs:15.

    backtrace:

    12: core::option::expect_none_failed at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src\libcore\option.rs:1211 13: core::result::Result<legion_core::borrow::RefMut<alloc::boxed::Box>, alloc::string::String>::unwrap<legion_core::borrow::RefMut<alloc::boxed::Box>,alloc::string::String> at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550\src\libcore\result.rs:1003 14: legion_core::borrow::AtomicRefCell<alloc::boxed::Box>::get_mut at \git\checkouts\legion-6fbc02e8da0bdce7\bd441f4\legion_core\src\borrow.rs:124 15: legion_systems::resource::Resources::get_mutharmony::graphics::resources::gpu_resource_manager::GPUResourceManager
    at \git\checkouts\legion-6fbc02e8da0bdce7\bd441f4\legion_systems\src\resource.rs:245 16: harmony::graphics::pipelines::brdf::create at .\src\graphics\pipelines\brdf.rs:15 17: harmony::graphics::resources::probe::Probe::new at .\src\graphics\resources\probe.rs:118 18: harmony::graphics::resources::probe_manager::ProbeManager::create at .\src\graphics\resources\probe_manager.rs:23 19: harmony::scene::entities::probe::create at .\src\scene\entities\probe.rs:12 20: hello_cube::{{impl}}::load at .\examples\hello-cube.rs:114 21: harmony::application::Application::load<hello_cube::AppState> at .\src\application.rs:196 22: hello_cube::main at .\examples\hello-cube.rs:191

    OS: Windows 10 rust 1.43

    good first issue Type: Bug 
    opened by berylraven 1
  • Re-write image to support multiple formats and handle Skybox loading better.

    Re-write image to support multiple formats and handle Skybox loading better.

    We need to re-write the image struct to support more formats other than the standard Rgba8UnormSrgb.

    Right now a single 2D flat image gets processed into a cube map for the skybox. This process is fairly static and will run on any HDR files loaded using the asset manager. However we should have some way of marking images as being required for a skybox and run them through the process at that point. There's a few ways we might do this:

    1. Have a .skybox file, that references the texture it uses, similar to the .shader files.
    2. Wait to process skyboxes until after the user sets up the scene and run through each skybox entity find out what texture it points to and process it.

    Currently I am leaning towards 1 as it cuts out some of the guess work.

    Type: Enhancement 
    opened by StarArawn 1
  • Text rendered with wgpu_glyph fails to show up on screen.

    Text rendered with wgpu_glyph fails to show up on screen.

    The text fails to show up on screen. I think this is due to a depth issue. Perhaps.. We do see the wire-frames showing up in the right spots in render doc:

    Screen Shot 2020-04-17 at 8 43 26 AM Type: Bug 
    opened by StarArawn 1
  • Example can't run because of

    Example can't run because of "Shadow map atlas" error

    Test on GTX 1070s, windows 10.

    [2020-08-02T10:51:56Z ERROR gfx_backend_vulkan] VALIDATION [VUID-VkImageViewCreateInfo-viewType-01004 (1838557948)] : Validation Error: [ VUID-VkImageViewCreateInfo-viewType-01004 ] Object 0: handle = 0xedbd50000000010, name = Shadow map atlas, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x6d962afc | vkCreateImageView(): pCreateInfo->viewType can't be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY without enabling the imageCubeArray feature. The Vulkan spec states: If the image cubemap arrays feature is not enabled, viewType must not be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY (https://vulkan.lunarg.com/doc/view/1.2.141.0/windows/1.2-extensions/vkspec.html#VUID-VkImageViewCreateInfo-viewType-01004) object info: (type: IMAGE, hndl: 1070683532407341072, name: Shadow map atlas)

    Type: Bug 
    opened by happydpc 1
  • Computer shader support

    Computer shader support

    Glad to see so many improvements. If async computer shader can be supported, that will be wonderful.

    Also, wgpu supports render bundle now, using render bundle can get rid of generating draw calls repeatedly.

    Great work.

    Type: Enhancement 
    opened by happydpc 1
  • Gltf mesh loading duplicates materials.

    Gltf mesh loading duplicates materials.

    Currently when loading in GLTF mesh both the mesh import code and the material manager duplicate materials per primitive. We can do better than that and share materials between primitives that have the same material on load.

    Thoughts on how to fix. Currently we use a random UUID as the asset key when loading in a material from memory or in this case from the Gltf data. Instead we should perhaps use the material name in the gltf file.

    Type: Bug 
    opened by StarArawn 0
  • Attempting to run the 'hello-cube' example on OS X v10.11 El Capitan gives error:

    Attempting to run the 'hello-cube' example on OS X v10.11 El Capitan gives error: "[ERROR gfx_backend_metal::device] Error compiling the shader"

    • Harmony version: commit bd4300ffbc651aeea8e625606645d90021cad83a
    • Active Rust Toolchain: stable-x86_64-apple-darwin (default) rustc 1.44.1 (c7087fe00 2020-06-17)
    • OS: OS X v10.11.6 El Capitan
    • GPU: Intel HD Graphics 4000
    • Computer: Mac mini (Late 2012)

    When attempting to run the hello-cube example, I get the following output:

    $ METAL_DEVICE_WRAPPER_TYPE=1 RUST_BACKTRACE=full cargo run --example hello-cube
    warning: unused import: `PointLightData`
      --> examples/hello-cube.rs:12:80
       |
    12 |     components::{CameraData, DirectionalLightData, LightType, Mesh, Transform, PointLightData},
       |                                                                                ^^^^^^^^^^^^^^
       |
       = note: `#[warn(unused_imports)]` on by default
    
    warning: 1 warning emitted
    
        Finished dev [unoptimized + debuginfo] target(s) in 0.19s
         Running `target/debug/examples/hello-cube`
    2020-07-17 06:25:10.883 hello-cube[59451:227586] Metal API Validation Enabled
    [2020-07-17T10:25:10Z WARN  wgpu_core::instance] Missing features: INDEPENDENT_BLENDING
    [2020-07-17T10:25:10Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:10Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:10Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:10Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:10Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, FMul)
    [2020-07-17T10:25:10Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  metal::device] Shader warnings: Compilation succeeded with: 
        
        <program source>:197:20: warning: unused variable 'Lunnormalized'
                    float3 Lunnormalized = L_1;
                           ^
        
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, Variable)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, ImageSampleExplicitLod)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration Flat
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration ColMajor
    [2020-07-17T10:25:11Z WARN  naga::front::spv] Unknown decoration MatrixStride
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, Variable)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Failed to parse shader SPIR-V code: MissingDecoration(Offset)
    [2020-07-17T10:25:11Z WARN  wgpu_core::device] Shader module will not be validated
    [2020-07-17T10:25:11Z ERROR gfx_backend_metal::device] Error compiling the shader CompilationFailed("Compilation failed: \n\n<program source>:47:43: error: no matching conversion for functional-style cast from \'void\' to \'spvUnsafeArray<float3, 36>\'\nconstant spvUnsafeArray<float3, 36> _29 = spvUnsafeArray<float3, 36>({ float3(1.0), float3(1.0, 1.0, -1.0), float3(1.0, -1.0, 1.0), float3(1.0, -1.0, 1.0), float3(1.0, 1.0, -1.0), float3(1.0, -1.0, -1.0), float3(-1.0, 1.0, -1.0), float3(-1.0, 1.0, 1.0), float3(-1.0), float3(-1.0), float3(-1.0, 1.0, 1.0), float3(-1.0, -1.0, 1.0), float3(-1.0, 1.0, -1.0), float3(1.0, 1.0, -1.0), float3(-1.0, 1.0, 1.0), float3(-1.0, 1.0, 1.0), float3(1.0, 1.0, -1.0), float3(1.0), float3(-1.0, -1.0, 1.0), float3(1.0, -1.0, 1.0), float3(-1.0), float3(-1.0), float3(1.0, -1.0, 1.0), float3(1.0, -1.0, -1.0), float3(-1.0, 1.0, 1.0), float3(1.0), float3(-1.0, -1.0, 1.0), float3(-1.0, -1.0, 1.0), float3(1.0), float3(1.0, -1.0, 1.0), float3(1.0, 1.0, -1.0), float3(-1.0, 1.0, -1.0), float3(1.0, -1.0, -1.0), float3(1.0, -1.0, -1.0), float3(-1.0, 1.0, -1.0), float3(-1.0) });\n                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const spvUnsafeArray<float __attribute__((ext_vector_type(3))), 36>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const device spvUnsafeArray<float __attribute__((ext_vector_type(3))), 36>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const threadgroup spvUnsafeArray<float __attribute__((ext_vector_type(3))), 36>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const constant spvUnsafeArray<float __attribute__((ext_vector_type(3))), 36>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert initializer list argument to \'spvUnsafeArray<float __attribute__((ext_vector_type(3))), 36>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided\n<program source>:48:42: error: no matching conversion for functional-style cast from \'void\' to \'spvUnsafeArray<float2, 6>\'\nconstant spvUnsafeArray<float2, 6> _53 = spvUnsafeArray<float2, 6>({ float2(-1.0), float2(1.0, -1.0), float2(-1.0, 1.0), float2(-1.0, 1.0), float2(1.0, -1.0), float2(1.0) });\n                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const spvUnsafeArray<float __attribute__((ext_vector_type(2))), 6>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const device spvUnsafeArray<float __attribute__((ext_vector_type(2))), 6>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const threadgroup spvUnsafeArray<float __attribute__((ext_vector_type(2))), 6>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert initializer list argument to \'const constant spvUnsafeArray<float __attribute__((ext_vector_type(2))), 6>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert initializer list argument to \'spvUnsafeArray<float __attribute__((ext_vector_type(2))), 6>\'\nstruct spvUnsafeArray\n       ^\n<program source>:10:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided\n")
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Other', /Users/username/.cargo/git/checkouts/wgpu-53e70f8674b08dd4/43c67ac/wgpu-core/src/device/mod.rs:2315:17
    stack backtrace:
       0:        0x10a190e4f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8ad47541fb823094
       1:        0x10a1b4e7e - core::fmt::write::he23e9bd6497f06c3
       2:        0x10a18d797 - std::io::Write::write_fmt::h91528f1131e6004e
       3:        0x10a192efa - std::panicking::default_hook::{{closure}}::h1983f014a45a477e
       4:        0x10a192c3c - std::panicking::default_hook::hb0d9b93b5be8b120
       5:        0x10a1935a8 - std::panicking::rust_panic_with_hook::h9f3faafe0983de5c
       6:        0x10a193142 - rust_begin_unwind
       7:        0x10a1b2bbf - core::panicking::panic_fmt::h0a2d1b3ca0b14316
       8:        0x10a1b2a05 - core::option::expect_none_failed::haea18d6ed867f4e9
       9:        0x10945cc76 - core::result::Result<T,E>::unwrap::hae914ba7279b340a
      10:        0x10929fe88 - wgpu_core::device::<impl wgpu_core::hub::Global<G>>::device_create_render_pipeline::h460451028d4887b4
      11:        0x1092b74d2 - wgpu::backend::direct::<impl wgpu::Context for wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>>::device_create_render_pipeline::h0db6e69f9b79edcd
      12:        0x10932eb2b - wgpu::Device::create_render_pipeline::h91929ef614a5bc31
      13:        0x108a445e0 - harmony::graphics::pipeline::SimplePipelineDesc::pipeline::h4d997a24c885e5ea
      14:        0x108a49087 - harmony::graphics::render_graph::RenderGraph::add::hc2e17c529793e2dc
      15:        0x108a35221 - harmony::graphics::material::skybox::Skybox::new_hdr::h9491772f8bc67b8c
      16:        0x108a306f6 - <hello_cube::AppState as harmony::application::AppState>::load::h75584cd4d604e419
      17:        0x108a914c1 - harmony::application::Application::load::hd6500b94167dba21
      18:        0x108a3123f - hello_cube::main::hf82171171da901f6
      19:        0x108a617be - std::rt::lang_start::{{closure}}::hfc682bbfb4c1749f
      20:        0x10a1939d9 - std::rt::lang_start_internal::h795af50241e12334
      21:        0x108a617a1 - std::rt::lang_start::he936ede608aba919
      22:        0x108a31382 - main
    

    I’m guessing that error is related to me using OS X v10.11 El Capitan (the very first version of macOS to support Metal, and thus is using Metal 1).

    Sidenote: The other examples run on this computer (with warnings), except for benchmark which gives a compile time error.

    good first issue Type: Bug 
    opened by A-R-M 6
  • Support shader branching?

    Support shader branching?

    Currently we don't really have a good way of branching based off of parameters in a shader which important for an uber shader. Ideally we likely should have some compile time defines and create multiple pipelines/shaders depending on those defines. Another soultion could be to just pass in extra data via uniform buffers.

    Type: Enhancement 
    opened by StarArawn 0
  • Make render target more consumable.

    Make render target more consumable.

    Mostly we use the RenderTarget stuff for probes and it's use is very internal to the engine, however I can see the use case for needing to expose it more. A possible API for that might be:

    let render_target = RenderTarget:new(.....)
    pipeline_manager.set_target(render_target);
    app.render_now();
    pipeline_manager.reset_target();
    

    Or in the case of custom rendering:

    let mut render_schedule =
        Schedule::builder()
            .add_system(crate::systems::MySystem::create())
            .flush()
            .add_thread_local_fn(harmony::graphics::systems::render::create())
            .build();
    
    let render_target = RenderTarget:new(....)
    pipeline_manager.set_target(render_target);
    render_schedule.execute(...);
    pipeline_manager.reset_target();
    
    Type: Enhancement 
    opened by StarArawn 0
Owner
John
John
game engine built in rust, using wgpu and probably other stuff too

horizon game engine engine for devpty games, made in 99.9% rust and 0.1% shell. this is our main project currently. the engine will be used for most i

DEVPTY 2 Apr 12, 2022
Rustcraft is a simple Minecraft engine written in rust using wgpu.

Rustcraft is a simple Minecraft engine written in rust using wgpu.

Raphael Van Hoffelen 110 Dec 22, 2022
Scion is a tiny 2D game library built on top of wgpu, winit and legion.

Scion is a 2D game library made in rust. Please note that this project is in its first milestones and is subject to change according to convience need

Jérémy Thulliez 143 Dec 25, 2022
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

Lucas Arriesse 125 Dec 31, 2022
Rust-based command-line language-learning game. Uses the Tatoeba database.

minicloze A command-line language learning game using Tatoeba's great database. Accelerate your studies by putting your knowledge to the test in an ad

benman 3 Mar 5, 2023
A curated list of wgpu code and resources.

Awesome wgpu A curated list of wgpu code and resources. PRs welcome. About wgpu https://github.com/gfx-rs/wgpu-rs matrix chat https://matrix.to/#/#wgp

Roman Frołow 283 Jan 3, 2023
Simple profiler scopes for wgpu using timer queries

wgpu-profiler Simple profiler scopes for wgpu using timer queries Features Easy to use profiler scopes Allows nesting! Can be disabled by runtime flag

null 41 Dec 5, 2022
Tic-Tac-Toe on the GPU, as an example application for wgpu

Tic-Tac-GPU A simple (cough cough) example on a tic-tac-toe game with wgpu. Why? Because I didn't find that many small applications which use wgpu as

multisn8 2 Oct 7, 2022
Guide for using gfx-rs's wgpu library.

Introduction What is wgpu? Wgpu is a Rust implementation of the WebGPU API spec. WebGPU is a specification published by the GPU for the Web Community

sotrh 1k Dec 29, 2022
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU

renderling ?? This library is a collection of WGPU render pipelines. Shaders are written in GLSL. shaderc is used to compile shaders to SPIR-V. Defini

Schell Carl Scivally 5 Dec 20, 2022
🦅🦁 Fast, simple 2D text renderer for wgpu

?? glyphon ?? Fast, simple 2D text rendering for wgpu What is this? This crate provides a simple way to render 2D text with wgpu by: rasterizing glyph

Josh Groves 60 Nov 5, 2022
A barebones example of how to integrate OpenXR with wgpu (Vulkan-only)

wgpu-openxr-example a barebones example of how to integrate OpenXR with wgpu (Vulkan-only) It has four modes: cargo run --no-default-features: desktop

Philpax 21 Dec 15, 2022
3d Cellular Automata using WGPU in Rust (for the web and using compute shaders)

3D-Cellular-Automata-WGPU 3d Cellular Automata using WGPU in Rust (for the web and using compute shaders) The branches are very messy... I recommend y

null 18 Dec 18, 2022
2-player game made with Rust and "ggez" engine, based on "Conway's Game of Life"

fight-for-your-life A 2-player game based on the "Conway's Game of Life", made with Rust and the game engine "ggez". Create shapes on the grid that wi

Petros 3 Oct 25, 2021
2d Endless Runner Game made with Bevy Game Engine

Cute-runner A 2d Endless Runner Game made with Bevy Game Engine. Table of contents Project Infos Usage Screenshots Disclaimer Project Infos Date: Sept

JoaoMarinho 2 Jul 15, 2022
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
A game made in one week for the Bevy engine's first game jam

¿Quien es el MechaBurro? An entry for the first Bevy game jam following the theme of "Unfair Advantage." It was made in one week using the wonderful B

mike 20 Dec 23, 2022
A Client/Server game networking plugin using QUIC, for the Bevy game engine.

Bevy Quinnet A Client/Server game networking plugin using QUIC, for the Bevy game engine. Bevy Quinnet QUIC as a game networking protocol Features Roa

Gilles Henaux 65 Feb 20, 2023
Solana Game Server is a decentralized game server running on Solana, designed for game developers

Solana Game Server* is the first decentralized Game Server (aka web3 game server) designed for game devs. (Think web3 SDK for game developers as a ser

Tardigrade Life Sciences, Inc 16 Dec 1, 2022