mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 23:41:01 +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>
70 lines
1.8 KiB
Plaintext
70 lines
1.8 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.0
|
|
; Generator: rspirv
|
|
; Bound: 45
|
|
OpCapability Shader
|
|
%1 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint Vertex %35 "vertex_two_structs" %25 %29 %31 %33
|
|
OpMemberDecorate %13 0 Offset 0
|
|
OpMemberDecorate %13 1 Offset 16
|
|
OpMemberDecorate %14 0 Offset 0
|
|
OpMemberDecorate %14 1 Offset 4
|
|
OpMemberDecorate %14 2 Offset 8
|
|
OpDecorate %16 ArrayStride 4
|
|
OpMemberDecorate %18 0 Offset 0
|
|
OpMemberDecorate %19 0 Offset 0
|
|
OpDecorate %25 BuiltIn VertexIndex
|
|
OpDecorate %29 BuiltIn InstanceIndex
|
|
OpDecorate %31 Invariant
|
|
OpDecorate %31 BuiltIn Position
|
|
OpDecorate %33 BuiltIn PointSize
|
|
%2 = OpTypeVoid
|
|
%4 = OpTypeFloat 32
|
|
%3 = OpConstant %4 1.0
|
|
%6 = OpTypeInt 32 0
|
|
%5 = OpConstant %6 1
|
|
%7 = OpConstant %4 0.0
|
|
%9 = OpTypeInt 32 1
|
|
%8 = OpConstant %9 1
|
|
%10 = OpConstant %9 0
|
|
%11 = OpConstant %6 2
|
|
%12 = OpTypeVector %4 4
|
|
%13 = OpTypeStruct %12 %4
|
|
%14 = OpTypeStruct %4 %6 %4
|
|
%15 = OpTypeBool
|
|
%16 = OpTypeArray %6 %8
|
|
%17 = OpTypeVector %6 3
|
|
%18 = OpTypeStruct %6
|
|
%19 = OpTypeStruct %6
|
|
%21 = OpTypePointer Function %6
|
|
%22 = OpConstantNull %6
|
|
%26 = OpTypePointer Input %6
|
|
%25 = OpVariable %26 Input
|
|
%29 = OpVariable %26 Input
|
|
%32 = OpTypePointer Output %12
|
|
%31 = OpVariable %32 Output
|
|
%34 = OpTypePointer Output %4
|
|
%33 = OpVariable %34 Output
|
|
%36 = OpTypeFunction %2
|
|
%35 = OpFunction %2 None %36
|
|
%23 = OpLabel
|
|
%20 = OpVariable %21 Function %22
|
|
%27 = OpLoad %6 %25
|
|
%24 = OpCompositeConstruct %18 %27
|
|
%30 = OpLoad %6 %29
|
|
%28 = OpCompositeConstruct %19 %30
|
|
OpStore %33 %3
|
|
OpBranch %37
|
|
%37 = OpLabel
|
|
OpStore %20 %11
|
|
%38 = OpCompositeExtract %6 %24 0
|
|
%39 = OpConvertUToF %4 %38
|
|
%40 = OpCompositeExtract %6 %28 0
|
|
%41 = OpConvertUToF %4 %40
|
|
%42 = OpLoad %6 %20
|
|
%43 = OpConvertUToF %4 %42
|
|
%44 = OpCompositeConstruct %12 %39 %41 %43 %7
|
|
OpStore %31 %44
|
|
OpReturn
|
|
OpFunctionEnd |