mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Simplify `naga::back::spv::LocalType` to have only one variant for representing pointers, and use the SPIR-V type as the base type, so that `LocalType` values are equal when the SPIR-V pointer types they map to would be equal as well. This avoids emitting multiple `OpTypePointer` instructions, which SPIR-V would interpret as distinct types, for equivalent Naga IR pointer types. Change the `get_pointer_type_id` utility function accordingly, and adjust its callers. Change `LocalType::from_inner` into `Writer::localtype_from_inner`, so that it can call `Writer` methods to build base types. Adjust users.
65 lines
1.6 KiB
Plaintext
65 lines
1.6 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.0
|
|
; Generator: rspirv
|
|
; Bound: 38
|
|
OpCapability Shader
|
|
%1 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint Vertex %28 "vertex" %15 %18 %20 %22 %24 %26
|
|
OpMemberDecorate %5 0 Offset 0
|
|
OpMemberDecorate %5 1 Offset 16
|
|
OpMemberDecorate %7 0 Offset 0
|
|
OpMemberDecorate %7 1 Offset 4
|
|
OpMemberDecorate %7 2 Offset 8
|
|
OpDecorate %9 ArrayStride 4
|
|
OpMemberDecorate %12 0 Offset 0
|
|
OpMemberDecorate %13 0 Offset 0
|
|
OpDecorate %15 BuiltIn VertexIndex
|
|
OpDecorate %18 BuiltIn InstanceIndex
|
|
OpDecorate %20 Location 10
|
|
OpDecorate %22 Invariant
|
|
OpDecorate %22 BuiltIn Position
|
|
OpDecorate %24 Location 1
|
|
OpDecorate %26 BuiltIn PointSize
|
|
%2 = OpTypeVoid
|
|
%3 = OpTypeFloat 32
|
|
%4 = OpTypeVector %3 4
|
|
%5 = OpTypeStruct %4 %3
|
|
%6 = OpTypeInt 32 0
|
|
%7 = OpTypeStruct %3 %6 %3
|
|
%8 = OpTypeBool
|
|
%10 = OpConstant %6 1
|
|
%9 = OpTypeArray %6 %10
|
|
%11 = OpTypeVector %6 3
|
|
%12 = OpTypeStruct %6
|
|
%13 = OpTypeStruct %6
|
|
%16 = OpTypePointer Input %6
|
|
%15 = OpVariable %16 Input
|
|
%18 = OpVariable %16 Input
|
|
%20 = OpVariable %16 Input
|
|
%23 = OpTypePointer Output %4
|
|
%22 = OpVariable %23 Output
|
|
%25 = OpTypePointer Output %3
|
|
%24 = OpVariable %25 Output
|
|
%26 = OpVariable %25 Output
|
|
%27 = OpConstant %3 1.0
|
|
%29 = OpTypeFunction %2
|
|
%30 = OpConstantComposite %4 %27 %27 %27 %27
|
|
%28 = OpFunction %2 None %29
|
|
%14 = OpLabel
|
|
%17 = OpLoad %6 %15
|
|
%19 = OpLoad %6 %18
|
|
%21 = OpLoad %6 %20
|
|
OpStore %26 %27
|
|
OpBranch %31
|
|
%31 = OpLabel
|
|
%32 = OpIAdd %6 %17 %19
|
|
%33 = OpIAdd %6 %32 %21
|
|
%34 = OpConvertUToF %3 %33
|
|
%35 = OpCompositeConstruct %5 %30 %34
|
|
%36 = OpCompositeExtract %4 %35 0
|
|
OpStore %22 %36
|
|
%37 = OpCompositeExtract %3 %35 1
|
|
OpStore %24 %37
|
|
OpReturn
|
|
OpFunctionEnd |