fix: "BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED not supported" error

This commit is contained in:
pml68 2025-04-09 22:53:40 +02:00
parent 6508ad67c1
commit bf6c7d0094
2 changed files with 6 additions and 2 deletions

View file

@ -8,7 +8,7 @@ var<private> uvs: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
);
@group(0) @binding(0) var u_sampler: sampler;
@group(0) @binding(1) var<uniform> u_ratio: vec2<f32>;
@group(0) @binding(1) var<uniform> u_ratio: vec4<f32>;
@group(1) @binding(0) var u_texture: texture_2d<f32>;
struct VertexInput {
@ -25,7 +25,7 @@ fn vs_main(input: VertexInput) -> VertexOutput {
let uv = uvs[input.vertex_index];
var out: VertexOutput;
out.uv = uv * u_ratio;
out.uv = uv * u_ratio.xy;
out.position = vec4<f32>(uv * vec2(2.0, -2.0) + vec2(-1.0, 1.0), 0.0, 1.0);
return out;

View file

@ -254,6 +254,8 @@ impl Targets {
struct Ratio {
u: f32,
v: f32,
p0: f32,
p1: f32,
}
pub struct State {
@ -306,6 +308,8 @@ impl State {
let ratio = Ratio {
u: region_size.width as f32 / targets.size.width as f32,
v: region_size.height as f32 / targets.size.height as f32,
p0: 0.0,
p1: 0.0,
};
if Some(ratio) != self.last_ratio {