Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Feature multiview #3323

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ path = "colour-uniform/main.rs"
name = "quad"
path = "quad/main.rs"

[[bin]]
name = "quad-multiview"
path = "quad-multiview/main.rs"

[[bin]]
name = "compute"
path = "compute/main.rs"
Expand Down
3 changes: 2 additions & 1 deletion examples/colour-uniform/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,13 @@ impl<B: Backend> RenderPassState<B> {
inputs: &[],
resolves: &[],
preserves: &[],
view_mask: 0,
};

device
.borrow()
.device
.create_render_pass(&[attachment], &[subpass], &[])
.create_render_pass(&[attachment], &[subpass], &[], None)
.ok()
};

Expand Down
3 changes: 2 additions & 1 deletion examples/mesh-shading/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ where
inputs: &[],
resolves: &[],
preserves: &[],
view_mask: 0,
};

ManuallyDrop::new(
unsafe { device.create_render_pass(&[attachment], &[subpass], &[]) }
unsafe { device.create_render_pass(&[attachment], &[subpass], &[], None) }
.expect("Can't create render pass"),
)
};
Expand Down
5 changes: 5 additions & 0 deletions examples/quad-multiview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Quad

The following image is an output of `cargo run --bin quad --features=gl`:

![screenshot](screenshot.png "Quad")
17 changes: 17 additions & 0 deletions examples/quad-multiview/data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
</head>
<body>
<script src="./spirv_cross_wrapper_glsl.js"></script>
<script type="module">
import init from './quad.js';
window.addEventListener("load", () => {
const module = window.sc_internal_wrapper().then(module => {
window.sc_internal = module;
init('./quad_bg.wasm');
});
});
</script>
</body>
</html>
Binary file added examples/quad-multiview/data/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions examples/quad-multiview/data/quad.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_multiview : enable

layout(location = 0) in vec2 v_uv;
layout(location = 0) out vec4 target0;

layout(set = 0, binding = 0) uniform texture2D u_texture;
layout(set = 0, binding = 1) uniform sampler u_sampler;

void main() {
vec4 mask = vec4(0, 0, 0, 1);

mask[gl_ViewIndex] = 1.0;

target0 = texture(sampler2D(u_texture, u_sampler), v_uv) * mask;
}
18 changes: 18 additions & 0 deletions examples/quad-multiview/data/quad.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_multiview : enable

layout(constant_id = 0) const float scale = 1.2f;

layout(location = 0) in vec2 a_pos;
layout(location = 1) in vec2 a_uv;
layout(location = 0) out vec2 v_uv;

out gl_PerVertex {
vec4 gl_Position;
};

void main() {
v_uv = a_uv;
gl_Position = vec4(scale * a_pos, 0.0, 1.0);
}
Loading