Tweak wgpu data formats

This commit is contained in:
mars 2022-11-08 20:39:44 -07:00
parent 13c395c880
commit 51c8627755
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ impl Vertex {
shader_location: 0,
},
VertexAttribute {
format: VertexFormat::Uint8x4,
format: VertexFormat::Unorm8x4,
offset: std::mem::size_of::<[f32; 2]>() as BufferAddress,
shader_location: 1,
},
@ -83,7 +83,7 @@ impl Renderer {
module: &shader,
entry_point: "fs_main",
targets: &[Some(ColorTargetState {
format: TextureFormat::Rgba8UnormSrgb,
format: TextureFormat::Bgra8UnormSrgb,
blend: Some(BlendState::ALPHA_BLENDING),
write_mask: ColorWrites::ALL,
})],

View File

@ -1,5 +1,5 @@
struct VertexOutput {
@builtin(position) position: vec2<f32>,
@builtin(position) position: vec4<f32>,
@location(0) color: vec4<f32>,
};
@ -9,7 +9,7 @@ fn vs_main(
@location(1) color: vec4<f32>,
) -> VertexOutput {
var result: VertexOutput;
result.position = position;
result.position = vec4<f32>(position, 0.0, 1.0);
result.color = color;
return result;
}