Fix translation to device coords in shader

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2021-03-21 09:01:50 -06:00
parent 1f647ef24c
commit 31fb707eea

View file

@ -21,8 +21,8 @@ vertex QuadFragmentInput quad_vertex(
) {
float2 unit_vertex = unit_vertices[unit_vertex_id];
GPUIQuad quad = quads[quad_id];
float2 position = (unit_vertex * quad.size + quad.origin) / (uniforms->viewport_size / 2.0);
float4 device_position = float4(position * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
float2 position = unit_vertex * quad.size + quad.origin;
float4 device_position = float4(position / uniforms->viewport_size * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
return QuadFragmentInput {
device_position,