mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 15:00:57 +01:00
Fixes #1745: Support out-of-order module scope declarations in WGSL Fixes #1044: Forbid local variable shadowing in WGSL Fixes #2076: [wgsl-in] no error for duplicated type definition Fixes #2071: Global item does not support 'const' Fixes #2105: [wgsl-in] Type aliases for a vecN<T> doesn't work when constructing vec from a single argument Fixes #1775: Referencing a function without a return type yields an unknown identifier error. Fixes #2089: Error span reported on the declaration of a variable instead of its use Fixes #1996: [wgsl-in] Confusing error: "expected unsigned/signed integer literal, found '1'" Separate parsing from lowering by generating an AST, which desugars as much as possible down to something like Naga IR. The AST is then used to resolve identifiers while lowering to Naga IR. Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Co-authored-by: Jim Blandy <jimb@red-bean.com>
39 lines
1.1 KiB
GLSL
39 lines
1.1 KiB
GLSL
#version 320 es
|
|
|
|
precision highp float;
|
|
precision highp int;
|
|
|
|
struct VertexOutput {
|
|
vec4 position;
|
|
vec3 uv;
|
|
};
|
|
struct Data {
|
|
mat4x4 proj_inv;
|
|
mat4x4 view;
|
|
};
|
|
layout(std140, binding = 0) uniform Data_block_0Vertex { Data _group_0_binding_0_vs; };
|
|
|
|
layout(location = 0) smooth out vec3 _vs2fs_location0;
|
|
|
|
void main() {
|
|
uint vertex_index = uint(gl_VertexID);
|
|
int tmp1_ = 0;
|
|
int tmp2_ = 0;
|
|
tmp1_ = (int(vertex_index) / 2);
|
|
tmp2_ = (int(vertex_index) & 1);
|
|
int _e9 = tmp1_;
|
|
int _e15 = tmp2_;
|
|
vec4 pos = vec4(((float(_e9) * 4.0) - 1.0), ((float(_e15) * 4.0) - 1.0), 0.0, 1.0);
|
|
vec4 _e27 = _group_0_binding_0_vs.view[0];
|
|
vec4 _e32 = _group_0_binding_0_vs.view[1];
|
|
vec4 _e37 = _group_0_binding_0_vs.view[2];
|
|
mat3x3 inv_model_view = transpose(mat3x3(_e27.xyz, _e32.xyz, _e37.xyz));
|
|
mat4x4 _e43 = _group_0_binding_0_vs.proj_inv;
|
|
vec4 unprojected = (_e43 * pos);
|
|
VertexOutput _tmp_return = VertexOutput(pos, (inv_model_view * unprojected.xyz));
|
|
gl_Position = _tmp_return.position;
|
|
_vs2fs_location0 = _tmp_return.uv;
|
|
return;
|
|
}
|
|
|