-
Notifications
You must be signed in to change notification settings - Fork 77
Closed as duplicate of#293
Closed as duplicate of#293
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behaviour
In the same place, replace simple fragment shader with compute shader. The compute shader one doesn't work.
Example & Steps To Reproduce
-
In the caller crate, I have line:
const BLENDER_BLOCK: &[u8] = include_bytes!(env!("blender_block.spv"));
-
In the caller Cargo.toml:
[build-dependencies] spirv-builder = { path = "../../rust-gpu/crates/spirv-builder", version = "0.9" }
-
In the caller build.rs
use spirv_builder::{MetadataPrintout, SpirvBuilder}; fn main() -> Result<(), Box<dyn std::error::Error>> { SpirvBuilder::new("../shader_collection/blender_block", "spirv-unknown-vulkan1.3") .print_metadata(MetadataPrintout::Full) .build()?; Ok(()) }
-
In the shader crate, if it's fragement shader:
#![cfg_attr(target_arch = "spirv", no_std)] use spirv_std::glam::{vec4, Vec4}; #[spirv(fragment)] pub fn main_fs(output: &mut Vec4) { *output = vec4(1.0, 0.0, 0.0, 1.0); }
It works, but with compute shader:
#![cfg_attr(target_arch = "spirv", no_std)]
use spirv_std::spirv;
use spirv_std::glam::{UVec3};
#[spirv(compute(threads(16, 16)))]
pub fn main_cs(
#[spirv(global_invocation_id)] id: UVec3,
) {
let _index = id.x as usize;
}
It emit noentrypoint error:
Compiling editor_driver v0.1.0 (/game/game_driver)
error: failed to run custom build command for `editor_driver v0.1.0 (/game/game_driver)`
Caused by:
process didn't exit successfully: `/game/target/debug/build/game_driver-92bce6ae680a18bd/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RUSTGPU_CODEGEN_ARGS
cargo:rerun-if-env-changed=RUSTGPU_RUSTFLAGS
cargo:rerun-if-env-changed=RUSTGPU_CARGOFLAGS
--- stderr
Compiling blender_block v0.1.0 (/game/game_driver_shader/blender_block)
error: No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used.
|
= note: module `/game/target/spirv-builder/spirv-unknown-vulkan1.3/release/deps/blender_block.spv`
warning: an unknown error occurred
|
= note: spirv-opt failed, leaving as unoptimized
= note: module `/game/target/spirv-builder/spirv-unknown-vulkan1.3/release/deps/blender_block.spv`
error: error:0:0 - No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used.
|
= note: spirv-val failed
= note: module `/game/target/spirv-builder/spirv-unknown-vulkan1.3/release/deps/blender_block.spv`
warning: `blender_block` (lib) generated 1 warning
error: could not compile `blender_block` (lib) due to 2 previous errors; 1 warning emitted
Error: BuildFailed
System Info
rustc -V
rustc 1.90.0-nightly (35f603652 2025-06-29)
spirv-val --version
SPIRV-Tools v2025.1 unknown hash, 2025-05-23T15:12:49+00:00
Targets:
SPIR-V 1.0
SPIR-V 1.1
SPIR-V 1.2
SPIR-V 1.3
SPIR-V 1.4
SPIR-V 1.5
SPIR-V 1.6
SPIR-V 1.2 (under OpenCL 2.2 Full Profile semantics)
SPIR-V 1.0 (under Vulkan 1.0 semantics)
SPIR-V 1.3 (under Vulkan 1.1 semantics)
SPIR-V 1.4 (under Vulkan 1.1 semantics)
SPIR-V 1.5 (under Vulkan 1.2 semantics)
SPIR-V 1.6 (under Vulkan 1.3 semantics) SPIR-V 1.6 (under Vulkan 1.4 semantics)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working