Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Error when trying to compile a simple shader #57

@Makogan

Description

@Makogan

I have a minimal rust shader that just renders a triangle to the screen that I am compiling with an old wrapper around rust-gpu.

I am trying to compile the same shader with cargo gpu as:

cargo gpu build                                                                       

🦀 Running `spirv-builder-cli` to compile shader at /home/makogan/rust_never_engine/examples/01_spinning_triangle/spinning_triangle_shader...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("missing field `force_overwrite_lockfiles_v4_to_v3`", line: 31, column: 3)', src/main.rs:82:62
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2025-03-15T17:36:26Z ERROR cargo_gpu] build failed
Error: build failed

I am within the crate folder when Invoke the command.

I am not entirely sure what the problem actually is. I know the crate has to be correct because it compiles with my custom wrapper.

the shader:

//! Ported to Rust from <https://github.com/Tw1ddle/Sky-Shader/blob/master/src/shaders/glsl/sky.fragment>

#![cfg_attr(target_arch = "spirv", no_std, feature(lang_items))]
#![allow(internal_features)]

extern crate bytemuck;
extern crate spirv_std;

pub use spirv_std::glam::{Mat2, Vec2, Vec3, Vec4};
use spirv_std::spirv;

#[spirv(fragment)]
pub fn main_fs(color: Vec4, output: &mut Vec4)
{
    *output = Vec4::new(color.x, color.y, color.z, 1.0); //
}

#[spirv(vertex)]
pub fn main_vs(
    #[spirv(uniform, descriptor_set = 1, binding = 0)] transform: &Mat2,
    position_bind0: Vec2,
    color_bind0: Vec3,
    #[spirv(position, invariant)] out_pos: &mut Vec4,
    out_color: &mut Vec4,
)
{
    let res: Vec2 = *transform * position_bind0;
    *out_pos = Vec4::new(res.x, res.y, 0., 1.);

    *out_color = Vec4::new(color_bind0.x, color_bind0.y, color_bind0.z, 1.0);
}

The cargo.toml:

[package]
name = "spinning-triangle-shader"
version = "0.0.0"
publish = false

[lib]
crate-type = ["lib", "dylib"]

[dependencies]
spirv-std = "0.9.0"
bytemuck = { version = "1.20.0", features = ["derive"] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions