Implement MSAA for triangle pipeline in iced_wgpu

This commit is contained in:
Héctor Ramón Jiménez 2020-02-15 10:08:27 +01:00
parent 4969bfdb66
commit dadae12253
15 changed files with 539 additions and 73 deletions

12
wgpu/src/shader/blit.frag Normal file
View file

@ -0,0 +1,12 @@
#version 450
layout(location = 0) in vec2 v_Uv;
layout(set = 0, binding = 0) uniform sampler u_Sampler;
layout(set = 1, binding = 0) uniform texture2D u_Texture;
layout(location = 0) out vec4 o_Color;
void main() {
o_Color = texture(sampler2D(u_Texture, u_Sampler), v_Uv);
}

Binary file not shown.

26
wgpu/src/shader/blit.vert Normal file
View file

@ -0,0 +1,26 @@
#version 450
layout(location = 0) out vec2 o_Uv;
const vec2 positions[6] = vec2[6](
vec2(-1.0, -1.0),
vec2(-1.0, 1.0),
vec2(1.0, 1.0),
vec2(-1.0, -1.0),
vec2(1.0, -1.0),
vec2(1.0, 1.0)
);
const vec2 uvs[6] = vec2[6](
vec2(0.0, 0.0),
vec2(0.0, 1.0),
vec2(1.0, 1.0),
vec2(0.0, 0.0),
vec2(1.0, 0.0),
vec2(1.0, 1.0)
);
void main() {
o_Uv = uvs[gl_VertexIndex];
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
}

Binary file not shown.

View file

@ -1,24 +0,0 @@
#version 450
layout(location = 0) in vec2 v_Pos;
layout(location = 1) in vec2 i_Pos;
layout(location = 2) in vec2 i_Scale;
layout (set = 0, binding = 0) uniform Globals {
mat4 u_Transform;
};
layout(location = 0) out vec2 o_Uv;
void main() {
o_Uv = v_Pos;
mat4 i_Transform = mat4(
vec4(i_Scale.x, 0.0, 0.0, 0.0),
vec4(0.0, i_Scale.y, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(i_Pos, 0.0, 1.0)
);
gl_Position = u_Transform * i_Transform * vec4(v_Pos, 0.0, 1.0);
}