mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Switch playtests to WGSL
This commit is contained in:
parent
7b886f4b1e
commit
dccc57e7b5
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -441,7 +441,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-auxil"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"gfx-hal",
|
||||
@ -451,7 +451,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-dx11"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
@ -472,7 +472,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-dx12"
|
||||
version = "0.6.2"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-set",
|
||||
@ -492,7 +492,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-empty"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"gfx-hal",
|
||||
"log",
|
||||
@ -502,7 +502,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-gl"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
@ -524,7 +524,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
@ -549,7 +549,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.6.5"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
@ -568,7 +568,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx-hal"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"naga",
|
||||
@ -927,7 +927,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/gfx-rs/naga?tag=gfx-2#0d81b1f78c763a2f564194ec108bcb8ead10ea2e"
|
||||
source = "git+https://github.com/gfx-rs/naga?tag=gfx-3#b597bc5af6f2affabb5a47dfcd5f8f2e32f766fe"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fxhash",
|
||||
@ -1217,7 +1217,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=654ad48ee39ce2a341407ae2857ddf4db639ea54#654ad48ee39ce2a341407ae2857ddf4db639ea54"
|
||||
source = "git+https://github.com/gfx-rs/gfx?rev=4b4a79eea213b4b22fe150b1995ef6a0c381249f#4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
|
@ -34,6 +34,11 @@ package = "wgpu-core"
|
||||
version = "0.6"
|
||||
features = ["replay", "raw-window-handle"]
|
||||
|
||||
#[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies.gfx-backend-metal]
|
||||
#git = "https://github.com/gfx-rs/gfx"
|
||||
#rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f"
|
||||
#features = ["auto-capture"]
|
||||
|
||||
[dependencies.wgpu-subscriber]
|
||||
git = "https://github.com/gfx-rs/subscriber.git"
|
||||
rev = "cdc9feb53f152f9c41905ed9efeff2c1ed214361"
|
||||
|
@ -218,7 +218,8 @@ impl GlobalPlay for wgc::hub::Global<IdentityPassThroughFactory> {
|
||||
let code = fs::read_to_string(dir.join(data)).unwrap();
|
||||
wgc::pipeline::ShaderModuleSource::Wgsl(Cow::Owned(code))
|
||||
} else {
|
||||
let byte_vec = fs::read(dir.join(data)).unwrap();
|
||||
let byte_vec = fs::read(dir.join(&data))
|
||||
.unwrap_or_else(|e| panic!("Unable to open '{}': {:?}", data, e));
|
||||
let spv = byte_vec
|
||||
.chunks(4)
|
||||
.map(|c| u32::from_le_bytes([c[0], c[1], c[2], c[3]]))
|
||||
|
@ -10,7 +10,7 @@
|
||||
CreateShaderModule(
|
||||
id: Id(0, 1, Empty),
|
||||
label: None,
|
||||
data: "empty.comp.spv",
|
||||
data: "empty.wgsl",
|
||||
),
|
||||
CreateComputePipeline(Id(0, 1, Empty), (
|
||||
label: None,
|
||||
|
@ -1,5 +0,0 @@
|
||||
#version 450
|
||||
layout(local_size_x = 1) in;
|
||||
|
||||
void main() {
|
||||
}
|
Binary file not shown.
3
player/tests/data/empty.wgsl
Normal file
3
player/tests/data/empty.wgsl
Normal file
@ -0,0 +1,3 @@
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn main() {
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
Binary file not shown.
@ -11,11 +11,7 @@
|
||||
actions: [
|
||||
CreateShaderModule(
|
||||
id: Id(0, 1, Empty),
|
||||
data: "quad.vert.spv",
|
||||
),
|
||||
CreateShaderModule(
|
||||
id: Id(1, 1, Empty),
|
||||
data: "quad.frag.spv",
|
||||
data: "quad.wgsl",
|
||||
),
|
||||
CreateTexture(Id(0, 1, Empty), (
|
||||
label: Some("Output Texture"),
|
||||
@ -58,11 +54,11 @@
|
||||
layout: Some(Id(0, 1, Empty)),
|
||||
vertex_stage: (
|
||||
module: Id(0, 1, Empty),
|
||||
entry_point: "main",
|
||||
entry_point: "vs_main",
|
||||
),
|
||||
fragment_stage: Some((
|
||||
module: Id(1, 1, Empty),
|
||||
entry_point: "main",
|
||||
module: Id(0, 1, Empty),
|
||||
entry_point: "fs_main",
|
||||
)),
|
||||
rasterization_state: None,
|
||||
primitive_topology: TriangleList,
|
||||
|
@ -1,10 +0,0 @@
|
||||
#version 450
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec2 pos = vec2(gl_VertexIndex == 2 ? 3.0 : -1.0, gl_VertexIndex == 1 ? 3.0 : -1.0);
|
||||
gl_Position = vec4(pos, 0.0, 1.0);
|
||||
}
|
Binary file not shown.
24
player/tests/data/quad.wgsl
Normal file
24
player/tests/data/quad.wgsl
Normal file
@ -0,0 +1,24 @@
|
||||
[[builtin(vertex_index)]]
|
||||
var<in> in_vertex_index: u32;
|
||||
[[builtin(position)]]
|
||||
var<out> out_pos: vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vs_main() {
|
||||
# hacky way to draw a large triangle
|
||||
var tmp1: i32 = i32(in_vertex_index) / 2;
|
||||
var tmp2: i32 = i32(in_vertex_index) & 1;
|
||||
var pos: vec2<f32> = vec2<f32>(
|
||||
f32(tmp1) * 4.0 - 1.0,
|
||||
f32(tmp2) * 4.0 - 1.0
|
||||
);
|
||||
out_pos = vec4<f32>(pos, 0.0, 1.0);
|
||||
}
|
||||
|
||||
[[location(0)]]
|
||||
var<out> out_color: vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fs_main() {
|
||||
out_color = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
@ -144,7 +144,9 @@ impl Test<'_> {
|
||||
}
|
||||
};
|
||||
|
||||
assert_eq!(&expected_data[..], contents);
|
||||
if &expected_data[..] != contents {
|
||||
panic!("Test expectation is not met!");
|
||||
}
|
||||
}
|
||||
|
||||
wgc::gfx_select!(device => global.clear_backend(()));
|
||||
|
@ -35,25 +35,25 @@ thiserror = "1"
|
||||
gpu-alloc = { git = "https://github.com/zakarumych/gpu-alloc", rev = "d07be73f9439a37c89f5b72f2500cbf0eb4ff613" }
|
||||
gpu-descriptor = { git = "https://github.com/zakarumych/gpu-descriptor", rev = "df74fd8c7bea03149058a41aab0e4fe04077b266"}
|
||||
|
||||
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
|
||||
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
|
||||
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54", features = ["naga"] }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54", optional = true }
|
||||
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f", features = ["naga"] }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "654ad48ee39ce2a341407ae2857ddf4db639ea54" }
|
||||
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "4b4a79eea213b4b22fe150b1995ef6a0c381249f" }
|
||||
|
||||
[dependencies.naga]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
tag = "gfx-2"
|
||||
tag = "gfx-3"
|
||||
features = ["spv-in", "spv-out", "wgsl-in"]
|
||||
|
||||
[dependencies.wgt]
|
||||
|
@ -154,7 +154,7 @@ pub enum StageError {
|
||||
#[error("shader module is invalid")]
|
||||
InvalidModule,
|
||||
#[error("unable to find an entry point at {0:?} stage")]
|
||||
MissingEntryPoint(wgt::ShaderStage),
|
||||
MissingEntryPoint(String),
|
||||
#[error("error matching global binding at index {binding} in group {group} against the pipeline layout: {error}")]
|
||||
Binding {
|
||||
group: u32,
|
||||
@ -792,10 +792,11 @@ impl Interface {
|
||||
wgt::ShaderStage::COMPUTE => naga::ShaderStage::Compute,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let pair = (shader_stage, entry_point_name.to_string());
|
||||
let entry_point = self
|
||||
.entry_points
|
||||
.get(&(shader_stage, entry_point_name.to_string()))
|
||||
.ok_or(StageError::MissingEntryPoint(stage_bit))?;
|
||||
.get(&pair)
|
||||
.ok_or(StageError::MissingEntryPoint(pair.1))?;
|
||||
|
||||
for &(handle, usage) in entry_point.resources.iter() {
|
||||
let res = &self.resources[handle];
|
||||
|
Loading…
Reference in New Issue
Block a user